From 74552b9f6ea8d9bf4b669e369897582764ca23e6 Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Wed, 30 Jul 2025 18:43:10 +0200 Subject: [PATCH] Just use set -e instead of manually checking for return values --- bin/omarchy-update | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/bin/omarchy-update b/bin/omarchy-update index 860e3f8..19b44b2 100755 --- a/bin/omarchy-update +++ b/bin/omarchy-update @@ -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 \ No newline at end of file +cd - >/dev/null +