hal/tools hal-system-storage-mount,1.1,1.2
Kay Sievers
kay at freedesktop.org
Mon Dec 12 09:50:20 PST 2005
Update of /cvs/hal/hal/tools
In directory gabe:/tmp/cvs-serv9644/tools
Modified Files:
hal-system-storage-mount
Log Message:
2005-12-12 Kay Sievers <kay.sievers at vrfy.org>
* tools/hal-system-storage-mount: Fix fallback to default mount
point which failed if the volume label was not valid.
Index: hal-system-storage-mount
===================================================================
RCS file: /cvs/hal/hal/tools/hal-system-storage-mount,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- hal-system-storage-mount 9 Dec 2005 05:50:55 -0000 1.1
+++ hal-system-storage-mount 12 Dec 2005 17:50:16 -0000 1.2
@@ -1,4 +1,4 @@
-#!/bin/sh -e
+#!/bin/sh
# Copyright (C) 2005, Kay Sievers <kay.sievers at vrfy.org>
#
@@ -33,13 +33,14 @@
if [ "$GIVEN_MOUNTPOINT" == "" ]; then
case "$HAL_PROP_VOLUME_LABEL" in
*[!A-Za-z0-9_\-\+:]*)
- break
- ;;
+ break
+ ;;
+ *)
+ GIVEN_MOUNTPOINT="$HAL_PROP_VOLUME_LABEL"
esac
- GIVEN_MOUNTPOINT="$HAL_PROP_VOLUME_LABEL"
fi
-# if no mountpoint, use default name
+# if no mountpoint is given, use default name
if [ "$GIVEN_MOUNTPOINT" == "" ]; then
GIVEN_MOUNTPOINT="disk"
fi
@@ -54,6 +55,24 @@
esac
MOUNTPOINT="$GIVEN_MOUNTPOINT"
+# pass only whitelisted types
+if [ "$GIVEN_MOUNTTYPE" != "" ]; then
+ case "$GIVEN_MOUNTTYPE" in
+ subfs)
+ MOUNTTYPE="subfs"
+ ;;
+ *)
+ echo "org.freedesktop.Hal.Device.Volume.InvalidMountType" >&2
+ echo "" >&2
+ exit 1
+ esac
+fi
+
+# if no type is given, use default name
+if [ "$MOUNTTYPE" == "" ]; then
+ MOUNTTYPE=$HAL_PROP_VOLUME_FSTYPE
+fi
+
# pass only whitelisted mount options
if [ "$GIVEN_MOUNTOPTIONS" != "" ]; then
for OPTION in $GIVEN_MOUNTOPTIONS; do
@@ -110,8 +129,7 @@
fi
# mount and return status
-mount -o "nosuid,nodev$MOUNTOPTIONS" -t "$HAL_PROP_VOLUME_FSTYPE" "$HAL_PROP_BLOCK_DEVICE" "$MOUNT_ROOT/$MOUNTPOINT" > /dev/null 2>&1
-logger O="nosuid,nodev$MOUNTOPTIONS" T="$HAL_PROP_VOLUME_FSTYPE" "$HAL_PROP_BLOCK_DEVICE" "$MOUNT_ROOT/$MOUNTPOINT"
+mount -o "nosuid,nodev$MOUNTOPTIONS" -t "$MOUNTTYPE" "$HAL_PROP_BLOCK_DEVICE" "$MOUNT_ROOT/$MOUNTPOINT" > /dev/null 2>&1
if [ $? -ne 0 ]; then
if [ -n "$MOUNTPOINT_CREATED" ]; then
rmdir "$MOUNT_ROOT/$MOUNTPOINT"
More information about the hal-commit
mailing list