summaryrefslogtreecommitdiffstats
path: root/gentoo/sys-apps/hal/files/hal-unmount.dev
diff options
context:
space:
mode:
Diffstat (limited to 'gentoo/sys-apps/hal/files/hal-unmount.dev')
-rw-r--r--gentoo/sys-apps/hal/files/hal-unmount.dev17
1 files changed, 17 insertions, 0 deletions
diff --git a/gentoo/sys-apps/hal/files/hal-unmount.dev b/gentoo/sys-apps/hal/files/hal-unmount.dev
new file mode 100644
index 000000000..04d1fa81b
--- /dev/null
+++ b/gentoo/sys-apps/hal/files/hal-unmount.dev
@@ -0,0 +1,17 @@
+#!/bin/sh
+
+# sanity check. DEVNAME should start with a /
+[ "$DEVNAME" != "${DEVNAME#/}" ] || exit 0
+
+# Lazily unmount drives which are removed, but still mounted
+if [ "$ACTION" = remove ] \
+ && (grep -q "^$DEVNAME" /proc/mounts || grep -q "^$DEVNAME" /etc/mtab); then
+ if [ -x /usr/bin/pumount ] ; then
+ /usr/bin/pumount -l "$DEVNAME";
+ else
+ /bin/umount -l "$DEVNAME";
+ fi
+fi
+
+exit 0
+