23/09/2006
rox icons + ivman continued
I have made some significant improvements to the previous rox.panelput script I had posted . It can now handle most of the previous “problems”.
a) If the device has a Label then, the icon created has the Label name. If it doen’t it has the Device Name.
If you insert a DVD with label “TEST”…the icon will have the name TEST, if you insert your usb key or your digital camera the icon will have the name of the device.
b) It handles automatic positioning of the icons.
If you insert a DVD (device 1 – icon 1) and then your usb key (device 2 – icon 2), your usb key icon will be placed below the DVD icon. If you then insert your digital camera (device 3 – icon 3) it will be placed below the usbkey. If you then remove your usb key (device 2 – icon 2) there will be left an empty spot at “place 2” and upon the insertion of a new device, a cdrom for example that device will take “place 2” (device 4 – icon 2).
c) There is a Restore feature.
If you place rox.panelput Restore
inside your window manager startup file, for example fluxbox’s .fluxbox/startup, it will clean up any unused icons left on the desktop that were not ejected-removed during the previous shutdown of your window manager. Restore will NOT remove icons from your desktop that were not created by rox.panelput script. This feature is really critical because with the older script icons were left over during restarts, hogged up the desktop and had to be manually removed. Now they are removed “automagically”.
d)Locks and checks
Many locks and checks were implemented during each stage of addition or removal of a device. They might slow down the script a bit, but add a great deal of security.
The UPDATED version of rox.panelput lies here: rox.panelput v0.34
In order to use it read the previous post: create-icons-on-rox-desktop-of-automounted-media-by-ivman
(and of course gunzip the file and place it in your binaries folder)
The only change that needs to be done is that IF you want to use the restore feature (which I strongly urge you to do so) you have to put the command:
rox.panelput Restore
somewhere before your window manager starts. Here’s my .fluxbox/startup :
rm /tmp/rox-ivman-lock.tmp
/PATH/TO/rox.panelput Restore
killall -9 ivman ; ivman &
echo > /home/CHANGEME/.ivman/mounted/devices
rox -p pinboard
exec /usr/bin/fluxbox -log ~/.fluxbox/log
If you change the paths or files inside rox.panelput then it’s almost sure that you have to change these paths too.
Please report any problems and give me any possible feed back on this.
Filed by kargig at 00:52 under Linux
17 Comments | 8,718 views
Hey, I followed both of your HowTos… nice ones! it works nice for automounting the device, BUT it doesn’t puts the icon in Rox! I’m using Ubuntu installed using the alternate CD (so it’s basically a core CLI linux with X, Fluxbox and apps installed, no ubuntu stuff except for the repositories and the gnome libraries and stuff) and when I run rox.panelput (even with Restore, or with /media/MSCN) I get:
:/usr/bin$ rox.panelput Restore
NUMLINES = 1
[: 138: ==: unexpected operator
[: 138: ==: unexpected operator
[: 138: ==: unexpected operator
[: 156: ==: unexpected operator
[: 156: ==: unexpected operator
[: 164: ==: unexpected operator
What can I do? help would be greatly appreciated!
Updated rox.panelput: rox.panelput ver 0.32
just change your homedir and replace the old one. The format of the mounted devices has changed a bit…so you might need to del your old one first.
The same version of this script + ROX works quite OK (I think) under the iloog liveCD. You might want to give that a try to see if the setup looks like yours…
Please report any success or failures with this one….
Hi
I have followed the recipe, but I have one problem that I cannot get to work and that is that I don’t get ivman to call the rox.panelput Add
I mean if I punmount a usbstick then rox.panelput Remove is always run, but as the usb stick is put in the usb the rox.panelput Add is not called. I checked this by running another program at the beginning of rox.panelput and it is only run when punmount
Any ideas?
You can see what the ivman does by starting ivman -d –nofork. It should give you enough information about what is really going on when you plug in a usb device. This is the output I get when I plug in my usb stick. You can clearly see rox.panelput running at some point.
IvmConfig/IvmConfigCommon.c:168 (ivm_device_is_mountable) UDI /org/freedesktop/Hal/devices/volume_uuid_D4B4_A5D9 is device /dev/corsair
IvmConfig/IvmConfigCommon.c:323 (ivm_device_is_mountable) Device /dev/corsair appears to be mountable
manager.c:1014 (ivm_media_changed) Attempting to mount device /dev/corsair
manager.c:786 (ivm_run_command) Running: pmount '/dev/corsair'
manager.c:1064 (ivm_media_changed) Device /dev/corsair is mounted at /media/corsair
IvmConfig/IvmConfigCommon.c:168 (ivm_device_is_mountable) UDI /org/freedesktop/Hal/devices/volume_uuid_D4B4_A5D9 is device /dev/corsair
IvmConfig/IvmConfigCommon.c:323 (ivm_device_is_mountable) Device /dev/corsair appears to be mountable
manager.c:844 (ivm_is_dvd) Checking for video DVD in device '/dev/corsair' mounted at '/media/corsair'
manager.c:863 (ivm_is_dvd) /dev/corsair does not look like a video DVD
IvmConfig/IvmConfigCommon.c:168 (ivm_device_is_mountable) UDI /org/freedesktop/Hal/devices/volume_uuid_D4B4_A5D9 is device /dev/corsair
IvmConfig/IvmConfigCommon.c:323 (ivm_device_is_mountable) Device /dev/corsair appears to be mountable
hal_interface.c:164 (hal_device_property_modified) Mounted: /org/freedesktop/Hal/devices/volume_uuid_D4B4_A5D9
hal_interface.c:178 (hal_device_property_modified) Devices table has 1 entries
hal_interface.c:325 (print_device) "/org/freedesktop/Hal/devices/volume_uuid_D4B4_A5D9" "/dev/corsair"
IvmConfig/IvmConfigCommon.c:168 (ivm_device_is_mountable) UDI /org/freedesktop/Hal/devices/volume_uuid_D4B4_A5D9 is device /dev/corsair
IvmConfig/IvmConfigCommon.c:323 (ivm_device_is_mountable) Device /dev/corsair appears to be mountable
manager.c:786 (ivm_run_command) Running: /usr/bin/rox.panelput Add "/media/corsair" "CORSAIR"
hal_interface.c:48 (hal_device_added) New Device: /org/freedesktop/Hal/devices/volume_uuid_D4B4_A5D9_0
IvmConfig/IvmConfigCommon.c:168 (ivm_device_is_mountable) UDI /org/freedesktop/Hal/devices/volume_uuid_D4B4_A5D9_0 is device /dev/corsair
IvmConfig/IvmConfigCommon.c:323 (ivm_device_is_mountable) Device /dev/corsair appears to be mountable
manager.c:1014 (ivm_media_changed) Attempting to mount device /dev/corsair
manager.c:786 (ivm_run_command) Running: pmount '/dev/corsair'
Error: device /dev/corsair is already mounted to /media/corsair
NUMLINES = 1
We are adding a device
DEVICECOUNT = 0
spot = 1
THEPSI = 50
manager.c:1030 (ivm_media_changed) /org/freedesktop/Hal/devices/volume_uuid_D4B4_A5D9_0 wasn't mounted, by us or by others...
IvmConfig/IvmConfigCommon.c:168 (ivm_device_is_mountable) UDI /org/freedesktop/Hal/devices/volume_uuid_D4B4_A5D9_0 is device /dev/corsair
IvmConfig/IvmConfigCommon.c:323 (ivm_device_is_mountable) Device /dev/corsair appears to be mountable
Are you sure you have succesfully edited the .ivman/IvmConfigProperties.xml config file ?
The relevant part should look quite like this:
<ivm:Option name="checkOnInit" value="false" />
<ivm:Match name="*" value="true">
<ivm:Property name="hal.volume.is_mounted">
<ivm:Action value="true" exec='/usr/bin/rox.panelput Add "$hal.volume.mount_point$" "$hal.volume.label$"' />
</ivm:Property>
</ivm:Match>
I don’t understand why you are asking us to modify the $HOME variable in the script, or even why you have one, since there is an already existing HOME variable in the environment variables
The HOME variable in the script is indeed unnecessary if someone uses his real home path for it. I’ll correct it.
The scripts posted here are neither perfect nor optimized. They do work for me though, so I posted them. If anyone wants to correct/optimize them I’d be glad if he posted his work someplace and notified me by a comment here. That’s what the open source is all about..right ? 🙂
Hi,
I use Fluxbox+Rox and find the combo great. I’ve been also using ivman for mounting/unmounting my USB devices but to Eject them I have to be root and go to /media. This is a hassle and I feel your above method could provide the solution.
However, I DO NOT use Rox pinboard feature (I like to have a clean desktop) and only use Rox panel. I kwonder if the above will work in this case or which tweaking will be required for the purpose.
Any comments/suggestions will be most welcome. Thanks
Hector
If you don’t use rox pinboard I can’t think of any other place to have an “icon” to umount/eject your usb devices. What did you have in mind ? Where would you like to have a place to show the devices and be able to eject them if that place is not the “desktop” ?
Hi!
Thanks for the quick response. I see your point above, but currently my rox panel accepts an icon which shows an attention sign if no usb device is plugged in. This icon changes to the familiar blue folder with a green lighted circle when my pen drive is inserted and mounted. All this happens automatically via ivman. I have added text to be displayed under the icon (USBDiskPro, which is the id of my pen-drive).
The sole remaining problem, in my case, is the inconvenience of becoming root and navigating to /media to eject the device. If I can solve this, then the whole thing will work as I want. (I’m not concerned with device names, or icon position, etc.).
Moreover, right-clicking on the panel icon shows the usual rox menu AND includes an Eject option. Choosing this one yields an error message: “Device /dev/sda1 was not mounted by you, eject: unmount of `/media/sda1′ failed, eject failed”.
There’s also the option ‘Mount point USBDiskPro’ which shows Unmount in a sub-menu. Clicking on this one also shows an error message: “Unmounting
/media/sda1, umount: /media/sda1 is not in the fstab (and you are not root) Unmount failed.
Please excuse my questioning, but I am a newbie in Linux and still groping for several items/places to learn and improve my skills. Any ideas?
make sure your user belongs to the “plugdev” group to be able to eject the device properly.
Here’s my current eject script:
#!/bin/sh
rox.panelput Remove "$1";
echo "1=$1"
TOSCAN=`echo "$1" | sed -e 's/ /\\\\\\\40/g'`
TOUMOUNT=`grep "$TOSCAN" /proc/mounts | cut -d" " -f1`
echo "TOUMOUNT=$TOUMOUNT"
pumount "$TOUMOUNT"
eject.old -v -p "$TOUMOUNT"
You can download iloog liveCD to check how exactly my scripts work. Use it as an example for your pc 🙂
Hi.
Very nice work I think !
But I have a problem to make it run on Fluxbuntu. I think it’s a prob with ivman only. If I Try to run rox.panelput Add /media/U3 it answers :
wc: /home/myhome/.ivman/mounted/devices: No such file or directory
NUMLINES =
(simplified output there)
145 unexpected operator
145 same as above
145 same
163 same
163 same
171 same
I tried to reconfigure (dpkg-reconfigure ivman) but still not working.
What I did wrong ? Do you have an idea please ?
Thanks a lot for any answer.
Sincerely.
I’ve uploaded a new version (0.33) of the rox.panelput script. You will find the link on the post. I hope it works better now for you.
I am also in the process of rewriting the script from bash to python so that it becomes a bit more sane…
Hi.
I used the last release of your script and I have a new error.
I don’t have anymore the problem with .ivman/mounted/devices, but still have a :
152 unexpected operator
152 same
152 same
170 same
170 same
178 same
When I plug my USB key, I can open the media/mykey folder and browse it but there is nothing un the file .ivman/mounted/devices. It’s empty…I Think the problem is here…right ?
Best regards.
rox.panelput 0.34 posted after a suggestion by a reader.
Those of you that are getting the unexpected errors need to make one change to the rox.panelput script.
Change the first line from:
#!/bin/sh
to
#!/bin/bash
This script uses bash-specific features that are NOT compliant with generic ‘sh’. Ubuntu has changed (a while back if I remember correctly) to using dash as it’s default shell. So, this should fix your issues.
Hi,
I’m using fluxbuntu with rox and ivman and found another solution for my USB sticks after playing around.
First there is a fluxbuntu(?) bug requiring us to do mkdir ~/.ivman if it doesn’t exist. Otherwise it woun’t mount correctly.
Secondly I needed to change the unmount command from ‘umount’ to ‘pumount’ (in rox options-ActionWindow)
Third I edited /etc/ivman/IvmConfigActions.xml :
I haven’t compared fbroxautomount in detail with your rox.panelput, but I assume they do more or less the same things.
Anyone knows any drawback with this fix? (except for removal at unplugg rather than unmount)
In my above post, the xml code was unfortunately filtered out. Not sure how to do this but I’ll make a new try, removing all chevrons:
ivm:Match name=”ivm.mountable” value=”true”
ivm:Option name=”mount” value=”true”
Add the following line, which will remove the icon when you unplugg the device:
ivm:Option name=”execun” value=”fbroxautomount Remove $hal.volume.mount_point$”
ivm:Match
Note: You need to edit the file as sudo.