Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
automount add icons desktop dynamically ivman+rox [SOLVED]
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Desktop Environments
View previous topic :: View next topic  
Author Message
gnychis
Veteran
Veteran


Joined: 23 Mar 2005
Posts: 1004
Location: Pittsburgh, PA

PostPosted: Wed Mar 15, 2006 6:26 am    Post subject: automount add icons desktop dynamically ivman+rox [SOLVED] Reply with quote

Hi,

ivman seems to have broken on me... it used to work perfectly but now it doesn't seem to run actions when a device is inserted... i don't know if this was from a udev, hal, or ivman update

For instance, in my local user .ivman/IvmConfigProperties.xml I have:
Code:

    <ivm:Match name="hal.block.device" value="/dev/sd_card">
        <ivm:Property name="hal.volume.is_mounted">
            <ivm:Action value="true" exec="rox.add /mnt/sdcard 20 370 SD_Card" />
            <ivm:Action value="false" exec="rox.rem /mnt/sdcard SD_Card" />
        </ivm:Property>
    </ivm:Match>


Which should add an icon to my desktop... this used to work

ivman still sees the card being inserted...
Code:

hal_interface.c:47 (hal_device_added) New Device: /org/freedesktop/Hal/devices/volume_uuid_1406_2A4F
IvmConfig/IvmConfigCommon.c:152 (ivm_device_is_mountable) UDI /org/freedesktop/Hal/devices/volume_uuid_1406_2A4F is device /dev/sdc1
IvmConfig/IvmConfigCommon.c:292 (ivm_device_is_mountable) Device /dev/sdc1 appears to be mountable
manager.c:977 (ivm_media_changed) Giving other programs a chance to mount...
manager.c:988 (ivm_media_changed) Attempting to mount device /dev/sdc1
manager.c:768 (ivm_run_command) Running: pmount -u 007 '/dev/sdc1' '1GB CF'
Warning: device /dev/sd_card is already handled by /etc/fstab, supplied label is ignored
manager.c:1004 (ivm_media_changed) /org/freedesktop/Hal/devices/volume_uuid_1406_2A4F wasn't mounted, by us or by others...
IvmConfig/IvmConfigCommon.c:152 (ivm_device_is_mountable) UDI /org/freedesktop/Hal/devices/volume_uuid_1406_2A4F is device /dev/sdc1
IvmConfig/IvmConfigCommon.c:292 (ivm_device_is_mountable) Device /dev/sdc1 appears to be mountable


and mounts it according to my /etc/fstab...
Code:

/dev/sd_card  /mnt/sdcard       vfat        noauto,users                0 0


So now the card is mounted... however the user ivman will not add anything to my desktop! I even tried switching:
<ivm:Match name="hal.block.device" value="/dev/sd_card">
to
<ivm:Match name="hal.block.device" value="/dev/sdc1">

still nothing... I also have an entry to add an icon on inserting a cd-rom that also used to work perfectly. I get the feeling that maybe name="hal.block.device" has changed or something, but i don't know how to find out

Any help or suggestions would be greatly appreciated.

Thanks!
George


Last edited by gnychis on Fri Jun 02, 2006 5:39 pm; edited 1 time in total
Back to top
View user's profile Send private message
JeliJami
Veteran
Veteran


Joined: 17 Jan 2006
Posts: 1086
Location: Belgium

PostPosted: Wed Mar 15, 2006 12:55 pm    Post subject: Re: my ivman rules broke, won't do actions on mounts Reply with quote

gnychis wrote:
I get the feeling that maybe name="hal.block.device" has changed or something, but i don't know how to find out


Code:
$ lshal

will show you the hal properties of your device

i'm sorry i can't help more than this
i have a problem of my own with ivman running as a regular user: http://forums.gentoo.org/viewtopic-t-443440-highlight-.html
_________________
Unanswered Post Initiative | Search | FAQ
Former username: davjel
Back to top
View user's profile Send private message
gnychis
Veteran
Veteran


Joined: 23 Mar 2005
Posts: 1004
Location: Pittsburgh, PA

PostPosted: Wed Mar 15, 2006 7:27 pm    Post subject: Reply with quote

that still seems to exist:
Code:

