-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·114 lines (97 loc) · 3.99 KB
/
install.sh
File metadata and controls
executable file
·114 lines (97 loc) · 3.99 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
#!/usr/bin/env bash
# helm installer — https://getkaze.dev/helm/install.sh
# Usage: curl -fsSL https://getkaze.dev/helm/install.sh | bash
set -euo pipefail
BINARY_NAME="helm"
RELEASES_BASE="https://github.com/getkaze/helm/releases"
# Resolve real user home when running under sudo.
if [ -n "${SUDO_USER:-}" ]; then
REAL_HOME="$(eval echo "~${SUDO_USER}")"
else
REAL_HOME="$HOME"
fi
# Install directory: ~/.local/bin (user-writable).
INSTALL_DIR="${REAL_HOME}/.local/bin"
mkdir -p "$INSTALL_DIR" 2>/dev/null || {
echo "error: could not create ${INSTALL_DIR}" >&2
echo "" >&2
echo "Try running without sudo:" >&2
echo " curl -fsSL https://getkaze.dev/helm/install.sh | bash" >&2
echo "" >&2
echo "Or create the directory first:" >&2
echo " mkdir -p ${INSTALL_DIR}" >&2
echo " curl -fsSL https://getkaze.dev/helm/install.sh | bash" >&2
exit 1
}
# Ensure the directory is owned by the real user (not root).
if [ -n "${SUDO_USER:-}" ]; then
chown -R "${SUDO_USER}" "${REAL_HOME}/.local"
fi
# ── color helpers ──────────────────────────────────────────────────────────────
bold=$(tput bold 2>/dev/null || true)
reset=$(tput sgr0 2>/dev/null || true)
green=$(tput setaf 2 2>/dev/null || true)
red=$(tput setaf 1 2>/dev/null || true)
info() { echo "${bold}==>${reset} $*"; }
ok() { echo "${green} ✓${reset} $*"; }
fail() { echo "${red}error:${reset} $*" >&2; exit 1; }
# ── sanity checks ─────────────────────────────────────────────────────────────
OS="$(uname -s | tr '[:upper:]' '[:lower:]')"
case "$OS" in
linux) ;;
darwin) ;;
*) fail "unsupported OS: $OS (supported: linux, darwin)" ;;
esac
ARCH="$(uname -m)"
case "$ARCH" in
x86_64) ARCH="amd64" ;;
aarch64) ARCH="arm64" ;;
arm64) ARCH="arm64" ;;
*) fail "unsupported architecture: $ARCH" ;;
esac
# Detect HELM_VERSION (optional — defaults to latest)
VERSION="${HELM_VERSION:-}"
if [ -z "$VERSION" ]; then
info "fetching latest version"
VERSION="$(curl -fsSL -o /dev/null -w '%{url_effective}' "${RELEASES_BASE}/latest" 2>/dev/null || true)"
VERSION="${VERSION##*/}"
[ -n "$VERSION" ] && [ "$VERSION" != "latest" ] || fail "could not fetch latest version from ${RELEASES_BASE}/latest"
VERSION="$(echo "$VERSION" | tr -d '[:space:]')"
fi
DOWNLOAD_URL="${RELEASES_BASE}/download/${VERSION}/${BINARY_NAME}-${OS}-${ARCH}"
# ── download binary ────────────────────────────────────────────────────────────
info "installing helm ${VERSION} (${OS}/${ARCH})"
TMP="$(mktemp)"
trap 'rm -f "$TMP"' EXIT
if command -v curl &>/dev/null; then
curl -fsSL "$DOWNLOAD_URL" -o "$TMP"
elif command -v wget &>/dev/null; then
wget -qO "$TMP" "$DOWNLOAD_URL"
else
fail "curl or wget is required"
fi
chmod +x "$TMP"
mv "$TMP" "${INSTALL_DIR}/${BINARY_NAME}"
ok "binary installed to ${INSTALL_DIR}/${BINARY_NAME}"
# ── done ───────────────────────────────────────────────────────────────────────
echo ""
echo "${bold}helm ${VERSION} installed successfully!${reset}"
# Check if install dir is in PATH
case ":${PATH}:" in
*":${INSTALL_DIR}:"*) ;;
*)
echo ""
echo "${bold}Note:${reset} ${INSTALL_DIR} is not in your PATH."
echo " Add it to your shell profile:"
echo ""
echo " export PATH=\"${INSTALL_DIR}:\$PATH\""
echo ""
;;
esac
echo ""
echo "Quick start:"
echo " helm init # initialize a project"
echo " helm status # show pipeline dashboard"
echo " helm resume # resume from last session"
echo " helm save # checkpoint session state"
echo ""