Roland Mas, 2006-04-23 11:54:37 +0200 :
When I think about it, I end up concluding that this file (or
directory or whatever it is) doesn't belong there. Even if I wanted
to let HAL mount and unmount stuff, there's no guarantee that the
filesystem containing the mountpoints is writable. Such state
information should therefore be stored somewhere else, like
/var/run, which seems more appropriate and should fix both problems.
And here's a patch implementing that suggestion. It works for me,
since it allows autofs to expire mountpoints again, and it seems not
to prevent Gnome from mounting and unmounting USB keys automagically.
I haven't tested that second part very thouroughly though, since it's
not in my regular usage patterns. Feel free to rewrite if needed :-)
Roland.
--
Roland Mas
It would be hard to be deader without special training.
-- in Theatre of Cruelty (Terry Pratchett)
diff -ruN hal-0.5.7/debian/changelog hal-0.5.7+lolando/debian/changelog
--- hal-0.5.7/debian/changelog 2006-04-23 15:13:03.0 +0200
+++ hal-0.5.7+lolando/debian/changelog 2006-04-23 15:16:18.0 +0200
@@ -1,3 +1,11 @@
+hal (0.5.7-1+lolando) unstable; urgency=low
+
+ * debian/patches/07_state_files_location.patch
++ Added. Change location of .created-by-hal files.
+ * Fixed hal.dirs and hal.init.dbus accordingly.
+
+ -- Roland Mas [EMAIL PROTECTED] Sun, 23 Apr 2006 15:16:18 +0200
+
hal (0.5.7-1) unstable; urgency=low
* New upstream release
diff -ruN hal-0.5.7/debian/hal.dirs hal-0.5.7+lolando/debian/hal.dirs
--- hal-0.5.7/debian/hal.dirs 2006-04-23 15:13:03.0 +0200
+++ hal-0.5.7+lolando/debian/hal.dirs 2006-04-23 13:36:50.0 +0200
@@ -1,2 +1,3 @@
/var/run/hal
+/var/run/hal/storage-states
/etc/hal/fdi
diff -ruN hal-0.5.7/debian/hal.init.dbus hal-0.5.7+lolando/debian/hal.init.dbus
--- hal-0.5.7/debian/hal.init.dbus 2006-04-23 15:13:03.0 +0200
+++ hal-0.5.7+lolando/debian/hal.init.dbus 2006-04-23 13:38:09.0
+0200
@@ -12,6 +12,7 @@
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
DAEMON=/usr/sbin/hald
PIDDIR=/var/run/hal
+STATE_DIR=/var/run/hal/storage-states
PIDFILE=$PIDDIR/hald.pid
NAME=hald
DAEMONUSER=hal
@@ -33,6 +34,10 @@
mkdir -p $PIDDIR
chown $DAEMONUSER:$DAEMONUSER $PIDDIR
fi
+ if [ ! -d $STATE_DIR ]; then
+mkdir -p $STATE_DIR
+chown $DAEMONUSER:$DAEMONUSER $STATE_DIR
+ fi
log_daemon_msg Starting $DESC $NAME
start-stop-daemon --start --pidfile $PIDFILE \
--exec $DAEMON -- $DAEMON_OPTS
diff -ruN hal-0.5.7/debian/patches/07_state_files_location.patch
hal-0.5.7+lolando/debian/patches/07_state_files_location.patch
--- hal-0.5.7/debian/patches/07_state_files_location.patch 1970-01-01
01:00:00.0 +0100
+++ hal-0.5.7+lolando/debian/patches/07_state_files_location.patch
2006-04-23 13:34:34.0 +0200
@@ -0,0 +1,188 @@
+diff -Nur hal-0.5.7-old/hald/linux2/blockdev.c hal-0.5.7/hald/linux2/blockdev.c
+--- hal-0.5.7-old/hald/linux2/blockdev.c 2006-02-24 05:29:06.0
+0100
hal-0.5.7/hald/linux2/blockdev.c 2006-04-23 12:38:39.0 +0200
+@@ -251,7 +251,7 @@
+ device_property_atomic_update_end ();
+ HAL_INFO ((set %s to unmounted, hal_device_get_udi (dev)));
+
+- mount_point_hal_file = g_strdup_printf (%s/.created-by-hal,
mount_point);
++ mount_point_hal_file = g_strdup_printf
(%s/%s/.created-by-hal, STATE_DIR, mount_point);
+ if (g_file_test (mount_point_hal_file, G_FILE_TEST_EXISTS)) {
+ char *cleanup_stdin;
+ char *extra_env[2];
+diff -Nur hal-0.5.7-old/hald/linux2/blockdev.h hal-0.5.7/hald/linux2/blockdev.h
+--- hal-0.5.7-old/hald/linux2/blockdev.h 2005-12-08 20:03:02.0
+0100
hal-0.5.7/hald/linux2/blockdev.h 2006-04-23 12:38:39.0 +0200
+@@ -28,6 +28,8 @@
+
+ #include glib.h
+
++#define STATE_DIR /var/run/hal/storage-states
++
+ void hotplug_event_begin_add_blockdev (const gchar *sysfs_path, const char
*device_file, gboolean is_partition, HalDevice *parent, void *end_token);
+
+ void hotplug_event_begin_remove_blockdev (const gchar *sysfs_path, gboolean
is_partition, void *end_token);
+diff -Nur hal-0.5.7-old/tools/hal-luks-remove hal-0.5.7/tools/hal-luks-remove
+--- hal-0.5.7-old/tools/hal-luks-remove2006-02-13 08:29:44.0
+0100
hal-0.5.7/tools/hal-luks-remove2006-04-23 12:38:39.0 +0200
+@@ -6,6 +6,8 @@
+ # This program is free software; you can redistribute it and/or modify
+ # it under the terms of the GNU General Public License version 2.
+
++STATE_DIR=/var/run/hal/storage-states
++
+ if [ $HAL_PROP_BLOCK_DEVICE == ] || [ $HAL_PROP_INFO_UDI == ] || [
$HAL_PROP_VOLUME_UUID == ] ; then
+ echo Missing or empty environment variable(s). 2
+ echo This script should be started by hald. 2
+@@ -22,9 +24,9 @@
+ if [ !