ports/net-p2p/uhub/files/uhub.sh.in
Stefan Walter 920fca23ec * Sets up a uhub UID and GID for the daemon to run as.
* Modifies configuration file permissions to restrict them to root and the above
  GID.
* Patches uhub source so that PREFIX/etc/uhub/uhub.conf is the compiled in
  default configuration file.
* rc.d script changes - enable above uid/gid, enable syslog logging, simplify.

PR:		151819
Submitted by:	Aragon Gouveia <aragon@phat.za.net>
Approved by:	maintainer
2010-11-11 10:31:35 +00:00

53 lines
887 B
Bash

#!/bin/sh
#
# $FreeBSD$
#
# PROVIDE: uhub
# REQUIRE: DAEMON
# BEFORE: LOGIN
# KEYWORD: shutdown
#
# Add the following lines to /etc/rc.conf to enable uhub:
#
# uhub_enable (bool): Set it to "YES" to enable uhub
# Default is "NO".
# uhub_pidfile (path): Set full path to pid file.
# Default is "/var/run/uhub.pid".
#
. /etc/rc.subr
name="uhub"
rcvar=`set_rcvar`
load_rc_config $name
: ${uhub_enable:="NO"}
: ${uhub_flags:="-L -u uhub -g uhub"}
: ${uhub_pidfile:="/var/run/${name}.pid"}
command=%%PREFIX%%/bin/uhub
command_args="-f -p ${uhub_pidfile}"
pidfile=${uhub_pidfile}
required_files=${uhub_conf}
stop_postcmd=stop_postcmd
reload_precmd=reload_precmd
reload_postcmd=reload_postcmd
extra_commands="reload"
stop_postcmd()
{
rm -f ${pidfile}
}
reload_precmd()
{
echo "Reload ${name} configuration."
}
reload_postcmd()
{
kill -HUP `cat ${pidfile}`
}
run_rc_command "$1"