xref: /DragonOS/tools/mount_virt_disk.sh (revision c635d8a9cfe25bc11779f323ef0c7d7a0f597d4a)
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