LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Ivman documentation or help for configs?? (need more than man pages) (https://www.linuxquestions.org/questions/linux-software-2/ivman-documentation-or-help-for-configs-need-more-than-man-pages-700820/)

tl3462 01-29-2009 10:19 AM

Ivman documentation or help for configs?? (need more than man pages)
 
I'd appreciate any pointers to documentation that isn't the man pages, but more specifically I'm looking for what options I have available to me to use in the XML configuration files.

I want to add a few rules to IvmConfigConditions.xml. My naive approach was...

Code:

<?xml version="1.0" encoding="UTF-8"?>
<ivm:ConditionsConfig version="0.1" xmlns:ivm="http://www.eikke.com/ivm">

    <ivm:Match name="ivm.mountable" value="true">
              <ivm:Condition name="hal_device_removed" exec="echo foo" />
              <ivm:Condition name="hal_device_added" exec="echo bah" />
        </ivm:Match>

</ivm:ConditionsConfig>

... but this seems to have no effect. Any ideas?!

David the H. 01-29-2009 04:05 PM

Umm, just where is it supposed to echo the line to? All you have is a raw echo command there. The ivman exec line is not a shell interpreter, it's just a launcher.

What you need to do is create a shell script with the commands you want to run and execute that. Even then, you can't simply use "echo"; it would only run as a background process and be invisible to the user. You need to have it spawn some kind of output window first.

If all you want is to have some kind of "info window" appear when the action occurs, you can use something like xdialog (generic xwindows), kdialog (kde), or zenity (gtk/gnome) to create a pop-up gui window for your text.

tl3462 01-30-2009 04:02 AM

Ah, okay - good point!

Do you know if the Condition names I've used are valid names? I've just guessed the ones I've used above (using the debug mode output) as I can't find out what options are available to use.

David the H. 01-30-2009 09:02 AM

I don't really know all that much about the hal output, but looking at your post more carefully, I think you're probably using the wrong config file.

IvmConfigConditions.xml is generally for when some device sends a signal or something, such as when a laptop's suspend button is pressed. If you want a command to run when a device is physically added or removed, you should be using IvmConfigActions.xml. And in that file, you specify the device (or type of device) to match, then use exec to run a command when that device is added, and execun when the device is removed.

If I'm following the comments in the file correctly, the following should run your scripts on any mountable block devices. I haven't actually tested it though.

Code:

    <ivm:Match name="ivm.mountable" value="true">
        <ivm:Option name="exec" value="/path/to/my_add_script.sh" />
        <ivm:Option name="execun" value="/path/to/my_remove_script.sh" />
    </ivm:Match>

If you want to specify a specific device, you can get the name of it to match by using lshal. In general I think you can use just about any line it gives, but the info.product lines seem to be the best for device matching. Then you can add the line to the block above:

Code:

    <ivm:Match name="ivm.mountable" value="true">
        <ivm:Match name="hal.info.product" value="Name Of Device">
        <ivm:Option name="exec" value="/home/david/my_add_script.sh" />
        <ivm:Option name="execun" value="/home/david/my_remove_script.sh" />
    </ivm:Match>

HTH! :)

tl3462 01-30-2009 11:08 AM

Amazing!!

I've spent hours going round in circles trying to get this functionality somehow or other! I'd read this page http://wiki.archlinux.org/index.php/Ivman among many others but somehow missed its mention of 'exec' and 'execun'. Thank you so much - you've made my day! :)

Tom

David the H. 01-30-2009 12:01 PM

Glad you could get it working. I mostly just followed the comments and examples found in the default config files that are installed with the program. They're fairly clearly explained.


All times are GMT -5. The time now is 08:19 PM.