From b68238081967efedc9019e9fa5dbce4fd960a554 Mon Sep 17 00:00:00 2001 From: RPRX <63339210+rprx@users.noreply.github.com> Date: Fri, 18 Dec 2020 19:15:56 +0000 Subject: [PATCH] Built-in service files --- install-release.sh | 30 ++++++++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) diff --git a/install-release.sh b/install-release.sh index 17eba5e..a9acd70 100644 --- a/install-release.sh +++ b/install-release.sh @@ -357,10 +357,36 @@ install_xray() { } install_startup_service_file() { - install -m 644 "${TMP_DIRECTORY}/systemd/system/xray.service" /etc/systemd/system/xray.service - install -m 644 "${TMP_DIRECTORY}/systemd/system/xray@.service" /etc/systemd/system/xray@.service mkdir -p '/etc/systemd/system/xray.service.d' mkdir -p '/etc/systemd/system/xray@.service.d/' + echo '[Unit] +Description=Xray Service +Documentation=https://github.com/xtls +After=network.target nss-lookup.target + +[Service] +User=nobody +CapabilityBoundingSet=CAP_NET_ADMIN CAP_NET_BIND_SERVICE +AmbientCapabilities=CAP_NET_ADMIN CAP_NET_BIND_SERVICE +NoNewPrivileges=true +ExecStart=/usr/local/bin/xray run -config /usr/local/etc/xray/config.json + +[Install] +WantedBy=multi-user.target' > /etc/systemd/system/xray.service + echo '[Unit] +Description=Xray Service +Documentation=https://github.com/xtls +After=network.target nss-lookup.target + +[Service] +User=nobody +CapabilityBoundingSet=CAP_NET_ADMIN CAP_NET_BIND_SERVICE +AmbientCapabilities=CAP_NET_ADMIN CAP_NET_BIND_SERVICE +NoNewPrivileges=true +ExecStart=/usr/local/bin/xray run -config /usr/local/etc/xray/%i.json + +[Install] +WantedBy=multi-user.target' > /etc/systemd/system/xray@.service if [[ -n "$JSONS_PATH" ]]; then "rm" '/etc/systemd/system/xray.service.d/10-donot_touch_single_conf.conf' \ '/etc/systemd/system/xray@.service.d/10-donot_touch_single_conf.conf'