[PR #15010] fix: install.sh no longer reports success on sudo failure #40839

Open
opened 2026-04-23 01:38:31 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ollama/ollama/pull/15010
Author: @r266-tech
Created: 3/22/2026
Status: 🔄 Open

Base: mainHead: fix/install-script-false-positive


📝 Commits (1)

  • 7eb3da6 fix: install.sh no longer reports success on sudo failure

📊 Changes

1 file changed (+8 additions, -3 deletions)

View changed files

📝 scripts/install.sh (+8 -3)

📄 Description

Problem

The install script (scripts/install.sh) reports "Install complete" even when critical commands fail due to sudo timeout or authentication failure. This misleads users into thinking the installation succeeded when it actually didn't.

The root cause: the EXIT trap unconditionally calls install_success() which always prints the success message, regardless of whether the installation actually completed.

Changes

  • Add INSTALL_COMPLETE flag variable (initialized to false)
  • Set flag to true only after the main binary is successfully downloaded and extracted
  • install_success() checks the flag before printing success messages
  • Chain cleanup into the exit handler to preserve temp directory cleanup
  • Add || true to systemctl restart to prevent the exit trap itself from failing under set -e

Testing

Verified the diff is minimal (8 lines added, 3 removed) and the logic is straightforward:

  • If useradd/usermod fails → script exits via set -eINSTALL_COMPLETE is still false → no false success message
  • If binary extraction succeeds → INSTALL_COMPLETE=true → success message still prints correctly

Fixes #14998


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/ollama/ollama/pull/15010 **Author:** [@r266-tech](https://github.com/r266-tech) **Created:** 3/22/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `fix/install-script-false-positive` --- ### 📝 Commits (1) - [`7eb3da6`](https://github.com/ollama/ollama/commit/7eb3da68b6df335d479b6c52a633905c51d27c7e) fix: install.sh no longer reports success on sudo failure ### 📊 Changes **1 file changed** (+8 additions, -3 deletions) <details> <summary>View changed files</summary> 📝 `scripts/install.sh` (+8 -3) </details> ### 📄 Description ## Problem The install script (`scripts/install.sh`) reports **"Install complete"** even when critical commands fail due to sudo timeout or authentication failure. This misleads users into thinking the installation succeeded when it actually didn't. The root cause: the EXIT trap unconditionally calls `install_success()` which always prints the success message, regardless of whether the installation actually completed. ## Changes - Add `INSTALL_COMPLETE` flag variable (initialized to `false`) - Set flag to `true` only after the main binary is successfully downloaded and extracted - `install_success()` checks the flag before printing success messages - Chain `cleanup` into the exit handler to preserve temp directory cleanup - Add `|| true` to `systemctl restart` to prevent the exit trap itself from failing under `set -e` ## Testing Verified the diff is minimal (8 lines added, 3 removed) and the logic is straightforward: - If `useradd`/`usermod` fails → script exits via `set -e` → `INSTALL_COMPLETE` is still `false` → no false success message - If binary extraction succeeds → `INSTALL_COMPLETE=true` → success message still prints correctly Fixes #14998 --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-04-23 01:38:31 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#40839