Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 275684 | Differences between
and this patch

Collapse All | Expand All

(-)files/named.init-r5 (+70 lines)
Lines 11-16 depend() { Link Here
11
	provide dns
11
	provide dns
12
}
12
}
13
13
14
_mount() {
15
	local from
16
	local to
17
	local opts
18
19
	if [[ $# -lt 3 ]];
20
	then
21
		eerror "_mount(): to few arguments"
22
		return 1
23
	fi
24
25
	from=$1
26
	to=$2
27
	shift 2
28
	
29
	opts="${*}"
30
	shift $#
31
32
	if [[ -z $(grep "${to}" /proc/mounts) ]];
33
	then
34
		einfo "mounting ${from} to ${to}"
35
		mount ${from} ${to} ${opts} || return 1
36
	fi
37
}
38
39
_umount() {
40
	local dir=$1
41
	
42
	if [[ -n $(grep "${dir}" /proc/mounts) ]];
43
	then
44
		einfo "umount ${dir}"
45
		umount ${dir}
46
	fi
47
}
48
14
checkconfig() {
49
checkconfig() {
15
	if [ ! -f ${CHROOT}/etc/bind/named.conf ] ; then
50
	if [ ! -f ${CHROOT}/etc/bind/named.conf ] ; then
16
		eerror "No ${CHROOT}/etc/bind/named.conf file exists!"
51
		eerror "No ${CHROOT}/etc/bind/named.conf file exists!"
Lines 35-41 checkconfig() { Link Here
35
70
36
start() {
71
start() {
37
	ebegin "Starting ${CHROOT:+chrooted }named"
72
	ebegin "Starting ${CHROOT:+chrooted }named"
73
74
	if [[ -n ${CHROOT} ]];
75
	then
76
		einfo "Mounting chroot dirs"
77
		_mount none ${CHROOT}/proc -t proc
78
		_mount /etc/bind ${CHROOT}/etc/bind -o bind
79
		_mount /var/bind ${CHROOT}/var/bind -o bind
80
		_mount /var/log/named ${CHROOT}/var/log/named -o bind
81
	fi
82
38
	checkconfig || return 1
83
	checkconfig || return 1
84
39
	start-stop-daemon --start --quiet --pidfile ${PIDFILE} \
85
	start-stop-daemon --start --quiet --pidfile ${PIDFILE} \
40
		--nicelevel ${NAMED_NICELEVEL:-0} \
86
		--nicelevel ${NAMED_NICELEVEL:-0} \
41
		--exec /usr/sbin/named \
87
		--exec /usr/sbin/named \
Lines 44-49 start() { Link Here
44
}
90
}
45
91
46
stop() {
92
stop() {
93
	local reported=0
94
47
	ebegin "Stopping ${CHROOT:+chrooted }named"
95
	ebegin "Stopping ${CHROOT:+chrooted }named"
48
	checkconfig || return 2
96
	checkconfig || return 2
49
	if [ -f $KEY ] ; then
97
	if [ -f $KEY ] ; then
Lines 52-57 stop() { Link Here
52
		start-stop-daemon --stop --quiet --pidfile $PIDFILE \
100
		start-stop-daemon --stop --quiet --pidfile $PIDFILE \
53
			--exec /usr/sbin/named -- stop
101
			--exec /usr/sbin/named -- stop
54
	fi
102
	fi
103
104
	if [[ -n ${CHROOT} ]];
105
	then
106
		einfo "Umounting chroot dirs"
107
108
		# just to be sure everything gets clean
109
		while [[ -n $(fuser ${CHROOT} 2>&1) ]]
110
		do
111
			if [[ ${reported} -eq 0 ]];
112
			then
113
				einfo "Waiting until all named processes are stopped"
114
				reported=1
115
			fi
116
			sleep 1
117
		done
118
119
		_umount ${CHROOT}/etc/bind
120
		_umount ${CHROOT}/var/log/named
121
		_umount ${CHROOT}/var/bind
122
		_umount ${CHROOT}/proc
123
	fi
124
55
	eend $?
125
	eend $?
56
}
126
}
57
127

Return to bug 275684