Skip to content

Commit

Permalink
Update release scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
nekohasekai committed Mar 31, 2023
1 parent 187421c commit 2012c0c
Show file tree
Hide file tree
Showing 10 changed files with 10 additions and 21 deletions.
3 changes: 0 additions & 3 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,6 @@ nfpms:
dst: /etc/systemd/system/[email protected]
- src: LICENSE
dst: /usr/share/licenses/sing-box/LICENSE
scripts:
postinstall: release/config/postinstall.sh
postremove: release/config/postremove.sh
source:
enabled: false
name_template: '{{ .ProjectName }}-{{ .Version }}.source'
Expand Down
4 changes: 2 additions & 2 deletions docs/examples/linux-server-installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
#### Install

```shell
git clone https://github.com/SagerNet/sing-box
git clone -b main https://github.com/SagerNet/sing-box
cd sing-box
./release/local/install_go.sh # skip if you have go1.19 already installed
./release/local/install_go.sh # skip if you have golang already installed
./release/local/install.sh
```

Expand Down
4 changes: 2 additions & 2 deletions docs/examples/linux-server-installation.zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
#### 安装

```shell
git clone https://github.com/SagerNet/sing-box
git clone -b main https://github.com/SagerNet/sing-box
cd sing-box
./release/local/install_go.sh # 如果已安装 go1.19 则跳过
./release/local/install_go.sh # 如果已安装 golang 则跳过
./release/local/install.sh
```

Expand Down
3 changes: 0 additions & 3 deletions release/config/postinstall.sh

This file was deleted.

3 changes: 0 additions & 3 deletions release/config/postremove.sh

This file was deleted.

3 changes: 1 addition & 2 deletions release/config/sing-box.service
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,9 @@ Documentation=https://sing-box.sagernet.org
After=network.target nss-lookup.target

[Service]
WorkingDirectory=/var/lib/sing-box
CapabilityBoundingSet=CAP_NET_ADMIN CAP_NET_BIND_SERVICE CAP_SYS_PTRACE CAP_DAC_READ_SEARCH
AmbientCapabilities=CAP_NET_ADMIN CAP_NET_BIND_SERVICE CAP_SYS_PTRACE CAP_DAC_READ_SEARCH
ExecStart=/usr/bin/sing-box run -c /etc/sing-box/config.json
ExecStart=/usr/bin/sing-box -D /var/lib/sing-box -C /etc/sing-box run
ExecReload=/bin/kill -HUP $MAINPID
Restart=on-failure
RestartSec=10s
Expand Down
3 changes: 1 addition & 2 deletions release/config/[email protected]
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,9 @@ Documentation=https://sing-box.sagernet.org
After=network.target nss-lookup.target

[Service]
WorkingDirectory=/var/lib/sing-box-%i
CapabilityBoundingSet=CAP_NET_ADMIN CAP_NET_BIND_SERVICE CAP_SYS_PTRACE CAP_DAC_READ_SEARCH
AmbientCapabilities=CAP_NET_ADMIN CAP_NET_BIND_SERVICE CAP_SYS_PTRACE CAP_DAC_READ_SEARCH
ExecStart=/usr/bin/sing-box run -c /etc/sing-box/%i.json
ExecStart=/usr/bin/sing-box -D /var/lib/sing-box-%i -c /etc/sing-box/%i.json run
ExecReload=/bin/kill -HUP $MAINPID
Restart=on-failure
RestartSec=10s
Expand Down
1 change: 0 additions & 1 deletion release/local/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ go install -v -trimpath -ldflags "-s -w -buildid=" -tags with_quic,with_wireguar
popd

sudo cp $(go env GOPATH)/bin/sing-box /usr/local/bin/
sudo mkdir -p /var/lib/sing-box
sudo mkdir -p /usr/local/etc/sing-box
sudo cp $PROJECT/release/config/config.json /usr/local/etc/sing-box/config.json
sudo cp $DIR/sing-box.service /etc/systemd/system
Expand Down
4 changes: 3 additions & 1 deletion release/local/install_go.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
#!/usr/bin/env bash

set -e -o pipefail
curl -Lo go.tar.gz https://go.dev/dl/go1.20.1.linux-amd64.tar.gz

go_version=$(curl -s https://raw.githubusercontent.com/actions/go-versions/main/versions-manifest.json | grep -oE '"version": "[0-9]{1}.[0-9]{1,}(.[0-9]{1,})?"' | head -1 | cut -d':' -f2 | sed 's/ //g; s/"//g')
curl -Lo go.tar.gz "https://go.dev/dl/go$go_version.linux-amd64.tar.gz"
sudo rm -rf /usr/local/go
sudo tar -C /usr/local -xzf go.tar.gz
rm go.tar.gz
3 changes: 1 addition & 2 deletions release/local/sing-box.service
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,9 @@ Documentation=https://sing-box.sagernet.org
After=network.target nss-lookup.target

[Service]
WorkingDirectory=/var/lib/sing-box
CapabilityBoundingSet=CAP_NET_ADMIN CAP_NET_BIND_SERVICE CAP_SYS_PTRACE CAP_DAC_READ_SEARCH
AmbientCapabilities=CAP_NET_ADMIN CAP_NET_BIND_SERVICE CAP_SYS_PTRACE CAP_DAC_READ_SEARCH
ExecStart=/usr/local/bin/sing-box run -c /usr/local/etc/sing-box/config.json
ExecStart=/usr/local/bin/sing-box -D /var/lib/sing-box -C /usr/local/etc/sing-box run
ExecReload=/bin/kill -HUP $MAINPID
Restart=on-failure
RestartSec=10s
Expand Down

0 comments on commit 2012c0c

Please sign in to comment.