xref: /DragonOS/tools/mount_virt_disk.sh (revision 83ed0ebc293d5a10245089f627f52770fd5b9dd4)
1# ======检查是否以sudo运行=================
2uid=`id -u`
3if [ ! $uid == "0" ];then
4 echo "请以sudo权限运行"
5 exit
6fi
7
8# 检查是否设置ARCH环境变量
9
10if [ ! ${ARCH} ];then
11 echo "请设置ARCH环境变量"
12 exit
13fi
14
15
16DISK_NAME=disk-${ARCH}.img
17
18echo "Mounting virtual disk image '${DISK_NAME}'..."
19
20LOOP_DEVICE=$(losetup -f --show -P ../bin/${DISK_NAME}) \
21    || exit 1
22
23echo ${LOOP_DEVICE}p1
24
25mkdir -p ../bin/disk_mount/
26mount ${LOOP_DEVICE}p1 ../bin/disk_mount/
27lsblk