#!/bin/sh # PROVIDE: hydroxide # REQUIRE: LOGIN # KEYWORD: shutdown # # Add the following lines to /etc/rc.conf or /etc/rc.conf.local to # enable hydroxide: # hydroxide_args (str): Custom additional arguments to be passed # hydroxide (default empty). # hydroxide_user (str): User to run hydroxide as. Default # to "%%USER%%" created by the port. # hydroxide_log (path): Console log file (default /dev/null). . /etc/rc.subr case $0 in /etc/rc*) # during boot (shutdown) $0 is /etc/rc (/etc/rc.shutdown), # so get the name of the script from $_file name=$_file ;; *) name=$0 ;; esac name=${name##*/} rcvar="${name}_enable" extra_commands="init" init_cmd="${name}_init" su_cmd="/usr/bin/su" load_rc_config "${name}" eval "${rcvar}=\${${rcvar}:-'NO'}" eval "__args=\${${name}_args:-''}" eval "__user=\${${name}_user:-'%%USER%%'}" eval "__log=\${${name}_log:-/dev/null}" pidfile="/var/run/${name}.pid" command="/usr/sbin/daemon" command_args="-P ${pidfile} -u ${__user} -f -H -o ${__log} -m 3 %%PREFIX%%/bin/hydroxide ${__args} serve" hydroxide_init() { read -p "Enter mail account id: " id ${su_cmd} -m ${__user} -c "%%PREFIX%%/bin/hydroxide auth $id" } run_rc_command "$1"