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

Collapse All | Expand All

(-)named.dist (-18 / +16 lines)
Lines 27-34 Link Here
27
		return 1
27
		return 1
28
	fi
28
	fi
29
29
30
	from=$1
30
	from=$(echo $1 | sed 's#//*#/#g')
31
	to=$2
31
	to=$(echo $2 | sed 's#//*#/#g')
32
	shift 2
32
	shift 2
33
33
34
	opts="${*}"
34
	opts="${*}"
Lines 47-53 Link Here
47
}
47
}
48
48
49
_umount() {
49
_umount() {
50
	local dir=$1
50
	local dir=$(echo $1 | sed 's#//*#/#g')
51
	local ret=0
51
	local ret=0
52
52
53
	if [ -n "$(awk "\$2 == \"${dir}\" { print \$2 }" /proc/mounts)" ]; then
53
	if [ -n "$(awk "\$2 == \"${dir}\" { print \$2 }" /proc/mounts)" ]; then
Lines 64-72 Link Here
64
64
65
_get_pidfile() {
65
_get_pidfile() {
66
	# as suggested in bug #107724, bug 335398#c17
66
	# as suggested in bug #107724, bug 335398#c17
67
	[ -n "${PIDFILE}" ] || PIDFILE=${CHROOT}$(\
67
	[ -n "${PIDFILE}" ] || PIDFILE=$(\
68
			/usr/sbin/named-checkconf -p ${CHROOT:+-t} ${CHROOT} ${NAMED_CONF#${CHROOT}} | grep 'pid-file' | cut -d\" -f2)
68
			/usr/sbin/named-checkconf -p ${CHROOT:+-t} ${CHROOT} ${NAMED_CONF#${CHROOT}} | grep 'pid-file' | cut -d\" -f2)
69
	[ -z "${PIDFILE}" ] && PIDFILE=${CHROOT}/run/named/named.pid
69
	[ -z "${PIDFILE}" ] && PIDFILE=/run/named/named.pid
70
}
70
}
71
71
72
check_chroot() {
72
check_chroot() {
Lines 119-124 Link Here
119
119
120
	ebegin "Starting ${CHROOT:+chrooted }named"
120
	ebegin "Starting ${CHROOT:+chrooted }named"
121
121
122
	# create piddir (usually /run/named) if necessary, bug 334535
123
	_get_pidfile
124
	piddir=${PIDFILE%/*}
125
	checkpath -q -d -o root:named -m 0770 "${piddir}" || {
126
		eerror "Failed to create PID directory at $piddir"
127
		eend 1
128
		return 1
129
	}
130
122
	if [ -n "${CHROOT}" ]; then
131
	if [ -n "${CHROOT}" ]; then
123
		if [ ${CHROOT_NOCHECK:-0} -eq 0 ]; then
132
		if [ ${CHROOT_NOCHECK:-0} -eq 0 ]; then
124
			check_chroot || {
133
			check_chroot || {
Lines 147-173 Link Here
147
			_mount /etc/bind ${CHROOT}/etc/bind -o bind
156
			_mount /etc/bind ${CHROOT}/etc/bind -o bind
148
			_mount /var/bind ${CHROOT}/var/bind -o bind
157
			_mount /var/bind ${CHROOT}/var/bind -o bind
149
			_mount /var/log/named ${CHROOT}/var/log/named -o bind
158
			_mount /var/log/named ${CHROOT}/var/log/named -o bind
159
			_mount ${piddir} ${CHROOT}/${piddir} -o bind
150
			if [ "${CHROOT_GEOIP:-0}" -eq 1 ]; then
160
			if [ "${CHROOT_GEOIP:-0}" -eq 1 ]; then
151
				_mount /usr/share/GeoIP ${CHROOT}/usr/share/GeoIP -o bind
161
				_mount /usr/share/GeoIP ${CHROOT}/usr/share/GeoIP -o bind
152
			fi
162
			fi
153
		fi
163
		fi
154
155
		# On initial startup, if piddir inside the chroot /var/run/named
156
		# Then the .../var/run part might not exist yet
157
		checkpath -q -d -o root:root -m 0755 "${piddir}/.."
158
	fi
164
	fi
159
165
160
	checkconfig || { eend 1; return 1; }
166
	checkconfig || { eend 1; return 1; }
161
167
162
	# create piddir (usually /run/named) if necessary, bug 334535
163
	_get_pidfile
164
	piddir="${PIDFILE%/*}"
165
	checkpath -q -d -o root:named -m 0770 "${piddir}" || {
166
		eerror "Failed to create PID directory at $piddir"
167
		eend 1
168
		return 1
169
	}
170
171
	# In case someone have $CPU set in /etc/conf.d/named
168
	# In case someone have $CPU set in /etc/conf.d/named
172
	if [ -n "${CPU}" ] && [ "${CPU}" -gt 0 ]; then
169
	if [ -n "${CPU}" ] && [ "${CPU}" -gt 0 ]; then
173
		CPU="-n ${CPU}"
170
		CPU="-n ${CPU}"
Lines 221-226 Link Here
221
		done
218
		done
222
219
223
		[ "${CHROOT_GEOIP:-0}" -eq 1 ] && _umount ${CHROOT}/usr/share/GeoIP
220
		[ "${CHROOT_GEOIP:-0}" -eq 1 ] && _umount ${CHROOT}/usr/share/GeoIP
221
		_umount ${CHROOT}/${PIDFILE%/*}
224
		_umount ${CHROOT}/etc/bind
222
		_umount ${CHROOT}/etc/bind
225
		_umount ${CHROOT}/var/log/named
223
		_umount ${CHROOT}/var/log/named
226
		_umount ${CHROOT}/var/bind
224
		_umount ${CHROOT}/var/bind

Return to bug 601510