diff options
author | Mike Gilbert <floppym@gentoo.org> | 2024-11-05 15:20:52 -0500 |
---|---|---|
committer | Mike Gilbert <floppym@gentoo.org> | 2024-11-07 11:36:36 -0500 |
commit | 2559800a0a46c96d9fe61768986de954c2f93e51 (patch) | |
tree | cec9c79dda8a8efa67199f3e61e37b08622df67c /net-dns | |
parent | app-text/mdbook: add 0.4.42 (diff) | |
download | gentoo-2559800a0a46c96d9fe61768986de954c2f93e51.tar.gz gentoo-2559800a0a46c96d9fe61768986de954c2f93e51.tar.bz2 gentoo-2559800a0a46c96d9fe61768986de954c2f93e51.zip |
net-dns/bind: wire up ROOT in pkg_postinst
Skip calling rndc-confgen when ROOT is not empty.
Add EPREFIX to paths.
Add proper quoting in pkg_postinst and pkg_config.
Closes: https://bugs.gentoo.org/942892
Signed-off-by: Mike Gilbert <floppym@gentoo.org>
Diffstat (limited to 'net-dns')
-rw-r--r-- | net-dns/bind/bind-9.18.31-r1.ebuild (renamed from net-dns/bind/bind-9.18.31.ebuild) | 48 |
1 files changed, 24 insertions, 24 deletions
diff --git a/net-dns/bind/bind-9.18.31.ebuild b/net-dns/bind/bind-9.18.31-r1.ebuild index b35542e12f4d..f10b1e166977 100644 --- a/net-dns/bind/bind-9.18.31.ebuild +++ b/net-dns/bind/bind-9.18.31-r1.ebuild @@ -173,11 +173,11 @@ src_install() { pkg_postinst() { tmpfiles_process named.conf - if [[ ! -f '/etc/bind/rndc.key' && ! -f '/etc/bind/rndc.conf' ]]; then + if [[ -z ${ROOT} && ! -f ${EPREFIX}/etc/bind/rndc.key && ! -f ${EPREFIX}/etc/bind/rndc.conf ]]; then einfo "Generating rndc.key" - /usr/sbin/rndc-confgen -a - chown root:named /etc/bind/rndc.key || die - chmod 0640 /etc/bind/rndc.key || die + "${EPREFIX}"/usr/sbin/rndc-confgen -a || die + chown root:named "${EPREFIX}"/etc/bind/rndc.key || die + chmod 0640 "${EPREFIX}"/etc/bind/rndc.key || die fi einfo @@ -190,7 +190,7 @@ pkg_postinst() { einfo "2) Run \`emerge --config '=${CATEGORY}/${PF}'\`" einfo - CHROOT=$(source /etc/conf.d/named 2>/dev/null; echo ${CHROOT}) + CHROOT=$(source "${EROOT}"/etc/conf.d/named 2>/dev/null; echo ${CHROOT}) if [[ -n ${CHROOT} ]]; then elog "NOTE: As of net-dns/bind-9.4.3_p5-r1 the chroot part of the init-script got some major changes!" elog "To enable the old behaviour (without using mount) uncomment the" @@ -216,9 +216,9 @@ pkg_postinst() { } pkg_config() { - CHROOT=$(source /etc/conf.d/named; echo ${CHROOT}) - CHROOT_NOMOUNT=$(source /etc/conf.d/named; echo ${CHROOT_NOMOUNT}) - CHROOT_GEOIP=$(source /etc/conf.d/named; echo ${CHROOT_GEOIP}) + CHROOT=$(source "${EROOT}"/etc/conf.d/named; echo ${CHROOT}) + CHROOT_NOMOUNT=$(source "${EROOT}"/etc/conf.d/named; echo ${CHROOT_NOMOUNT}) + CHROOT_GEOIP=$(source "${EROOT}"/etc/conf.d/named; echo ${CHROOT_GEOIP}) if [[ -z "${CHROOT}" ]]; then eerror "This config script is designed to automate setting up" @@ -239,34 +239,34 @@ pkg_config() { echo; einfo "Setting up the chroot directory..." - mkdir -m 0750 -p ${CHROOT} || die - mkdir -m 0755 -p ${CHROOT}/{dev,etc,var/log,run} || die - mkdir -m 0750 -p ${CHROOT}/etc/bind || die - mkdir -m 0770 -p ${CHROOT}/var/{bind,log/named} ${CHROOT}/run/named/ || die + mkdir -m 0750 -p "${CHROOT}" || die + mkdir -m 0755 -p "${CHROOT}"/{dev,etc,var/log,run} || die + mkdir -m 0750 -p "${CHROOT}"/etc/bind || die + mkdir -m 0770 -p "${CHROOT}"/var/{bind,log/named} "${CHROOT}"/run/named/ || die chown root:named \ - ${CHROOT} \ - ${CHROOT}/var/{bind,log/named} \ - ${CHROOT}/run/named/ \ - ${CHROOT}/etc/bind \ + "${CHROOT}" \ + "${CHROOT}"/var/{bind,log/named} \ + "${CHROOT}"/run/named/ \ + "${CHROOT}"/etc/bind \ || die - mknod ${CHROOT}/dev/null c 1 3 || die - chmod 0666 ${CHROOT}/dev/null || die + mknod "${CHROOT}"/dev/null c 1 3 || die + chmod 0666 "${CHROOT}"/dev/null || die - mknod ${CHROOT}/dev/zero c 1 5 || die - chmod 0666 ${CHROOT}/dev/zero || die + mknod "${CHROOT}"/dev/zero c 1 5 || die + chmod 0666 "${CHROOT}"/dev/zero || die if [[ "${CHROOT_NOMOUNT:-0}" -ne 0 ]]; then - cp -a /etc/bind ${CHROOT}/etc/ || die - cp -a /var/bind ${CHROOT}/var/ || die + cp -a /etc/bind "${CHROOT}"/etc/ || die + cp -a /var/bind "${CHROOT}"/var/ || die fi if [[ "${CHROOT_GEOIP:-0}" -eq 1 ]]; then if use geoip; then - mkdir -m 0755 -p ${CHROOT}/usr/share/GeoIP || die + mkdir -m 0755 -p "${CHROOT}"/usr/share/GeoIP || die elif use geoip2; then - mkdir -m 0755 -p ${CHROOT}/usr/share/GeoIP2 || die + mkdir -m 0755 -p "${CHROOT}"/usr/share/GeoIP2 || die fi fi |