diff --git a/scripts/snap-pac b/scripts/snap-pac index 2ae0af4..358795c 100755 --- a/scripts/snap-pac +++ b/scripts/snap-pac @@ -52,10 +52,10 @@ trap kill_exit SIGTERM SIGINT source "$SNAPPER_CONFIG_FILE" [[ $EUID -ne 0 ]] && die "Script must be run as root." -[[ ! -d /var/run/dbus ]] && die "Unable to use snapper without dbus. Are you in a chroot environment?" +[[ ! -d /var/run/dbus ]] && die "No dbus available. Are you in a chroot environment?" [[ $# -ne 1 ]] && die "Only one argument should be passed to this script." [[ $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." declare -r pre_or_post=$1 declare pacman_cmd="$(sed 's./usr/bin/pacman.pacman.g' <(ps -C pacman -o args=))" @@ -83,16 +83,16 @@ for CONFIG in $SNAPPER_CONFIGS; do [[ $PACMAN_PRE_POST == "no" ]] && continue prefile="/tmp/$name-pre_$CONFIG" - snapper_cmd="snapper --config $CONFIG create --type $pre_or_post --cleanup-algorithm $PACMAN_CLEANUP_ALGORITHM --print-number" + snapper_cmd="snapper --config $CONFIG create --type $pre_or_post --cleanup-algorithm $PACMAN_CLEANUP_ALGORITHM --print-number --description" x=$((x+1)) printf " %s " "$CONFIG" case "$pre_or_post" in - pre) printf "$($snapper_cmd --description "$(truncate_description $PACMAN_PRE_DESCRIPTION)" | tee "$prefile")\n" ;; + pre) printf "$($snapper_cmd "$(truncate_description $PACMAN_PRE_DESCRIPTION)" | tee "$prefile")\n" ;; post) if [[ -f $prefile ]]; then - printf "$($snapper_cmd --description "$(truncate_description $PACMAN_POST_DESCRIPTION)" --pre-number "$(< "$prefile")")\n" + 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" @@ -102,4 +102,4 @@ for CONFIG in $SNAPPER_CONFIGS; do done -[[ $x -eq 0 ]] && die "No snapper configurations are set up for snapshots to be taken!" +[[ $x -eq 0 ]] && die "No snapper configurations are set up for snapshots to be taken."