update readme

This commit is contained in:
James Barnett 2016-09-01 07:30:22 -05:00
parent 5417160503
commit 9625951a11
2 changed files with 26 additions and 28 deletions

View file

@ -37,9 +37,11 @@ The key's fingerprint is `8535CEF3F3C38EE69555BF67E4B5E45AA3B8C5C3`.
## Configuration ## Configuration
Configuration is done via the snapper configuration files, with extra variables Configuration is done via the snapper configuration files, with extra variables
specific to these pacman hooks. The defaults should be suitable for most users. specific to these pacman hooks. The defaults should be suitable for most users,
so you shouldn't need to change anything.
The following are possible settings you can place in each snapper configuration The following are possible settings you can place in each snapper configuration
file: file (*e.g.*, `/etc/snapper/configs/root`, etc.):
* `PACMAN_PRE_POST` - perform pacman pre/post snapshots for this configuration. * `PACMAN_PRE_POST` - perform pacman pre/post snapshots for this configuration.
Default is `"no"` for all configurations, except for the `root` configuration Default is `"no"` for all configurations, except for the `root` configuration
@ -54,14 +56,10 @@ which is `"yes"`.
The following setting can be changed in the snapper configuration file The following setting can be changed in the snapper configuration file
`/etc/conf.d/snapper`: `/etc/conf.d/snapper`:
* `PACMAN_ABORT_ON_FAIL` - If for some reason there is an error taking the pre * `PACMAN_ABORT_ON_FAIL` - By default this is set to `"no"`. When set to `"yes"`
snapshot, abort the pacman transaction if this is set to `"yes"`. Default is this causes pacman to abort a transaction if the snap-pac pre hook fails. This
`"no"`, meaning if there is an error taking the pre snapshot then continue with prevents an upgrade/installation/removal from occurring if a pre snapshot cannot be
the pacman transaction as normal. Any other value than `"no"` is treated the performed.
same as `"yes"`.
These settings only need to be added to the snapper configuration files if you
want to change the default.
## Usage ## Usage

View file

@ -38,46 +38,46 @@ fi
if [[ $EUID -ne 0 ]]; then if [[ $EUID -ne 0 ]]; then
echo -e "$ERRORMSG Script must be run as root." echo -e "$ERRORMSG Script must be run as root."
if [[ $PACMAN_ABORT_ON_FAIL == "no" ]]; then if [[ $PACMAN_ABORT_ON_FAIL == "yes" ]]; then
exit 0
else
exit 1 exit 1
else
exit 0
fi fi
fi fi
if [[ ! -d /var/run/dbus ]]; then if [[ ! -d /var/run/dbus ]]; then
echo -e "$ERRORMSG Unable to use snapper without dbus. Are you in a chroot environment?" echo -e "$ERRORMSG Unable to use snapper without dbus. Are you in a chroot environment?"
if [[ $PACMAN_ABORT_ON_FAIL == "no" ]]; then if [[ $PACMAN_ABORT_ON_FAIL == "yes" ]]; then
exit 0
else
exit 1 exit 1
else
exit 0
fi fi
fi fi
if [[ $# -ne 1 ]]; then if [[ $# -ne 1 ]]; then
echo -e "$ERRORMSG Only one argument should be passed to this script." echo -e "$ERRORMSG Only one argument should be passed to this script."
if [[ $PACMAN_ABORT_ON_FAIL == "no" ]]; then if [[ $PACMAN_ABORT_ON_FAIL == "yes" ]]; then
exit 0
else
exit 1 exit 1
else
exit 0
fi fi
fi fi
if [[ $1 != "pre" ]] && [[ $1 != "post" ]]; then if [[ $1 != "pre" ]] && [[ $1 != "post" ]]; then
echo -e "$ERRORMSG First argument should either be 'pre' or 'post'." echo -e "$ERRORMSG First argument should either be 'pre' or 'post'."
if [[ $PACMAN_ABORT_ON_FAIL == "no" ]]; then if [[ $PACMAN_ABORT_ON_FAIL == "yes" ]]; then
exit 0
else
exit 1 exit 1
else
exit 0
fi fi
fi fi
if [[ -z "$SNAPPER_CONFIGS" ]]; then if [[ -z "$SNAPPER_CONFIGS" ]]; then
echo -e "$WARNINGMSG No snapper configurations found, so not taking any snapshots!" echo -e "$WARNINGMSG No snapper configurations found, so not taking any snapshots!"
if [[ $PACMAN_ABORT_ON_FAIL == "no" ]]; then if [[ $PACMAN_ABORT_ON_FAIL == "yes" ]]; then
exit 0
else
exit 1 exit 1
else
exit 0
fi fi
fi fi
@ -132,10 +132,10 @@ done
if [[ $x -eq 0 ]]; then if [[ $x -eq 0 ]]; then
echo -e "$WARNINGMSG No snapper configurations are set up for snapshots to be taken!" echo -e "$WARNINGMSG No snapper configurations are set up for snapshots to be taken!"
if [[ $PACMAN_ABORT_ON_FAIL == "no" ]]; then if [[ $PACMAN_ABORT_ON_FAIL == "yes" ]]; then
exit 0
else
exit 1 exit 1
else
exit 0
fi fi
fi fi