#!/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'