Skip to content

Commit

Permalink
remove trap and logical chaining in favor of if source, add brave to …
Browse files Browse the repository at this point in the history
…optional
  • Loading branch information
IbrahimTanyalcin committed Jul 26, 2024
1 parent db58d9f commit f9d5521
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 21 deletions.
10 changes: 6 additions & 4 deletions bin/omakub-sub/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,12 @@ else
*) INSTALLER_FILE="$OMAKUB_PATH/install/desktop/optional/app-$INSTALLER.sh" ;;
esac

trap "handle_omakub_source_error $INSTALLER_FILE" ERR
source $INSTALLER_FILE && gum spin --spinner globe --title "Install completed!" -- sleep 3 \
&& handle_omakub_source_success "$INSTALLER_FILE"
trap - ERR
if source $INSTALLER_FILE; then
gum spin --spinner globe --title "Install completed!" -- sleep 3
handle_omakub_source_success "$INSTALLER_FILE"
else
handle_omakub_source_error "$INSTALLER_FILE"
fi
fi

clear
Expand Down
10 changes: 6 additions & 4 deletions bin/omakub-sub/update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,12 @@ else
*) INSTALLER_FILE="$OMAKUB_PATH/install/terminal/app-$INSTALLER.sh" ;;
esac

trap "handle_omakub_source_error $INSTALLER_FILE" ERR
source $INSTALLER_FILE && gum spin --spinner globe --title "Update completed!" -- sleep 3 \
&& handle_omakub_source_success "$INSTALLER_FILE"
trap - ERR
if source $INSTALLER_FILE; then
gum spin --spinner globe --title "Update completed!" -- sleep 3
handle_omakub_source_success "$INSTALLER_FILE"
else
handle_omakub_source_error "$INSTALLER_FILE"
fi
fi

clear
Expand Down
2 changes: 1 addition & 1 deletion first_run_choices.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
OPTIONAL_APPS=("1password" "Spotify" "Zoom" "Dropbox")
OPTIONAL_APPS=("1password" "Spotify" "Zoom" "Dropbox" "Brave")
DEFAULT_OPTIONAL_APPS='1password,Spotify,Zoom'
export OMAKUB_FIRST_RUN_OPTIONAL_APPS=$(gum choose "${OPTIONAL_APPS[@]}" --no-limit --selected $DEFAULT_OPTIONAL_APPS --height 7 --header "Select optional apps" | tr ' ' '-')

Expand Down
8 changes: 5 additions & 3 deletions install/desktop.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,11 @@ fi

# Run desktop installers
for installer in ~/.local/share/omakub/install/desktop/*.sh; do
trap "handle_omakub_source_error $installer" ERR
source "$installer" && handle_omakub_source_success "$installer"
trap - ERR
if source "$installer"; then
handle_omakub_source_success "$installer"
else
handle_omakub_source_error "$installer"
fi
done

# Revert to normal idle and lock settings
Expand Down
4 changes: 2 additions & 2 deletions install/desktop/optional/app-1password.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ if [[ -z $UTILS_SOURCED ]]; then
fi
ARCH=$(get_arch)
case "$ARCH" in
--aarch64)
aarch64)
cd /tmp
curl -sSO https://downloads.1password.com/linux/tar/stable/aarch64/1password-latest.tar.gz
curl -sSO https://downloads.1password.com/linux/tar/stable/aarch64/1password-latest.tar.gz.sig
Expand All @@ -16,7 +16,7 @@ case "$ARCH" in
sudo /opt/1Password/after-install.sh
cd -
;;
--*)
*)
# Install 1password and 1password-cli single script
curl -sS https://downloads.1password.com/linux/keys/1password.asc | \
sudo gpg --dearmor --output /usr/share/keyrings/1password-archive-keyring.gpg
Expand Down
9 changes: 5 additions & 4 deletions install/desktop/select-optional-apps.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,11 @@ if [[ -v OMAKUB_FIRST_RUN_OPTIONAL_APPS ]]; then

if [[ -n "$apps" ]]; then
for app in $apps; do
trap "handle_omakub_source_error $app" ERR
source "$OMAKUB_PATH/install/desktop/optional/app-${app,,}.sh" \
&& handle_omakub_source_success "$app"
trap - ERR
if source "$OMAKUB_PATH/install/desktop/optional/app-${app,,}.sh"; then
handle_omakub_source_success "$app"
else
handle_omakub_source_error "$app"
fi
done
fi
fi
8 changes: 5 additions & 3 deletions install/terminal.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ fi

# Run terminal installers
for installer in ~/.local/share/omakub/install/terminal/*.sh; do
trap "handle_omakub_source_error $installer" ERR
source "$installer" && handle_omakub_source_success "$installer"
trap - ERR
if source "$installer"; then
handle_omakub_source_success "$installer"
else
handle_omakub_source_error "$installer"
fi
done

0 comments on commit f9d5521

Please sign in to comment.