Skip to content

feat(install): support a custom INSTALL_DIR - #1574

Open
arlenvasconcelos wants to merge 2 commits into
skyhook-io:mainfrom
arlenvasconcelos:feature/custom-install-dir
Open

feat(install): support a custom INSTALL_DIR#1574
arlenvasconcelos wants to merge 2 commits into
skyhook-io:mainfrom
arlenvasconcelos:feature/custom-install-dir

Conversation

@arlenvasconcelos

@arlenvasconcelos arlenvasconcelos commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

Description

The quick-install script hardcoded /usr/local/bin, which forces sudo on machines where the user has a perfectly good ~/.local/bin. INSTALL_DIR now overrides it, the directory is created when missing, and the success message names where the binary landed plus a note when that path is not on PATH.

Relative paths are rejected up front: the script cds into the temp dir it extracts to and then deletes, so a relative INSTALL_DIR would install into that dir and vanish.

Default behaviour is unchanged — with no INSTALL_DIR set, the install still goes to /usr/local/bin and still escalates to sudo when that directory isn't writable.

curl -fsSL https://get.radarhq.io | INSTALL_DIR="$HOME/.local/bin" sh

Files touched:

  • install.shINSTALL_DIR env override, absolute-path guard, mkdir -p (via sudo when needed), install path in the success message, PATH membership note
  • .github/workflows/installers.yml — two smoke steps covering the new behaviour
  • README.md — documents the custom install location

Type of change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update

How has this been tested?

Installer-only change — it never touches a cluster, so the minikube/remote-cluster boxes don't apply.

  • sh -n install.sh — POSIX sh syntax check passes.

  • The install block (mkdir / -w / $SUDO / PATH check) was exercised directly in a scratch directory: writable custom dir, missing custom dir that gets created, and a relative INSTALL_DIR, which exits 1 before any download or extract.

  • Two new CI steps in installers.yml run the real script end to end on the ubuntu and macOS runners:

    • custom absolute INSTALL_DIR → asserts both kubectl-radar --version and radar --version from that directory
    • relative INSTALL_DIR → asserts the install fails
  • The workflow's existing shellcheck --shell=sh install.sh step is the lint gate for the new code; it was not run locally (shellcheck isn't installed on this machine).

  • The existing default-path step (sh ./install.sh/usr/local/bin/kubectl-radar --version) is unchanged and still passes, which is the regression guard on the default.

  • Tested locally with minikube/kind

  • Tested against a remote cluster

  • Added/updated unit tests

Checklist

  • My code follows the project's coding standards
  • I have performed a self-review of my code
  • I have added comments where necessary
  • My changes generate no new warnings
  • Any dependent changes have been merged

Related issues

Fixes #1563


Note

Low Risk
Installer-only change with default behavior preserved; risk is limited to where binaries are placed on the user’s machine, with guards against relative paths and invalid targets.

Overview
The macOS/Linux quick-install script now accepts INSTALL_DIR to override the default /usr/local/bin, so users can install into writable paths like ~/.local/bin without sudo. Relative paths are rejected before download/extract (they would land in the temp dir that gets deleted), and an existing non-directory path fails fast.

Install flow creates the target directory when missing (mkdir -p, with sudo when the dir isn’t writable), consolidates the binary move behind $SUDO, and improves post-install messaging: success names the install path and warns when that path isn’t on PATH.

README documents the custom-location one-liner; CI adds smoke tests for a custom absolute INSTALL_DIR and for a relative path that must fail without creating directories.

Reviewed by Cursor Bugbot for commit 3e9fbce. Bugbot is set up for automated code reviews on this repo. Configure here.

The quick-install script hardcoded /usr/local/bin, which forces sudo on
machines where the user has a perfectly good ~/.local/bin. INSTALL_DIR
now overrides it, the directory is created when missing, and the success
message names where the binary landed plus a note when that path is not
on PATH.

Relative paths are rejected up front: the script cds into the temp dir it
extracts to and deletes, so a relative INSTALL_DIR would install into
that dir and vanish.

Covers both the custom-dir and rejected-relative-path cases in the
installer workflow.
test -w is true for a writable regular file, so pointing INSTALL_DIR at a
file took the no-sudo branch and failed late with "mv: cannot stat
'<path>/': Not a directory" — after downloading the release. Checking for
a non-directory alongside the absolute-path guard fails before any
network work.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow installation to a custom location

1 participant