diff --git a/ChangeLog b/ChangeLog index 4725a113..9afa28a7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2008-05-10 Curtis Gedak + + * gparted.in: Enhanced script to use hal-lock only if it exists + - This removes the absolute requirement for hal-lock and + enables systems without HAL to use GParted. + + * configure.in: Removed check for hal-lock program (added 2008-05-08) + 2008-05-08 Curtis Gedak * README: Added note about hal-lock and HAL requirement diff --git a/configure.in b/configure.in index 149f7c59..3c4e862b 100644 --- a/configure.in +++ b/configure.in @@ -14,12 +14,6 @@ AC_PROG_CC AC_PROG_CXX AM_PROG_LIBTOOL -dnl check for hal-lock program -AC_CHECK_PROG([HAVE_HAL_LOCK], [hal-lock], [yes], [no]) -if test "x$HAVE_HAL_LOCK" = "xno"; then - AC_MSG_ERROR([*** hal-lock program not found]) -fi - dnl====================== dnl i18n stuff diff --git a/gparted.in b/gparted.in index bc9244cc..ab2d39a6 100755 --- a/gparted.in +++ b/gparted.in @@ -1,23 +1,35 @@ -#!/bin/bash +#!/bin/sh # -# Purpose: Acquire device locks prior to running gparted. +# 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. # 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 # -# -# Following is a quote from HAL 0.5.10 Specification. -# http://people.freedesktop.org/~david/hal-spec/hal-spec.html#locking-guidelines -# -# In order to prevent HAL-based automounters from mounting partitions -# that are being prepared, applications that access block devices -# directly (and pokes the kernel to reload the partitioning table) -# should lock out automounters by either a) obtaining the -# org.freedesktop.Hal.Device.Storage lock on each drive being processed; -# or b) obtaining the global org.freedesktop.Hal.Device.Storage lock. +# On systems without hal-lock, invoke gpartedbin directly. # -hal-lock --interface org.freedeskdesktop.Hal.Device.Storage --exclusive \ - --run "@installdir@/gpartedbin $*" +# +# Search PATH to determine if hal-lock program can be found +# +HAVE_HAL_LOCK=no +for k in '' `echo "$PATH" | sed 's,:, ,g'`; do + if test -x "$k/hal-lock"; then + HAVE_HAL_LOCK=yes + break + fi +done + +# +# Use hal-lock for invocation if it exists, otherwise simply run gpartedbin +# +if test "x$HAVE_HAL_LOCK" = "xyes"; then + hal-lock --interface org.freedeskdesktop.Hal.Device.Storage --exclusive \ + --run "@installdir@/gpartedbin $*" +else + @installdir@/gpartedbin $* +fi