man IvmConfigActions.xml (Formats) - actions to be performed by ivman(8)
NAME
DESCRIPTION
IvmConfigActions.xml specifies which actions are to be performed by ivman(8) when a device is inserted/attached to the system, where an action is defined as mounting the device or executing a program.
IvmConfigActions.xml is parsed as an XML file. The general form of the file is:
<?xml version="1.0" encoding="UTF-8"?>
<ivm:ActionsConfig version="0.2" xmlns:ivm="http://www.eikke.com/ivm">
<ivm:Match name="matchname" value="matchvalue">
<ivm:Option name="optionname1" value="optionvalue1" />
<ivm:Option name="optionname2" value="optionvalue2" />
...
</ivm:Match>
... </ivm:ActionsConfig>
Each time a device is added to the system, this file is parsed. If, for a Match element, matchname=matchvalue is true for the new device, then the Match or Option elements within that Match element are parsed.
A Match element can have any of the following names:
- ivm.mountable
- Whether or not HAL specifies that a device can and should be mounted. Must be "true" or "false".
- hal.anything
- The string in place of "anything" will be taken as the name of a HAL property string for the device, and the value of the property will be compared to the value given. Run 'lshal' to see a list of HAL properties which can be used here.
- *
- Match every device. Use with care!
An Option element can have any of the following names:
- mount
- Whether or not to mount the device. Must be "true" or "false". If more than one value applies to a device, then the one closest to the end of the file will be used.
- exec
- A command to execute when the device or disc is inserted. The amount of commands per device is unlimited.
- execun
- A command to execute when the device or disc is removed. The amount of commands per device is unlimited. Note that HAL property substitution is limited for execun; since the device no longer exists when the command is executed, we cannot get information about it from HAL, therefore any substitution will occur with the property values at the time of device insertion (or mounting if Ivman mounted it), NOT removal.
- execdvd
- A command to execute when the device is inserted if the device is a volume containing DVD-format video. The amount of commands per device is unlimited. NOTE: execdvd is deprecated! A HAL property now exists to indicate whether or not a DVD contains video - volume.disc.is_videodvd .
exec, execdvd and execun support substitution of HAL device properties. This is accomplished by surrounding the property name with $ symbols. For instance, if $hal.volume.mount_point$ is within a command, it will be replaced with the volume's mount point before execution. No character escaping is done in the substitution, but the characters ' and " are replaced with ?, so you can surround the substitution with quotes without fear.
Remember that this is an XML file, which means that characters which have a special meaning in XML (entities) need to be escaped. Some characters which are popular in shell scripting (&, <, >) are among these special characters. As a quick reference, & becomes & , < becomes < , > becomes > , ' becomes ' and " becomes " .
As many Matches can be nested as is desired, and as many Matches and Options can be placed within a Match as is desired. This, along with the ability to test HAL properties, makes Ivman quite flexible; see the examples below.
EXAMPLES
<!-- autoplay video DVDs -->
<ivm:Match name="hal.volume.disc.type" value="dvd_rom">
<ivm:Option name="execdvd" value="xine -f -g -D dvd:$hal.block.device$" />
</ivm:Match>
<!-- autoplay audio CDs -->
<ivm:Match name="hal.volume.disc.type" value="cd_rom">
<ivm:Match name="hal.volume.disc.has_audio" value="true">
<ivm:Match name="hal.volume.disc.has_data" value="false">
<ivm:Option name="exec" value="cdplay -d $hal.block.device$ -c" />
</ivm:Match>
</ivm:Match>
</ivm:Match>
<!-- blacklist some partitions we don't want mounted -->
<ivm:Match name="hal.block.device" value="/dev/hda5">
<ivm:Option name="mount" value="false" />
</ivm:Match>
<ivm:Match name="hal.block.device" value="/dev/hda2">
<ivm:Option name="mount" value="false" />
</ivm:Match>
Many more examples are given in the default file provided with Ivman.