summaryrefslogtreecommitdiff
path: root/functions
diff options
context:
space:
mode:
authorDaniel Baumann <daniel@debian.org>2009-12-23 22:27:18 +0100
committerDaniel Baumann <daniel@debian.org>2009-12-23 22:27:18 +0100
commitff1e5377a867de1a57dbc2f17aaaa378d4ed17fd (patch)
treed366eaa164c1f7864b452cfcc9d7b8a7247b81b5 /functions
parent199a6035febe64e0e2eafc6874b11b5d759b1c2e (diff)
downloadvyos-live-build-ff1e5377a867de1a57dbc2f17aaaa378d4ed17fd.tar.gz
vyos-live-build-ff1e5377a867de1a57dbc2f17aaaa378d4ed17fd.zip
Making unmount routines a bit more robust.
Diffstat (limited to 'functions')
-rwxr-xr-xfunctions/exit.sh17
1 files changed, 13 insertions, 4 deletions
diff --git a/functions/exit.sh b/functions/exit.sh
index 928fd6e85..f29dbf790 100755
--- a/functions/exit.sh
+++ b/functions/exit.sh
@@ -20,10 +20,19 @@ Exit ()
# Always exit true in case we are not able to unmount
# (e.g. due to running processes in chroot from user customizations)
Echo_message "Begin unmounting filesystems..."
- for DIRECTORY in $(awk -v dir="${PWD}/chroot/" '$2 ~ dir { print $2 }' /proc/mounts | sort -r)
- do
- umount ${DIRECTORY} > /dev/null 2>&1 || true
- done
+
+ if [ -e /proc/mounts ]
+ then
+ for DIRECTORY in $(awk -v dir="${PWD}/chroot/" '$2 ~ dir { print $2 }' /proc/mounts | sort -r)
+ do
+ umount ${DIRECTORY} > /dev/null 2>&1 || true
+ done
+ else
+ for DIRECTORY in /dev/pts /dev /proc /selinux /sys
+ do
+ umount -f chroot/${DIRECTORY} > /dev/null 2>&1 || true
+ done
+ fi
return ${VALUE}
}