first commit
parent
6db9bcc3dd
commit
63917c2807
|
@ -0,0 +1,58 @@
|
|||
#!/bin/bash
|
||||
# Naive Client setup , run as root
|
||||
|
||||
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:/usr/local:~/bin
|
||||
export PATH
|
||||
|
||||
|
||||
apt-get install xz-utils
|
||||
|
||||
# get_architecture
|
||||
arch=$(uname -m)
|
||||
|
||||
# 设置 ARCHITECTURE 变量
|
||||
if [[ $arch == "aarch64" ]]; then
|
||||
ARCHITECTURE="arm64"
|
||||
elif [[ $arch == "x86_64" ]]; then
|
||||
ARCHITECTURE="x64"
|
||||
else
|
||||
ARCHITECTURE="unknown"
|
||||
fi
|
||||
|
||||
# 输出结果
|
||||
echo "ARCHITECTURE: $ARCHITECTURE"
|
||||
|
||||
|
||||
mkdir -p /root/myserve/naiveproxy && cd /root/myserve/naiveproxy
|
||||
|
||||
github_project="klzgrad/naiveproxy"
|
||||
tag=$(wget -qO- -t1 -T2 "https://api.github.com/repos/${github_project}/releases/latest" | grep "tag_name" | head -n 1 | awk -F ":" '{print $2}' | sed 's/\"//g;s/,//g;s/ //g')
|
||||
# echo $tag
|
||||
wget https://github.com/klzgrad/naiveproxy/releases/download/$tag/naiveproxy-$tag-linux-$ARCHITECTURE.tar.xz
|
||||
|
||||
# 解压并整理目录
|
||||
tar -Jxv -f naiveproxy-*-linux-$ARCHITECTURE.tar.xz && rm naiveproxy-*-linux-$ARCHITECTURE.tar.xz
|
||||
mv naiveproxy-*-linux-$ARCHITECTURE/naive ./ && rm -r naiveproxy-*-linux-$ARCHITECTURE
|
||||
|
||||
|
||||
cat > /etc/systemd/system/naiveproxy.service <<EOF
|
||||
[Unit]
|
||||
Description=naiveproxy client Service
|
||||
Documentation=https://github.com/klzgrad/naiveproxy
|
||||
After=network.target nss-lookup.target
|
||||
|
||||
[Service]
|
||||
User=root
|
||||
Group=root
|
||||
ExecStart=/root/myserve/naiveproxy/naive /root/myserve/naiveproxy/config.json
|
||||
Restart=on-failure
|
||||
LimitNPROC=10000
|
||||
LimitNOFILE=1000000
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
EOF
|
||||
|
||||
|
||||
systemctl daemon-reload
|
||||
sudo systemctl enable naiveproxy.service
|
Loading…
Reference in New Issue