1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-12-07 02:06:57 +00:00
freebsd-ports/irc/quassel/files/quasselcore.in
Doug Barton 83eb2c3700 In the rc.d scripts, change assignments to rcvar to use the
literal name_enable wherever possible, and ${name}_enable
when it's not, to prepare for the demise of set_rcvar().

In cases where I had to hand-edit unusual instances also
modify formatting slightly to be more uniform (and in
some cases, correct). This includes adding some $FreeBSD$
tags, and most importantly moving rcvar= to right after
name= so it's clear that one is derived from the other.
2012-01-14 08:57:23 +00:00

74 lines
1.9 KiB
Bash

#!/bin/sh
# $FreeBSD$
#
# PROVIDE: quasselcore
# REQUIRE: LOGIN
# KEYWORD: shutdown
#
# Add the following lines to /etc/rc.conf to enable quasselcore:
#
# quasselcore_enable="YES"
# # optional
# quasselcore_data="/var/db/quasselcore"
# quasselcore_log="/var/log/quasselcore.log"
# quasselcore_args="--configdir=${quasselcore_data} --logfile=${quasselcore_log}"
# quasselcore_user="quasselcore"
# quasselcore_group="quasselcore"
. /etc/rc.subr
name=quasselcore
rcvar=quasselcore_enable
load_rc_config ${name}
: ${quasselcore_enable:="NO"}
: ${quasselcore_data="/var/db/quasselcore"}
: ${quasselcore_log="/var/log/quasselcore.log"}
: ${quasselcore_args="--configdir=${quasselcore_data} --logfile=${quasselcore_log}"}
: ${quasselcore_user="quasselcore"}
: ${quasselcore_group="${quasselcore_user}"}
procname="%%PREFIX%%/bin/quasselcore"
pidfile="/var/run/${name}.pid"
command="/usr/sbin/daemon"
command_args="-p ${pidfile} ${procname} ${quasselcore_args}"
start_precmd="${name}_prestart"
stop_postcmd="${name}_poststop"
keygen_cmd="${name}_keygen"
extra_commands="keygen"
quasselcore_keygen()
{
openssl req -x509 -nodes -days 365 -newkey rsa:1024 \
-keyout "${quasselcore_data}/quasselCert.pem" \
-out "${quasselcore_data}/quasselCert.pem"
chown ${quasselcore_user}:${quasselcore_group} "${quasselcore_data}/quasselCert.pem"
chmod 400 "${quasselcore_data}/quasselCert.pem"
}
quasselcore_prestart()
{
install -d -o ${quasselcore_user} -g ${quasselcore_group} ${quasselcore_data}
if [ ! -f "${quasselcore_log}" ]; then
install -o ${quasselcore_user} -g ${quasselcore_group} /dev/null ${quasselcore_log}
fi
if [ ! -f "${pidfile}" ]; then
install -o ${quasselcore_user} -g ${quasselcore_group} /dev/null ${pidfile}
fi
if [ ! -f "${quasselcore_data}/quasselCert.pem" ]; then
quasselcore_keygen
fi
}
quasselcore_poststop()
{
rm -f "${pidfile}"
}
run_rc_command "$1"