fix: 运行脚本无法正确匹配回环设备名称的问题

This commit is contained in:
fslongjin 2022-08-14 17:35:44 +08:00
parent f58bb5f78a
commit fb1144fbda
2 changed files with 3 additions and 9 deletions

5
run.sh
View File

@ -106,10 +106,7 @@ cfg_content='set timeout=15
# ${GRUB_PATH}/grub-mkrescue -o ${iso} ${iso_folder}
# rm -rf ${iso_folder}
LOOP_DEVICE=$(lsblk | grep disk_mount)
LOOP_DEVICE=${LOOP_DEVICE:2:10}
LOOP_DEVICE=${LOOP_DEVICE%%p1*}
LOOP_DEVICE=$(lsblk | grep disk_mount|sed 's/.*\(loop[0-9]*\)p1.*/\1/1g'|awk 'END{print $0}')
echo $LOOP_DEVICE
grub-install --target=i386-pc --boot-directory=${root_folder}/bin/disk_mount/boot/ /dev/$LOOP_DEVICE

View File

@ -5,11 +5,8 @@ if [ ! $uid == "0" ];then
exit
fi
LOOP_DEVICE=$(lsblk | grep disk_mount)
LOOP_DEVICE=${LOOP_DEVICE:2:10}
LOOP_DEVICE=${LOOP_DEVICE%%p1*}
LOOP_DEVICE=$(lsblk | grep disk_mount|sed 's/.*\(loop[0-9]*\)p1.*/\1/1g'|awk 'END{print $0}')
umount -f ../bin/disk_mount/
losetup -d /dev/$LOOP_DEVICE
echo $LOOP_DEVICE
echo $LOOP_DEVICE