hal/tools hal-system-storage-eject, 1.1,
1.2 hal-system-storage-mount, 1.5,
1.6 hal-system-storage-unmount, 1.1, 1.2
Kay Sievers
kay at freedesktop.org
Sat Dec 17 12:21:42 PST 2005
Update of /cvs/hal/hal/tools
In directory gabe:/tmp/cvs-serv6733/tools
Modified Files:
hal-system-storage-eject hal-system-storage-mount
hal-system-storage-unmount
Log Message:
2005-12-17 Kay Sievers <kay.sievers at vrfy.org>
Detailed return values from method invocations.
* tools/hal-system-storage-eject:
* tools/hal-system-storage-mount:
* tools/hal-system-storage-unmount:
Index: hal-system-storage-eject
===================================================================
RCS file: /cvs/hal/hal/tools/hal-system-storage-eject,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- hal-system-storage-eject 9 Dec 2005 05:50:55 -0000 1.1
+++ hal-system-storage-eject 17 Dec 2005 20:21:40 -0000 1.2
@@ -12,10 +12,17 @@
exit 1
fi
-eject "$HAL_PROP_BLOCK_DEVICE" > /dev/null 2>&1
+RESULT=$(eject "$HAL_PROP_BLOCK_DEVICE" 2>&1)
if [ $? -ne 0 ]; then
- echo "org.freedesktop.Hal.Device.Volume.EjectFailed" >&2
- echo "$HAL_PROP_BLOCK_DEVICE" >&2
+ case "$RESULT" in
+ *busy*)
+ echo "org.freedesktop.Hal.Device.Volume.Busy" >&2
+ echo "Device is busy." >&2
+ ;;
+ *)
+ echo "org.freedesktop.Hal.Device.Volume.UnknowFailure" >&2
+ echo "Unknown failure." >&2
+ esac
exit 1
fi
Index: hal-system-storage-mount
===================================================================
RCS file: /cvs/hal/hal/tools/hal-system-storage-mount,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- hal-system-storage-mount 14 Dec 2005 19:51:13 -0000 1.5
+++ hal-system-storage-mount 17 Dec 2005 20:21:40 -0000 1.6
@@ -23,7 +23,7 @@
# check if device is already mounted
if [ "$HAL_PROP_VOLUME_IS_MOUNTED" = "true" ]; then
echo "org.freedesktop.Hal.Device.Volume.AlreadyMounted" >&2
- echo "$HAL_PROP_VOLUME_MOUNT_POINT" >&2
+ echo "Device is already mounted." >&2
exit 1
fi
@@ -55,7 +55,7 @@
case "$GIVEN_MOUNTPOINT" in
*[!A-Za-z0-9_\-\+:]*)
echo "org.freedesktop.Hal.Device.Volume.InvalidMountpoint" >&2
- echo "" >&2
+ echo "The mountpoint is invalid." >&2
exit 1
;;
esac
@@ -68,8 +68,8 @@
MOUNTTYPE="subfs"
;;
*)
- echo "org.freedesktop.Hal.Device.Volume.InvalidMountType" >&2
- echo "" >&2
+ echo "org.freedesktop.Hal.Device.Volume.InvalidFilesystemType" >&2
+ echo "Invalid filesystem type." >&2
exit 1
esac
fi
@@ -112,7 +112,7 @@
done
fi
-# special handling for certain filesystems
+# special options handling for certain filesystems
case "$MOUNTTYPE" in
vfat)
MOUNTOPTIONS="$MOUNTOPTIONS,quiet,shortname=winnt,uid=$HAL_METHOD_INVOKED_BY_UID"
@@ -146,18 +146,25 @@
if [ ! -e "$MOUNT_ROOT/$MOUNTPOINT" ]; then
echo "org.freedesktop.Hal.Device.Volume.FailedToCreateMountpoint" >&2
- echo "$MOUNT_ROOT/$MOUNTPOINT" >&2
+ echo "Failed to create moutpoint $MOUNT_ROOT/$MOUNTPOINT." >&2
exit 1
fi
# mount and return status
-mount -o "noexec,nosuid,nodev$MOUNTOPTIONS" -t "$MOUNTTYPE" "$HAL_PROP_BLOCK_DEVICE" "$MOUNT_ROOT/$MOUNTPOINT" > /dev/null 2>&1
+RESULT=$(mount -o "noexec,nosuid,nodev$MOUNTOPTIONS" -t "$MOUNTTYPE" "$HAL_PROP_BLOCK_DEVICE" "$MOUNT_ROOT/$MOUNTPOINT" 2>&1)
if [ $? -ne 0 ]; then
+ case "$RESULT" in
+ *"unknown filesystem"*)
+ echo "org.freedesktop.Hal.Device.Volume.UnknownFilesystemType" >&2
+ echo "Invalid filesystem type." >&2
+ ;;
+ *)
+ echo "org.freedesktop.Hal.Device.Volume.UnknownFailure" >&2
+ echo "Failed to mount device." >&2
+ esac
if [ -n "$MOUNTPOINT_CREATED" ]; then
rmdir "$MOUNT_ROOT/$MOUNTPOINT"
fi
- echo "org.freedesktop.Hal.Device.Volume.MountFailed" >&2
- echo "$MOUNT_ROOT/$MOUNTPOINT" >&2
exit 1
fi
Index: hal-system-storage-unmount
===================================================================
RCS file: /cvs/hal/hal/tools/hal-system-storage-unmount,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- hal-system-storage-unmount 9 Dec 2005 05:50:55 -0000 1.1
+++ hal-system-storage-unmount 17 Dec 2005 20:21:40 -0000 1.2
@@ -1,4 +1,4 @@
-#!/bin/sh -e
+#!/bin/sh
# Copyright (C) 2005, Kay Sievers <kay.sievers at vrfy.org>
#
@@ -14,14 +14,25 @@
if [ "$HAL_PROP_VOLUME_IS_MOUNTED" != "true" ]; then
echo "org.freedesktop.Hal.Device.Volume.NotMounted" >&2
- echo "$HAL_PROP_VOLUME_MOUNT_POINT" >&2
+ echo "Device is not mounted." >&2
exit 1
fi
-umount "$HAL_PROP_VOLUME_MOUNT_POINT" > /dev/null 2>&1 || true
+RESULT=$(umount "$HAL_PROP_VOLUME_MOUNT_POINT" 2>&1)
if [ $? -ne 0 ]; then
- echo "org.freedesktop.Hal.Device.Volume.UnmountFailed" >&2
- echo "$HAL_PROP_VOLUME_MOUNT_POINT" >&2
+ case "$RESULT" in
+ *busy*)
+ echo "org.freedesktop.Hal.Device.Volume.Busy" >&2
+ echo "Device is busy." >&2
+ ;;
+ *"not mounted"*)
+ echo "org.freedesktop.Hal.Device.Volume.NotMounted" >&2
+ echo "Device is not mounted." >&2
+ ;;
+ *)
+ echo "org.freedesktop.Hal.Device.Volume.UnknownFailure" >&2
+ echo "Unknown failure." >&2
+ esac
exit 1
fi
More information about the hal-commit
mailing list