[PR #13404] fix: ensure installer PATH is exported and persistent #14647

Open
opened 2026-02-16 18:19:25 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/anomalyco/opencode/pull/13404

State: open
Merged: No


What does this PR do?

Fixes #13403

This PR improves the installation script to handle environments where shell configuration files (like .bashrc) might not exist or where the PATH isn't updated in the current session after installation.

Changes made:

  • Added mkdir and touch to guarantee the target config file exists before attempting to grep or append to it.
  • Added an immediate export PATH within the script so the opencode command can be used in the same session that ran the installer.
  • Updated the final UI logic to check if the command is actually available. If not, it provides a clear source instruction for the user.

These changes work because they address both disk persistence and current shell memory, preventing the "command not found" error on minimal Linux distros (like Debian/Armbian) immediately after a successful install.

How did you verify your code works?

Tested on Debian Bookworm (Orange Pi 5) via SSH:

  1. Confirmed opencode was not found.
  2. Ran the modified install.sh.
  3. Verified the progress bar and ASCII art rendered correctly.
  4. Immediately ran opencode -v without restarting the terminal or manual sourcing.
  5. Result: Command recognized correctly.

Terminal session:

opi5@homelab:~$ opencode
opencode: command not found

opi5@homelab:~$ ./install_opencode.sh
Installing opencode version: 1.1.64
■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■ 100%

Successfully installed opencode!

opi5@homelab:~$ opencode -v
1.1.64
**Original Pull Request:** https://github.com/anomalyco/opencode/pull/13404 **State:** open **Merged:** No --- ### What does this PR do? Fixes #13403 This PR improves the installation script to handle environments where shell configuration files (like `.bashrc`) might not exist or where the `PATH` isn't updated in the current session after installation. **Changes made:** * Added `mkdir` and `touch` to guarantee the target config file exists before attempting to `grep` or append to it. * Added an immediate `export PATH` within the script so the `opencode` command can be used in the same session that ran the installer. * Updated the final UI logic to check if the command is actually available. If not, it provides a clear `source` instruction for the user. These changes work because they address both disk persistence and current shell memory, preventing the "command not found" error on minimal Linux distros (like Debian/Armbian) immediately after a successful install. ### How did you verify your code works? Tested on **Debian Bookworm (Orange Pi 5)** via SSH: 1. Confirmed `opencode` was not found. 2. Ran the modified `install.sh`. 3. Verified the progress bar and ASCII art rendered correctly. 4. Immediately ran `opencode -v` without restarting the terminal or manual sourcing. 5. **Result:** Command recognized correctly. **Terminal session:** ```bash opi5@homelab:~$ opencode opencode: command not found opi5@homelab:~$ ./install_opencode.sh Installing opencode version: 1.1.64 ■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■ 100% Successfully installed opencode! opi5@homelab:~$ opencode -v 1.1.64
yindo added the pull-request label 2026-02-16 18:19:25 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#14647