-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·138 lines (88 loc) · 2.35 KB
/
install.sh
File metadata and controls
executable file
·138 lines (88 loc) · 2.35 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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
#!/bin/bash
# =========================================
# SnapX Installer
# Linux + Termux
# =========================================
GREEN="\e[32m"
RED="\e[31m"
YELLOW="\e[33m"
BLUE="\e[34m"
RESET="\e[0m"
REPO_URL="https://raw.githubusercontent.com/codebysushil/SnapX/main/snapx"
echo -e "${BLUE}"
echo "========================================="
echo " SnapX Installer"
echo "========================================="
echo -e "${RESET}"
# =========================================
# Detect OS
# =========================================
detect_os() {
if [ -n "$PREFIX" ] && command -v pkg >/dev/null 2>&1; then
OS="termux"
elif command -v apt >/dev/null 2>&1; then
OS="debian"
elif command -v pacman >/dev/null 2>&1; then
OS="arch"
elif command -v dnf >/dev/null 2>&1; then
OS="fedora"
else
OS="unknown"
fi
}
# =========================================
# Install Dependencies
# =========================================
install_dependencies() {
echo -e "${YELLOW}➜ Checking dependencies...${RESET}"
case "$OS" in
termux)
pkg update -y
pkg install curl tar -y
;;
debian)
sudo apt update
sudo apt install curl tar -y
;;
arch)
sudo pacman -Sy curl tar --noconfirm
;;
fedora)
sudo dnf install curl tar -y
;;
*)
echo -e "${RED}✖ Unsupported operating system.${RESET}"
exit 1
;;
esac
}
# =========================================
# Install SnapX
# =========================================
install_snapx() {
echo ""
echo -e "${YELLOW}➜ Downloading SnapX...${RESET}"
curl -fsSL "$REPO_URL" -o snapx
if [ $? -ne 0 ]; then
echo -e "${RED}✖ Failed to download SnapX.${RESET}"
exit 1
fi
chmod +x snapx
echo ""
echo -e "${YELLOW}➜ Installing SnapX...${RESET}"
if [ "$OS" = "termux" ]; then
mv snapx "$PREFIX/bin/snapx"
else
sudo mv snapx /usr/local/bin/snapx
fi
echo ""
echo -e "${GREEN}✔ SnapX installed successfully.${RESET}"
echo ""
snapx
}
# =========================================
# Main
# =========================================
detect_os
install_dependencies
install_snapx