forked from ankitpokhrel/jira-cli
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·36 lines (28 loc) · 1013 Bytes
/
install.sh
File metadata and controls
executable file
·36 lines (28 loc) · 1013 Bytes
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
#!/bin/sh
set -e
REPO="antonzaytsev/jira-cli"
INSTALL_DIR="${HOME}/.local/bin"
ARCH=$(uname -m)
case "$ARCH" in
arm64|aarch64) ARCH="arm64" ;;
x86_64) ARCH="x86_64" ;;
*) echo "Unsupported architecture: $ARCH" >&2; exit 1 ;;
esac
VERSION=$(curl -sI "https://github.com/${REPO}/releases/latest" | grep -i '^location:' | sed 's|.*/v||;s/[[:space:]]//g')
if [ -z "$VERSION" ]; then
echo "Failed to determine latest version" >&2
exit 1
fi
URL="https://github.com/${REPO}/releases/download/v${VERSION}/jira_${VERSION}_macOS_${ARCH}.tar.gz"
TMP=$(mktemp -d)
echo "Downloading jira v${VERSION} (${ARCH})..."
curl -sL "$URL" | tar -xz -C "$TMP"
mkdir -p "$INSTALL_DIR"
mv "$TMP/jira_${VERSION}_macOS_${ARCH}/bin/jira" "$INSTALL_DIR/jira"
rm -rf "$TMP"
if ! echo "$PATH" | grep -q "$INSTALL_DIR"; then
echo ""
echo "Add this to your shell config (~/.zshrc or ~/.bashrc):"
echo " export PATH=\"${INSTALL_DIR}:\$PATH\""
fi
echo "Installed jira v${VERSION} to ${INSTALL_DIR}/jira"