#!/sbin/openrc-run

description="Virtualization secret daemon"

VIRTSECRETD_OPTS=${VIRTSECRETD_OPTS:-"${VIRTSECRETD_OPTS}"}
VIRTSECRETD_TIMEOUT=${VIRTSECRETD_TERMTIMEOUT:-"TERM/25/KILL/5"}

command="/usr/sbin/virtsecretd"
command_args="-d ${VIRTSECRETD_OPTS}"
pidfile="/run/virtsecretd.pid"
retry="${VIRTSECRETD_TERMTIMEOUT}"

extra_started_commands="reload"
description_reload="re-exec the daemon to enforce configuration reload"

depend() {
    use ceph dbus iscsid virtlockd
    after nfs nfsmount
}

reload() {
    ebegin "re-exec() virtsecretd"

    start-stop-daemon --signal SIGHUP \
      --exec "${command}" --pidfile "${pidfile}"
}
