blob: 84d73c049c0173982c2363be50b4ffb33eacb7f1 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
--- /var/tmp/portage/sys-block/gparted-0.3.7/work/gparted-0.3.7/gparted.in 2008-04-29 16:17:29.000000000 +0200
+++ gparted.in 2008-06-15 19:21:32.000000000 +0200
@@ -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
#
+# On systems without hal-lock, invoke gpartedbin directly.
#
-# 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.
+# 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
-hal-lock --interface org.freedeskdesktop.Hal.Device.Storage --exclusive \
- --run @installdir@/gpartedbin $*
+#
+# 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
|