[Pkg-utopia-commits] r118 - packages/hal/trunk/debian

Sjoerd Simons sjoerd@haydn.debian.org
Mon, 22 Nov 2004 14:18:12 -0700


Author: sjoerd
Date: 2004-11-22 14:17:55 -0700 (Mon, 22 Nov 2004)
New Revision: 118

Modified:
   packages/hal/trunk/debian/changelog
   packages/hal/trunk/debian/hal.postinst
Log:
Add code to do udevsend again on all current block devices. This ensured that
the permissions are set up just the way we like it :)



Modified: packages/hal/trunk/debian/changelog
===================================================================
--- packages/hal/trunk/debian/changelog	2004-11-22 20:02:40 UTC (rev 117)
+++ packages/hal/trunk/debian/changelog	2004-11-22 21:17:55 UTC (rev 118)
@@ -8,6 +8,8 @@
     (Script from the ubuntu package)
   * Install udev configuration to make removable devices owned by group hal
     (Adapted from the ubuntu package)
+  * Call udevsend for all block devices in the postinst. To ensure 
+    the permissions are set right for already available devices.
   * debian/README. Updated to reflect we run as user hal by default now.
   * debian/patches/storage-policy-debian.patch.
     + Updated. turn of sync and noatime for drivers bigger then 2GB. 

Modified: packages/hal/trunk/debian/hal.postinst
===================================================================
--- packages/hal/trunk/debian/hal.postinst	2004-11-22 20:02:40 UTC (rev 117)
+++ packages/hal/trunk/debian/hal.postinst	2004-11-22 21:17:55 UTC (rev 118)
@@ -23,6 +23,24 @@
 #     installation fails and the `postinst' is called with `abort-upgrade',
 #     `abort-remove' or `abort-deconfigure'.
 
+UDEVSEND="/sbin/udevsend"
+
+do_udev() {
+  # Synthesize events on block devices, so we know the permissions are setup
+  # the right way 
+  SYSFS="/sys"
+  for i in /sys/block/* ; do
+    # for each device
+    ACTION=add DEVPATH=${i#${SYSFS}} ${UDEVSEND} block &
+
+    for j in $i/* ; do
+      if [ -f $j/dev ]; then
+        ACTION=add DEVPATH=${j#${SYSFS}} ${UDEVSEND} block &
+      fi
+    done
+  done
+}
+
 case "$1" in
     configure)
 	adduser --quiet --system --home /var/run/hal \
@@ -38,6 +56,10 @@
 		mv /etc/init.d/hal /etc/dbus-1/event.d/
 		update-rc.d hal remove
 	fi
+  if [ -x ${UDEVSEND} ] ; then
+    do_udev;
+  fi
+
   if [ -x /etc/init.d/dbus-1 ]; then
    	invoke-rc.d dbus-1 restart || true
   fi