xref: /DragonOS/tools/umount_virt_disk.sh (revision f5b2038871d3441e1c7f32439ff422957e7ab828)
1# ======检查是否以sudo运行=================
2uid=`id -u`
3if [ ! $uid == "0" ];then
4 echo "请以sudo权限运行"
5 exit
6fi
7
8if [ ! ${ARCH} ];then
9 echo "请设置ARCH环境变量"
10 exit
11fi
12
13DISK_NAME=disk-${ARCH}.img
14
15LOOP_DEVICE=$(lsblk | grep disk_mount|sed 's/.*\(loop[0-9]*\)p1.*/\1/1g'|awk 'END{print $0}')
16
17umount -f ../bin/disk_mount/
18losetup -d /dev/$LOOP_DEVICE
19echo $LOOP_DEVICE