per-user udev rules subset
Stef Bon
stef at bononline.nl
Wed Oct 14 12:32:27 PDT 2009
gibboris at gmail.com wrote:
>>
> DKD handle several mountpaths (char **), so does my code (comma separated) :
> if one of specified path matches one the mountpath of the newly mounted device
> (which I recall, can be mounted by automounter, user, root, udev, ...)
> The the value of DeviceMounted is execvp()
> ("mirage" is simple image viewer, I should have said that).
> The action may have been :
> ln -sf /mnt/pictures ~/.fuse/bind/Pictures
>
>
OK! Before I continue, I try to explain how fuse-workspace works:
fuse-workspace mirrors the contents of $HOME/.fuse/bind. This is the
first feature.
Second, it's possible to let a symbolic link look like a directory,
which is a nice feature.
Two start:
mkdir -p $HOME/.fuse/bind/Devices
now when and usb stick is mounted by HAL (DeviceKit) at /media/USBstick,
create a symlink like:
ln -sf /media/USBstick $HOME/.fuse/bind/Devices/USBstick
now mounting:
fuse-workspace $HOME/Workspace -o allow_root,use_ino
Now, at this moment it only mirrors:
ls -al $HOME/Workspace gives
Devices
and
ls -al $HOME/Workspace/Devices gives
lrwxrwxrwx USBstick -> /media/USBstick
Now, this is already possible, making symlinks, so what's new?? Here the
second feature:
after creating the directory in the "shadow" directory:
mkdir -p $HOME/Workspace/Devices/USBstick
the module fuse-workspace translates the symlink to a directory, so now
a ls command gives:
ls -al $HOME/Workspace/Devices gives
drwxr-xr-x USBstick
This is actually a trick, workspace is folling you and the system.
> I remember having searched for a non-root bind -o, if it's possible with fuse-workspace,
> then the following theory should work :
> - plug happens
> - udev calls this script [1]
> - DKD is warned that plug happens (but not about mount)
> - DKD --monitor knows about mount, with my code it can trigger an event like :
> [catch-all mount rule]
> DeviceMounted=ln -sf %device_mount_paths ~/.fuse/bind/<something_variable_to_define>
> - the fuse-workspace daemon was already loaded, the bind is done
> My only problem with this is that I don't want my "known" mp3 player being given a generic
> name (or even it's LABEL) but being given specific mount path and access.
> So I need to find out how to make udev nicely ignore fstab configured device but that's another
> story.
>
> [1] http://en.gentoo-wiki.com/wiki/Autofs#Write_the_mount.2Funmount_scripts_2
>
This is great! I know this link, I've created a simular contruction with
autofs, launced by ConsoleKit and UDEV.
But about the order you've described above, and about the ability to
have more than one mountpoint stored in the mount_point
property:
- plug happens
- DeviceKit (or autofs launched by udev at /mnt...) mounts the device at
/media/USBstick
DeviceKit sets the system mountpoint to /media/USBstick
- somehow (I do not know how) a symbolic link in $HOME/.fuse/bind/...
and a directory in $HOME/.fuse/shadow... should be made for every logged
in user (which is also running a fuse-workspace instance) as shown above
- latest the mountpoint property for every user should be set to
$HOME/Workspace/Devices/USBstick
As you may notice this only works if there is a difference between a
system mountpoint (/media/USBstick)
and the mountpoints (like /home/sbon/Workspace/Devices/USBstick and
/home/marian/Workspace/Hardware/USBstick)
should be exported to the environment of the different users, respect.
sbon and marian.
Somehowe these different mountpoint should be stored and the environment
(KDE or Gnome) should select the right mountpoint,
so /home/sbon/Workspace/Devices/USBstick should be taken by the
(graphical) environment of sbon,
and simular for marian, you'll get the idea.
So per-user rules? Maybe, but sure per user mountpoints.
Stef
More information about the devkit-devel
mailing list