2b948
![]() |
|
|
|
|
|||||||
| Other Window Managers XFCE, Fluxbox, Enlightenment, IceWM, WindowMaker, ION, etc. |
![]() |
|
|
Thread Tools | Display Modes |
|
#1
|
|||
|
|||
|
Hi
So I finally ditched Xfce 4.6 and decided to give Xfce 4.8 a skip to try something else instead. After playing with LXDE for a bit, I've ended up using standalone Openbox, tint2, and various other bits for my new desktop setup. I poked around for HAL-esque auto mounting setups, but they were all hacky or used amd(8) - not really ideal for hot plug storage devices. I've made a small auto mounting system that uses devd(8) and integrates with Openbox via its pipemenu system. Mountable filesystems are added to a "Mount" menu entry in my Openbox menu, and clicking an entry toggles between mounted and unmounted with popup message boxes to confirm success/failure. Filesystems are mounted to subdirectories below /media (or wherever you define), and are named in correspondence to their label if present, or their device name if not. Storage devices are probed to determine if a device is an MBR partition, BSD label, or raw disk device, and educated guesses are made to determine what is mountable. File systems are probed too, but currently only UFS and MSDOSFS are supported. Large MSDOSFS support still needs to be added too. The Openbox specific bit is also written to allow users to mix manual (via terminal) and auto mount/umounting of devices. When it comes time to call mount/umount, sudo is used, so you will need that installed and correctly configured for this to work. I think one could also use vfs.usermount too, but I haven't tested that yet. [2011-10-24] Defunct. See volman instead. [2011-05-23] Latest version: here Last edited by aragon; October 24th, 2011 at 20:12. |
| The Following 5 Users Say Thank You to aragon For This Useful Post: | ||
bigtoque (June 16th, 2011), Columbo0815 (July 25th, 2011), mousaka (August 14th, 2011), musucopo (February 4th, 2012), richardpl (June 20th, 2011) | ||
|
#2
|
|||
|
|||
|
My project's name is amount. At its core is a daemon logically named amountd. This daemon is a shell script that sets up an IPC channel with devd(8), listens for device attachment messages and attempts to discover mountable filesystems on newly attached devices.
When running, amountd creates a directory for itself at /tmp/.amountd, below which it maintains the text file mountable. This is simply a listing of file systems that amountd has discovered. As storage devices come and go, this file is updated with a listing of filesystems that are thought to be mountable, and some details about each file system. All other components of amount essentially serve as clients to amountd - bridges between amountd, your desktop environment, and mount/umount commands. The most basic of which is a script named amount, a small CLI client to let you use amountd via a terminal, and hopefully to serve as a prototype for future clients to be written by others. There is one more client currently included: obamount.sh. Written by me too for use with my window manager of choice, Openbox. I plan to include other clients into my distribution too, so feel free to make them public or send them my way. Last edited by aragon; August 6th, 2011 at 15:15. |
|
#3
|
|||
|
|||
|
I'm basically reciting my setup here. Feel free to experiment if you understand things. I'll formalise everything better later.
First you need to get xmountd starting in the background. Place it in ~/bin and make sure it's executable. Then add it to your X startup, in my case ~/.xsession. Here's what mine looks like: Code:
xset m 1 1 r rate 250 30 dpms 0 0 300 xmodmap \ -e "keycode 210 = XF86AudioLowerVolume" \ -e "keycode 209 = XF86AudioRaiseVolume" \ -e "keycode 219 = XF86AudioMute" \ -e "keycode 220 = XF86AudioPause" \ -e "keycode 207 = XF86AudioStop" \ -e "keycode 190 = XF86AudioPrev" \ -e "keycode 130 = XF86AudioNext" \ -e "keycode 191 = XF86Calculator" \ -e "keycode 132 = XF86Music" \ -e "keycode 113 = Multi_key" export CHARSET=UTF-8 nitrogen --restore & xcompmgr -c -C -f -t 1 -l 1 -r5 -o.55 -I 0.4 -O 0.4 -D 50 & ~/bin/xmountd & ssh-agent openbox-session Open ~/.config/openbox/menu.xml and locate your root-menu block. Add a Pipemenu element to it that executes obmount.sh. Here's how mine looks: Code:
<menu id="root-menu" label="Openbox 3">
<menu id="applications" label="Applications" execute="/usr/home/aragon/.config/openbox/dynmenu.pl"/>
<menu id="system-menu"/>
<menu id="mount" label="Mount" execute="/usr/home/aragon/.config/openbox/obmount.sh"/>
<separator/>
<item label="Log Out">
<action name="Exit">
<prompt>
yes
</prompt>
</action>
</item>
</menu>
Code:
$ ps ax |grep xmountd 33422 ?? I 0:00.02 /bin/sh /usr/home/aragon/bin/xmountd Now install security/sudo if it isn't already installed: # pkg_add -r sudoUse visudo to add an entry to sudoers that looks similar to mine: Code:
aragon ALL=(ALL) NOPASSWD: /usr/home/aragon/.config/openbox/obmount.sh Test that sudo works: Code:
$ sudo ~/.config/openbox/obmount.sh <openbox_pipe_menu> </openbox_pipe_menu> Finally, try plug a USB disk in and try mount/umount it via the Openbox menu. With the above setup, errors should be logged to ~/.xsession-errors in case you need to debug. Comments/contributions appreciated.
|
|
#4
|
|||
|
|||
|
Ah, geek pride at its best... here's a video of it in action:
http://www.youtube.com/watch?v=VI9koEAes3U |
|
#5
|
||||
|
||||
|
Just tried it out. It works nicely.
|
|
#6
|
|||
|
|||
|
Inspired by this, I wrote a PyQt based program that does roughly the same. It adds an icon to the system tray, notifies you when a device becomes available and has a context menu to mount / unmount devices.
It will only let you mount devices it knows about. An config entry look like: Code:
[msdosfs/foo] mount = sudo mount /media/foo umount = sudo umount /media/foo postmount = xdg-open /media/foo The config files are /usr/local/etc/mountagent.conf and $HOME/.mountagent.conf (both are read, entries in the later may overwrite entries in the former). Enjoy! Last edited by DutchDaemon; April 15th, 2011 at 23:45. |
|
#7
|
|||
|
|||
|
@aragon
Hi, it doesn't work for me. I checked everything, code, permissions,..it's all there but there's no entry in openbox "mount" menu. update: It seems that it works only with msdosfs, not with ufs. Tried with different gpart configurations, but it doesn't read it. Also, it can only mount a FS, not unmount it. I changed working dirs to ~/tmp and ~/mnt. Last edited by bbzz; April 27th, 2011 at 17:47. |
|
#8
|
|||
|
|||
|
I recommend checking for error output in ~/.xsession-errors. If that doesn't work, try call the obmount.sh script manually to inspect output, eg.:
$ obmount.sh umount da0s1a aragon(replace "aragon" with your username) |
|
#9
|
|||
|
|||
|
I'm not using xsession, but .xinitrc. Script is started nonetheless.
If I run Code:
.config/openbox/obmount.sh umount /dev/da0s1 bbzz Code:
</openbox_pipe_menu I changed paths to ~/media and ~/tmp where appropriate in scripts. I though maybe sudo is messing up with something so I tried without it, but it isn't. To make it work without sudo, there needs to be writing permission to /dev/msdosfs/ so there needs to be an entry in /etc/devfs.rules, something like this: Code:
add path "/dev/msdofs/*" mode 660 group operator Anyway, not sure what else to try. Last edited by DutchDaemon; April 29th, 2011 at 00:37. |
|
#10
|
|||
|
|||
|
More information is really needed. Disable xmountd from starting in .xinitrc and run it manually in an xterm so you can see its output. Inspect the /tmp/.xmountd/mountable file for volumes to appear/disappear as you insert/remove devices. Finally run the obmount.sh script without parameters to inspect the menu XML it generates. If you post all that info here I should be able to help better.
|
|
#11
|
|||
|
|||
|
After a restart, msdofs disk can now mount as well as umount. Don't ask. I didn't change anything.
Anyway, still can't mount ufs. Tried different gpart configurations. First only DD mode, no slices. Code:
# gpart show da0
=> 63 7843752 da0 MBR (3.7G)
63 7843752 1 freebsd (3.7G)
Code:
CREATE da0 Code:
<openbox_pipe_menu> </openbox_pipe_menu> So i tried with slices and labels. Code:
# gpart show da0s1
=> 0 7843752 da0s1 BSD (3.7G)
0 16 - free - (8.0K)
16 7843736 1 freebsd-ufs (3.7G)
Code:
CREATE da0 CREATE da0s1 CREATE da0s1 CREATE da0s1a CREATE da0s1c CREATE da0s1a CREATE da0s1a CREATE da0s1c CREATE da0s1a CREATE da0s1ca CREATE da0s1ca The rest of output is just like before. There's no item in openbox menu. Does that help any? So to recap, msdosfs works fine, but ufs doesn't at all. Another thing that would be cool for future is maybe adding support for writable ntfs via ntfs-3g. |
|
#12
|
||||
|
||||
|
Quote:
Quote:
Quote:
# dd if=/dev/da0 of=/tmp/parttable bs=1k count=128Gzip and attach here please. Quote:
|
|
#13
|
|||
|
|||
|
Yeah figured something doesn't look right there
![]() gpart was used to create da0s1a like this: Code:
gpart create -s mbr da0 gpart add -b 63 -t freebsd da0 gpart create -s bsd da0s1 gpart add -i 1 -b 16 -t freebsd-ufs da0s1 newfs da0s1a |
|
#14
|
|||
|
|||
|
I've had some time to do more work on this. Changes include:
Script file names have changed so I recommend deleting your old version completely to save you any confusion when installing this version. If you want to see log messages, please setup your syslog to catch user.* or tag "amountd", eg. /etc/syslog.conf Code:
user.* /var/log/user Code:
/var/log/user 644 3 100 * JC Everything else should work the same. An example of the command line utility in action: Code:
$ amount mount da0 msdosfs mount da1 msdosfs/SAMSD $ amount da0 mounting da0 msdosfs... success $ ls -l /media total 32 drwxr-xr-x 1 aragon wheel 32768 Jan 1 1980 da0/ $ amount umount da0 msdosfs mount da1 msdosfs/SAMSD $ amount da0 umounting da0 msdosfs... success $ ls -l /media total 0 Todo:
Last edited by aragon; May 22nd, 2011 at 23:29. |
|
#15
|
||||
|
||||
|
It should work to add -o large for ALL msdosfs mounts, it should not break anything I suppose.
Quote:
__________________
Religions, worst damnation of mankind. "FreeBSD has always been the operating system that GNU/Linux should have been." Frank Pohlmann, IBM http://vermaden.blogspot.com |
|
#16
|
|||
|
|||
|
Hi all:
I've made a custom hack of fabulous 'amount'. It runs fine in XFCE 4.8. NTFS support was added but not widely tested, but it seems to work fine. Thanks for the original 'amount', aragon. It's a great piece of code. Attached to this post my hack. |
| The Following User Says Thank You to jjjesss For This Useful Post: | ||
bigtoque (June 16th, 2011) | ||
|
#18
|
|||
|
|||
|
@jjjesss and @aragon,
Thanks for your scripts! @jjjess, A couple of things: First off, I added this line to my sudoers file Code:
bigtoque ALL=(ALL) NOPASSWD: /etc/amount/openthunar.sh Code:
%wheel ALL=(ALL) ALL Second, the command run from the launcher icon doesn't work for me. If I right-click on the icon, edit the launcher and tell it to run from the terminal, mounting and unmounting works just fine. Unfortunately, you need to edit the launcher every time you mount and unmount. Finally, (and I have no idea if this should or should not be part of the script), but when unmounting an iPod, I have to run the command camcontrol eject [device] to properly disconnect the iPod. I'm just curious if something like this could be added to the script.
Last edited by DutchDaemon; June 17th, 2011 at 00:58. |
|
#19
|
|||
|
|||
|
Are you saying that you don't get prompted for a password when it's run from a terminal? Can you provide more information on your WM/DE setup?
Quote:
When amount unmounts something, it unmounts the file system only. It doesn't try to "eject" or reset the hardware in any way. This means your device won't realise what's happening, but disconnecting it should be safe in terms of data integrity. |
|
#20
|
|||
|
|||
|
Quote:
I can see that my post wasn't worded that well. When I run the command from the launcher (without editing the launcher to open in a terminal), nothing happens (or at least I can't see anything happening). When I edit the launcher to open in a terminal (or just run the command from a terminal), I get asked for my password. After I enter my password, I get the output: Code:
Sorry, user bigtoque is not allowed to execute '/etc/amount/amount doCmd mount msdosfs /dev/msdosfs/FLASH /media/FLASH stefan' as root on bsd-toque. Mountdir = /media/FLASH Quote:
You're suggesting that as long as the iPod has been properly unmounted, it should be safe to just disconnect it? |
|
#21
|
|||
|
|||
|
Quote:
What is openthunar.sh? Yes, it is safe. You can add the eject command if you like, but one downside I can think of is that once you unmount, you will have to physically unplug and replug your ipod to mount it again. Last edited by DutchDaemon; June 17th, 2011 at 00:59. |
|
#22
|
|||
|
|||
|
Hi all:
My user belongs to 'wheel' group in my computer, so I put in the /usr/local/etc/sudoers: Code:
%wheel ALL=(ALL) NOPASSWD: /etc/amount/amount %wheel ALL=(ALL) NOPASSWD: /etc/amount/amountd %wheel ALL=(ALL) NOPASSWD: /etc/amount/openthunar.pl And the updatedesktop.pl is an absolutely dirty script, relying on things like whoami to guess the user who is clicking in the desktop icon but it's a matter of time (and hurry). Next thing I'd like to implement is mount/unmount sd cards from my MMC Card Reader (/dev/mmcsd). BR Last edited by DutchDaemon; June 17th, 2011 at 01:00. Reason: Proper formatting: http://forums.freebsd.org/showthread.php?t=8816 |
|
#23
|
|||
|
|||
|
Quote:
Everything seems to work just fine. |
|
#24
|
|||
|
|||
|
Added support for /dev/mmcsdXXXX devices (MMC Card Reader integrated in laptops). Included some notes about permissions and the sudoers file.
Last edited by DutchDaemon; June 17th, 2011 at 15:29. |
|
#25
|
|||
|
|||
|
aragon, one question: amountd intends to mount devices like /dev/adaxxx, for example, in my computer, /dev/ada0s3.journal. According to the code it seems only devices starting by da or in my hack mmcsd, so any ada device should be watched by amountd. So, why does this happen? I don't want amountd watch my computer partitions. How can be this arranged?
Thanks in advance. Last edited by DutchDaemon; June 18th, 2011 at 19:29. Reason: Proper formatting: http://forums.freebsd.org/showthread.php?t=8816 |
![]() |
| Tags |
| auto, devd, mount, openbox |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| fluxbox vs openbox | alie | Other Window Managers | 57 | June 7th, 2012 04:26 |
| [Solved] [Openbox] my openbox autostart wont work | manblue | Other Window Managers | 8 | March 30th, 2011 04:50 |
| Auto mounting again... | zeiz | GNOME | 30 | January 4th, 2011 13:03 |
| [Solved] [Openbox] No *.xml files for openbox | mefizto | Other Window Managers | 2 | August 7th, 2010 03:41 |
| [Openbox] [Help] OpenBox Configuration | azzura- | Other Window Managers | 7 | December 23rd, 2008 13:42 |