drop/openrc/authd

67 lines
1.5 KiB
Plaintext
Raw Permalink Normal View History

#!/sbin/openrc-run
: ${cfgfile:="/etc/baguette/auth.yml"}
: ${auth_password_file:="/etc/baguette/auth-password"}
command_user="_auth:_ipc"
# The command cannot go background by itself and cannot write its own PID.
command_background=true
description="Authentication daemon"
description_checkconfig="Verify configuration file (TODO)"
description_reload="Reload configuration (TODO)"
description_debug="Print actual command line to run (TODO)"
extra_commands="checkconfig debug"
extra_started_commands="reload"
pidfile="${AUTHD_PIDFILE:-"/run/$RC_SVCNAME.pid"}"
command="${AUTHD_BINARY:-"/usr/local/bin/authd"}"
command_args="${command_args:-${AUTHD_OPTS:- -k $auth_password_file}}"
depend() {
provide auth
}
required_files="$cfgfile $auth_password_file"
debug() {
ewarn Hello this is debug.
ewarn auth_password_file: $auth_password_file
ewarn pidfile: $pidfile
ewarn command: $command
ewarn command_args: $command_args
}
checkconfig() {
if [ ! -d /run/ipc ] ; then
mkdir -p /run/ipc || return 1
fi
# "$command" -t $command_args || return 1
ewarn "authd cannot check its own configuration files, yet"
return 0
}
start_pre() {
checkconfig
}
stop_pre() {
if [ "${RC_CMD}" = "restart" ] ; then
checkconfig || return 1
fi
}
reload() {
ewarn "Reloading: not available, let's just restart."
# checkconfig || return 1
restart || return 1
# ebegin "Reloading $RC_SVCNAME"
# start-stop-daemon --signal HUP \
# --exec "$command" --pidfile "$pidfile"
# eend $?
}