aports/testing/adguardhome/adguardhome.initd
2025-04-15 22:00:05 +00:00

38 lines
905 B
Bash

#!/sbin/openrc-run
# fallback for /etc/conf.d/adguardhome
: ${command_user:=adguardhome:adguardhome}
: ${directory:="/var/lib/adguardhome"}
: ${cfgfile:="$directory/AdGuardHome.yaml"}
: ${extra_args=""}
name=adguardhome
description="AdGuardHome daemon"
command="/usr/bin/adguardhome"
command_args="--no-check-update --work-dir $directory --config $cfgfile $extra_args"
command_background=true
pidfile="/run/adguardhome.pid"
# bind_service for ports lower than 1024 / raw for dhcp/sockets
capabilities="^cap_net_bind_service,^cap_net_raw"
depend() {
need net
provide dns
after firewall
}
start_pre() {
checkpath -d -m 700 -o "$command_user" "$directory"
if [ -n "$logdir" ]; then
checkpath -d -o "$command_user" "$logdir"
fi
if [ -n "$output_log" ]; then
checkpath -f -o "$command_user" "$output_log"
fi
if [ -n "$error_log" ]; then
checkpath -f -o "$command_user" "$error_log"
fi
}