hal/tools hal-system-storage-mount,1.23,1.24
David Zeuthen
david at freedesktop.org
Tue Feb 14 10:49:57 PST 2006
Update of /cvs/hal/hal/tools
In directory gabe:/tmp/cvs-serv24688/tools
Modified Files:
hal-system-storage-mount
Log Message:
2006-02-14 David Zeuthen <davidz at redhat.com>
* tools/hal-system-storage-mount: Refuse to mount a volume if it's
already listed in /etc/fstab - includes checking symlinks. Patch
from Ludwig Nussel <ludwig.nussel at suse.de>.
Index: hal-system-storage-mount
===================================================================
RCS file: /cvs/hal/hal/tools/hal-system-storage-mount,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -d -r1.23 -r1.24
--- hal-system-storage-mount 13 Feb 2006 16:15:23 -0000 1.23
+++ hal-system-storage-mount 14 Feb 2006 18:49:55 -0000 1.24
@@ -29,6 +29,36 @@
exit 1
fi
+
+check_fstab()
+{
+ awk -v dev="$1" \
+ '
+ BEGIN {
+ sub(/^\/dev\//,"", dev)
+ cmd = "/usr/bin/udevinfo -q symlink -n " dev
+ if (( cmd | getline) < 0 ) {
+ print "org.freedesktop.Hal.Device.Volume.PermissionDenied" >/dev/stderr
+ exit 1
+ }
+
+ for(i=1; i <= NF; i++) {
+ a["/dev/" $i] = 1
+ }
+ a["/dev/" dev] = 1
+ }
+ {
+ if ($1 in a) {
+ print "org.freedesktop.Hal.Device.Volume.PermissionDenied" >"/dev/stderr"
+ print $1 " found in /etc/fstab" >"/dev/stderr"
+ exit 1
+ }
+ }
+ ' /etc/fstab
+}
+
+check_fstab "$HAL_PROP_BLOCK_DEVICE" || exit 1
+
# read parameters
# "MyDisk\n"
# "fuse\n"
More information about the hal-commit
mailing list