-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·52 lines (41 loc) · 1.16 KB
/
install.sh
File metadata and controls
executable file
·52 lines (41 loc) · 1.16 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
#!/bin/bash
set -e
REPO="topcug/secclear-cli"
INSTALL_DIR="/usr/local/bin"
get_latest_release() {
curl -s "https://api.github.com/repos/$REPO/releases/latest" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/'
}
get_platform() {
case "$(uname -s)" in
Linux*) echo "linux";;
Darwin*) echo "darwin";;
*) echo "unsupported"; exit 1;;
esac
}
get_arch() {
case "$(uname -m)" in
x86_64) echo "amd64";;
aarch64) echo "arm64";;
arm64) echo "arm64";;
*) echo "unsupported"; exit 1;;
esac
}
main() {
PLATFORM=$(get_platform)
ARCH=$(get_arch)
VERSION=$(get_latest_release)
echo "Installing secclear $VERSION for $PLATFORM-$ARCH..."
DOWNLOAD_URL="https://github.com/$REPO/releases/download/$VERSION/secclear-$PLATFORM-$ARCH"
TMP_FILE="/tmp/secclear"
curl -sSL "$DOWNLOAD_URL" -o "$TMP_FILE"
chmod +x "$TMP_FILE"
if [ -w "$INSTALL_DIR" ]; then
mv "$TMP_FILE" "$INSTALL_DIR/secclear"
else
echo "Need sudo to install to $INSTALL_DIR"
sudo mv "$TMP_FILE" "$INSTALL_DIR/secclear"
fi
echo "secclear installed successfully!"
echo "Run: secclear scan minikube"
}
main