ELN: Move %post scripts from --nochroot %post to normal %post.

The scripts changing the image were wrongly run in --nochroot
%post section. This commit fixes it by simply moving it from
--nochroot %post to normal chroot %post.

Signed-off-by: Jan Kaluza <jkaluza@redhat.com>
This commit is contained in:
Jan Kaluza 2020-10-12 08:08:59 +02:00
parent 79d9ceeaae
commit 0d53f9ce6c

View File

@ -52,6 +52,29 @@ sudo
%end
%post --erroronfail --log=/root/anaconda-post.log
set -eux
# Set install langs macro so that new rpms that get installed will
# only install langs that we limit it to.
LANG="en_US"
echo "%_install_langs $LANG" > /etc/rpm/macros.image-language-conf
# https://bugzilla.redhat.com/show_bug.cgi?id=1727489
echo 'LANG="C.UTF-8"' > /etc/locale.conf
# https://bugzilla.redhat.com/show_bug.cgi?id=1400682
echo "Import RPM GPG key"
rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-33-primary /etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-34-primary
# Disable conflicting repositories.
dnf config-manager --disable eln-modular "*rawhide*" "*cisco*"
echo "# fstab intentionally empty for containers" > /etc/fstab
# Remove machine-id on pre generated images
rm -f /etc/machine-id
touch /etc/machine-id
# remove some extraneous files
rm -rf /var/cache/dnf/*
rm -rf /tmp/*
@ -82,27 +105,6 @@ rm -rfv /var/cache/* /var/log/* /tmp/*
%post --nochroot --erroronfail --log=/mnt/sysimage/root/anaconda-post-nochroot.log
set -eux
# Set install langs macro so that new rpms that get installed will
# only install langs that we limit it to.
LANG="en_US"
echo "%_install_langs $LANG" > /etc/rpm/macros.image-language-conf
# https://bugzilla.redhat.com/show_bug.cgi?id=1727489
echo 'LANG="C.UTF-8"' > /etc/locale.conf
# https://bugzilla.redhat.com/show_bug.cgi?id=1400682
echo "Import RPM GPG key"
rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-33-primary /etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-34-primary
# Disable conflicting repositories.
dnf config-manager --disable eln-modular "*rawhide*" "*cisco*"
echo "# fstab intentionally empty for containers" > /etc/fstab
# Remove machine-id on pre generated images
rm -f /etc/machine-id
touch /etc/machine-id
# See: https://bugzilla.redhat.com/show_bug.cgi?id=1051816
# NOTE: run this in nochroot because "find" does not exist in chroot
KEEPLANG=en_US