gnychis@monster ~ $ lshal | grep block.device
998:  block.device = '/dev/sdc'  (string)
1030:  block.device = '/dev/sdc1'  (string)
1075:  block.device = '/dev/sdd'  (string)
1120:  block.device = '/dev/sde'  (string)
1152:  block.device = '/dev/sde1'  (string)
1197:  block.device = '/dev/sdf'  (string)
1827:  block.device = '/dev/hda'  (string)
1869:  block.device = '/dev/hdc'  (string)
1901:  block.device = '/dev/hdc1'  (string)
1933:  block.device = '/dev/hdc2'  (string)
1975:  block.device = '/dev/hdd'  (string)
2007:  block.device = '/dev/hdd1'  (string)
2088:  block.device = '/dev/sda'  (string)
2120:  block.device = '/dev/sda1'  (string)
2149:  block.device = '/dev/sda2'  (string)
2178:  block.device = '/dev/sda3'  (string)
2235:  block.device = '/dev/sdb'  (string)
2264:  block.device = '/dev/sdb1'  (string)
2293:  block.device = '/dev/sdb2'  (string)
2322:  block.device = '/dev/sdb3'  (string)


ivman has the biggest lack of support ever... no mailing list, a dead irc channel...
Back to top
View user's profile Send private message
JeliJami
Veteran
Veteran


Joined: 17 Jan 2006
Posts: 1086
Location: Belgium

PostPosted: Thu Mar 16, 2006 1:38 pm    Post subject: Reply with quote

Quote:
Code:
manager.c:988 (ivm_media_changed) Attempting to mount device /dev/sdc1
manager.c:768 (ivm_run_command) Running: pmount -u 007 '/dev/sdc1' '1GB CF'
Warning: device /dev/sd_card is already handled by /etc/fstab, supplied label is ignored


what happens if you remove that line from /etc/fstab?
_________________
Unanswered Post Initiative | Search | FAQ
Former username: davjel
Back to top
View user's profile Send private message
gnychis
Veteran
Veteran


Joined: 23 Mar 2005
Posts: 1004
Location: Pittsburgh, PA

PostPosted: Sun Apr 02, 2006 5:18 pm    Post subject: Reply with quote

woops, i thought i replied to this post... it never mounts if i remove that line
_________________
<---- me and Richard Stallman :)
Back to top
View user's profile Send private message
TeMy4uH
n00b
n00b


Joined: 24 Mar 2006
Posts: 9

PostPosted: Wed May 31, 2006 1:39 pm    Post subject: Reply with quote

Well, my actions dont work too. I tried to do smth. like that:
Code:

    <ivm:Match name="*">
        <ivm:Option name="exec" value="/usr/bin/aplay /usr/share/sounds/gaim/arrive.wav" />
        <ivm:Option name="execun" value="/usr/bin/aplay /usr/share/sounds/gaim/leave.wav" />
    </ivm:Match>

But it dont works...Do I need to run ivman as a user to run this actions? Because I run ivman with /etc/init.d/ivman start.
Back to top
View user's profile Send private message
gnychis
Veteran
Veteran


Joined: 23 Mar 2005
Posts: 1004
Location: Pittsburgh, PA

PostPosted: Wed May 31, 2006 4:12 pm    Post subject: Reply with quote

that all depends where the config file is... /etc/init.d/ivman start reads the root configs in /etc/ivman

if you login as user and run "ivman" it will read the ~/.ivman configs

So it all depends where your actions are.

Unofrtunately ivman seems to have absolutely *no* support at all... and i truly wish i could find out what broke the actions
_________________
<---- me and Richard Stallman :)
Back to top
View user's profile Send private message
TeMy4uH
n00b
n00b


Joined: 24 Mar 2006
Posts: 9

PostPosted: Wed May 31, 2006 7:56 pm    Post subject: Reply with quote

I tried both ways and it didnt work...ivman mount the devices there is no problem, but this custom actions just dont want to act...
Back to top
View user's profile Send private message
gnychis
Veteran
Veteran


Joined: 23 Mar 2005
Posts: 1004
Location: Pittsburgh, PA

PostPosted: Wed May 31, 2006 11:40 pm    Post subject: Reply with quote

yeah, none of my actions work either, its probably nothing wrong with your configuration files. I e-mailed the devel about it and havn't heard anything back yet. In the mean time i'll try rolling back versions until i find a working version with actions.
_________________
<---- me and Richard Stallman :)
Back to top
View user's profile Send private message
rohan28
Tux's lil' helper
Tux's lil' helper


Joined: 12 Dec 2004
Posts: 84
Location: Australia

PostPosted: Thu Jun 01, 2006 12:01 am    Post subject: Reply with quote

It works for me with version 0.6.12. It should also work with 0.6.11 (latest in portage).

Some things which may be helpful:

You MUST use the exact block device appearing in 'lshal', not any symlinks - /dev/sd_card will not work.

You do not need to restart Ivman for changes in the config files to take effect (except IvmConfigBase.xml).

Here is the output of 'lshal --monitor' when I attach a USB card reader (with a card inserted):
Code:

usb_device_7c4_a603_0000064037 added
usb_device_7c4_a603_0000064037_if0 added
usb_device_7c4_a603_0000064037_if0_scsi_host added
usb_device_7c4_a603_0000064037_usbraw added
usb_device_7c4_a603_0000064037_if0_scsi_host_scsi_device_lun0 added
storage_serial_Generic_STORAGE_DEVICE_0000064037 added
volume_uuid_6336_3832 added
volume_uuid_6336_3832 property volume.mount_point = '/media/sda1'
volume_uuid_6336_3832 property volume.is_mounted = true

If you do not see something similar, then please say so. Of course, please state your HAL and Ivman versions too.

Here is an example of rules in ~/.ivman/IvmConfigProperties.xml which work correctly:
Code:

    <ivm:Match name="hal.block.device" value="/dev/sda1">
        <ivm:Property name="hal.volume.is_mounted">
            <ivm:Action value="true" exec="echo 'ivman: sda1 mounted' >> /home/rohan/.ivmantest" />
            <ivm:Action value="false" exec="echo 'ivman: sda1 unmounted' >> /home/rohan/.ivmantest" />
        </ivm:Property>
    </ivm:Match>


The reason for the lack of support is quite simple: providing support for free and rarely receiving thanks is not rewarding at all, and I have other things to do which I deem more important and which require much more time and effort.
Back to top
View user's profile Send private message
gnychis
Veteran
Veteran


Joined: 23 Mar 2005
Posts: 1004
Location: Pittsburgh, PA

PostPosted: Thu Jun 01, 2006 12:06 am    Post subject: Reply with quote

thanks for the response rohan!

At one time, it did work with sym links, because /dev/sd_card for example used to trigger actions for me. So i'm not sure what exactly changed to no longer support that.

But I will try using the exact block device appearing in lshal and see what happens and post back

Thanks!
George
_________________
<---- me and Richard Stallman :)
Back to top
View user's profile Send private message
pussi
l33t
l33t


Joined: 08 May 2004
Posts: 727
Location: Finland

PostPosted: Thu Jun 01, 2006 6:24 am    Post subject: Reply with quote

Have you tried revdep-rebuild?

ivman mounting broke for me some time ago and the actual problem appeared to be broken pmount.
Back to top
View user's profile Send private message
gnychis
Veteran
Veteran


Joined: 23 Mar 2005
Posts: 1004
Location: Pittsburgh, PA

PostPosted: Thu Jun 01, 2006 12:53 pm    Post subject: Reply with quote

Okay, i got it to do an action by using /dev/sdf1 instead of /dev/sd_card ... but this strays away from the whole point of udev and symlinks

I really think there should be support for linking, or else i cannot truly create actions for specific devices.

I'd be willing to help in the coding if you're busy, if you could just give me some pointers.

Thanks for your help

- George
_________________
<---- me and Richard Stallman :)
Back to top
View user's profile Send private message
rohan28
Tux's lil' helper
Tux's lil' helper


Joined: 12 Dec 2004
Posts: 84
Location: Australia

PostPosted: Thu Jun 01, 2006 1:47 pm    Post subject: Reply with quote

