-
Notifications
You must be signed in to change notification settings - Fork 446
/
install.sh
57 lines (49 loc) · 1.7 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
51
52
53
54
55
56
57
#!/bin/bash
#
# Dante Socks5 Server AutoInstall
# -- Owner: https://www.inet.no/dante
# -- Provider: https://sockd.info
# -- Author: Lozy
#
# Check if user is root
if [ $(id -u) != "0" ]; then
echo "Error: You must be root to run this script, please use root to install"
exit 1
fi
REQUEST_SERVER="https://raw.github.com/Lozy/danted/master"
SCRIPT_SERVER="https://public.sockd.info"
SYSTEM_RECOGNIZE=""
[ "$1" == "--no-github" ] && REQUEST_SERVER=${SCRIPT_SERVER}
if [ -s "/etc/os-release" ];then
os_name=$(sed -n 's/PRETTY_NAME="\(.*\)"/\1/p' /etc/os-release)
if [ -n "$(echo ${os_name} | grep -Ei 'Debian|Ubuntu' )" ];then
printf "Current OS: %s\n" "${os_name}"
SYSTEM_RECOGNIZE="debian"
elif [ -n "$(echo ${os_name} | grep -Ei 'CentOS')" ];then
printf "Current OS: %s\n" "${os_name}"
SYSTEM_RECOGNIZE="centos"
else
printf "Current OS: %s is not support.\n" "${os_name}"
fi
elif [ -s "/etc/issue" ];then
if [ -n "$(grep -Ei 'CentOS' /etc/issue)" ];then
printf "Current OS: %s\n" "$(grep -Ei 'CentOS' /etc/issue)"
SYSTEM_RECOGNIZE="centos"
else
printf "+++++++++++++++++++++++\n"
cat /etc/issue
printf "+++++++++++++++++++++++\n"
printf "[Error] Current OS: is not available to support.\n"
fi
else
printf "[Error] (/etc/os-release) OR (/etc/issue) not exist!\n"
printf "[Error] Current OS: is not available to support.\n"
fi
if [ -n "$SYSTEM_RECOGNIZE" ];then
wget -qO- --no-check-certificate ${REQUEST_SERVER}/install_${SYSTEM_RECOGNIZE}.sh | \
bash -s -- $* | tee /tmp/danted_install.log
else
printf "[Error] Installing terminated"
exit 1
fi
exit 0