Date: Mon, 4 Mar 2013 21:20:44 +0100 From: Olivier Duchateau <duchateau.olivier@gmail.com> To: Jason Bacon <jwbacon@tds.net> Cc: xfce@freebsd.org Subject: Re: xfce4-mount-plugin Message-ID: <CAHcdu2pMzaMzWggoNtBLK3L_-1W%2BDDVy_A9wDDrAU_GqYdUBvA@mail.gmail.com> In-Reply-To: <5134EE36.6060709@tds.net> References: <5134EE36.6060709@tds.net>
next in thread | previous in thread | raw e-mail | index | archive | help
2013/3/4 Jason Bacon <jwbacon@tds.net>: > > I maintain and develop sysutils/desktop-installer, which began as a simple > script for setting up XFCE, until I realized that 99% of what it does is > desktop-independent, so now it supports most common desktops. > > Now that xfce4-mount-plugin is available, I'm working on getting CD and > flash drive mounts working out-of-the-box for members of the operator group. > > It's almost there if the following steps are taken: > > 1) Install the following in sudoers.d/mounts: > > %operator ALL=(ALL) NOPASSWD: /sbin/mount /dev/cd0, /sbin/umount /dev/cd0, > /sbin/mount /media/cdrom0, /sbin/umount /media/cdrom0, /sbin/mount /dev/cd1, > /sbin/umount /dev/cd1, /sbin/mount /media/cdrom1, /sbin/umount > /media/cdrom1, /sbin/mount /dev/da0a, /sbin/umount /dev/da0a, /sbin/mount > /media/flash_ufs, /sbin/umount /media/flash_ufs, /sbin/mount /dev/da0s1, > /sbin/umount /dev/da0s1, /sbin/mount /media/flash_fat, /sbin/umount > /media/flash_fat, /sbin/mount /dev/da0s1, /sbin/umount /dev/da0s1, > /sbin/mount /media/flash_ntfs, /sbin/umount /media/flash_ntfs > > An alternative to sudo would be to change the ownership of the mount points > when a user logs in under XFCE and enable vfs.usermount. This avoids the > need for sudo, but limits mounting to users on the console, which is > probably OK. > > 2) Add the appropriate fstab entries > > 3) Configure xfce4-mount-plugin for each user. > > 4) Put the following in /usr/local/etc/gamin/gaminrc to that gam_server > doesn't prevent umounts: > > poll /media/cdrom0 > poll /media/cdrom1 > poll /media/flash_ufs > poll /media/flash_fat > poll /media/flash_ntfs > > I'd like to find a way to eliminate step 3, so that mounting just works for > all users in the operator group. > > From my investigation so far, I've found 2 possibilites: > > 1) Install an appropriate xfce4-mount-plugin-??.rc in > /usr/local/etc/xdg/xfce4/panel that adds sudo to the mount commands. This > file will probably be version-specific, so it will have to be regenerated > with every upgrade of the plugin. > > or > > 2) Patch the source files with the following: > > sed -i '' -e 's|"mount %d"|"sudo mount %d"|g' \ > -e 's|"umount %d"|"sudo umount %d"|g' \ > work/xfce4-mount-plugin-*/panel-plugin/mount-plugin.h > > The above only changes the default custom command, but does not affect the > built-in default if custom commands are not selected. I haven't figured out > how to fix this yet. User can modify mount and umount command, see preferences dialog. In order to, if usermount is set, user can use mount command without sudo. xfce4-mount-plugin reads mount points from /etc/fstab, it can't mount new devices. If you need plugin wich detects new devices like CDRom, USB stick, ...., i think you must use xfce4-genmon-plugin with your own shell script or sysutils/automounter. If you known C, you can also look to GIO (it's part of GLib) [1], there're functions for mount devices. [1] http://developer.gnome.org/gio/2.28/volume_mon.html > > I also added the following patch, although I'm still uncertain whether it's > a better default: > > sed -i '' -e \ > 's|on_mount_cmd = g_strdup("")|on_mount_cmd = g_strdup("thunar > %m") > work/xfce4-mount-plugin-*/panel-plugin/mount-plugin.c You can also use g_spawn_command_line_sync() function [2]. [2] http://developer.gnome.org/glib/2.28/glib-Spawning-Processes.html#g-spawn-command-line-sync > > Would you be amenable to changing the default behavior of the port to > eliminate the need for users to do manual configuration? If not, I'll do > some sort of workaround in desktop-installer. Before, report your patch upstream. > > Regards, > > -- > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > Jason W. Bacon > jwbacon@tds.net > http://personalpages.tds.net/~jwbacon > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > > > _______________________________________________ > freebsd-xfce@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-xfce > To unsubscribe, send any mail to "freebsd-xfce-unsubscribe@freebsd.org" -- olivier
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAHcdu2pMzaMzWggoNtBLK3L_-1W%2BDDVy_A9wDDrAU_GqYdUBvA>