diff --git a/shells/ab_switch.sh b/shells/ab_switch.sh new file mode 100644 index 0000000000000000000000000000000000000000..72f7808f6ee41cb1bf6c53f2ad69addea9736a00 --- /dev/null +++ b/shells/ab_switch.sh @@ -0,0 +1,26 @@ +#!/bin/bash + +# æ£€æŸ¥å‚æ•°æ•°é‡ +if [ $# -ne 2 ]; then + echo "Usage: $0 <a|b> <mount_point>" + exit 1 +fi + +# 获å–ä¼ å…¥çš„å‚æ•° +option="$1" +mount_point="$2" + +# 检查是å¦ä¸ºæœ‰æ•ˆçš„选项 +if [ "$option" != "a" ] && [ "$option" != "b" ]; then + echo "Invalid option. Please use 'a' or 'b'." + exit 1 +fi + +# 修改 /etc/fstab 文件 +if [ "$option" == "a" ]; then + sed -i "s|^UUID=.* / .*|UUID=your_uuid_here $mount_point ext4 defaults 0 1|" /etc/fstab +elif [ "$option" == "b" ]; then + sed -i "s|^UUID=.* / .*|UUID=your_other_uuid_here $mount_point ext4 defaults 0 1|" /etc/fstab +fi + +echo "Updated /etc/fstab with the new mount point." diff --git a/shells/check_img.sh b/shells/check_img.sh new file mode 100644 index 0000000000000000000000000000000000000000..56135676b097ec921cf071911e3ca6fa01154d53 --- /dev/null +++ b/shells/check_img.sh @@ -0,0 +1,27 @@ +#!/bin/bash + +# æ£€æŸ¥å‚æ•°æ•°é‡ +if [ $# -ne 1 ]; then + echo "Usage: $0 <img_path>" + exit 1 +fi + +# 获å–ä¼ å…¥çš„é•œåƒæ–‡ä»¶è·¯å¾„ +img_path="$1" + +# 使用fdisk命令获å–镜åƒçš„åˆ†åŒºä¿¡æ¯ +partition_info=$(sudo fdisk -l "$img_path") + +# 检查是å¦å˜åœ¨å为 "boot" 的分区 +if echo "$partition_info" | grep -q "boot"; then + echo "镜åƒä¸å˜åœ¨å为 'boot' 的分区。" +else + echo "镜åƒä¸ä¸å˜åœ¨å为 'boot' 的分区。" +fi + +# 检查是å¦å˜åœ¨å为 "systemos" 的分区 +if echo "$partition_info" | grep -q "systemos"; then + echo "镜åƒä¸å˜åœ¨å为 'systemos' 的分区。" +else + echo "镜åƒä¸ä¸å˜åœ¨å为 'systemos' 的分区。" +fi diff --git a/shells/write_image_by_dd.sh b/shells/write_image_by_dd.sh new file mode 100644 index 0000000000000000000000000000000000000000..835c592a2989873ef6d4a1f3347648fe6963f38e --- /dev/null +++ b/shells/write_image_by_dd.sh @@ -0,0 +1,15 @@ +#!/bin/bash + +# æ£€æŸ¥å‚æ•°æ•°é‡ +if [ $# -ne 1 ]; then + echo "Usage: $0 <img_path>" + exit 1 +fi + +# 获å–ä¼ å…¥çš„é•œåƒæ–‡ä»¶è·¯å¾„ +img_path="$1" + +# 使用dd命令将镜åƒå†™å…¥/dev/sda +sudo dd if="$img_path" of=/dev/sda bs=4M status=progress + +echo "镜åƒå·²æˆåŠŸå†™å…¥ /dev/sda。"