summaryrefslogtreecommitdiff
path: root/packages/udev/files/mount.sh
diff options
context:
space:
mode:
Diffstat (limited to 'packages/udev/files/mount.sh')
-rw-r--r--packages/udev/files/mount.sh21
1 files changed, 14 insertions, 7 deletions
diff --git a/packages/udev/files/mount.sh b/packages/udev/files/mount.sh
index be8b3dfca9..2220c020c8 100644
--- a/packages/udev/files/mount.sh
+++ b/packages/udev/files/mount.sh
@@ -10,16 +10,23 @@ PMOUNT="/usr/bin/pmount"
UMOUNT="/bin/umount"
name="`basename "$DEVNAME"`"
-for line in `cat /etc/udev/mount.blacklist | grep -v ^#`
-do
- if ( echo "$DEVNAME" | grep -q "$line" )
+cat /etc/udev/mount.whitelist | sed -n 's/^#.*/;/[^[:space:]]/p' > /tmp/mount.whitelist
+if ( echo "$DEVNAME" | grep -q -f /tmp/mount.whitelist )
+then
+ logger "udev/mount.sh" "[$DEVNAME] is not whitelisted, ignoring"
+ exit 0
+fi
+rm /tmp/mount.whitelist
+
+automount() {
+ # don't mount a block device if it contains partitions
+ if ( echo "$DEVNAME" | grep -q "[0-9]$" )
then
- logger "udev/mount.sh" "[$DEVNAME] is blacklisted, ignoring"
- exit 0
+ ls "$DEVNAME"p[1-9] > /dev/null 2>&1 && return
+ else
+ ls "$DEVNAME"[1-9] > /dev/null 2>&1 && return
fi
-done
-automount() {
! test -d "/media/$name" && mkdir -p "/media/$name"
if ! $MOUNT -t auto -o sync $DEVNAME "/media/$name"