mirror of
https://github.com/flatcar/scripts.git
synced 2025-11-29 14:31:46 +01:00
net-dns/bind: Sync with Gentoo
It's from Gentoo commit 4517d4f250473834d29d74f38acebe0bede4b149.
This commit is contained in:
parent
fb696b2ab9
commit
f124f539b5
@ -15,7 +15,7 @@ S="${WORKDIR}/${PN}-${MY_PV}"
|
|||||||
|
|
||||||
LICENSE="MPL-2.0"
|
LICENSE="MPL-2.0"
|
||||||
SLOT="0"
|
SLOT="0"
|
||||||
KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~loong ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux"
|
KEYWORDS="~alpha amd64 ~arm ~arm64 ~hppa ~loong ~mips ppc ppc64 ~riscv ~s390 ~sparc x86 ~amd64-linux ~x86-linux"
|
||||||
IUSE="+caps dnstap doc doh fixed-rrset idn jemalloc geoip gssapi lmdb selinux static-libs test xml"
|
IUSE="+caps dnstap doc doh fixed-rrset idn jemalloc geoip gssapi lmdb selinux static-libs test xml"
|
||||||
RESTRICT="!test? ( test )"
|
RESTRICT="!test? ( test )"
|
||||||
|
|
||||||
@ -66,6 +66,10 @@ src_prepare() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
src_configure() {
|
src_configure() {
|
||||||
|
# configure automagically uses sphinx even if prebuilt man pages
|
||||||
|
# are available. Force fallback to prebuilt ones.
|
||||||
|
use doc || export ac_cv_path_SPHINX_BUILD= SPHINX_BUILD=
|
||||||
|
|
||||||
local myeconfargs=(
|
local myeconfargs=(
|
||||||
--prefix="${EPREFIX}"/usr
|
--prefix="${EPREFIX}"/usr
|
||||||
--sysconfdir="${EPREFIX}"/etc/bind
|
--sysconfdir="${EPREFIX}"/etc/bind
|
||||||
|
|||||||
@ -64,6 +64,10 @@ src_prepare() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
src_configure() {
|
src_configure() {
|
||||||
|
# configure automagically uses sphinx even if prebuilt man pages
|
||||||
|
# are available. Force fallback to prebuilt ones.
|
||||||
|
use doc || export ac_cv_path_SPHINX_BUILD= SPHINX_BUILD=
|
||||||
|
|
||||||
local myeconfargs=(
|
local myeconfargs=(
|
||||||
--prefix="${EPREFIX}"/usr
|
--prefix="${EPREFIX}"/usr
|
||||||
--sysconfdir="${EPREFIX}"/etc/bind
|
--sysconfdir="${EPREFIX}"/etc/bind
|
||||||
|
|||||||
@ -1,13 +0,0 @@
|
|||||||
diff --git a/contrib/dlz/config.dlz.in b/contrib/dlz/config.dlz.in
|
|
||||||
index f769cf1..721d480 100644
|
|
||||||
--- a/contrib/dlz/config.dlz.in
|
|
||||||
+++ b/contrib/dlz/config.dlz.in
|
|
||||||
@@ -396,7 +396,7 @@ case "$use_dlz_ldap" in
|
|
||||||
*)
|
|
||||||
DLZ_ADD_DRIVER(LDAP, dlz_ldap_driver,
|
|
||||||
[-I$use_dlz_ldap/include],
|
|
||||||
- [-L$use_dlz_ldap/lib -lldap -llber])
|
|
||||||
+ [-lldap -llber])
|
|
||||||
|
|
||||||
AC_MSG_RESULT(
|
|
||||||
[using LDAP from $use_dlz_ldap/lib and $use_dlz_ldap/include])
|
|
||||||
@ -1,48 +0,0 @@
|
|||||||
# Set various named options here.
|
|
||||||
#
|
|
||||||
#OPTIONS=""
|
|
||||||
|
|
||||||
# Set this to the number of processors you want bind to use.
|
|
||||||
# Leave this unchanged if you want bind to automatically detect the number
|
|
||||||
#CPU="1"
|
|
||||||
|
|
||||||
# If you wish to run bind in a chroot:
|
|
||||||
# 1) un-comment the CHROOT= assignment, below. You may use
|
|
||||||
# a different chroot directory but MAKE SURE it's empty.
|
|
||||||
# 2) run: emerge --config =<bind-version>
|
|
||||||
#
|
|
||||||
#CHROOT="/chroot/dns"
|
|
||||||
|
|
||||||
# Uncomment to enable binmount of /usr/share/GeoIP
|
|
||||||
#CHROOT_GEOIP="1"
|
|
||||||
|
|
||||||
# Uncomment the line below to avoid that the init script mounts the needed paths
|
|
||||||
# into the chroot directory.
|
|
||||||
# You have to copy all needed config files by hand if you say CHROOT_NOMOUNT="1".
|
|
||||||
#CHROOT_NOMOUNT="1"
|
|
||||||
|
|
||||||
# Uncomment this option if you have setup your own chroot environment and you
|
|
||||||
# don't want/need the chroot consistency check
|
|
||||||
#CHROOT_NOCHECK=1
|
|
||||||
|
|
||||||
# Default pid file location
|
|
||||||
PIDFILE="${CHROOT}/run/named/named.pid"
|
|
||||||
|
|
||||||
# Scheduling priority: 19 is the lowest and -20 is the highest.
|
|
||||||
# Default: 0
|
|
||||||
#NAMED_NICELEVEL="0"
|
|
||||||
|
|
||||||
# Uncomment rc_named_use/rc_named_after for the database you need.
|
|
||||||
# Its necessary to ensure the database backend will be started before named.
|
|
||||||
|
|
||||||
# MySQL
|
|
||||||
#rc_named_use="mysql"
|
|
||||||
#rc_named_after="mysql"
|
|
||||||
|
|
||||||
# PostgreSQL
|
|
||||||
#rc_named_use="pg_autovacuum postgresql"
|
|
||||||
#rc_named_after="pg_autovacuum postgresql"
|
|
||||||
|
|
||||||
# LDAP
|
|
||||||
#rc_named_use="ldap"
|
|
||||||
#rc_named_after="ldap"
|
|
||||||
@ -1,252 +0,0 @@
|
|||||||
#!/sbin/openrc-run
|
|
||||||
# Copyright 1999-2014 Gentoo Foundation
|
|
||||||
# Distributed under the terms of the GNU General Public License v2
|
|
||||||
|
|
||||||
extra_commands="checkconfig checkzones"
|
|
||||||
extra_started_commands="reload"
|
|
||||||
|
|
||||||
depend() {
|
|
||||||
need net
|
|
||||||
use logger
|
|
||||||
provide dns
|
|
||||||
}
|
|
||||||
|
|
||||||
NAMED_CONF=${CHROOT}/etc/bind/named.conf
|
|
||||||
|
|
||||||
OPENSSL_LIBGOST=${OPENSSL_LIBGOST:-0}
|
|
||||||
MOUNT_CHECK_TIMEOUT=${MOUNT_CHECK_TIMEOUT:-60}
|
|
||||||
|
|
||||||
_mount() {
|
|
||||||
local from
|
|
||||||
local to
|
|
||||||
local opts
|
|
||||||
local ret=0
|
|
||||||
|
|
||||||
if [ "${#}" -lt 3 ]; then
|
|
||||||
eerror "_mount(): to few arguments"
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
from=$1
|
|
||||||
to=$2
|
|
||||||
shift 2
|
|
||||||
|
|
||||||
opts="${*}"
|
|
||||||
shift $#
|
|
||||||
|
|
||||||
if [ -z "$(awk "\$2 == \"${to}\" { print \$2 }" /proc/mounts)" ]; then
|
|
||||||
einfo "mounting ${from} to ${to}"
|
|
||||||
mount ${from} ${to} ${opts}
|
|
||||||
ret=$?
|
|
||||||
|
|
||||||
eend $ret
|
|
||||||
return $ret
|
|
||||||
fi
|
|
||||||
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
|
|
||||||
_umount() {
|
|
||||||
local dir=$1
|
|
||||||
local ret=0
|
|
||||||
|
|
||||||
if [ -n "$(awk "\$2 == \"${dir}\" { print \$2 }" /proc/mounts)" ]; then
|
|
||||||
ebegin "umounting ${dir}"
|
|
||||||
umount ${dir}
|
|
||||||
ret=$?
|
|
||||||
|
|
||||||
eend $ret
|
|
||||||
return $ret
|
|
||||||
fi
|
|
||||||
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
|
|
||||||
_get_pidfile() {
|
|
||||||
# as suggested in bug #107724, bug 335398#c17
|
|
||||||
[ -n "${PIDFILE}" ] || PIDFILE=${CHROOT}$(\
|
|
||||||
/usr/sbin/named-checkconf -p ${CHROOT:+-t} ${CHROOT} ${NAMED_CONF#${CHROOT}} | grep 'pid-file' | cut -d\" -f2)
|
|
||||||
[ -z "${PIDFILE}" ] && PIDFILE=${CHROOT}/run/named/named.pid
|
|
||||||
}
|
|
||||||
|
|
||||||
check_chroot() {
|
|
||||||
if [ -n "${CHROOT}" ]; then
|
|
||||||
[ ! -d "${CHROOT}" ] && return 1
|
|
||||||
[ ! -d "${CHROOT}/dev" ] || [ ! -d "${CHROOT}/etc" ] || [ ! -d "${CHROOT}/var" ] && return 1
|
|
||||||
[ ! -d "${CHROOT}/run" ] || [ ! -d "${CHROOT}/var/log" ] && return 1
|
|
||||||
[ ! -d "${CHROOT}/etc/bind" ] || [ ! -d "${CHROOT}/var/bind" ] && return 1
|
|
||||||
[ ! -d "${CHROOT}/var/log/named" ] && return 1
|
|
||||||
[ ! -c "${CHROOT}/dev/null" ] || [ ! -c "${CHROOT}/dev/zero" ] && return 1
|
|
||||||
[ ! -c "${CHROOT}/dev/urandom" ] && return 1
|
|
||||||
[ "${CHROOT_GEOIP:-0}" -eq 1 ] && [ ! -d "${CHROOT}/usr/share/GeoIP" ] && return 1
|
|
||||||
if [ ${OPENSSL_LIBGOST:-0} -eq 1 ]; then
|
|
||||||
if [ -d "/usr/lib64" ]; then
|
|
||||||
[ ! -d "${CHROOT}/usr/lib64/engines" ] && return 1
|
|
||||||
elif [ -d "/usr/lib" ]; then
|
|
||||||
[ ! -d "${CHROOT}/usr/lib/engines" ] && return 1
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
|
|
||||||
checkconfig() {
|
|
||||||
ebegin "Checking named configuration"
|
|
||||||
|
|
||||||
if [ ! -f "${NAMED_CONF}" ] ; then
|
|
||||||
eerror "No ${NAMED_CONF} file exists!"
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
/usr/sbin/named-checkconf ${CHROOT:+-t} ${CHROOT} ${NAMED_CONF#${CHROOT}} || {
|
|
||||||
eerror "named-checkconf failed! Please fix your config first."
|
|
||||||
return 1
|
|
||||||
}
|
|
||||||
|
|
||||||
eend 0
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
|
|
||||||
checkzones() {
|
|
||||||
ebegin "Checking named configuration and zones"
|
|
||||||
/usr/sbin/named-checkconf -z -j ${CHROOT:+-t} ${CHROOT} ${NAMED_CONF#${CHROOT}}
|
|
||||||
eend $?
|
|
||||||
}
|
|
||||||
|
|
||||||
start() {
|
|
||||||
local piddir
|
|
||||||
|
|
||||||
ebegin "Starting ${CHROOT:+chrooted }named"
|
|
||||||
|
|
||||||
if [ -n "${CHROOT}" ]; then
|
|
||||||
if [ ${CHROOT_NOCHECK:-0} -eq 0 ]; then
|
|
||||||
check_chroot || {
|
|
||||||
eend 1
|
|
||||||
eerror "Your chroot dir ${CHROOT} is inconsistent, please run 'emerge --config net-dns/bind' first"
|
|
||||||
return 1
|
|
||||||
}
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ ${OPENSSL_LIBGOST:-0} -eq 1 ]; then
|
|
||||||
if [ ! -e /usr/lib/engines/libgost.so ]; then
|
|
||||||
eend 1
|
|
||||||
eerror "Couldn't find /usr/lib/engines/libgost.so but bind has been built with openssl and libgost support"
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
cp -Lp /usr/lib/engines/libgost.so "${CHROOT}/usr/lib/engines/libgost.so" || {
|
|
||||||
eend 1
|
|
||||||
eerror "Couldn't copy /usr/lib/engines/libgost.so into '${CHROOT}/usr/lib/engines/'"
|
|
||||||
return 1
|
|
||||||
}
|
|
||||||
fi
|
|
||||||
cp -Lp /etc/localtime "${CHROOT}/etc/localtime"
|
|
||||||
|
|
||||||
if [ "${CHROOT_NOMOUNT:-0}" -eq 0 ]; then
|
|
||||||
einfo "Mounting chroot dirs"
|
|
||||||
_mount /etc/bind ${CHROOT}/etc/bind -o bind
|
|
||||||
_mount /var/bind ${CHROOT}/var/bind -o bind
|
|
||||||
_mount /var/log/named ${CHROOT}/var/log/named -o bind
|
|
||||||
if [ "${CHROOT_GEOIP:-0}" -eq 1 ]; then
|
|
||||||
_mount /usr/share/GeoIP ${CHROOT}/usr/share/GeoIP -o bind
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
# On initial startup, if piddir inside the chroot /var/run/named
|
|
||||||
# Then the .../var/run part might not exist yet
|
|
||||||
checkpath -q -d -o root:root -m 0755 "${piddir}/.."
|
|
||||||
fi
|
|
||||||
|
|
||||||
checkconfig || { eend 1; return 1; }
|
|
||||||
|
|
||||||
# create piddir (usually /run/named) if necessary, bug 334535
|
|
||||||
_get_pidfile
|
|
||||||
piddir="${PIDFILE%/*}"
|
|
||||||
checkpath -q -d -o root:named -m 0770 "${piddir}" || {
|
|
||||||
eerror "Failed to create PID directory at $piddir"
|
|
||||||
eend 1
|
|
||||||
return 1
|
|
||||||
}
|
|
||||||
|
|
||||||
# In case someone have $CPU set in /etc/conf.d/named
|
|
||||||
if [ -n "${CPU}" ] && [ "${CPU}" -gt 0 ]; then
|
|
||||||
CPU="-n ${CPU}"
|
|
||||||
fi
|
|
||||||
|
|
||||||
start-stop-daemon --start --pidfile ${PIDFILE} \
|
|
||||||
--nicelevel ${NAMED_NICELEVEL:-0} \
|
|
||||||
--exec /usr/sbin/named \
|
|
||||||
-- -u named ${CPU} ${OPTIONS} ${CHROOT:+-t} ${CHROOT}
|
|
||||||
eend $?
|
|
||||||
}
|
|
||||||
|
|
||||||
stop() {
|
|
||||||
local reported=0
|
|
||||||
|
|
||||||
ebegin "Stopping ${CHROOT:+chrooted }named"
|
|
||||||
|
|
||||||
# Workaround for now, until openrc's restart has been fixed.
|
|
||||||
# openrc doesn't care about a restart() function in init scripts.
|
|
||||||
if [ "${RC_CMD}" = "restart" ]; then
|
|
||||||
if [ -n "${CHROOT}" -a ${CHROOT_NOCHECK:-0} -eq 0 ]; then
|
|
||||||
check_chroot || {
|
|
||||||
eend 1
|
|
||||||
eerror "Your chroot dir ${CHROOT} is inconsistent, please run 'emerge --config net-dns/bind' first"
|
|
||||||
return 1
|
|
||||||
}
|
|
||||||
fi
|
|
||||||
|
|
||||||
checkconfig || { eend 1; return 1; }
|
|
||||||
fi
|
|
||||||
|
|
||||||
# -R 10, bug 335398
|
|
||||||
_get_pidfile
|
|
||||||
start-stop-daemon --stop --retry 10 --pidfile $PIDFILE \
|
|
||||||
--exec /usr/sbin/named
|
|
||||||
|
|
||||||
if [ -n "${CHROOT}" ] && [ "${CHROOT_NOMOUNT:-0}" -eq 0 ]; then
|
|
||||||
ebegin "Umounting chroot dirs"
|
|
||||||
|
|
||||||
# just to be sure everything gets clean
|
|
||||||
while fuser -s ${CHROOT} 2>/dev/null; do
|
|
||||||
if [ "${reported}" -eq 0 ]; then
|
|
||||||
einfo "Waiting until all named processes are stopped (max. ${MOUNT_CHECK_TIMEOUT} seconds)"
|
|
||||||
elif [ "${reported}" -eq "${MOUNT_CHECK_TIMEOUT}" ]; then
|
|
||||||
eerror "Waiting until all named processes are stopped failed!"
|
|
||||||
eend 1
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
sleep 1
|
|
||||||
reported=$((reported+1))
|
|
||||||
done
|
|
||||||
|
|
||||||
[ "${CHROOT_GEOIP:-0}" -eq 1 ] && _umount ${CHROOT}/usr/share/GeoIP
|
|
||||||
_umount ${CHROOT}/etc/bind
|
|
||||||
_umount ${CHROOT}/var/log/named
|
|
||||||
_umount ${CHROOT}/var/bind
|
|
||||||
fi
|
|
||||||
|
|
||||||
eend $?
|
|
||||||
}
|
|
||||||
|
|
||||||
reload() {
|
|
||||||
local ret
|
|
||||||
|
|
||||||
ebegin "Reloading named.conf and zone files"
|
|
||||||
|
|
||||||
checkconfig || { eend 1; return 1; }
|
|
||||||
|
|
||||||
_get_pidfile
|
|
||||||
if [ -n "${PIDFILE}" ]; then
|
|
||||||
start-stop-daemon --pidfile $PIDFILE --signal HUP
|
|
||||||
ret=$?
|
|
||||||
else
|
|
||||||
ewarn "Unable to determine the pidfile... this is"
|
|
||||||
ewarn "a fallback mode. Please check your installation!"
|
|
||||||
|
|
||||||
$RC_SERVICE restart
|
|
||||||
ret=$?
|
|
||||||
fi
|
|
||||||
|
|
||||||
eend $ret
|
|
||||||
}
|
|
||||||
@ -1,13 +0,0 @@
|
|||||||
[Unit]
|
|
||||||
Description=Internet domain name server
|
|
||||||
After=network.target
|
|
||||||
|
|
||||||
[Service]
|
|
||||||
ExecStartPre=/usr/libexec/generate-rndc-key.sh
|
|
||||||
ExecStartPre=/usr/sbin/named-checkconf -z /etc/bind/named.conf
|
|
||||||
ExecStart=/usr/sbin/named -f -u named
|
|
||||||
ExecReload=/usr/sbin/rndc reload
|
|
||||||
ExecStop=/usr/sbin/rndc stop
|
|
||||||
|
|
||||||
[Install]
|
|
||||||
WantedBy=multi-user.target
|
|
||||||
Loading…
x
Reference in New Issue
Block a user