add container steps to config.sh

This commit is contained in:
Louis Abel 2024-04-23 14:35:21 -07:00
parent f307b722ce
commit 2ada997a06
Signed by untrusted user: label
GPG Key ID: 2A6975660E424560

View File

@ -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