-
Notifications
You must be signed in to change notification settings - Fork 1
/
singbox.sh
67 lines (67 loc) · 2.06 KB
/
singbox.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
58
59
60
61
62
63
64
65
66
67
#!/bin/bash
# Installer script written by Lumière Élevé
appName="Sing Box"
debArch=$(uname -m)
transArch=$debArch
targetVer="1.5.5"
case $debArch in
"x86_64" | "amd64")
transArch="amd64"
;;
"arm64" | "armv8l" | "aarch64")
transArch="arm64"
;;
esac
echo "Installing $appName for $debArch..."
echo "Preparing folders..."
if [ -e "$PREFIX/opt/sing-box" ] ; then
echo "Directory already existed."
else
mkdir -p $PREFIX/opt/sing-box
fi
filename="sing-box-${targetVer}-linux-${transArch}"
if [ -e "./sing-box.tgz" ] ; then
echo "Copying sing-box to /opt ..."
cp ./sing-box.tgz $PREFIX/opt/sing-box/
else
echo "Downloading sing-box..."
curl -Lso $PREFIX/opt/sing-box/sing-box.tgz https://github.com/SagerNet/sing-box/releases/download/v${targetVer}/${filename}.tar.gz
fi
cd $PREFIX/opt/sing-box/
echo "Extracting archives..."
tar zxvf sing-box.tgz && rm sing-box.tgz
mv ./${filename}/* ./
rmdir ./${filename}
echo "Linking executables..."
if [ -e "$PREFIX/bin/sing-box" ] ; then
echo "Found pre-existing copy."
else
ln -s $PREFIX/opt/sing-box/sing-box $PREFIX/bin/sing-box
fi
printf "Testing Systemd... "
if [ -e "$PREFIX/lib/systemd" ] ; then
echo "found."
if [ -e "$PREFIX/lib/systemd/system/sing-box.service" ] ; then
echo "Skipped registering."
else
echo "Registering sing-box as service..."
curl -Lo "$PREFIX/lib/systemd/system/sing-box.service" https://github.com/PoneyClairDeLune/tempest/raw/main/blob/sing-box/sing-box.service
echo "Reloading daemon..."
systemctl daemon-reload
fi
if [ -e "$PREFIX/lib/systemd/system/[email protected]" ] ; then
echo "Skipped registering."
else
echo "Registering sing-box as service..."
curl -Lo "$PREFIX/lib/systemd/system/[email protected]" https://github.com/PoneyClairDeLune/tempest/raw/main/blob/sing-box/[email protected]
echo "Reloading daemon..."
systemctl daemon-reload
fi
else
echo "not found."
fi
echo "Filling for configuration files..."
mkdir -p $PREFIX/etc/sing-box/
echo "{}" > $PREFIX/etc/sing-box/config.json
echo "Sing Box is now installed on your system. Modify /etc/sing-box/config.json for more info."
exit