summaryrefslogtreecommitdiff
path: root/ngircd/contrib/ngircd-bsd.sh
blob: e085646381e35417298d5f15f4c341bd1ca40d2a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#!/bin/sh

# PROVIDE: ngircd
# REQUIRE: NETWORKING SERVERS
# BEFORE: DAEMON
# KEYWORD: FreeBSD shutdown

# Add the following line to /etc/rc.conf to enable `ngircd':
#
#ngircd_enable="YES"
#

. "/etc/rc.subr"

name="ngircd"
rcvar=`set_rcvar`

command="/usr/local/sbin/ngircd"
command_args=""

load_rc_config "$name"
: ${ngircd_enable="NO"}
: ${ngircd_flags=""}

required_files="/usr/local/etc/$name.conf"
pidfile="${ngircd_pidfile:-/var/run/${name}/${name}.pid}"

if [ ! x"${ngircd_chrootdir}" = x ];then
	# Mount a devfs in the chroot directory if needed
	if [ ! -c ${ngircd_chrootdir}/dev/random \
	  -o ! -c ${ngircd_chrootdir}/dev/null ]; then
		umount ${ngircd_chrootdir}/dev 2>/dev/null
		mount_devfs devfs ${ngircd_chrootdir}/dev
	fi

	devfs -m ${ngircd_chrootdir}/dev rule apply hide
	devfs -m ${ngircd_chrootdir}/dev rule apply path null unhide
	devfs -m ${ngircd_chrootdir}/dev rule apply path random unhide

	# Copy local timezone information if it is not up to date.
	if [ -f /etc/localtime ]; then
		cmp -s /etc/localtime "${named_chrootdir}/etc/localtime" || \
			cp -p /etc/localtime "${named_chrootdir}/etc/localtime"
	fi

	pidfile="${ngircd_chrootdir}${pidfile}"
fi

run_rc_command "$1"

# -eof-