Hi,

Sjoerd Simons [2006-08-08 22:23 +0200]:
> The problem with the fix is that some parts of debian will use pmount and 
> other
> part hal callouts, while i would prefer that all desktops use the same way of
> mounting removable media. What was the reason for KDE to drop pmount and 
> switch
> to hal callouts ?

For the record, we recently had the very same problem, so I changed
ubuntu's hal to enable the storage scripts again, and patched them to
use pmount. So we get the best of both worlds: the rigid pmount policy
checks, and the rather convenient hal interface, which has already
become a standard interface in both KDE and gnome-volume-manager. 

FYI I attach the relevant bzr diffs (sorry, a bit messy).

Martin

-- 
Martin Pitt        http://www.piware.de
Ubuntu Developer   http://www.ubuntu.com
Debian Developer   http://www.debian.org

In a world without walls and fences, who needs Windows and Gates?
=== added file 'debian/patches/mount-scripts-pmount.patch'
--- /dev/null   
+++ debian/patches/mount-scripts-pmount.patch   
@@ -0,0 +1,71 @@
+diff -Nur hal/build-tree/hal-0.5.7.1/tools/hal-system-storage-eject 
hal.new/build-tree/hal-0.5.7.1/tools/hal-system-storage-eject
+--- hal-0.5.7.1/tools/hal-system-storage-eject 2006-02-10 04:41:54.000000000 
+0100
++++ hal-0.5.7.1/tools/hal-system-storage-eject 2006-08-04 09:57:41.000000000 
+0200
+@@ -31,7 +31,18 @@
+ read GIVEN_EJECTOPTIONS
+ GIVEN_EJECTOPTIONS=${GIVEN_EJECTOPTIONS//[^a-zA-Z0-9_=[:space:]]/_}
+ 
+-RESULT=$(eject "$HAL_PROP_BLOCK_DEVICE" 2>&1)
++# check validity of user id
++if [ "$HAL_METHOD_INVOKED_BY_UID" = "0" ]; then
++    echo "Script was called with HAL_METHOD_INVOKED_BY_UID=0, aborting." >&2
++    exit 1
++fi
++PWD=`getent passwd "$HAL_METHOD_INVOKED_BY_UID"` || {
++    echo "User id $HAL_METHOD_INVOKED_BY_UID does not exist." >&2
++    exit 1
++}
++USER="`echo "$PWD" | cut -f 1 -d: | head -n 1`"
++
++RESULT=$(su -c "eject '$HAL_PROP_BLOCK_DEVICE'" "$USER" 2>&1)
+ if [ $? -ne 0 ]; then
+     case "$RESULT" in
+       *busy*)
+diff -Nur hal/build-tree/hal-0.5.7.1/tools/hal-system-storage-mount 
hal.new/build-tree/hal-0.5.7.1/tools/hal-system-storage-mount
+--- hal-0.5.7.1/tools/hal-system-storage-mount 2006-02-14 19:49:55.000000000 
+0100
++++ hal-0.5.7.1/tools/hal-system-storage-mount 2006-08-04 09:57:32.000000000 
+0200
+@@ -15,6 +15,20 @@
+     exit 1
+ fi
+ 
++# check validity of user id
++if [ "$HAL_METHOD_INVOKED_BY_UID" = "0" ]; then
++    echo "Script was called with HAL_METHOD_INVOKED_BY_UID=0, aborting." >&2
++    exit 1
++fi
++PWD=`getent passwd "$HAL_METHOD_INVOKED_BY_UID"` || {
++    echo "User id $HAL_METHOD_INVOKED_BY_UID does not exist." >&2
++    exit 1
++}
++USER="`echo "$PWD" | cut -f 1 -d:`"
++
++su -c "pmount-hal \"$HAL_PROP_BLOCK_DEVICE\"" "$USER"
++exit $?
++
+ # check if device is already mounted
+ if [ "$HAL_PROP_VOLUME_IS_MOUNTED" = "true" ]; then
+     echo "org.freedesktop.Hal.Device.Volume.AlreadyMounted" >&2
+diff -Nur hal/build-tree/hal-0.5.7.1/tools/hal-system-storage-unmount 
hal.new/build-tree/hal-0.5.7.1/tools/hal-system-storage-unmount
+--- hal-0.5.7.1/tools/hal-system-storage-unmount       2006-02-13 
08:29:44.000000000 +0100
++++ hal-0.5.7.1/tools/hal-system-storage-unmount       2006-08-04 
09:57:39.000000000 +0200
+@@ -13,6 +13,20 @@
+     exit 1
+ fi
+ 
++# check validity of user id
++if [ "$HAL_METHOD_INVOKED_BY_UID" = "0" ]; then
++    echo "Script was called with HAL_METHOD_INVOKED_BY_UID=0, aborting." >&2
++    exit 1
++fi
++PWD=`getent passwd "$HAL_METHOD_INVOKED_BY_UID"` || {
++    echo "User id $HAL_METHOD_INVOKED_BY_UID does not exist." >&2
++    exit 1
++}
++USER="`echo "$PWD" | cut -f 1 -d:`"
++
++su -c "pumount \"$HAL_PROP_BLOCK_DEVICE\"" "$USER"
++exit $?
++
+ MOUNT_POINT="$HAL_PROP_INFO_HAL_MOUNT_CREATED_MOUNT_POINT"
+ if [ "$MOUNT_POINT" == "" ]; then
+     MOUNT_POINT="$HAL_PROP_VOLUME_MOUNT_POINT"

