[gparted] Use both devkit-disks and hal-lock if available



commit d9b892a73f2f078ae6314c4925b438e43fe4392e
Author: Curtis Gedak <gedakc gmail com>
Date:   Fri Oct 16 10:49:31 2009 -0600

    Use both devkit-disks and hal-lock if available
    
    During the transition period from HAL to devicekit-disks some
    distributions might require both methods to prevent device
    auto-mounting.  See Ubuntu launchpad bug link:
    https://bugs.launchpad.net/ubuntu/+source/gparted/+bug/428133

 gparted.in |   17 ++++++++++++-----
 1 files changed, 12 insertions(+), 5 deletions(-)
---
diff --git a/gparted.in b/gparted.in
index fe22f5a..e6c1473 100755
--- a/gparted.in
+++ b/gparted.in
@@ -37,15 +37,22 @@ for k in '' `echo "$PATH" | sed 's,:, ,g'`; do
 done
 
 #
-#  Use devkit-disks for invocation if binary exists and daemon is running.
+#  Use both devkit-disks and hal-lock for invocation if both binaries exist
+#  and both of the daemons are running.
+#  Else use devkit-disks for invocation if binary exists and daemon is running.
 #  Otherwise use hal-lock for invocation if binary exists and daemon is running.
 #  If the above checks fail then simply run gpartedbin.
 #
-if test "x$HAVE_DEVKIT_DISKS" = "xyes"; then
-	devkit-disks --inhibit -- @installdir@/gpartedbin $*
+BASE_CMD="@installdir@/gpartedbin $*"
+if test "x$HAVE_DEVKIT_DISKS" = "xyes" && test "x$HAVE_HAL_LOCK" = "xyes"; then
+	devkit-disks --inhibit -- \
+		hal-lock --interface org.freedesktop.Hal.Device.Storage --exclusive \
+			--run "$BASE_CMD"
+elif test "x$HAVE_DEVKIT_DISKS" = "xyes"; then
+	devkit-disks --inhibit -- $BASE_CMD
 elif test "x$HAVE_HAL_LOCK" = "xyes"; then
 	hal-lock --interface org.freedesktop.Hal.Device.Storage --exclusive \
-		--run "@installdir@/gpartedbin $*"
+		--run "$BASE_CMD"
 else
-	@installdir@/gpartedbin $*
+	$BASE_CMD
 fi



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]