hal/tools hal-system-storage-cleanup-mountpoints, 1.1, 1.2 hal-system-storage-mount, 1.21, 1.22

David Zeuthen david at freedesktop.org
Sun Feb 12 18:16:59 PST 2006


Update of /cvs/hal/hal/tools
In directory gabe:/tmp/cvs-serv19949/tools

Modified Files:
	hal-system-storage-cleanup-mountpoints 
	hal-system-storage-mount 
Log Message:
2006-02-12  David Zeuthen  <davidz at redhat.com>

        * tools/hal-system-storage-mount: Use [:alnum:] and [:space:]
        instead of a-zA-Z0-9 so we support mount points like "foobar der
        æøå サイトの". Set LANG to en_US.UTF-8 to get bash to do this.
        Also allow - in GIVEN_MOUNTOPTIONS (Reported by Jeffrey Stedfast
        <fejj at novell.com>) in order to get iocharset= to work.

        * tools/hal-system-storage-cleanup-mountpoints: Make this work for
        mountpoints with spaces in them

        * hald/linux2/blockdev.c (blockdev_refresh_mount_state): Also
        remove info.hal_mount properties.
        (blockdev_generate_add_hotplug_event): For Reprobe, pass the
        model, vendor, serial and firmware rev.



Index: hal-system-storage-cleanup-mountpoints
===================================================================
RCS file: /cvs/hal/hal/tools/hal-system-storage-cleanup-mountpoints,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- hal-system-storage-cleanup-mountpoints	21 Dec 2005 16:07:40 -0000	1.1
+++ hal-system-storage-cleanup-mountpoints	13 Feb 2006 02:16:57 -0000	1.2
@@ -1,6 +1,7 @@
-#!/bin/sh
+#!/bin/bash
 
 # Copyright (C) 2005, Kay Sievers <kay.sievers at vrfy.org>
+# Copyright (C) 2006, David Zeuthen <davidz at redhat.com>
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License version 2.
@@ -8,25 +9,24 @@
 MOUNT_ROOT="/media"
 
 for DIR in $MOUNT_ROOT/*; do
-    # check if we created it
-    if [ ! -e $DIR/.created-by-hal ]; then
-	continue
-    fi
 
-    # don't touch mounted volumes
-    BUSY=
-    while read dev dir type options; do
-	if [ "$dir" = "$DIR" ]; then
-	    BUSY=1
-	    break
+    # /proc/mounts substitute spaces with 040
+    DIRMOD=${DIR//[[:space:]]/040}
+
+    # check if we created it
+    if [ -e "$DIR/.created-by-hal" ]; then
+	BUSY=0
+	while read dev dir type options; do
+	    if [ "$dir" = "$MDIR" ]; then
+		BUSY=1
+		break
+	    fi
+	done < /proc/mounts
+	if [ "$BUSY" != "1" ]; then
+	    rm -f "$DIR/.created-by-hal"
+	    rmdir --ignore-fail-on-non-empty "$DIR"
 	fi
-    done < /proc/mounts
-    if [ "$BUSY" = "1" ]; then
-	continue
     fi
-
-    rm -f $DIR/.created-by-hal
-    rmdir --ignore-fail-on-non-empty "$DIR"
 done
 
 exit 0

Index: hal-system-storage-mount
===================================================================
RCS file: /cvs/hal/hal/tools/hal-system-storage-mount,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -d -r1.21 -r1.22
--- hal-system-storage-mount	10 Feb 2006 03:41:54 -0000	1.21
+++ hal-system-storage-mount	13 Feb 2006 02:16:57 -0000	1.22
@@ -37,12 +37,15 @@
 # only allow ^a-zA-Z0-9_= in the string because otherwise someone may
 # pass e.g. umask=0600,suid,dev or umask=`/bin/evil`
 
+# Used to get :alnum: to be somewhat useful
+LANG=en_US.UTF-8
+
 read GIVEN_MOUNTPOINT
-GIVEN_MOUNTPOINT=${GIVEN_MOUNTPOINT//[^a-zA-Z0-9_:.+-]/@}
+GIVEN_MOUNTPOINT=${GIVEN_MOUNTPOINT//[^[:alnum:]_=[:space:]:.+-]/@}
 read GIVEN_MOUNTTYPE
 GIVEN_MOUNTTYPE=${GIVEN_MOUNTTYPE//[^a-zA-Z0-9_=]/_}
 read GIVEN_MOUNTOPTIONS
-GIVEN_MOUNTOPTIONS=${GIVEN_MOUNTOPTIONS//[^a-zA-Z0-9_=[:space:]]/_}
+GIVEN_MOUNTOPTIONS=${GIVEN_MOUNTOPTIONS//[^a-zA-Z0-9_=-[:space:]]/_}
 
 # if no mountpoint is requested, get the mountpoint from the filesystem
 # label if it does not contain invalid chars or starts with a "."




More information about the hal-commit mailing list