Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ POST_CHECKOUT_HOOK_URL="https://raw.githubusercontent.com/LucaTools/LucaScripts/
# GITHUB API AUTHENTICATION
# =============================================================================

trap 'printf "\n❌ Installation interrupted.\n"; exit 130' INT

# Build curl options for GitHub API requests.
# If GITHUB_TOKEN is set, include it as a Bearer token to avoid rate limiting
# (5000 req/hr authenticated vs. 60 req/hr unauthenticated).
Expand Down Expand Up @@ -210,6 +212,7 @@ echo "🧹 Cleaned up temporary files"
# This checks if the install directory is writable before using sudo
sudo_if_install_dir_not_writeable() {
local command="$1"
local exit_code
if [ -w "$INSTALL_DIR" ]; then
# Directory is writable, run without sudo
sh -c "$command"
Expand All @@ -218,6 +221,11 @@ sudo_if_install_dir_not_writeable() {
echo "🔐 Administrator privileges required for installation to $INSTALL_DIR"
sudo sh -c "$command"
fi
exit_code=$?
if [ "$exit_code" -ne 0 ]; then
echo "❌ ERROR: Command failed or was interrupted (exit code: $exit_code)"
exit "$exit_code"
fi
}

# Create install directory if it doesn't exist
Expand Down
Loading