Add support for devicekit-disks device automount prevention

This commit is contained in:
Curtis Gedak 2009-10-15 10:32:29 -06:00
parent cf4a962c73
commit b1667d4f6d
1 changed files with 23 additions and 9 deletions

View File

@ -2,19 +2,29 @@
# #
# Purpose: Perform appropriate startup of GParted executable gpartedbin. # Purpose: Perform appropriate startup of GParted executable gpartedbin.
# #
# On systems with hal-lock, use hal-lock to acquire device # The purpose of these startup methods is to prevent
# locks prior to running gpartedbin. # devices from being automounted.
# This is to prevent devices from being automounted.
# File system problems can occur if devices are mounted # File system problems can occur if devices are mounted
# prior to the completion of GParted's operations. # 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 # Search PATH to determine if hal-lock program can be found
# and if appropriate daemon is running.
# #
HAVE_HAL_LOCK=no HAVE_HAL_LOCK=no
for k in '' `echo "$PATH" | sed 's,:, ,g'`; do for k in '' `echo "$PATH" | sed 's,:, ,g'`; do
@ -27,9 +37,13 @@ for k in '' `echo "$PATH" | sed 's,:, ,g'`; do
done 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 \ hal-lock --interface org.freedesktop.Hal.Device.Storage --exclusive \
--run "@installdir@/gpartedbin $*" --run "@installdir@/gpartedbin $*"
else else