RPRX 5 лет назад
Родитель
Сommit
b682380819
1 измененных файлов с 28 добавлено и 2 удалено
  1. 28 2
      install-release.sh

+ 28 - 2
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/[email protected]" /etc/systemd/system/[email protected]
   mkdir -p '/etc/systemd/system/xray.service.d'
   mkdir -p '/etc/systemd/system/[email protected]/'
+  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/[email protected]
   if [[ -n "$JSONS_PATH" ]]; then
     "rm" '/etc/systemd/system/xray.service.d/10-donot_touch_single_conf.conf' \
       '/etc/systemd/system/[email protected]/10-donot_touch_single_conf.conf'