diff --git a/snapper-post b/snapper-post index e94bc15..95be55a 100755 --- a/snapper-post +++ b/snapper-post @@ -26,16 +26,15 @@ else echo "WARNING: /etc/snap-pac.conf is missing. Using default settings." fi -cleanupalgo=${CLEANUP_ALGORITHM:-"number"} -description=${POST_DESCRIPTION:-"$(echo $(ps -C pacman -o args=) | sed 'sX/usr/bin/pacmanXpacmanXg')"} -configurations=${CONFIGS:-"root"} -PREFILE_PREFIX="/usr/share/libalpm/hooks.bin/snap-pac/.pre" +declare -r cleanupalgo=${CLEANUP_ALGORITHM:-"number"} +declare -r description=${POST_DESCRIPTION:-"$(echo $(ps -C pacman -o args=) | sed 'sX/usr/bin/pacmanXpacmanXg')"} +declare -r configurations=${CONFIGS:-"root"} +declare -r prefile_prefix="/usr/share/libalpm/hooks.bin/snap-pac/.pre" for x in $configurations; do - if [ -f $PREFILE_PREFIX"_"$x ]; then - SNAPPERPACPRE=$(cat $PREFILE_PREFIX"_"$x) - snapper --config $x create --cleanup-algorithm $cleanupalgo --type post --pre-number $SNAPPERPACPRE --description "$description" - rm $PREFILE_PREFIX"_"$x + if [ -f $prefile_prefix"_"$x ]; then + snapper --config $x create --cleanup-algorithm $cleanupalgo --type post --pre-number $(cat $prefile_prefix"_"$x) --description "$description" + rm $prefile_prefix"_"$x else - echo "WARNING: $PREFILE_PREFIX"_"$x does not exist, so no post snapshot will be taken. If you are initially installing snap-pac, this is normal." + echo "WARNING: $prefile_prefix"_"$x does not exist, so no post snapshot will be taken. If you are initially installing snap-pac, this is normal." fi done diff --git a/snapper-pre b/snapper-pre index 6240f2d..1cb363e 100755 --- a/snapper-pre +++ b/snapper-pre @@ -26,10 +26,10 @@ else echo "WARNING: /etc/snap-pac.conf is missing. Using default settings." fi -cleanupalgo=${CLEANUP_ALGORITHM:-"number"} -description=${POST_DESCRIPTION:-"$(echo $(ps -C pacman -o args=) | sed 'sX/usr/bin/pacmanXpacmanXg')"} -configurations=${CONFIGS:-"root"} -PREFILE_PREFIX="/usr/share/libalpm/hooks.bin/snap-pac/.pre" +declare -r cleanupalgo=${CLEANUP_ALGORITHM:-"number"} +declare -r description=${POST_DESCRIPTION:-"$(echo $(ps -C pacman -o args=) | sed 'sX/usr/bin/pacmanXpacmanXg')"} +declare -r configurations=${CONFIGS:-"root"} +declare -r prefile_prefix="/usr/share/libalpm/hooks.bin/snap-pac/.pre" for x in $configurations; do - snapper --config $x create --type pre --cleanup-algorithm $cleanupalgo --print-number --description "$description" > $PREFILE_PREFIX"_"$x + snapper --config $x create --type pre --cleanup-algorithm $cleanupalgo --print-number --description "$description" > $prefile_prefix"_"$x done