[gparted] Add support for devicekit-disks device automount prevention



commit b1667d4f6dac1c1a0da0d6aed528ebdd48c02de4
Author: Curtis Gedak <gedakc gmail com>
Date:   Thu Oct 15 10:32:29 2009 -0600

    Add support for devicekit-disks device automount prevention

 gparted.in |   30 ++++++++++++++++++++++--------
 1 files changed, 22 insertions(+), 8 deletions(-)
---
diff --git a/gparted.in b/gparted.in
index 40461b0..fe22f5a 100755
--- a/gparted.in
+++ b/gparted.in
@@ -2,19 +2,29 @@
 #
 #  Purpose:  Perform appropriate startup of GParted executable gpartedbin.
 #
-#            On systems with hal-lock, use hal-lock to acquire device
-#            locks prior to running gpartedbin.
-#            This is to prevent devices from being automounted.
+#            The purpose of these startup methods is to prevent
+#            devices from being automounted.
 #            File system problems can occur if devices are mounted
 #            prior to the completion of GParted's operations.
-#            See GParted bug #324220
-#            http://bugzilla.gnome.org/show_bug.cgi?id=324220
 #
-#            On systems without hal-lock, invoke gpartedbin directly.
+
+#
+#  Search PATH to determine if devkit-disks program can be found
+#  and if appropriate daemon is running.
 #
+HAVE_DEVKIT_DISKS=no
+for k in '' `echo "$PATH" | sed 's,:, ,g'`; do
+	if test -x "$k/devkit-disks"; then
+		if test "z`ps -e | grep devkit-disks-da`" != "z"; then
+			HAVE_DEVKIT_DISKS=yes
+			break
+		fi
+	fi
+done
 
 #
 #  Search PATH to determine if hal-lock program can be found
+#  and if appropriate daemon is running.
 #
 HAVE_HAL_LOCK=no
 for k in '' `echo "$PATH" | sed 's,:, ,g'`; do
@@ -27,9 +37,13 @@ for k in '' `echo "$PATH" | sed 's,:, ,g'`; do
 done
 
 #
-#  Use hal-lock for invocation if it exists, otherwise simply run gpartedbin
+#  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_HAL_LOCK" = "xyes"; then
+if test "x$HAVE_DEVKIT_DISKS" = "xyes"; then
+	devkit-disks --inhibit -- @installdir@/gpartedbin $*
+elif test "x$HAVE_HAL_LOCK" = "xyes"; then
 	hal-lock --interface org.freedesktop.Hal.Device.Storage --exclusive \
 		--run "@installdir@/gpartedbin $*"
 else



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