diff --git a/src/cachy-auto-update b/src/cachy-auto-update index 69cde93..50b7e53 100644 --- a/src/cachy-auto-update +++ b/src/cachy-auto-update @@ -170,7 +170,9 @@ cau_do_status() { cau_do_run() { cau_need_root - exec "$CAU_LIBEXECDIR/cachy-auto-update-run" "$@" + # Not exec'd: this is also called from the menu, which has to survive the + # run and redraw afterwards. + "$CAU_LIBEXECDIR/cachy-auto-update-run" "$@" } cau_do_log() { diff --git a/src/cachy-auto-update-run b/src/cachy-auto-update-run index 0a1947b..f6165a3 100644 --- a/src/cachy-auto-update-run +++ b/src/cachy-auto-update-run @@ -40,6 +40,13 @@ if [[ $EUID -ne 0 ]]; then exit 2 fi +# Force a neutral locale here rather than relying on the unit's Environment=, +# so a run started by hand behaves exactly like one started by the timer. +# pacman failures are classified by matching its output, and on a German system +# that output is German. Text aimed at a person does not come through here - a +# notification is rendered in the recipient's own locale by cau_msg_in. +export LC_ALL=C LANGUAGE= + # Re-exec under an inhibitor so a suspend or shutdown cannot land in the middle # of a pacman transaction and leave the database half-written. Done before # anything else so the whole pass is covered, including the lock. diff --git a/src/lib/pkg_pacman.sh b/src/lib/pkg_pacman.sh index 22817ef..d656c82 100644 --- a/src/lib/pkg_pacman.sh +++ b/src/lib/pkg_pacman.sh @@ -76,9 +76,16 @@ cau_pacman_update() { return 0 fi - CAU_PACMAN_COUNT="$(grep -c . <<< "$CAU_PACMAN_PENDING")" - [[ $CAU_PACMAN_COUNT =~ ^[0-9]+$ ]] || CAU_PACMAN_COUNT=0 - cau_info "Updating $CAU_PACMAN_COUNT repository package(s)" + if [[ -n $CAU_PACMAN_PENDING ]]; then + CAU_PACMAN_COUNT="$(grep -c . <<< "$CAU_PACMAN_PENDING")" + [[ $CAU_PACMAN_COUNT =~ ^[0-9]+$ ]] || CAU_PACMAN_COUNT=0 + cau_info "Updating $CAU_PACMAN_COUNT repository package(s)" + else + # checkupdates is unavailable, so the list is unknown and pacman is + # asked to work it out itself. + CAU_PACMAN_COUNT=0 + cau_info "Running a full system upgrade (pending list unavailable)" + fi mapfile -t flags < <(cau_pacman_flags) log="$(mktemp)" || return 1