-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathinstall.sh
executable file
·50 lines (39 loc) · 1.43 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
#!/bin/bash
# Define the release URL and the binary file name
release_url="https://api.github.com/repos/cchalop1/JustDeploy/releases/latest"
zip_file="justdeploy.zip"
binary_file="justdeploy"
# Get the current platform and architecture
platform=$(uname -s | tr '[:upper:]' '[:lower:]')
arch=$(uname -m)
if [ "$platform" == "darwin" ]; then
if [ "$arch" == "arm64" ]; then
zip_file="justdeploy-darwin-arm.zip"
binary_file_arch="justdeploy-darwin-arm"
else
zip_file="justdeploy-darwin-x86.zip"
binary_file_arch="justdeploy-darwin-x86"
fi
else
if [ "$(expr substr $(uname -m) 1 5)" == "armv7" ] || [ "$(expr substr $(uname -m) 1 3)" == "aarch64" ]; then
zip_file="justdeploy-linux-arm.zip"
binary_file_arch="justdeploy-linux-arm"
else
zip_file="justdeploy-linux-x86.zip"
binary_file_arch="justdeploy-linux-x86"
fi
fi
# Get the latest release download URL for the specific platform
response=$(curl -s $release_url)
download_url=$(echo $response | grep -o "https://github.com/cchalop1/JustDeploy/releases/download/[^ ]*/$zip_file" | head -n 1)
# Download the binary
curl -L -o $zip_file $download_url
# Unzip binary file
unzip $zip_file
# Make the binary executable
chmod +x ./bin/$binary_file_arch
# Move the binary to a system directory (e.g., /usr/local/bin)
sudo mv ./bin/$binary_file_arch /usr/local/bin/$binary_file
rm $zip_file
rm -rf ./bin
echo "✨ Installation complete. You can now run $binary_file"