satip-axe/fs-add/sbin/sd-hotunplug.sh

15 lines
383 B
Bash
Executable File

#!/bin/sh
logger -p local0.notice "Unmounting $MDEV"
for MOUNT_POINT in /media/* ; do
if test -d "$MOUNT_POINT"; then
d=$(mountpoint -n "$MOUNT_POINT" 2> /dev/null | cut -d ' ' -f 1)
if test "$d" = "$MDEV" -o "$d" = "UNKNOWN"; then
logger -p local0.notice "Unmounting $MDEV : $MOUNT_POINT"
umount -f "$MOUNT_POINT"
rmdir "$MOUNT_POINT"
fi
fi
done