fix(updater): continue after individual failures

This commit is contained in:
2026-10-11 14:53:41 -04:00
parent 891ba27000
commit ed99088c87
+39 -19
View File
@@ -22,8 +22,7 @@ function dnfUpdate {
function aptUpdate { function aptUpdate {
if command -v apt &> /dev/null; then if command -v apt &> /dev/null; then
echo Updating APT... echo Updating APT...
sudo apt update sudo apt update && sudo apt upgrade
sudo apt upgrade
fi fi
} }
@@ -31,22 +30,31 @@ function aptUpdate {
function flatpakUpdate { function flatpakUpdate {
if command -v flatpak &> /dev/null; then if command -v flatpak &> /dev/null; then
echo Updating Flatpak... echo Updating Flatpak...
flatpak uninstall --unused flatpak uninstall --unused && flatpak update
flatpak update
fi fi
} }
# Appimage Updater # Appimage Updater
function appimageUpdate { function appimageUpdate {
am update if command -v am &> /dev/null; then
echo Updating AppImages...
am update
fi
}
# Homebrew Updater
function brewUpdate {
if command -v brew &> /dev/null; then
echo Updating Homebrew...
brew update && brew upgrade
fi
} }
# Pass Repository Updater # Pass Repository Updater
function passUpdate { function passUpdate {
if [ -d "$HOME/.password-store/.git" ] && [ -d "$HOME/.password-store" ]; then if [ -d "$HOME/.password-store/.git" ] && [ -d "$HOME/.password-store" ]; then
echo Updating pass repository... echo Updating pass repository...
cd "$HOME/.password-store" git -C "$HOME/.password-store" pull
git pull
fi fi
} }
@@ -72,16 +80,28 @@ function manualUpdate {
fi fi
} }
chezmoiUpdate update_failed=0
echo ''
dnfUpdate
aptUpdate
echo ''
flatpakUpdate
echo ''
appimageUpdate
echo ''
manualUpdate
echo ''
passUpdate
# Report failures while allowing the remaining updaters to run.
function run_updater {
if ! "$1"; then
echo "Updater failed: $1" >&2
update_failed=1
fi
}
run_updater chezmoiUpdate
echo ''
run_updater brewUpdate
run_updater dnfUpdate
run_updater aptUpdate
echo ''
run_updater flatpakUpdate
echo ''
run_updater appimageUpdate
echo ''
run_updater manualUpdate
echo ''
run_updater passUpdate
exit "$update_failed"