Just use set -e instead of manually checking for return values

This commit is contained in:
David Heinemeier Hansson
2025-07-30 18:43:10 +02:00
parent 49c154cb1f
commit 74552b9f6e

View File

@ -1,5 +1,8 @@
#!/bin/bash
# Exit immediately if a command exits with a non-zero status
set -e
STATE_DIR="$HOME/.local/state/omarchy/migrations"
cd ~/.local/share/omarchy
@ -20,13 +23,8 @@ for file in migrations/*.sh; do
[ -e "${STATE_DIR}/$filename" ] && continue
echo -e "\e[32m\nRunning migration (${filename%.sh})\e[0m"
if source $file; then
touch "${STATE_DIR}/$filename"
echo -e "\t\e[32m✔ Succeess\e[0m"
else
echo -e "\t\e[31m✖ FAILED\e[0m"
exit 1
fi
source $file
touch "${STATE_DIR}/$filename"
done
# Update system packages
@ -34,4 +32,5 @@ echo -e "\e[32m\nUpdate system packages\e[0m"
yay -Syu --noconfirm
# Back to where we came from
cd - >/dev/null
cd - >/dev/null