diff --git a/snapper-post b/snapper-post index 02d6bd6..5c6f819 100755 --- a/snapper-post +++ b/snapper-post @@ -20,12 +20,19 @@ # 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" + PACMAN_CMD=$(ps -C pacman -o args=) PREFILE=/usr/share/libalpm/hooks.bin/snap-pac/.pre -if [ -f $PREFILE ]; then - SNAPPERPACPRE=$(cat $PREFILE) - snapper --config root create --cleanup-algorithm number --type post --pre-number $SNAPPERPACPRE --description "$PACMAN_CMD" - rm $PREFILE -else - echo "WARNING: $PREFILE does not exist, so not performing post snapshot. If you are initially installing snap-pac, this is normal." -fi +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 + else + echo "WARNING: $PREFILE"_"$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 a1c4aeb..694c923 100755 --- a/snapper-pre +++ b/snapper-pre @@ -20,6 +20,13 @@ # 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" + PACMAN_CMD=$(ps -C pacman -o args=) PREFILE=/usr/share/libalpm/hooks.bin/snap-pac/.pre -snapper --config root create --type pre --cleanup-algorithm number --print-number --description "$PACMAN_CMD" > $PREFILE +for x in $CONFIGS; do + snapper --config $x create --type pre --cleanup-algorithm number --print-number --description "$PACMAN_CMD" > $PREFILE"_"$x +done