summaryrefslogtreecommitdiffstats
path: root/sys-apps/hal/files/hal-unmount.dev
diff options
context:
space:
mode:
Diffstat (limited to 'sys-apps/hal/files/hal-unmount.dev')
-rw-r--r--sys-apps/hal/files/hal-unmount.dev17
1 files changed, 17 insertions, 0 deletions
diff --git a/sys-apps/hal/files/hal-unmount.dev b/sys-apps/hal/files/hal-unmount.dev
new file mode 100644
index 00000000..04d1fa81
--- /dev/null
+++ b/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
+