-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
42 lines (35 loc) · 965 Bytes
/
Copy pathinstall.sh
File metadata and controls
42 lines (35 loc) · 965 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
37
38
39
40
41
42
#!/bin/bash
# Determine the OS
OS=$(uname -s)
if [[ "$OS" == "Linux" ]]; then
BINARY_NAME="urlactions"
elif [[ "$OS" == "Darwin" ]]; then
BINARY_NAME="urlcli"
else
echo "Unsupported operating system: $OS"
exit 1
fi
DESTINATION="/usr/local/bin"
# Ensure the script is run with root privileges
if [[ $EUID -ne 0 ]]; then
echo "This script must be run as root. Try 'sudo ./install.sh'."
exit 1
fi
# Check if the binary exists in the current directory
if [[ ! -f "$BINARY_NAME" ]]; then
echo "Error: $BINARY_NAME not found in the current directory."
exit 1
fi
# Make the binary executable
chmod +x "$BINARY_NAME"
# Move the binary to the destination directory
echo "Installing $BINARY_NAME to $DESTINATION..."
mv "$BINARY_NAME" "$DESTINATION"
# Verify installation
if [[ $? -eq 0 ]]; then
echo "Installation successful!"
echo "You can now run the tool using: $BINARY_NAME"
else
echo "Installation failed."
exit 1
fi