From 8f10395a88df3819bd3f59be72b8e480bbb3a892 Mon Sep 17 00:00:00 2001 From: James Barnett Date: Fri, 3 Feb 2017 11:45:13 -0600 Subject: [PATCH] no need to list configurations that aren't being snapshotted --- hooks/00_snapper-pre.hook | 2 +- hooks/zz_snapper-post.hook | 2 +- scripts/snap-pac | 10 ++-------- 3 files changed, 4 insertions(+), 10 deletions(-) diff --git a/hooks/00_snapper-pre.hook b/hooks/00_snapper-pre.hook index 2904d7e..c62fada 100644 --- a/hooks/00_snapper-pre.hook +++ b/hooks/00_snapper-pre.hook @@ -24,7 +24,7 @@ Type = Package Target = * [Action] -Description = Performing snapper pre snapshots... +Description = Performing snapper pre snapshots for the following configurations... Depends = snap-pac When = PreTransaction Exec = /usr/share/libalpm/scripts/snap-pac pre diff --git a/hooks/zz_snapper-post.hook b/hooks/zz_snapper-post.hook index 4755817..74f08d2 100644 --- a/hooks/zz_snapper-post.hook +++ b/hooks/zz_snapper-post.hook @@ -24,7 +24,7 @@ Type = Package Target = * [Action] -Description = Performing snapper post snapshots... +Description = Performing snapper post snapshots for the following configurations... Depends = snap-pac When = PostTransaction Exec = /usr/share/libalpm/scripts/snap-pac post diff --git a/scripts/snap-pac b/scripts/snap-pac index 6e7af0e..66bb3b7 100755 --- a/scripts/snap-pac +++ b/scripts/snap-pac @@ -128,8 +128,6 @@ for CONFIG in $SNAPPER_CONFIGS; do # Source snapper configuration to override defaults source /etc/snapper/configs/"$CONFIG" - printf " %s " "$CONFIG" - if [[ $PACMAN_PRE_POST == "yes" ]]; then prefile="/tmp/snap-pac-pre_$CONFIG" @@ -138,18 +136,19 @@ for CONFIG in $SNAPPER_CONFIGS; do x=$((x+1)) if [[ "$pre_or_post" == "pre" ]]; then + printf " %s " "$CONFIG" if [[ "${#PACMAN_PRE_DESCRIPTION}" -gt $DESC_LIMIT ]]; then PACMAN_PRE_DESCRIPTION="$(echo $PACMAN_PRE_DESCRIPTION | cut -c 1-$DESC_LIMIT)..." fi $snapper_cmd --description "$PACMAN_PRE_DESCRIPTION" --print-number > "$prefile" printf "%s %s\n" "$(< "$prefile")" "$checkmark" elif [[ "$pre_or_post" == "rem" ]]; then - printf "N/A\n" if [[ -f $prefile ]]; then rm "$prefile" fi elif [[ "$pre_or_post" == "post" ]]; then if [[ -f $prefile ]]; then + printf " %s " "$CONFIG" if [[ "${#PACMAN_POST_DESCRIPTION}" -gt $DESC_LIMIT ]]; then PACMAN_POST_DESCRIPTION="$(echo $PACMAN_POST_DESCRIPTION | cut -c 1-$DESC_LIMIT)..." fi @@ -157,15 +156,10 @@ for CONFIG in $SNAPPER_CONFIGS; do printf "%s %s\n" "$postnum" "$checkmark" rm "$prefile" else - printf "N/A\n" printf "%b %s does not exist, so no post snapshot for %s will be taken. If you are initially installing snap-pac, this is normal.\n" "$WARNINGMSG" "$prefile" "$CONFIG" fi fi - else - - printf "N/A\n" - fi done