The problem is that HAL knows nothing about any symlinks to devices (i.e., they don't appear in output of 'lshal' command). At the moment, Ivman only sees what HAL sees, and I'd prefer to keep it that way.

If you really wanted to let Ivman treat symlinks to devices exactly the same as the devices themselves, I can think of a fairly simple approach. When parsing the rules, whenever a rule referencing hal.block.device is found, simply use readlink (man 2 readlink) to find the real device node, and store that instead of the symlink. I don't really like it, though - it would be better for HAL to provide more information than to have to use special case code to obtain that information in Ivman.

Also, I believe you are wrong when you say you cannot create actions for specific devices without support for symlinks. Remember, you can match for absolutely any HAL property in an Ivman rule. I am sure you can find certain properties in the output of 'lshal' which are unique for each of your devices. In fact, you can get much more fine grained detection of different devices this way than simply using symlinks (e.g., you can invoke programs for CDs with a specific volume label, even if all CDs inserted use the same /dev/cdrom symlink).
Back to top
View user's profile Send private message
gnychis
Veteran
Veteran


Joined: 23 Mar 2005
Posts: 1004
Location: Pittsburgh, PA

PostPosted: Thu Jun 01, 2006 2:17 pm    Post subject: Reply with quote

Ahhhh okay, i understand now

In that case, i found a nice way of doing it... but i can't get it to execute the value=false part

i can also go by volume.mount_point since lshal shows this:
Code:

volume_part1_size_129744384 added
volume_part1_size_129744384 property volume.mount_point = '/mnt/sdcard'
volume_part1_size_129744384 property volume.is_mounted = true


Therefore i just made this property:
Code:

    <ivm:Match name="hal.volume.mount_point" value="/mnt/sdcard">
        <ivm:Property name="hal.volume.is_mounted">
            <ivm:Action value="true" exec="rox.add /mnt/flashdrive 20 160 Flash_Drive" />
            <ivm:Action value="false" exec="rox.rem /mnt/flashdrive Flash_Drive" />
        </ivm:Property>
    </ivm:Match>


works perfectly when i insert the device, it adds the icon to my desktop

However, when i do umount /mnt/sdcard, it doesn't execute the action value=false ... rox.rem command

What do i need to do so it executes this command when i unmount ?
_________________
<---- me and Richard Stallman :)
Back to top
View user's profile Send private message
gnychis
Veteran
Veteran


Joined: 23 Mar 2005
Posts: 1004
Location: Pittsburgh, PA

PostPosted: Thu Jun 01, 2006 2:54 pm    Post subject: Reply with quote

I guess this problem comes because of the lshal output:
Code:

volume_uuid_6024_F0E8 property volume.mount_point = ''
volume_uuid_6024_F0E8 property volume.is_mounted = false


mount point is blank when you unmount something... so how can i properly associate these two?

how do i properly do the readlink thing you were suggesting? I understand that readlink will give me the device name, but i'm not sure how to properly do this with ivman and xml
_________________
<---- me and Richard Stallman :)
Back to top
View user's profile Send private message
TeMy4uH
n00b
n00b


Joined: 24 Mar 2006
Posts: 9

PostPosted: Thu Jun 01, 2006 10:20 pm    Post subject: Reply with quote

Quote:
What do i need to do so it executes this command when i unmount ?

I think its "execun"
Back to top
View user's profile Send private message
gnychis
Veteran
Veteran


Joined: 23 Mar 2005
Posts: 1004
Location: Pittsburgh, PA

PostPosted: Thu Jun 01, 2006 10:37 pm    Post subject: Reply with quote

but how does it know what to exec?
_________________
<---- me and Richard Stallman :)
Back to top
View user's profile Send private message
rohan28
Tux's lil' helper
Tux's lil' helper


Joined: 12 Dec 2004
Posts: 84
Location: Australia

PostPosted: Fri Jun 02, 2006 1:07 am    Post subject: Reply with quote

You can't do readlink with the current config system; what I meant is that you could actually program that feature in Ivman itself (using the C 'readlink' function call, not the '/bin/readlink' command).

It would seem to me that the easiest solution is to simply use some other HAL property which doesn't disappear when the volume is unmounted. volume.uuid comes to mind. However, if you use lots of different devices which mount at /mnt/sdcard and you want some rules which work for all of them, I think you'll have to go with something a bit more complex.

Consider this, in IvmConfigProperties.xml:

