#!/bin/sh # PROVIDE: comentario # REQUIRE: LOGIN # KEYWORD: shutdown # # Add the following lines to /etc/rc.conf to enable comentario: # # comentario_enable (bool): Set to YES to enable comentario. # Default: NO # comentario_run_user (str): User to run comentario as. # Default: %%COMENTARIO_USER%% # comentario_run_group (str): Group to run comentario as. # Default: %%COMENTARIO_GROUP%% # comentario_conf (str): Path to the static configuration file. # Default: %%ETCDIR%%/comentario.conf # comentario_flags (str): Extra arguments passed to comentario. # Default: empty . /etc/rc.subr name=comentario rcvar=comentario_enable desc="Self-hosted comment engine" load_rc_config ${name} : ${comentario_enable:="NO"} : ${comentario_run_user:="%%COMENTARIO_USER%%"} : ${comentario_run_group:="%%COMENTARIO_GROUP%%"} : ${comentario_conf:="%%ETCDIR%%/comentario.conf"} : ${comentario_flags:=""} pidfile="/var/run/${name}.pid" command="/usr/sbin/daemon" comentario_command="%%PREFIX%%/bin/${name}" command_args="-P ${pidfile} -r -f -T ${name} -t ${name} -u ${comentario_run_user} -- ${comentario_command} ${comentario_flags}" required_files="${comentario_conf}" start_precmd=comentario_prestart comentario_prestart() { if [ -f "${comentario_conf}" ]; then set -a # shellcheck disable=SC1090 . "${comentario_conf}" set +a fi install -d -m 0700 -o "${comentario_run_user}" -g "${comentario_run_group}" \ %%COMENTARIO_DBDIR%% } run_rc_command "$1"