#!/sbin/openrc-run

SVCNAME=xsd
XSD_PIDFILE=/var/run/xsd.pid
XSD_USER=root
XSD_HOME=/var/run
INST_PREFIX=/usr/local
COMMAND=$INST_PREFIX/sbin/xsd
#ARGS="-L -aK KEX_all -aC C_all -aH H_all"
echo "SET ARGS in this script to define allow KEX, cipher and hmac algs"
exit 1

depend() {
    need net
    use dns logger
}

checkconfig() {
    if [ ! -f "$COMMAND" ] ; then
        eerror "$COMMAND not installed" || return 1
    fi
    return 0
}

start() {
    checkconfig || return 1

    ebegin "Starting ${SVCNAME}"
    start-stop-daemon \
        -d ${XSD_HOME} \
        --make-pidfile --pidfile ${XSD_PIDFILE} \
        --start --quiet --background \
        --exec "${COMMAND}" -- ${ARGS}
    eend $?
}

stop() {
    ebegin "Stopping ${SVCNAME}"
    start-stop-daemon --stop --quiet --pidfile $XSD_PIDFILE
    eend $?
}
