From 35e62cc8b2911984be0dddfb97abc7606a163a1e Mon Sep 17 00:00:00 2001 From: James Barnett Date: Mon, 25 Apr 2016 13:08:07 -0500 Subject: [PATCH] add warning if configuration file is missing --- snapper-post | 8 ++++++-- snapper-pre | 6 +++++- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/snapper-post b/snapper-post index 3feda8f..e94bc15 100755 --- a/snapper-post +++ b/snapper-post @@ -20,7 +20,11 @@ # Takes a snapper post snapshot after a pacman transaction -source /etc/snap-pac.conf +if [ -f /etc/snap-pac.conf ]; then + source /etc/snap-pac.conf +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')"} @@ -32,6 +36,6 @@ for x in $configurations; do snapper --config $x create --cleanup-algorithm $cleanupalgo --type post --pre-number $SNAPPERPACPRE --description "$description" rm $PREFILE_PREFIX"_"$x else - echo "WARNING: $PREFILE_PREFIX"_"$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 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 126bb28..6240f2d 100755 --- a/snapper-pre +++ b/snapper-pre @@ -20,7 +20,11 @@ # Takes a snapper pre snapshot before a pacman transaction -source /etc/snap-pac.conf +if [ -f /etc/snap-pac.conf ]; then + source /etc/snap-pac.conf +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')"}