1#!/bin/sh
2
3# PROVIDE: ngircd
4# REQUIRE: NETWORKING SERVERS
5# BEFORE: DAEMON
6# KEYWORD: FreeBSD shutdown
7
8# Add the following line to /etc/rc.conf to enable `ngircd':
9#
10#ngircd_enable="YES"
11#
12
13. "/etc/rc.subr"
14
15name="ngircd"
16rcvar=`set_rcvar`
17
18command="/usr/local/sbin/ngircd"
19command_args=""
20
21load_rc_config "$name"
22: ${ngircd_enable="NO"}
23: ${ngircd_flags=""}
24
25required_files="/usr/local/etc/$name.conf"
26pidfile="${ngircd_pidfile:-/var/run/${name}/${name}.pid}"
27
28if [ ! x"${ngircd_chrootdir}" = x ];then
29	# Mount a devfs in the chroot directory if needed
30	if [ ! -c ${ngircd_chrootdir}/dev/random \
31	  -o ! -c ${ngircd_chrootdir}/dev/null ]; then
32		umount ${ngircd_chrootdir}/dev 2>/dev/null
33		mount_devfs devfs ${ngircd_chrootdir}/dev
34	fi
35
36	devfs -m ${ngircd_chrootdir}/dev rule apply hide
37	devfs -m ${ngircd_chrootdir}/dev rule apply path null unhide
38	devfs -m ${ngircd_chrootdir}/dev rule apply path random unhide
39
40	# Copy local timezone information if it is not up to date.
41	if [ -f /etc/localtime ]; then
42		cmp -s /etc/localtime "${named_chrootdir}/etc/localtime" || \
43			cp -p /etc/localtime "${named_chrootdir}/etc/localtime"
44	fi
45
46	pidfile="${ngircd_chrootdir}${pidfile}"
47fi
48
49run_rc_command "$1"
50
51# -eof-
52