aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2021-07-10 02:46:52 +0200
committerSven Gothel <[email protected]>2021-07-10 02:46:52 +0200
commit592bc58adc40408e1156242b833c3e6a7c1b8936 (patch)
tree893dc1d80270f7d2681a9e763da41b22861c129e
parent749a26064132700d3902e6ef500a17f4509e6a3c (diff)
./imagetool.sh: Allow unmount w/o NBD_DEV, i.e. single mounted rootfs image
-rwxr-xr-ximagetool.sh7
1 files changed, 4 insertions, 3 deletions
diff --git a/imagetool.sh b/imagetool.sh
index 65a251f..be01783 100755
--- a/imagetool.sh
+++ b/imagetool.sh
@@ -5,6 +5,8 @@ if [ "$(id -u)" != "0" ]; then
exit 1
fi
+BASE_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
+
progname=$(basename $0)
function usage()
@@ -179,7 +181,7 @@ if [ ! -d "${MOUNTPOINT}" ]; then
exit 1
fi
-source scripts/qcow2_handling
+source ${BASE_DIR}/scripts/qcow2_handling
if [ "${MOUNT}" = "1" ]; then
if [ "${RAW_IMAGE}" = "1" ]; then
@@ -192,8 +194,7 @@ elif [ "${UMOUNT}" = "1" ]; then
if [ -z "${NBD_DEV}" ] ; then
NBD_DEV=$(find_nbd ${MOUNTPOINT})
if [ -z "${NBD_DEV}" ] ; then
- echo "umount: NBD_DEV not set and not found for ${MOUNTPOINT}. Exit."
- exit 1;
+ echo "umount: NBD_DEV not set and not found for ${MOUNTPOINT}."
fi
fi
umount_image "${MOUNTPOINT}"