From 66bb849b8cd9446908abcfc7ab37bac1ab07129a Mon Sep 17 00:00:00 2001 From: Adrien Bourmault Date: Wed, 5 Feb 2020 23:17:13 +0100 Subject: [PATCH] Bug with makefile that can erase host MBR (6) --- build/install-os-k.sh | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/build/install-os-k.sh b/build/install-os-k.sh index 92cf6ad..6705e69 100755 --- a/build/install-os-k.sh +++ b/build/install-os-k.sh @@ -64,4 +64,12 @@ echo ${CL2}[install-os-k.sh]${NC} Sync image... \(sync\)${CL3} sync echo ${CL2}[install-os-k.sh]${NC} Unmount image... \(udisksctl\)${CL3} -udisksctl unmount --no-user-interaction -b $lpblock \ No newline at end of file +udisksctl unmount --no-user-interaction -b $lpblock + +lpblock=$(/sbin/losetup -j $1 | cut -d ':' -f 1) +if [ -z $lpblock ]; +then + return 0 +fi + +udisksctl loop-delete -b $lpblock