summaryrefslogtreecommitdiff
path: root/packages/udev/files/mount.sh
diff options
context:
space:
mode:
authorRichard Purdie <rpurdie@rpsys.net>2005-09-20 14:49:36 +0000
committerOpenEmbedded Project <openembedded-devel@lists.openembedded.org>2005-09-20 14:49:36 +0000
commiteb992319a0a412435289e60b5e666da07133d1f5 (patch)
tree1cee9b6e532cf1c859026c1b740ffb01c4b86285 /packages/udev/files/mount.sh
parentc838ad939cd52d897390eefb9b578cd654b9e98d (diff)
udev: Rearrange the udev files into a more logical structure. Create copies of the rules we're using rather than the distributed version due to links to external scripts. Add mount.sh which attempts to mount block devices using pmount if available, falling back to mount if not. Fix the --mode switch to mknod in the init script.
Diffstat (limited to 'packages/udev/files/mount.sh')
-rw-r--r--packages/udev/files/mount.sh25
1 files changed, 25 insertions, 0 deletions
diff --git a/packages/udev/files/mount.sh b/packages/udev/files/mount.sh
new file mode 100644
index 0000000000..7e641b08d7
--- /dev/null
+++ b/packages/udev/files/mount.sh
@@ -0,0 +1,25 @@
+#!/bin/sh
+#
+# Called from udev
+# Attemp to mount any added block devices
+# and remove any removed devices
+#
+
+MOUNT="/bin/mount"
+PMOUNT="/usr/bin/pmount"
+UMOUNT="/bin/umount"
+
+if [ "$ACTION" = "add" ] && [ -n "$DEVNAME" ]; then
+ if [ -x "$PMOUNT" ]; then
+ $PMOUNT $DEVNAME 2> /dev/null
+ elif [ -x $MOUNT ]; then
+ $MOUNT $DEVNAME 2> /dev/null
+ fi
+fi
+
+if [ "$ACTION" = "remove" ] && [ -x "$UMOUNT" ] && [ -n "$DEVNAME" ]; then
+ for mnt in `cat /proc/mounts | grep "$DEVNAME" | cut -f 2 -d " " `
+ do
+ $UMOUNT $mnt
+ done
+fi