gparted/gparted.in

38 lines
1.1 KiB
Bash
Executable File

#!/bin/sh
#
# 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
#
# On systems without hal-lock, invoke gpartedbin directly.
#
#
# 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
if test "z`ps -e | grep hald`" != "z"; then
HAVE_HAL_LOCK=yes
break
fi
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.freedesktop.Hal.Device.Storage --exclusive \
--run "@installdir@/gpartedbin $*"
else
@installdir@/gpartedbin $*
fi