From 2ada997a06807d91387554d1f010dc4aa3c11ff8 Mon Sep 17 00:00:00 2001 From: Louis Abel Date: Tue, 23 Apr 2024 14:35:21 -0700 Subject: [PATCH] add container steps to config.sh --- config.sh | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/config.sh b/config.sh index 0a78563..876c7cc 100644 --- a/config.sh +++ b/config.sh @@ -547,6 +547,38 @@ function azure_cleanup_steps() { cloud-init clean waagent -force -deprovision+user } + +function common_container_steps() { + /bin/date +%Y-%m-%d_%H:%M:%S > /etc/BUILDTIME + echo 'container' > /etc/dnf/vars/infra + LANG="en_US" + echo "%_install_langs $LANG" > /etc/rpm/macros.image-language-conf + echo 'LANG="C.UTF-8"' > /etc/locale.conf + releasever=$(rpm --eval '%{?rocky}') + rpm --import "/etc/pki/rpm-gpg/RPM-GPG-KEY-Rocky-${releasever}" + :> /etc/machine-id + echo "# placeholder" > /etc/resolv.conf + chmod 644 /etc/resolv.conf + rm -rf /tmp/* + printf "tsflags=nodocs\n" >>/etc/dnf/dnf.conf +} + +function minimal_container_steps() { + rm -fv /usr/share/gnupg/help*.txt + rm /usr/lib/rpm/rpm.daily + rm -rfv /usr/lib64/nss/unsupported-tools/ + rm -fv /usr/sbin/{glibc_post_upgrade.x86_64,sln} + ln /usr/bin/ln usr/sbin/sln + rm -rfv /var/lib/dnf + rm -rfv /usr/share/icons/* + rm -fv /usr/bin/pinky + rm -rfv /usr/lib/systemd +} + +function toolbox_container_steps() { + rm -f /etc/rpm/macros.image-language-conf + sed -i '/tsflags=nodocs/d' /etc/dnf/dnf.conf +} # ################################################################################ @@ -630,3 +662,14 @@ if [[ "$kiwi_profiles" == *"Live"* ]]; then epel_de_steps fi fi + +# Containers only +if [[ "$kiwi_profiles" == *"Container"* ]]; then + common_container_steps + if [[ "$kiwi_profiles" == *"Container-Minimal"* ]]; then + minimal_container_steps + fi + if [[ "$kiwi_profiles" == *"Container-Toolbox"* ]]; then + toolbox_container_steps + fi +fi