#!/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 use /etc/headscale/config.yaml.example as 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 }