diff --git a/scripts/snap-pac b/scripts/snap-pac index 1be6c5c..da453b2 100755 --- a/scripts/snap-pac +++ b/scripts/snap-pac @@ -26,8 +26,8 @@ declare -r name="snap-pac" declare PACMAN_ABORT_ON_FAIL="no" out() { printf "$1 $2\n" "${@:3}"; } -error() { out "\033[00;31m==> ERROR:\033[00m" "$@"; } >&2 -warning() { out "\033[00;33m==> WARNING:\033[00m" "$@"; } >&2 +error() { out "\033[00;31m==> ERROR:\033[00m" "$@"; } >&2 +warning() { out "\033[00;33m==> WARNING:\033[00m" "$@"; } >&2 die() { error "$@" [[ $PACMAN_ABORT_ON_FAIL == "yes" ]] && exit 1 @@ -87,18 +87,14 @@ for CONFIG in $SNAPPER_CONFIGS; do x=$((x+1)) - printf "==> %s " "$CONFIG" - case "$pre_or_post" in - pre) printf "$($snapper_cmd "$(truncate_description $PACMAN_PRE_DESCRIPTION)" | tee "$prefile")\n" ;; - post) - if [[ -f $prefile ]]; then - printf "$($snapper_cmd "$(truncate_description $PACMAN_POST_DESCRIPTION)" --pre-number "$(< "$prefile")")\n" - rm -f "$prefile" - else - warning "%s does not exist, so no post snapshot for %s will be taken. If you are initially installing $name, this is normal." "$prefile" "$CONFIG" - fi - ;; - esac + if [[ "$pre_or_post" == "pre" ]]; then + printf "==> %s $($snapper_cmd "$(truncate_description $PACMAN_PRE_DESCRIPTION)" | tee "$prefile")\n" "$CONFIG" + elif [[ -f $prefile && "$pre_or_post" == "post" ]]; then + printf "==> %s $($snapper_cmd "$(truncate_description $PACMAN_POST_DESCRIPTION)" --pre-number "$(< "$prefile")")\n" "$CONFIG" + rm -f "$prefile" + elif [[ ! -f $prefile && "$pre_or_post" == "post" ]]; then + warning "%s does not exist, so no post snapshot for %s will be taken. If you are initially installing $name, this is normal." "$prefile" "$CONFIG" + fi done