add variable SNAPPER_CONFIG_FILE

This commit is contained in:
James Barnett 2016-08-31 12:02:44 -05:00
parent 47da90f66f
commit 3a4e052d7b

View file

@ -22,6 +22,8 @@
set -e set -e
SNAPPER_CONFIG_FILE=/etc/conf.d/snapper
if [[ $EUID -ne 0 ]]; then if [[ $EUID -ne 0 ]]; then
echo "ERROR: Script must be run as root." echo "ERROR: Script must be run as root."
exit 1 exit 1
@ -37,10 +39,10 @@ if [[ $1 != "pre" ]] && [[ $1 != "post" ]]; then
exit 1 exit 1
fi fi
if [[ -f /etc/conf.d/snapper ]]; then if [[ -f "$SNAPPER_CONFIG_FILE" ]]; then
source /etc/conf.d/snapper source "$SNAPPER_CONFIG_FILE"
else else
echo "ERROR: /etc/conf.d/snapper does not exist!" echo "ERROR: $SNAPPER_CONFIG_FILE does not exist!"
exit 1 exit 1
fi fi
@ -56,6 +58,7 @@ pacman_cmd="$(sed 's./usr/bin/pacman.pacman.g' <(ps -C pacman -o args=))"
declare -i x=0 declare -i x=0
for CONFIG in $SNAPPER_CONFIGS; do for CONFIG in $SNAPPER_CONFIGS; do
# Set defaults
PACMAN_PRE_POST="no" PACMAN_PRE_POST="no"
if [[ $CONFIG == "root" ]]; then if [[ $CONFIG == "root" ]]; then
PACMAN_PRE_POST="yes" PACMAN_PRE_POST="yes"
@ -64,6 +67,7 @@ for CONFIG in $SNAPPER_CONFIGS; do
PACMAN_POST_DESCRIPTION="$pacman_cmd" PACMAN_POST_DESCRIPTION="$pacman_cmd"
PACMAN_CLEANUP_ALGORITHM="number" PACMAN_CLEANUP_ALGORITHM="number"
# Source snapper configuration to override defaults
source /etc/snapper/configs/"$CONFIG" source /etc/snapper/configs/"$CONFIG"
echo -n " $CONFIG " echo -n " $CONFIG "