=== modified file 'debian/changelog'
--- debian/changelog    
+++ debian/changelog    
@@ -2,8 +2,15 @@
 
   * debian/hal.install: Revert 0.5.7.1-0ubuntu3 changes, install all
     hal-system-storage-* scripts again.
-
- -- Martin Pitt <[EMAIL PROTECTED]>  Fri,  4 Aug 2006 09:55:21 +0200
+  * Add debian/patches/mount-scripts-pmount.patch:
+    - Change mount/umount scripts to call pmount-hal/pumount as the
+      destination user instead of mount/umount as root. This way, we do not
+      have to rely on hal properties for sanity checking, which are unreliable
+      in hal's current trust model.
+    - This change should be completely transparent to the outside world, so
+      that KDE and gnome-mount will just work.
+
+ -- Martin Pitt <[EMAIL PROTECTED]>  Fri,  4 Aug 2006 09:58:19 +0200
 
 hal (0.5.7.1-0ubuntu3) edgy; urgency=low
 

=== modified file 'debian/changelog'
--- debian/changelog    
+++ debian/changelog    
@@ -9,11 +9,12 @@
       in hal's current trust model.
     - This change should be completely transparent to the outside world, so
       that KDE and gnome-mount will just work.
+  * debian/control: Add pmount dependency to hal for above change.
   * debian/control: Replace python version specific p-dbus and p-gnome2
     dependencies with their unversioned package names. Leave p-glade2 for now
     since it has not yet been converted. Closes: LP#54615
 
- -- Martin Pitt <[EMAIL PROTECTED]>  Fri,  4 Aug 2006 10:08:27 +0200
+ -- Martin Pitt <[EMAIL PROTECTED]>  Fri,  4 Aug 2006 10:14:23 +0200
 
 hal (0.5.7.1-0ubuntu3) edgy; urgency=low
 

=== modified file 'debian/control'
--- debian/control      
+++ debian/control      
@@ -8,7 +8,7 @@
 
 Package: hal
 Architecture: any
-Depends: ${shlibs:Depends}, adduser, pciutils, usbutils, udev (>= 0.065), dbus 
(>= 0.60-1), lsb-base
+Depends: ${shlibs:Depends}, adduser, pciutils, usbutils, udev (>= 0.065), dbus 
(>= 0.60-1), lsb-base, pmount
 Suggests: hal-device-manager
 Description: Hardware Abstraction Layer
  HAL provides an abstract view on hardware.

=== modified file 'debian/changelog'
--- debian/changelog    
+++ debian/changelog    
@@ -7,6 +7,8 @@
       destination user instead of mount/umount as root. This way, we do not
       have to rely on hal properties for sanity checking, which are unreliable
       in hal's current trust model.
+    - Change eject script to call eject as the destination user instead of
+      root.
     - This change should be completely transparent to the outside world, so
       that KDE and gnome-mount will just work.
   * debian/control: Add pmount dependency to hal for above change.

Attachment: signature.asc
Description: Digital signature

Reply via email to