summaryrefslogtreecommitdiff
path: root/net-vpn/headscale/files/headscale.initd
diff options
context:
space:
mode:
authorV3n3RiX <venerix@koprulu.sector>2022-05-12 16:42:50 +0300
committerV3n3RiX <venerix@koprulu.sector>2022-05-12 16:42:50 +0300
commit752d6256e5204b958b0ef7905675a940b5e9172f (patch)
tree330d16e6362a49cbed8875a777fe641a43376cd3 /net-vpn/headscale/files/headscale.initd
parent0c100b7dd2b30e75b799d806df4ef899fd98e1ea (diff)
gentoo resync : 12.05.2022
Diffstat (limited to 'net-vpn/headscale/files/headscale.initd')
-rw-r--r--net-vpn/headscale/files/headscale.initd29
1 files changed, 29 insertions, 0 deletions
diff --git a/net-vpn/headscale/files/headscale.initd b/net-vpn/headscale/files/headscale.initd
new file mode 100644
index 000000000000..5a98c0e6cb34
--- /dev/null
+++ b/net-vpn/headscale/files/headscale.initd
@@ -0,0 +1,29 @@
+#!/sbin/openrc-run
+# Copyright 2022 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+description="Headscale Server daemon"
+command="/usr/bin/headscale"
+user="${HEADSCALE_USER}:${HEADSCALE_GROUP}"
+directory="/var/lib/headscale"
+output_log="/var/log/headscale.log"
+error_log="/var/log/headscale.log"
+
+start_stop_daemon_args="--user \"${user}\" ${HEADSCALE_OPTIONS} --background"
+
+depend() {
+ need net
+}
+
+start_pre() {
+ if [ ! -s /etc/headscale/config.yaml ] ; then
+ eerror "Missing headscale configuration file"
+ eerror "Please check the documentation directory for an example"
+ return 1
+ fi
+
+ checkpath -d -m 700 -o "${user}" /run/headscale /var/lib/headscale
+ checkpath -f -m 600 -o "${user}" /var/lib/headscale/db.sqlite /var/log/headscale.log
+ checkpath -f -m 600 -o "${user}" /etc/headscale/config.yaml
+}
+