From 0d53f9ce6cd3379414ea2181a141682326d03db5 Mon Sep 17 00:00:00 2001 From: Jan Kaluza Date: Mon, 12 Oct 2020 08:08:59 +0200 Subject: [PATCH] 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 --- fedora-eln-container-base.ks | 44 +++++++++++++++++++----------------- 1 file changed, 23 insertions(+), 21 deletions(-) diff --git a/fedora-eln-container-base.ks b/fedora-eln-container-base.ks index e1540f5..d6f018d 100644 --- a/fedora-eln-container-base.ks +++ b/fedora-eln-container-base.ks @@ -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