diff --git a/install b/install index 2407d2c..dd63013 100755 --- a/install +++ b/install @@ -32,4 +32,5 @@ install -Dm 755 snap-pac-clean $SCRIPTS_DIR install -Dm 644 10_snapper-pre.hook $HOOKS_DIR install -Dm 644 10_snapper-post.hook $HOOKS_DIR install -Dm 644 20_snap-pac-clean.hook $HOOKS_DIR +install -Dm 644 snap-pac.conf /etc/ install -Dm 644 LICENSE "$INSTALL_DIR/usr/share/licenses/snap-pac/LICENSE" diff --git a/snap-pac-clean b/snap-pac-clean index 0fc51fb..98ae51f 100755 --- a/snap-pac-clean +++ b/snap-pac-clean @@ -20,5 +20,6 @@ # Takes a snapper pre snapshot before a pacman transaction -rm /usr/share/libalpm/hooks.bin/snap-pac/.pre* +source /etc/snap-pac.conf +rm "$PREFIX_PREFILE"* echo "NOTE: No post snapshot will be performed for this transaction, since you are removing the pacman hooks." diff --git a/snapper-post b/snapper-post index 5c6f819..b21e33e 100755 --- a/snapper-post +++ b/snapper-post @@ -20,19 +20,14 @@ # Takes a snapper post snapshot after a pacman transaction -# Change this variable to include other configs in the post snapshot -# You must also change it in the pre snapshot script -CONFIGS="root" -#CONFIGS="root home" +source /etc/snap-pac.conf -PACMAN_CMD=$(ps -C pacman -o args=) -PREFILE=/usr/share/libalpm/hooks.bin/snap-pac/.pre for x in $CONFIGS; do - if [ -f $PREFILE"_"$x ]; then - SNAPPERPACPRE=$(cat $PREFILE"_"$x) - snapper --config $x create --cleanup-algorithm number --type post --pre-number $SNAPPERPACPRE --description "$PACMAN_CMD" - rm $PREFILE"_"$x + if [ -f $PREFILE_PREFIX"_"$x ]; then + SNAPPERPACPRE=$(cat $PREFILE_PREFIX"_"$x) + snapper --config $x create --cleanup-algorithm number --type post --pre-number $SNAPPERPACPRE --description "$PRE_DESCRIPTION" + rm $PREFILE_PREFIX"_"$x else - echo "WARNING: $PREFILE"_"$x does not exist, so not performing post snapshot. If you are initially installing snap-pac, this is normal." + echo "WARNING: $PREFILE_PREFIX"_"$x does not exist, so not performing post snapshot. If you are initially installing snap-pac, this is normal." fi done diff --git a/snapper-pre b/snapper-pre index 694c923..3ab5776 100755 --- a/snapper-pre +++ b/snapper-pre @@ -20,13 +20,8 @@ # Takes a snapper pre snapshot before a pacman transaction -# Change this variable to include other configs in the pre snapshot -# You must also change it in the post snapshot script -CONFIGS="root" -#CONFIGS="root home" +source /etc/snap-pac.conf -PACMAN_CMD=$(ps -C pacman -o args=) -PREFILE=/usr/share/libalpm/hooks.bin/snap-pac/.pre for x in $CONFIGS; do - snapper --config $x create --type pre --cleanup-algorithm number --print-number --description "$PACMAN_CMD" > $PREFILE"_"$x + snapper --config $x create --type pre --cleanup-algorithm number --print-number --description "$POST_DESCRIPTION" > $PREFILE_PREFIX"_"$x done