install.sh: ingen sudo (mkdir bin först; ~/.local/bin-fallback; sudo sh för system-wide)
All checks were successful
build-and-push / build (push) Successful in 10s
All checks were successful
build-and-push / build (push) Successful in 10s
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
13
install.sh
13
install.sh
@@ -32,22 +32,21 @@ TAG=$(curl -fsSL "$API/releases/latest" | tr ',' '\n' | grep -m1 '"tag_name"' |
|
||||
[ -n "${TAG:-}" ] || { echo "agent-helm: hittade ingen release på $BASE"; exit 1; }
|
||||
URL="$BASE/$OWNER/$REPO/releases/download/$TAG/$ASSET"
|
||||
|
||||
# --- bin-katalog (root -> /usr/local/bin, annars sudo, annars ~/.local/bin) ---
|
||||
# --- bin-katalog: /usr/local/bin om root/skrivbar, annars ~/.local/bin (ingen sudo).
|
||||
# För system-wide utan att vara root: curl -fsSL ... | sudo sh
|
||||
PREFIX="${PREFIX:-/usr/local}"
|
||||
SUDO=""
|
||||
if [ "$(id -u)" = 0 ] || [ -w "$PREFIX/bin" ]; then
|
||||
if [ "$(id -u)" = 0 ] || { mkdir -p "$PREFIX/bin" 2>/dev/null && [ -w "$PREFIX/bin" ]; }; then
|
||||
BIN="$PREFIX/bin"
|
||||
elif command -v sudo >/dev/null 2>&1; then
|
||||
BIN="$PREFIX/bin"; SUDO=sudo
|
||||
else
|
||||
BIN="$HOME/.local/bin"; mkdir -p "$BIN"
|
||||
BIN="$HOME/.local/bin"
|
||||
fi
|
||||
mkdir -p "$BIN"
|
||||
|
||||
echo "agent-helm: hämtar $ASSET ($TAG) -> $BIN/agent-helm"
|
||||
tmp=$(mktemp)
|
||||
curl -fSL "$URL" -o "$tmp"
|
||||
chmod +x "$tmp"
|
||||
$SUDO install -m 0755 "$tmp" "$BIN/agent-helm"
|
||||
install -m 0755 "$tmp" "$BIN/agent-helm"
|
||||
rm -f "$tmp"
|
||||
|
||||
# --- config ---
|
||||
|
||||
Reference in New Issue
Block a user