Add support for the new includes.chroot system to /etc/hosts file

The new includes.chroot system implemented in !214 adds the option
to include files in the chroot before and after package installation.

chroot_hostname and chroot_resolv have been updated but not chroot_hosts.

Gbp-Dch: Short
This commit is contained in:
Olivier BLIN 2022-04-22 10:16:54 +02:00
parent f1a98e4da6
commit 36e019c38d
1 changed files with 9 additions and 3 deletions

View File

@ -70,10 +70,16 @@ EOF
# Acquire lock file # Acquire lock file
Acquire_lockfile Acquire_lockfile
if [ -e config/includes.chroot/etc/hosts ] # Copying hosts from includes, if existing
INCLUDE_DIR=$(select_includes_chroot)
# includes.chroot_before_packages takes the highest precedence
if [ -e config/includes.chroot_before_packages/etc/hosts ]
then then
# Copying local hosts INCLUDE_DIR="includes.chroot_before_packages"
cp -a config/includes.chroot/etc/hosts chroot/etc/hosts fi
if [ -n "${INCLUDE_DIR}" ] && [ -e config/"${INCLUDE_DIR}"/etc/hosts ]
then
cp -a config/"${INCLUDE_DIR}"/etc/hosts chroot/etc/hosts
rm -f chroot/etc/hosts.orig rm -f chroot/etc/hosts.orig
elif [ -f chroot/etc/hosts.orig ] elif [ -f chroot/etc/hosts.orig ]
then then