fix(scripts): handle BASH_SOURCE[0] unbound when piped via curl
BASH_SOURCE[0] is unset when a script runs via `curl | bash` (no source
file on disk). With `set -u` this triggers "unbound variable" and exits.
Fall back to $0 with ${BASH_SOURCE[0]:-$0} so piped execution works.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
2a2744f897
commit
f1cec6ac33
3 changed files with 3 additions and 3 deletions
|
|
@ -14,7 +14,7 @@
|
|||
# --no-tls Skip the TLS-required sanity check (dev).
|
||||
set -euo pipefail
|
||||
|
||||
SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)"
|
||||
SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]:-$0}")" &>/dev/null && pwd)"
|
||||
cd "$SCRIPT_DIR"
|
||||
|
||||
info() { printf '[manage-server] %s\n' "$*"; }
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@
|
|||
# sudo bash uninstall.sh --purge-data # also delete DB + binaries volume
|
||||
set -euo pipefail
|
||||
|
||||
SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)"
|
||||
SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]:-$0}")" &>/dev/null && pwd)"
|
||||
cd "$SCRIPT_DIR"
|
||||
|
||||
info() { printf '[manage-server] %s\n' "$*"; }
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@
|
|||
# sudo bash upgrade.sh --image TAG # pin a specific image tag
|
||||
set -euo pipefail
|
||||
|
||||
SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)"
|
||||
SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]:-$0}")" &>/dev/null && pwd)"
|
||||
cd "$SCRIPT_DIR"
|
||||
|
||||
info() { printf '[manage-server] %s\n' "$*"; }
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue