Fix ss-server scripts

This commit is contained in:
XYenon 2022-05-11 19:28:47 +08:00 committed by 世界
parent 11764949f0
commit c97267395d
No known key found for this signature in database
GPG key ID: CD109927C34A63C4
3 changed files with 20 additions and 6 deletions

View file

@ -2,12 +2,20 @@
export GOAMD64=v3
DIR=$(dirname "$0")
PROJECT=$DIR/../..
PATH="$PATH:$(go env GOPATH)/bin"
pushd $PROJECT
go install -v -trimpath -ldflags "-s -w -buildid=" ./cli/genpsk || exit 1
go install -v -trimpath -ldflags "-s -w -buildid=" ./cli/ss-server || exit 1
popd
sudo cp $(go env GOPATH)/bin/ss-server /usr/local/bin/ || exit 1
sudo mkdir -p /usr/local/etc/shadowsocks || exit 1
sudo cp ./cli/ss-server/config.json /usr/local/etc/shadowsocks/config.json || exit 1
sudo cp $DIR/config.json /usr/local/etc/shadowsocks/config.json || exit 1
echo ">> /usr/local/etc/shadowsocks/config.json"
sudo sed -i "s|psk|$(go run ./cli/genpsk 16)|" /usr/local/etc/shadowsocks/config.json || exit 1
sudo sed -i "s|psk|$(genpsk 16)|" /usr/local/etc/shadowsocks/config.json || exit 1
sudo cat /usr/local/etc/shadowsocks/config.json || exit 1
sudo cp ./cli/ss-server/ss.service /etc/systemd/system || exit 1
sudo cp $DIR/ss.service /etc/systemd/system || exit 1
sudo systemctl daemon-reload

View file

@ -2,7 +2,7 @@
sudo systemctl stop ss
sudo systemctl stop 'ss@*'
sudo rm /usr/local/bin/ss-server
sudo rm -r /usr/local/etc/shadowsocks
sudo rm /etc/systemd/system/ss.service
sudo rm -rf /usr/local/bin/ss-server
sudo rm -rf /usr/local/etc/shadowsocks
sudo rm -rf /etc/systemd/system/ss.service
sudo systemctl daemon-reload

View file

@ -2,10 +2,16 @@
export GOAMD64=v3
DIR=$(dirname "$0")
PROJECT=$DIR/../..
pushd $PROJECT
git fetch || exit 1
git reset origin/main --hard || exit 1
git clean -fdx || exit 1
go install -v -trimpath -ldflags "-s -w -buildid=" ./cli/ss-server || exit 1
popd
sudo systemctl stop ss
sudo cp $(go env GOPATH)/bin/ss-server /usr/local/bin || exit 1
sudo systemctl start ss