-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathinstall.sh
55 lines (47 loc) · 1.4 KB
/
install.sh
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
#!/bin/bash
set -e
# Define variables
REPO="nullswan/nomi"
LATEST_RELEASE=$(curl -s https://api.github.com/repos/nullswan/nomi/releases/latest | grep '"tag_name":' | cut -d '"' -f 4)
PLATFORM="$(uname | tr '[:upper:]' '[:lower:]')"
ARCHITECTURE="$(uname -m)"
case "${PLATFORM}-${ARCHITECTURE}" in
darwin-arm64)
ARCH="arm64"
;;
linux-386)
ARCH="386"
;;
linux-amd64)
ARCH="amd64"
;;
linux-arm64)
ARCH="arm64"
;;
*)
echo "Unsupported platform or architecture: ${PLATFORM}-${ARCHITECTURE}"
exit 1
;;
esac
# Construct the download URL
DOWNLOAD_URL="https://github.com/$REPO/releases/download/$LATEST_RELEASE/nomi-cli-${PLATFORM}-${ARCH}"
# Download
echo "Downloading $DOWNLOAD_URL..."
curl --location --progress-bar --output nomi-cli $DOWNLOAD_URL
echo "Installing nomi..."
mkdir -p ~/.local/bin
mv nomi-cli ~/.local/bin/nomi
chmod +x ~/.local/bin/nomi
rm -f nomi-cli
read -p "Do you want to add ~/.local/bin to your PATH? (y/n): " response < /dev/tty
if [[ "$response" =~ ^[Yy]$ ]]; then
for rc in ~/.bashrc ~/.zshrc; do
if ! grep -q 'export PATH="$HOME/.local/bin:$PATH"' "$rc"; then
echo 'export PATH="$HOME/.local/bin:$PATH"' >> "$rc"
echo "Added to $rc"
source "$rc"
fi
done
echo "PATH updated. Please restart your terminal or run 'source ~/.bashrc' or 'source ~/.zshrc'."
fi
echo "nomi installed successfully!"