update: a failing hook without run_update fails the update
shellcheck / shellcheck (push) Failing after 17s

Since a65f07c ran each hook in a subshell, a hook that does its work as
it's sourced (12-migrations, 15-services, 20-aur, 30-flatpak and others)
had its failure lost: the run_update check after source left the
subshell's status at 0, so update said "Done." and exited 0. The smoketest's
40-failing-migration caught it. update now exits the subshell with the
sourced hook's status.

Also, the smoketest scenarios that check whether a migration ran look for
"Running migration " so install.sh's "Running migrations..." heading
doesn't match (11-refresh failed on it).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-05 08:39:54 -07:00
co-authored by Claude Opus 5.5
parent 6524ff9efd
commit 101261bd9b
5 changed files with 36 additions and 4 deletions
+5
View File
@@ -78,10 +78,15 @@ for plugin in "$COREDESKTOP/updates.d/"*.sh; do
(
unset -f is_installed run_update
source "$plugin"
# A hook without run_update does its work as it's sourced, so its
# last command's status is the hook's
status=$?
if declare -f run_update > /dev/null; then
if ! declare -f is_installed > /dev/null || is_installed; then
run_update
fi
else
exit "$status"
fi
)
# Checked separately: under `( ... ) ||`, bash would ignore set -e inside the hook