install.sh: drop --user, add BANGER_INSTALL_NONINTERACTIVE env var
Surveyed the install scripts of comparable systemd-installing tools (Docker, k3s, Tailscale, Ollama, Determinate Systems Nix, flyctl): none of the daemon installers offer a --user staging mode, because the resulting install isn't useful — banger inherits that. The "--user just stages binaries you can't actually use yet" UX was a trap; remove it before users hit it. In its place, adopt the cross-tool convention for non-interactive runs: the BANGER_INSTALL_NONINTERACTIVE=1 env var is friendlier through a curl|bash pipe than `bash -s -- --yes` because the env var can sit on the same line: curl -fsSL ...install.sh | env BANGER_INSTALL_NONINTERACTIVE=1 bash The --yes flag still works for direct script invocation. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
3c29af55a2
commit
1004331c14
1 changed files with 5 additions and 31 deletions
|
|
@ -13,9 +13,10 @@
|
|||
# scope rather than the whole pipeline.
|
||||
#
|
||||
# Flags:
|
||||
# --yes skip the interactive confirmation (CI / scripted use)
|
||||
# --user install binaries to ~/.local/bin and stop; the user
|
||||
# runs `sudo banger system install` later when ready
|
||||
# --yes skip the interactive confirmation (CI / scripted use).
|
||||
# Same effect as exporting BANGER_INSTALL_NONINTERACTIVE=1,
|
||||
# which is friendlier through `curl | bash` since you can
|
||||
# set the env var in the same line.
|
||||
# --version v install a specific version instead of latest_stable
|
||||
#
|
||||
# Trust model:
|
||||
|
|
@ -49,14 +50,12 @@ die() { printf '[banger-install] ERROR: %s\n' "$*" >&2; exit 1; }
|
|||
# ----------------------------------------------------------------------
|
||||
# Flag parsing
|
||||
# ----------------------------------------------------------------------
|
||||
ASSUME_YES=0
|
||||
USER_INSTALL=0
|
||||
ASSUME_YES="${BANGER_INSTALL_NONINTERACTIVE:-0}"
|
||||
TARGET_VERSION=""
|
||||
|
||||
while [[ $# -gt 0 ]]; do
|
||||
case "$1" in
|
||||
-y|--yes) ASSUME_YES=1 ;;
|
||||
--user) USER_INSTALL=1 ;;
|
||||
--version) TARGET_VERSION="${2:-}"; shift ;;
|
||||
--version=*) TARGET_VERSION="${1#--version=}" ;;
|
||||
-h|--help)
|
||||
|
|
@ -156,31 +155,6 @@ for bin in banger bangerd banger-vsock-agent; do
|
|||
|| die "tarball missing expected binary: $bin"
|
||||
done
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
# --user mode: drop binaries in ~/.local/bin and stop
|
||||
# ----------------------------------------------------------------------
|
||||
if [[ "$USER_INSTALL" -eq 1 ]]; then
|
||||
USER_BIN="${HOME}/.local/bin"
|
||||
USER_LIB="${HOME}/.local/lib/banger"
|
||||
mkdir -p "$USER_BIN" "$USER_LIB"
|
||||
install -m 0755 "$WORK_DIR/stage/banger" "$USER_BIN/banger"
|
||||
install -m 0755 "$WORK_DIR/stage/bangerd" "$USER_BIN/bangerd"
|
||||
install -m 0755 "$WORK_DIR/stage/banger-vsock-agent" "$USER_LIB/banger-vsock-agent"
|
||||
cat <<EOF >&2
|
||||
|
||||
Installed banger $TARGET_VERSION to:
|
||||
$USER_BIN/banger
|
||||
$USER_BIN/bangerd
|
||||
$USER_LIB/banger-vsock-agent
|
||||
|
||||
Make sure $USER_BIN is in your PATH, then finish setup with:
|
||||
sudo $USER_BIN/banger system install
|
||||
$USER_BIN/banger doctor
|
||||
|
||||
EOF
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
# System install: confirm scope, then re-exec sudo
|
||||
# ----------------------------------------------------------------------
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue