LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 01-29-2009, 10:19 AM   #1
tl3462
LQ Newbie
 
Registered: Jan 2009
Posts: 8

Rep: Reputation: 0
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?!
 
Old 01-29-2009, 04:05 PM   #2
David the H.
Bash Guru
 
Registered: Jun 2004
Location: Osaka, Japan
Distribution: Arch + Xfce
Posts: 6,852

Rep: Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037
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.

Last edited by David the H.; 01-29-2009 at 04:34 PM.
 
Old 01-30-2009, 04:02 AM   #3
tl3462
LQ Newbie
 
Registered: Jan 2009
Posts: 8

Original Poster
Rep: Reputation: 0
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.
 
Old 01-30-2009, 09:02 AM   #4
David the H.
Bash Guru
 
Registered: Jun 2004
Location: Osaka, Japan
Distribution: Arch + Xfce
Posts: 6,852

Rep: Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037
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!
 
Old 01-30-2009, 11:08 AM   #5
tl3462
LQ Newbie
 
Registered: Jan 2009
Posts: 8

Original Poster
Rep: Reputation: 0
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
 
Old 01-30-2009, 12:01 PM   #6
David the H.
Bash Guru
 
Registered: Jun 2004
Location: Osaka, Japan
Distribution: Arch + Xfce
Posts: 6,852

Rep: Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037
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.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Which package contains man pages documentation for c++ functions ikk Linux - Software 3 03-14-2006 02:16 PM
who - man pages kshkid Programming 17 03-01-2006 02:37 AM
C man pages sono2 Linux - General 1 09-09-2005 10:36 AM
Man pages twantrd Solaris / OpenSolaris 5 08-16-2004 03:15 AM
man pages spuppett Linux - General 5 02-23-2003 02:28 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 03:08 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration