install.sh: POSIX-compatible 'set -o pipefail' so 'curl | sh' works
The README documents the one-liner as 'curl ... install.sh | sh', but on Debian/Ubuntu /bin/sh is dash which rejects 'set -o pipefail' unknown option. The shebang #!/usr/bin/env bash is honored only when the script is invoked directly — when piped via 'curl | sh' the running shell IS dash. Fix: split the strict-mode setup. 'set -eu' is POSIX-portable (every shell). 'pipefail' is then enabled conditionally only on shells that recognise it. Every curl/tar/install step in the rest of the script checks its own exit code, so losing pipefail in dash costs no behaviour — the installer still fails fast on any error.
This commit is contained in:
+6
-1
@@ -19,7 +19,12 @@
|
||||
# 0 — installed successfully
|
||||
# 1 — error (unsupported arch, download failure, permission denied)
|
||||
|
||||
set -euo pipefail
|
||||
# POSIX-friendly: -eu is universal, pipefail only on shells that
|
||||
# support it (bash, ksh, dash >= 0.5.12). Without pipefail the
|
||||
# installer still exits on the first hard error since every curl/
|
||||
# tar/install step is checked explicitly.
|
||||
set -eu
|
||||
(set -o pipefail) 2>/dev/null && set -o pipefail || true
|
||||
|
||||
REPO="${SKELETONKEY_REPO:-KaraZajac/SKELETONKEY}"
|
||||
VERSION="${SKELETONKEY_VERSION:-latest}"
|
||||
|
||||
Reference in New Issue
Block a user