Fix permissions and ownership of chroot_hosts and chroot_hostname copied files

Ensure that /etc/hosts and /etc/hostname have safe permissions and the right
ownership when copied from include directory.

Gbp-Dch: Ignore
This commit is contained in:
Olivier BLIN 2022-06-10 11:11:21 +02:00
parent 5b7d86686c
commit d2722e8f19
2 changed files with 6 additions and 2 deletions

View File

@ -75,7 +75,9 @@ EOF
fi fi
if [ -n "${INCLUDE_DIR}" ] && [ -e config/"${INCLUDE_DIR}"/etc/hostname ] if [ -n "${INCLUDE_DIR}" ] && [ -e config/"${INCLUDE_DIR}"/etc/hostname ]
then then
cp -a config/"${INCLUDE_DIR}"/etc/hostname chroot/etc/hostname cp config/"${INCLUDE_DIR}"/etc/hostname chroot/etc/hostname
chmod 644 chroot/etc/hostname
Chroot chroot "chown root:root chroot/etc/hostname"
fi fi
Echo_message "Deconfiguring file /bin/hostname" Echo_message "Deconfiguring file /bin/hostname"

View File

@ -79,7 +79,9 @@ EOF
fi fi
if [ -n "${INCLUDE_DIR}" ] && [ -e config/"${INCLUDE_DIR}"/etc/hosts ] if [ -n "${INCLUDE_DIR}" ] && [ -e config/"${INCLUDE_DIR}"/etc/hosts ]
then then
cp -a config/"${INCLUDE_DIR}"/etc/hosts chroot/etc/hosts cp config/"${INCLUDE_DIR}"/etc/hosts chroot/etc/hosts
chmod 644 chroot/etc/hosts
Chroot chroot "chown root:root /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