UDISKS-GLUE(1)

NAME
udisks-glue - A tool to associate udisks events to user-defined actions

SYNOPSIS
udisks-glue [-c config-file] [-f] [-p pidfile] udisks-glue [-h]

DESCRIPTION
udisks-glue listens for UDisks DBus events and reacts to them according to the configuration.

-c/--config config-file
    Use config-file as the configuration file

-f/--foreground
    Remain in foreground (don't daemonize)

-h/--help
    Display usage information and exit

-p/--pidfile pidfile
    Use pidfile file as the pidfile

CONFIGURATION FILE
If no configuration file is specified by command line arguments, udisks-glue looks for the following configuration files (in this order):

1.  $HOME/.udisks-glue.conf

2.  $XDG_CONFIG_HOME/udisks-glue/config

3.  /etc/udisks-glue.conf

4.  $DIR/udisks-glue/config for each dir in $XDG_CONFIG_DIR

A configuration file must exist or otherwise udisks-glue will fail to start up.

CONFIGURATION SYNTAX
udisks-glue is configured by a series of match directives referencing filter directives. Filter directives define parameters that filter the UDisks events. Match directives specify actions to be taken by udisks-glue in case the corresponded filter matches. Filter and match directives can be specified in any order. You should use unique names for filter directives. The rules are evaluated in the order the match directives are specified. A default directive is a special directive used as a fallback in case no other directives match. It does not reference a filter directive. You may choose not to specify a default directive. Due to the way the rules are evaluated, it's advised that more specific match directives are defined before less specific ones. If a match directive does not specify one of the available actions, another directive may be chosen. If no action is to be taken, specify an empty command to prevent another match directive from taking over. The currently available match directive actions are:

post_insertion_command
    Runs after a device is inserted or after its media has been made available

post_mount_command
    Runs after a device has been mounted

post_removal_command
    Runs after a device or its media has been removed

The currently supported filter parameters are:

label (string)
    User-visible label of the detected file system

optical (boolean)
    Set if the device uses optical disc as its media

optical_disc_closed (boolean)
    Set if the optical disc is closed

readonly (boolean)
    Set if the device is a ready-only device

removable (boolean)
    Set if the device is a removable device

type (string)
    Extended information about the device, generally set to the name of the detected file system if the usage property is set to filesystem

usage (string)
    The result of probing for signatures on the block device, generally set to filesystem if a mountable file system was detected

uuid (string)
    UUID of the detected file system

Note that the rules are evaluated only at the time the device or its media is inserted. Internal drives are always ignored.

EXAMPLES
The following configuration example shows how udisks(1) can be used to mount USB pendrives and similar devices. Notifications are provided by a custom script that could display on-screen information or provide notifications in some other way:
filter disks {
    optical = false
    usage = filesystem
}
match disks {
    post_insertion_command = "udisks --mount %device_file --mount-options sync"
    post_mount_command = "mount-notify %device_file %mount_point"
    post_removal_command = "mount-notify %device_file removed"
}
A more complex example shows how the filters can be used to mount optical and non-optical media (USB pendrives and the like) using different mount options and how a specific program can be launched on non-closed optical discs.
#
# Filters
#
filter disks {
    optical = false
    usage = filesystem
}
filter burnable {
    optical = true
    disc_closed = false
}
filter optical {
    optical = true
}
#
# The default entry
#
default {
    post_mount_command = "mount-notify %device_file %mount_point"
    post_removal_command = "mount-notify %device_file removed"
}
#
# Additional entries
#
match disks {
    post_insertion_command = "udisks --mount %device_file --mount-options sync"
}
match burnable {
    post_insertion_command = "k3b %device_file"
    post_mount_command = ""
}
match optical {
    post_insertion_command = "udisks --mount %device_file --mount-options ro"
}
Note how we explicitly defined an empty post-mount command for the burnable match directive. This means that no post-mount command will be taken if the burnable match directive is chosen when the rules are evaluated.

SEE ALSO
udisks(1), udisks(7), udisks-daemon(8)