Code:

    <ivm:Match name="hal.volume.mount_point" value="/mnt/sdcard">
        <ivm:Property name="hal.volume.is_mounted">
            <ivm:Action value="true" exec="rox.add /mnt/flashdrive 20 160 Flash_Drive &amp;&amp; echo $hal.volume.uuid$ > ~/.rox_icon" />
        </ivm:Property>
    </ivm:Match>
    <ivm:Match name="*">
        <ivm:Property name="hal.volume.is_mounted">
            <ivm:Action value="false" exec="cat ~/.rox_icon | grep $hal.volume.uuid$ &amp;&amp; rox.rem /mnt/flashdrive Flash_Drive &amp;&amp; rm -f ~/.rox_icon" />
        </ivm:Property>
    </ivm:Match>


Within the first 'match' is a rule which will add the icon (exactly as you've already written) and then record the volume UUID of the volume which the icon applies to.
The rule in the second 'match' will execute every time a volume is unmounted, but "cat ~/.rox_icon | grep $hal.volume.uuid$" will only return true if the volume unmounted is the one which the rox icon applies to, and hence the icon removal command will only execute in this case.

I haven't tested this, but it looks good to me.
Back to top
View user's profile Send private message
gnychis
Veteran
Veteran


Joined: 23 Mar 2005
Posts: 1004
Location: Pittsburgh, PA

PostPosted: Fri Jun 02, 2006 5:37 pm    Post subject: Reply with quote

very helpful response rohan, thank you very much

but I see one problem with it... that would only allow a single thing to be mounted at a given time, or else you would be removing the file when you unmount 1 device, but if a mounted device still existed, it would not have that file anymore

So heres what I came up with ... every time you mount, create information in a file based on the volume name, then when you unmount, search through all the files and remove the icon based on what is in the file. I also coded it to work properly with volume ID's that include spaces

This works flawlessly for me and emulates Nautilus ... i even have it dynamically placing icons based on how many are already on your desktop, the only thing i hard code is the column ... i also do not have a solution to knowing when to put things in a new column without dynamically reading the desktop size somewhere, but i'm not worrying about that

The only other thing i have no solution for is mounting volumes with no name... no file can be created, an obvious solution would be to create an Unknown file and append a number, and just label it Unknown, but i don't have this problem, if i get bored i'll do this some day

It works for all types of media... cdroms... flash drives... ipods...

enjoy

- George

*NOTE YOU MUST CREATE ~/.ivman/mounted YOURSELF BEFORE ANY OF THIS WILL WORK *

/bin/rox.add
Code:

#!/bin/bash
numfiles=$(ls ~/.ivman/mounted/ | wc | awk -F" " '{print $1}')
offset=$(echo "($numfiles*100)+210" | bc -l)

echo $numfiles $offset

rox --RPC << EOF
<?xml version="1.0"?>
<env:Envelope xmlns:env="http://www.w3.org/2001/12/soap-envelope">
 <env:Body xmlns="http://rox.sourceforge.net/SOAP/ROX-Filer">
  <PinboardAdd>
   <Path>$1</Path>
   <X>20</X>
   <Y>$offset</Y>
   <Label>$2</Label>
  </PinboardAdd>
 </env:Body>
</env:Envelope>
EOF


/bin/rox.rem
Code:

#!/bin/bash
path=$(tail -n 1 "$1")
label=$(basename "$1")

rox --RPC << EOF
<?xml version="1.0"?>
<env:Envelope xmlns:env="http://www.w3.org/2001/12/soap-envelope">
 <env:Body xmlns="http://rox.sourceforge.net/SOAP/ROX-Filer">
  <PinboardRemove>
   <Path>$path</Path>
   <Label>$label</Label>
  </PinboardRemove>
 </env:Body>
</env:Envelope>
EOF


~/.ivman/IvmConfigProperties.xml
Code:

...
.....

    <ivm:Match name="*">
        <ivm:Property name="hal.volume.is_mounted">
            <ivm:Action value="true" exec="rox.add $hal.volume.mount_point$ &quot;$hal.volume.label$&quot;;echo $hal.volume.uuid$ >> ~/.ivman/mounted/&quot;$hal.volume.label$&quot; &amp;&amp; echo $hal.volume.mount_point$ >> ~/.ivman/mounted/&quot;$hal.volume.label$&quot;" />
            <ivm:Action value="false" exec="for FILE in ~/.ivman/mounted/*; do grep $hal.volume.uuid$ &quot;$FILE&quot; &amp;&amp; touch /tmp/found &amp;&amp; rox.rem &quot;$FILE&quot; &amp;&amp; rm -f &quot;$FILE&quot;; done" />
         </ivm:Property>
    </ivm:Match>
...
.....

_________________
<---- me and Richard Stallman :)
Back to top
View user's profile Send private message
gnychis
Veteran
Veteran


Joined: 23 Mar 2005
Posts: 1004
Location: Pittsburgh, PA

PostPosted: Mon Jun 05, 2006 1:49 am    Post subject: Reply with quote

so it was brought to my attention that i could get overlapping icons and wasted space with my current implementation. For instance, if you insert card1 then card2, you have two icons, but if you remove card1 and plug it back in, it will goto the same place as card2.

Therefore I created a file which maps icons on the desktop and if you remove media it marks the spot on the desktop as blank and the highest blank spot is where the next icon will be placed.

Anyways here it is:

/bin/rox.add
Code:

#!/bin/bash
echo before
location=$(rox.place $2)
echo after location: $location
offset=$(echo "($location*100)+210" | bc -l)

rox --RPC << EOF
<?xml version="1.0"?>
<env:Envelope xmlns:env="http://www.w3.org/2001/12/soap-envelope">
 <env:Body xmlns="http://rox.sourceforge.net/SOAP/ROX-Filer">
  <PinboardAdd>
   <Path>$1</Path>
   <X>20</X>
   <Y>$offset</Y>
   <Label>$2</Label>
  </PinboardAdd>
 </env:Body>
</env:Envelope>
EOF


/bin/rox.rem
Code:

#!/bin/bash
tmp_file=/tmp/rox-tmp

rm -f $tmp_file
touch $tmp_file

path=$(tail -n 1 "$1")
label=$(basename "$1")

spot=$(grep "$label" ~/.ivman/mounted/.locations -n | awk '{ print substr($0, 1, 1) }')
lines=$(cat ~/.ivman/mounted/.locations | wc -l)

head -n $((spot-1)) ~/.ivman/mounted/.locations >> $tmp_file
echo >> $tmp_file
tail -n $((lines-spot)) ~/.ivman/mounted/.locations >> $tmp_file
mv $tmp_file ~/.ivman/mounted/.locations

rox --RPC << EOF
<?xml version="1.0"?>
<env:Envelope xmlns:env="http://www.w3.org/2001/12/soap-envelope">
 <env:Body xmlns="http://rox.sourceforge.net/SOAP/ROX-Filer">
  <PinboardRemove>
   <Path>$path</Path>
   <Label>$label</Label>
  </PinboardRemove>
 </env:Body>
</env:Envelope>
EOF


/bin/rox.place
Code:

#!/bin/bash
tmp_file=/tmp/rox-tmp

rm -f /tmp/rox-tmp
touch /tmp/rox-tmp
touch ~/.ivman/mounted/.locations

num_locations=$(cat ~/.ivman/mounted/.locations | wc -l)
num_icons=$(ls ~/.ivman/mounted/ | wc | awk -F" " '{print $1}')
let num_icons-=1

if [ $num_icons -lt $num_locations ]; then
   spot=$(grep ^$ ~/.ivman/mounted/.locations -n -m 1 | awk '{ print substr($0, 1, 1) }')
   head -n $((spot-1)) ~/.ivman/mounted/.locations >> $tmp_file
   echo $@ >> $tmp_file
   tail -n $((num_locations-spot)) ~/.ivman/mounted/.locations >> $tmp_file
   mv $tmp_file ~/.ivman/mounted/.locations
   echo $((spot-1))
else
   echo $@ >> ~/.ivman/mounted/.locations
   echo $((num_locations))
fi


- George
_________________
<---- me and Richard Stallman :)
Back to top
View user's profile Send private message
Zentoo
Apprentice
Apprentice


Joined: 18 Nov 2002
Posts: 171
Location: /dev/console

PostPosted: Tue Oct 31, 2006 4:22 pm    Post subject: Reply with quote

