diff --git a/setup.sh b/setup.sh index e136d571e..b47b513ed 100755 --- a/setup.sh +++ b/setup.sh @@ -226,7 +226,6 @@ _scheduler_detect_installed() { return 1 } - # Spinner for long-running operations # Usage: run_with_spinner "Installing package..." command arg1 arg2 run_with_spinner() { @@ -672,6 +671,8 @@ main() { bootstrap_repo "$@" parse_args "$@" + local _os + _os="$(uname -s)" # Auto-detect non-interactive terminals (CI/CD, agent shells, piped stdin) # Must run after parse_args so explicit --interactive flag takes precedence @@ -877,7 +878,7 @@ main() { # # Ensure crontab has a global PATH= line (Linux only; macOS uses launchd env). # Must run before any cron entries are installed so they inherit the PATH. - if [[ "$PLATFORM_MACOS" != "true" ]]; then + if [[ "$_os" != "Darwin" ]]; then _ensure_cron_path fi @@ -967,6 +968,7 @@ main() { fi # Detect if pulse is already installed (for upgrade messaging) + # Uses shared helper to check both launchd and cron consistently local _pulse_installed=false if _scheduler_detect_installed \ "Supervisor pulse" \ @@ -986,7 +988,7 @@ main() { if [[ "$_do_install" == "true" ]]; then mkdir -p "$HOME/.aidevops/logs" - if [[ "$(uname -s)" == "Darwin" ]]; then + if [[ "$_os" == "Darwin" ]]; then # macOS: use launchd plist with wrapper local pulse_plist="$HOME/Library/LaunchAgents/${pulse_label}.plist" @@ -1113,7 +1115,7 @@ PLIST fi elif [[ "$_pulse_lower" == "false" && "$_pulse_installed" == "true" ]]; then # User explicitly disabled but pulse is still installed — clean up - if [[ "$(uname -s)" == "Darwin" ]]; then + if [[ "$_os" == "Darwin" ]]; then local pulse_plist="$HOME/Library/LaunchAgents/${pulse_label}.plist" if _launchd_has_agent "$pulse_label"; then launchctl unload "$pulse_plist" || true