-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·53 lines (46 loc) · 1.29 KB
/
install.sh
File metadata and controls
executable file
·53 lines (46 loc) · 1.29 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
#!/bin/bash
set -e
INSTALL_PATH="${1:-/usr/local/bin}"
REPO="codingarchitect-wq/xsops"
SCRIPT_NAME="xsops"
# Verify supported OS
case "$(uname | tr '[:upper:]' '[:lower:]')" in
linux*|darwin*)
;;
*)
echo "Error: Unsupported OS: $(uname)"
echo "xsops requires Linux or macOS with bash."
exit 1
;;
esac
# Verify install path exists
if [[ ! -d "$INSTALL_PATH" ]]; then
echo "Error: $INSTALL_PATH does not exist."
exit 1
fi
# Check for download tool
download() {
local url="$1"
local dest="$2"
if command -v curl &> /dev/null; then
curl -fsSL "$url" -o "$dest"
elif command -v wget &> /dev/null; then
wget -qO "$dest" "$url"
else
echo "Error: curl or wget required."
exit 1
fi
}
echo "Downloading xsops..."
DOWNLOAD_URL="https://raw.githubusercontent.com/${REPO}/main/${SCRIPT_NAME}"
TEMP_FILE=$(mktemp)
trap "rm -f $TEMP_FILE" EXIT
download "$DOWNLOAD_URL" "$TEMP_FILE"
echo "Installing to ${INSTALL_PATH}/${SCRIPT_NAME}..."
if mv "$TEMP_FILE" "${INSTALL_PATH}/${SCRIPT_NAME}" && chmod 755 "${INSTALL_PATH}/${SCRIPT_NAME}"; then
echo "Successfully installed xsops to ${INSTALL_PATH}/${SCRIPT_NAME}"
else
echo "Failed to install. Try running with sudo:"
echo " curl -fsSL https://raw.githubusercontent.com/${REPO}/main/install.sh | sudo bash"
exit 1
fi