-
Notifications
You must be signed in to change notification settings - Fork 129
plugin
see https://github.com/openSUSE/snapper/issues/28 for the preceding discussion
- Replace existing grub hooks.
- Allow scripts to avoid snapshot creation, e.g. when disk is spun-down.
- Allow other hooks to be run after snapshot creation, like btrfs send'ing a snapshot to another volume.
Snapper should read all plugin configuration files from the directory /etc/snapper/plugins
. Only files ending in .conf
are considered, e.g. /etc/snapper/plugins/grub.conf
.
The configuration syntax is inspired by systemd unit definition files and consists of Key = Value
pairs without any sectional grouping. These are the possible configuration options:
-
Type: Specifies when the plugin should be run. There are two possible values:
action
andprecondition
. Actions are invoked after every snapshot, which has been created. Preconditions are executed before a snapshot is to be created. If the specified command returns any other status code than 0, the snapshot will not be created. -
Exec: Specifies the command to be run when the plugin hook is invoked.
-
Subvolume: Is as a condition for the plugin's
Exec
command to be invoked. It matches on a wildcard or regex of the snapshotted subvolume path.
Variables can be expanded with ${variable-name}
.
Possible values for variable-name
:
- snapshot-num: An integer value stating the number of the newly created snapshot (for actions)
# /etc/snapper/plugins/grub.conf
Type = action
Exec = /usr/bin/grub-snapper --number=${snapshot-num}
Subvolume = /
# /etc/snapper/plugins/always-works.conf
Type = precondition
Exec = /bin/true
Subvolume = /