-
Notifications
You must be signed in to change notification settings - Fork 13
/
install.sh
executable file
·43 lines (35 loc) · 1.14 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
#!/bin/bash
# Set variables
OS=$(uname -s | tr '[:upper:]' '[:lower:]')
ARCH=$(uname -m)
TAG_WITHOUT_VERSION_PREFIX=$(echo "v0.8.4" | sed 's/^v//')
if [ "$OS" = "darwin" ]; then
if [ "$ARCH" = "arm64" ]; then
BINARY_NAME="redo_${TAG_WITHOUT_VERSION_PREFIX}_Darwin_arm64.tar.gz"
else
BINARY_NAME="redo_${TAG_WITHOUT_VERSION_PREFIX}_Darwin_x86_64.tar.gz"
fi
elif [ "$OS" = "linux" ]; then
if [ "$ARCH" = "arm64" ]; then
BINARY_NAME="redo_${TAG_WITHOUT_VERSION_PREFIX}_Linux_arm64.tar.gz"
else
BINARY_NAME="redo_${TAG_WITHOUT_VERSION_PREFIX}_Linux_x86_64.tar.gz"
fi
else
echo "Unsupported OS/ARCH: $OS/$ARCH"
exit 1
fi
RELEASE_URL="https://github.com/barthr/redo/releases/download/v0.8.4/${BINARY_NAME}"
INSTALL_PATH="/usr/local/bin"
# Download the binary
curl -L -o redo.tar.gz $RELEASE_URL
# Extract the binary and move it to the installation path
echo "Extracting and installing redo binary to $INSTALL_PATH..."
tar -zxvf redo.tar.gz redo
sudo mv redo "$INSTALL_PATH"
# Make the binary executable
sudo chmod +x $INSTALL_PATH/redo
#Cleanup
rm redo.tar.gz
# Print success message
echo "Successfully installed redo to $INSTALL_PATH"