Removed absolute requirement for hal-lock. GParted will now work on systems with or without hal-lock

svn path=/trunk/; revision=849
This commit is contained in:
Curtis Gedak 2008-05-10 15:34:39 +00:00
parent 913a42d268
commit a75a70a9a2
3 changed files with 34 additions and 20 deletions

View File

@ -1,3 +1,11 @@
2008-05-10 Curtis Gedak <gedakc@gmail.com>
* 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 <gedakc@gmail.com>
* README: Added note about hal-lock and HAL requirement

View File

@ -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

View File

@ -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