From owner-freebsd-xfce@FreeBSD.ORG Mon Mar 4 20:20:46 2013 Return-Path: Delivered-To: xfce@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 82119E6A for ; Mon, 4 Mar 2013 20:20:46 +0000 (UTC) (envelope-from duchateau.olivier@gmail.com) Received: from mail-lb0-f182.google.com (mail-lb0-f182.google.com [209.85.217.182]) by mx1.freebsd.org (Postfix) with ESMTP id 1679711DE for ; Mon, 4 Mar 2013 20:20:45 +0000 (UTC) Received: by mail-lb0-f182.google.com with SMTP id gg6so4288494lbb.13 for ; Mon, 04 Mar 2013 12:20:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:in-reply-to:references:date:message-id :subject:from:to:cc:content-type; bh=Y7mGKGB5fe/f+DMdiG+w2ETW9HW63fvocjs2g4CjRHM=; b=YM95UkoXdR7mOuqEhnM+joy/iZxEy41uHhwcLS9p/4QMht+qROVaLpndvgaztw7/TL mx3QTlLJXaJfw1/yDaHy3IxSsE9mqUAP7XX+9LHvjQuorccH2xImxv3xbnUmrfPP10/e fhvTFkkah7d2T2sFiPnpDTaFYwFS/r4I/ZItYlR4hmFzK0UPTm2E89GWnuL34OX/GojA VhYMc3n0ItPqcMz+CbozhTHTc9K+4NI+TXMtx3BNGY9cIfFMQaJ6FnQHGOCOl5PctwxI NuAKI1xXqjFWxcaR1KLoJtEivjDer1WWltlvmKs1Bxr5gthvZCsYqvMavWRM42pJ3xH/ n9pg== MIME-Version: 1.0 X-Received: by 10.112.16.79 with SMTP id e15mr5068233lbd.18.1362428444620; Mon, 04 Mar 2013 12:20:44 -0800 (PST) Received: by 10.152.120.33 with HTTP; Mon, 4 Mar 2013 12:20:44 -0800 (PST) In-Reply-To: <5134EE36.6060709@tds.net> References: <5134EE36.6060709@tds.net> Date: Mon, 4 Mar 2013 21:20:44 +0100 Message-ID: Subject: Re: xfce4-mount-plugin From: Olivier Duchateau To: Jason Bacon Content-Type: text/plain; charset=ISO-8859-1 Cc: xfce@freebsd.org X-BeenThere: freebsd-xfce@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: XFCE for FreeBSD -- porting and maintaining List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Mar 2013 20:20:46 -0000 2013/3/4 Jason Bacon : > > 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