Files
bind9/util/check-make-install.in
Michal Nowak 039979e460 Install BIND with "make DESTDIR=<PATH> install"
BIND installation should be done by setting $DESTDIR during "make
install", not by setting --prefix via ./configure to the destination
directory. However, on 9.11 --prefix still needs to be set to eliminate
the compatibility mode with older BIND9 releases (see the comment in
configure.ac, lines 379-396), which does not place sysconfdir and
localstatedir to $DESTDIR/$prefix but directly to $DESTDIR. When
--prefix is set they end up in $DESTDIR/$prefix, which is the BIND 9.16+
default).

    $ ./configure && make && make install DESTDIR=/tmp/bind9
    $ ls /tmp/bind9/{,usr/local}
    /tmp/bind9/:
    etc  usr  var
    /tmp/bind9/usr/local:
    bin  include  lib  sbin  share

    $ ./configure --prefix=/usr/local && make && make install DESTDIR=/tmp/bind9
    $ ls /tmp/bind9/{,usr/local}
    /tmp/bind9/:
    usr
    /tmp/bind9/usr/local:
    bin  etc  include  lib  sbin  share  var

Make sure that installation with DESTDIR=<PATH> works by checking that
named binary and it's respective man page were installed and that
well-known BIND9 directories - and only them - are present in DESTDIR.

Also rename install path variable from BIND_INSTALL_PATH to
INSTALL_PATH to avoid namespace clash in stress tests which use
BIND_INSTALL_PATH variable to configure path to BIND9 binaries.

(cherry picked from commit 823bf3e79b)
2021-05-25 18:42:37 +02:00

62 lines
1.7 KiB
Bash

#!/bin/sh
#
# Copyright (C) Internet Systems Consortium, Inc. ("ISC")
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, you can obtain one at https://mozilla.org/MPL/2.0/.
#
# See the COPYRIGHT file distributed with this work for additional
# information regarding copyright ownership.
abs_top_srcdir=@abs_top_srcdir@
abs_builddir=@abs_builddir@
prefix=@prefix@
includedir=@includedir@
install_dir="${DESTDIR}@prefix@"
headers_to_install() {
find "${abs_top_srcdir}/lib" -name "*.h" -or -name "*.h.in" |
grep -v -F /win32/ |
grep -v -F include/isc/ipv6.h |
sed -n \
-e "s|\.h\.in$|\.h|" \
-e "s|.*include/|${DESTDIR}${includedir}/|p" |
sort -u
}
status=0
for header in $(headers_to_install); do
if [ ! -f "${header}" ]; then
echo "Missing $header"
status=1
fi
done
named_binary_path="${install_dir}/sbin/named"
if [ ! -x "${named_binary_path}" ]; then
echo "ERROR: ${named_binary_path} does not exist or is not executable"
status=1
fi
named_man_page_path="${install_dir}/share/man/man8/named.8"
if [ ! -f "${named_man_page_path}" ]; then
echo "ERROR: ${named_man_page_path} does not exist"
status=1
fi
if [ -n "${DESTDIR}" ]; then
for expected_subdir in bin etc include lib sbin share var; do
echo "${install_dir}/${expected_subdir}" >> "${abs_builddir}/expected_dirs"
done
find "${install_dir}" -maxdepth 1 -mindepth 1 -type d | sort > "${abs_builddir}/existing_dirs"
if ! diff -u "${abs_builddir}/expected_dirs" "${abs_builddir}/existing_dirs"; then
echo "ERROR: Contents of DESTDIR do not match expectations"
status=1
fi
rm -f "${abs_builddir}/expected_dirs" "${abs_builddir}/existing_dirs"
fi
exit $status