why do we need a checkmark?

The number itself tells us it was completed
This commit is contained in:
James Barnett 2017-02-14 09:31:50 -06:00
parent 2edea865b0
commit 6105acf78b
No known key found for this signature in database
GPG key ID: E4B5E45AA3B8C5C3
2 changed files with 6 additions and 13 deletions

View file

@ -100,12 +100,12 @@ Installing the nano package as normal:
(1/1) checking available disk space [######################################] 100% (1/1) checking available disk space [######################################] 100%
:: Running pre-transaction hooks... :: Running pre-transaction hooks...
(1/1) Performing snapper pre snapshots... (1/1) Performing snapper pre snapshots...
root 1033 root 1033
:: Processing package changes... :: Processing package changes...
(1/1) installing nano [######################################] 100% (1/1) installing nano [######################################] 100%
:: Running post-transaction hooks... :: Running post-transaction hooks...
(1/1) Performing snapper post snapshots... (1/1) Performing snapper post snapshots...
root 1034 root 1034
.EE .EE

View file

@ -56,10 +56,6 @@ source "$SNAPPER_CONFIG_FILE"
[[ $1 != "pre" ]] && [[ $1 != "post" ]] && [[ $1 != "rem" ]] && die "First argument should either be 'pre', 'post', or 'rem'." [[ $1 != "pre" ]] && [[ $1 != "post" ]] && [[ $1 != "rem" ]] && die "First argument should either be 'pre', 'post', or 'rem'."
[[ -z "$SNAPPER_CONFIGS" ]] && die "No snapper configurations found, so not taking any snapshots!" [[ -z "$SNAPPER_CONFIGS" ]] && die "No snapper configurations found, so not taking any snapshots!"
# Only use checkmark if UTF8 is available and we are not in TTY
declare checkmark="done"
[[ $(awk '/UTF-8|utf8/' <(echo $LANG)) && "$TERM" != "linux" ]] && checkmark="✓"
declare -r pre_or_post=$1 declare -r pre_or_post=$1
declare pacman_cmd="$(sed 's./usr/bin/pacman.pacman.g' <(ps -C pacman -o args=))" declare pacman_cmd="$(sed 's./usr/bin/pacman.pacman.g' <(ps -C pacman -o args=))"
@ -90,21 +86,18 @@ for CONFIG in $SNAPPER_CONFIGS; do
x=$((x+1)) x=$((x+1))
printf " %s " "$CONFIG"
case "$pre_or_post" in case "$pre_or_post" in
pre) pre)
printf " %s " "$CONFIG" printf "$($snapper_cmd --description "$(truncate_description $PACMAN_PRE_DESCRIPTION)" | tee "$prefile")\n"
$snapper_cmd --description "$(truncate_description $PACMAN_PRE_DESCRIPTION)" > "$prefile"
printf "%s %s\n" "$(< "$prefile")" "$checkmark"
;; ;;
post) post)
if [[ -f $prefile ]]; then if [[ -f $prefile ]]; then
printf " %s " "$CONFIG" printf "$($snapper_cmd --description "$(truncate_description $PACMAN_POST_DESCRIPTION)" --pre-number "$(< "$prefile")")\n"
postnum=$($snapper_cmd --description "$(truncate_description $PACMAN_POST_DESCRIPTION)" --pre-number "$(< "$prefile")")
printf "%s %s\n" "$postnum" "$checkmark"
rm "$prefile"
else else
warning "%s does not exist, so no post snapshot for %s will be taken. If you are initially installing snap-pac, this is normal." "$prefile" "$CONFIG" warning "%s does not exist, so no post snapshot for %s will be taken. If you are initially installing snap-pac, this is normal." "$prefile" "$CONFIG"
fi fi
rm -f "$prefile"
;; ;;
esac esac