I use your scripts on my desktop and that's work almost perfectly here on a ~amd64 system.

I get this thread reference from your email from the Rox User ML.

So thanks really for this stuff that is really usefull.

Think to us, users of your scripts if you update your scripts in the future.
_________________
Kernel 3.14.6| Gcc 4.8.3 | Glibc 2.19
Core i7 990x @ 4.0GHz | X58 | 12Gb
ACCEPT_KEYWORDS="~amd64"
CFLAGS="-march=native -O2 -pipe"
Back to top
View user's profile Send private message
skualito
n00b
n00b


Joined: 14 Feb 2007
Posts: 1

PostPosted: Wed Feb 14, 2007 11:26 pm    Post subject: thanks for the tips Reply with quote

Hi gnychis,

your scripts work great, thanks.
Back to top
View user's profile Send private message
broken_chaos
Guru
Guru


Joined: 18 Jan 2006
Posts: 370
Location: Ontario, Canada

PostPosted: Sat Jul 21, 2007 8:54 am    Post subject: Reply with quote

I fixed up some of the (ivman only) parts of this to allow for mounting things without a volume label (since my SD card reader doesn't show volume labels for some reason...). The rox shell scripts are great, though (so use them with these modifications to ivman configs for non-labeled volumes as well).

First, your IvmConfigBase.xml, this should be your mountcommand/umountcommand lines:
Code:
<ivm:Option name="mountcommand" value="pmount -A $hal.block.device$ $hal.volume.label$" />
<ivm:Option name="umountcommand" value="pumount $hal.block.device$" />

The change here is simply not putting quotes around the variables - they don't need them and without the quotes pmount behaves as if no volume label is defined, when the volume label is empty. Problem one, solved!

Next the modifications to IvmConfigProperties.xml, this should be the entire section, replacing what was posted above:
Code:
<ivm:Match name="*">
<ivm:Property name="hal.volume.is_mounted">
<ivm:Action value="true" exec="rox.add $hal.volume.mount_point$ &quot;$(echo $hal.volume.mount_point$ | sed -e 's|/media/||')&quot;;echo &quot;$hal.volume.mount_point$&quot; >> ~/.ivman/mounted/&quot;$(echo $hal.volume.mount_point$ | sed -e 's|/media/||')&quot; &amp;&amp; echo $hal.volume.mount_point$ >> ~/.ivman/mounted/&quot;$(echo $hal.volume.mount_point$ | sed -e 's|/media/||')&quot;" />
<ivm:Action value="false" exec="for FILE in ~/.ivman/mounted/*; do grep &quot;$hal.volume.mount_point$&quot; &quot;$FILE&quot; &amp;&amp; touch /tmp/found &amp;&amp; rox.rem &quot;$FILE&quot; &amp;&amp; rm -f &quot;$FILE&quot;; done" />
</ivm:Property>
</ivm:Match>

The change here is using the *mount point* as the name and thing to search for instead of uuid and volume label (as my SD card reader was reporting empty volume uuids too....). All this needs is a device to mount, pmount to mount it, and a mountpoint that it's mounted *at* - no labels, uuids, etc. are required. Labels work, but aren't needed.

This mounts all labeled partitions to /media/LABEL (i.e. /media/backup), showing up as LABEL (i.e. backup) on the desktop, and all unlabeled devices are mounted as /media/NODE (i.e. /media/mmcblk0p1), showing up as NODE (i.e. mmcblk0p1) on the desktop. I tested this as much as I could (SD cards, thumbdrive, and external USB hard drive) and it worked in all cases, as I described.

One other, slightly offtopic, but noteworthy thing is that if your external USB disks aren't automounting, create the following file:
/etc/hal/fdi/policy/mountpolicies.fdi:
<?xml version="1.0" encoding="ISO-8859-1"?>
<!-- -*- SGML -*- -->
<deviceinfo version="0.2">
<device>
<match key="info.category" string="storage">
<match key="storage.hotpluggable" bool="true">
<merge key="storage.policy.should_mount" type="bool">true</merge>
</match>
</match>
</device>
</deviceinfo>

This file will tell HAL to mark these as 'mount these!' for ivman.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Desktop Environments All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum