#!/bin/sh

# $NetBSD$
#
# Shell in a Box Daemon startup script
#
# PROVIDE: shellinaboxd
# REQUIRE: LOGIN
# KEYWORD: shutdown

#
# Add the following to /etc/rc.conf to enable this service
#
# shellinaboxd="YES"
#
# You can fine tune others variables too:
# shellinaboxd_pidfile="/var/run/shellinabox.pid"
# shellinaboxd_user="shellinabox"
# shellinaboxd_group="shellinabox"
# shellinaboxd_port="4200"
# shellinaboxd_flags="--disable-ssl --localhost-only --linkify=normal --service=/shell:SSH:127.0.0.1"

. /etc/rc.subr

name="shellinaboxd"
rcvar=${name}

command="/2022Q2/bin/${name}"

shellinaboxd=${shellinaboxd:-"NO"}
shellinaboxd_user=${shellinaboxd_user:-"shellinabox"}
shellinaboxd_group=${shellinaboxd_group:-"shellinabox"}
shellinaboxd_port=${shellinaboxd_port:-"4200"}

pidfile=${shellinaboxd_pidfile:-"/var/run/shellinaboxd.pid"}

command_args="--disable-ssl --user-css Normal:-/2022Q2/share/${name}/black-on-white.css,Reverse:+/2022Q2/share/${name}/white-on-black.css --user=${shellinaboxd_user} --group=${shellinaboxd_group} --port=${shellinaboxd_port} --background=${pidfile}"

# avoid unnecessary su(1) initiated by rc.subr
unset shellinaboxd_user shellinaboxd_group

load_rc_config $name
run_rc_command "$1"
