gparted/gparted.in

52 lines
1.4 KiB
Plaintext
Raw Normal View History

#!/bin/sh
#
# Purpose: Perform appropriate startup of GParted executable gpartedbin.
#
# 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.
#
#
# 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
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 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_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
@installdir@/gpartedbin $*
fi