This repository was archived by the owner on Dec 31, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsingboxInstall.sh
More file actions
59 lines (50 loc) · 1.46 KB
/
singboxInstall.sh
File metadata and controls
59 lines (50 loc) · 1.46 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
#!/bin/bash
# 设置反向代理
github=https://github.com/
raw=https://raw.githubusercontent.com/
curl() {
# Copy from https://github.com/XTLS/Xray-install
if ! $(type -P curl) -L -q --retry 5 --retry-delay 10 --retry-max-time 60 "$@";then
echo "ERROR:Curl Failed, check your network"
exit 1
fi
}
# 检测微架构
case $(lscpu) in
*avx512*)
microArch=4
;;
*avx2*)
microArch=3
;;
*sse4_2*)
microArch=2
;;
*)
microArch=1
;;
esac
# 安装 xz
apt update
apt install xz-utils -y
# 安装 sing-box
groupadd --system sing-box
useradd --system --gid sing-box --create-home --home-dir /var/lib/sing-box --shell /usr/sbin/nologin sing-box
curl $github/AsenHu/box_builder/releases/download/quic/sing-box-linux-amd64-v$microArch.xz | xz -d > /usr/local/bin/sing-box
curl -o /etc/systemd/system/sing-box.service $raw/AsenHu/rootmust_script/main/systemd/sing-box.service
chmod +x /usr/local/bin/sing-box
# 配置 sing-box
mkdir -p /usr/local/etc/sing-box/
if [ ! -f /usr/local/etc/sing-box/config.json ]
then
echo -e '{}' > /usr/local/etc/sing-box/config.json
fi
if ! /usr/local/bin/sing-box check --config /usr/local/etc/sing-box/config.json
then
mv -b /usr/local/etc/sing-box/config.json /usr/local/etc/sing-box/config.json.bad
echo -e '{}' > /usr/local/etc/sing-box/config.json
fi
# 启动 sing-box
systemctl daemon-reload
systemctl enable sing-box
systemctl restart sing-box