first commit
This commit is contained in:
15
scripts/build.sh
Executable file
15
scripts/build.sh
Executable file
@@ -0,0 +1,15 @@
|
||||
#!/usr/bin/env sh
|
||||
set -eu
|
||||
|
||||
cd "$(dirname "$0")/.."
|
||||
mkdir -p dist
|
||||
|
||||
GOOS="${GOOS:-linux}"
|
||||
GOARCH="${GOARCH:-amd64}"
|
||||
CGO_ENABLED=0 GOOS="$GOOS" GOARCH="$GOARCH" go build \
|
||||
-trimpath \
|
||||
-ldflags="-s -w" \
|
||||
-o "dist/rtorrent-scgi-proxy-${GOOS}-${GOARCH}" \
|
||||
./cmd/rtorrent-scgi-proxy
|
||||
|
||||
printf '%s\n' "dist/rtorrent-scgi-proxy-${GOOS}-${GOARCH}"
|
||||
21
scripts/install.sh
Executable file
21
scripts/install.sh
Executable file
@@ -0,0 +1,21 @@
|
||||
#!/usr/bin/env sh
|
||||
set -eu
|
||||
|
||||
cd "$(dirname "$0")/.."
|
||||
|
||||
if ! id rtproxy >/dev/null 2>&1; then
|
||||
useradd --system --no-create-home --shell /usr/sbin/nologin rtproxy
|
||||
fi
|
||||
|
||||
BIN_PATH="$(./scripts/build.sh)"
|
||||
install -m 0755 "$BIN_PATH" /usr/local/bin/rtorrent-scgi-proxy
|
||||
install -m 0644 systemd/rtorrent-scgi-proxy.service /etc/systemd/system/rtorrent-scgi-proxy.service
|
||||
|
||||
if [ ! -f /etc/rtorrent-scgi-proxy.env ]; then
|
||||
install -m 0600 examples/rtorrent-scgi-proxy.env /etc/rtorrent-scgi-proxy.env
|
||||
chown root:root /etc/rtorrent-scgi-proxy.env
|
||||
printf '%s\n' 'Created /etc/rtorrent-scgi-proxy.env - edit TOKEN, LISTEN_ADDR, TARGET_ADDRESS and ALLOW_NET.'
|
||||
fi
|
||||
|
||||
systemctl daemon-reload
|
||||
printf '%s\n' 'Installed. Run: systemctl enable --now rtorrent-scgi-proxy'
|
||||
Reference in New Issue
Block a user