summaryrefslogtreecommitdiffstats
path: root/sys-apps/hal/files/hal-unmount.dev
blob: 04d1fa81b597402b2900d30e27528b9eb1a9af41 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
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