-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathinstall.sh
More file actions
68 lines (54 loc) · 1.87 KB
/
install.sh
File metadata and controls
68 lines (54 loc) · 1.87 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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#!/bin/bash
INSTALL_DIR="/usr/local/bin"
REPO="jamesvillarrubia/pullcraft"
# Determine system architecture
ARCH=$(uname -m)
case $ARCH in
x86_64)
BINARY_ARCH="x64"
;;
arm64|aarch64)
BINARY_ARCH="arm64"
;;
*)
echo "Unsupported architecture: $ARCH"
exit 1
;;
esac
# Get the latest release version
LATEST_VERSION=$(curl -s https://api.github.com/repos/$REPO/releases/latest | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/')
if [ -z "$LATEST_VERSION" ]; then
echo "Failed to fetch the latest version. Please check your internet connection and try again."
exit 1
fi
echo "Latest version: $LATEST_VERSION"
echo "System architecture: $ARCH, downloading binary for $BINARY_ARCH"
# Download the latest release
echo "Downloading PullCraft..."
curl -L "https://github.com/$REPO/releases/download/$LATEST_VERSION/pullcraft" -o pullcraft
if [ $? -ne 0 ]; then
echo "Failed to download PullCraft. Please check your internet connection and try again."
exit 1
fi
# Make the binary executable
chmod +x pullcraft
# Move the binary to the installation directory
sudo mv pullcraft "$INSTALL_DIR/pullcraft"
if [ $? -ne 0 ]; then
echo "Failed to move PullCraft to $INSTALL_DIR. Please check your permissions and try again."
exit 1
fi
echo "PullCraft has been installed successfully in $INSTALL_DIR"
echo "You can now use the 'pullcraft' command to run the application."
# Update PATH if necessary
if [[ ":$PATH:" != *":$INSTALL_DIR:"* ]]; then
echo "export PATH=\"$INSTALL_DIR:\$PATH\"" >> ~/.bashrc
echo "Please restart your terminal or run 'source ~/.bashrc' to update your PATH."
fi
# Verify the installation
echo "Verifying installation..."
$INSTALL_DIR/pullcraft --version
if [ $? -ne 0 ]; then
echo "Installation verification failed. Please check if the binary is compatible with your system."
exit 1
fi