From a2e188df357fb9311c8e1df83a4c0336e1ce3900 Mon Sep 17 00:00:00 2001 From: ZHANG Yuntian <95260730+RadxaYuntian@users.noreply.github.com> Date: Mon, 11 Dec 2023 10:27:12 +0800 Subject: [PATCH] install: display error message --- lib/sub_commands.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/sub_commands.sh b/lib/sub_commands.sh index 13d92728..f7f29ab9 100644 --- a/lib/sub_commands.sh +++ b/lib/sub_commands.sh @@ -24,7 +24,12 @@ _install() { then trap "set +e; sudo -n true && (sudo umount -R /mnt; sudo kpartx -d '$disk'; sync)" SIGINT SIGQUIT SIGTSTP EXIT sudo kpartx -a "$disk" - disk="$(sudo blkid -t LABEL=rootfs -o device | grep /dev/mapper/loop | tail -n 1)" + echo "Target is a file. Trying to find rootfs partition..." + if ! disk="$(sudo blkid -t LABEL=rootfs -o device | grep /dev/mapper/loop | tail -n 1)" + then + echo "Failed to find rootfs partition." >&2 + return + fi disk="${disk%p*}p" fi