aboutsummaryrefslogtreecommitdiff
path: root/config.sh
diff options
from:
to:
context:
space:
mode:
authorGravatar Neal Gompa <ngompa@fedoraproject.org> 2024-01-07 22:16:11 -0500
committerGravatar Neal Gompa <ngompa@fedoraproject.org> 2024-01-07 22:16:11 -0500
commitd27e4c3f6c3e13bcefe9d1d904386794140d8a91 (patch)
treea8289b74fa7871701961a798b85f8f179ce354d0 /config.sh
parente6896b13c2757e3b36a574f83fffc74922470132 (diff)
downloadkiwi-descriptions-d27e4c3f6c3e13bcefe9d1d904386794140d8a91.tar.gz
kiwi-descriptions-d27e4c3f6c3e13bcefe9d1d904386794140d8a91.zip
Add base container definitions
This adds the definitions for building the container tarballs for the base container, the minimal base container, and the toolbox container.
Diffstat (limited to 'config.sh')
-rwxr-xr-xconfig.sh100
1 files changed, 87 insertions, 13 deletions
diff --git a/config.sh b/config.sh
index 67c2cad..7abd097 100755
--- a/config.sh
+++ b/config.sh
@@ -16,8 +16,10 @@ echo "Configure image: [$kiwi_iname]-[$kiwi_profiles]..."
#======================================
# Set SELinux booleans
#--------------------------------------
-## Fixes KDE Plasma, see rhbz#2058657
-setsebool -P selinuxuser_execmod 1
+if [[ "$kiwi_profiles" != *"Container"* ]]; then
+ ## Fixes KDE Plasma, see rhbz#2058657
+ setsebool -P selinuxuser_execmod 1
+fi
#======================================
# Clear machine specific configuration
@@ -31,13 +33,15 @@ rm -f /var/lib/systemd/random-seed
#======================================
# Configure grub correctly
#--------------------------------------
-## Works around issues with grub-bls
-## See: https://github.com/OSInside/kiwi/issues/2198
-echo "GRUB_DEFAULT=saved" >> /etc/default/grub
-## Disable submenus to match Fedora
-echo "GRUB_DISABLE_SUBMENU=true" >> /etc/default/grub
-## Disable recovery entries to match Fedora
-echo "GRUB_DISABLE_RECOVERY=true" >> /etc/default/grub
+if [[ "$kiwi_profiles" != *"Container"* ]]; then
+ ## Works around issues with grub-bls
+ ## See: https://github.com/OSInside/kiwi/issues/2198
+ echo "GRUB_DEFAULT=saved" >> /etc/default/grub
+ ## Disable submenus to match Fedora
+ echo "GRUB_DISABLE_SUBMENU=true" >> /etc/default/grub
+ ## Disable recovery entries to match Fedora
+ echo "GRUB_DISABLE_RECOVERY=true" >> /etc/default/grub
+fi
#======================================
# Delete & lock the root user password
@@ -64,10 +68,12 @@ fi
#======================================
# Setup default target
#--------------------------------------
-if [[ "$kiwi_profiles" == *"GNOME"* ]] || [[ "$kiwi_profiles" == *"KDE"* ]]; then
- systemctl set-default graphical.target
-else
- systemctl set-default multi-user.target
+if [[ "$kiwi_profiles" != *"Container"* ]]; then
+ if [[ "$kiwi_profiles" == *"GNOME"* ]] || [[ "$kiwi_profiles" == *"KDE"* ]]; then
+ systemctl set-default graphical.target
+ else
+ systemctl set-default multi-user.target
+ fi
fi
#======================================
@@ -118,4 +124,72 @@ chmod 600 /root/.ssh/authorized_keys
chown -R root:root /root/.ssh
fi
+if [[ "$kiwi_profiles" == *"Container"* ]]; then
+ # 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"
+ releasever=$(rpm --eval '%{?fedora}')
+
+ # When building ELN containers, we don't have the %{fedora} macro
+ if [ -z $releasever ]; then
+ releasever=eln
+ fi
+
+ rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-$releasever-primary
+
+ echo "# fstab intentionally empty for containers" > /etc/fstab
+
+ # Remove machine-id on pre generated images
+ rm -f /etc/machine-id
+ touch /etc/machine-id
+
+ echo "# resolv placeholder" > /etc/resolv.conf
+ chmod 644 /etc/resolv.conf
+
+ # Remove extraneous files
+ rm -rf /tmp/*
+
+ # https://pagure.io/atomic-wg/issue/308
+ printf "tsflags=nodocs\n" >>/etc/dnf/dnf.conf
+
+ if [[ "$kiwi_profiles" == *"Base-Generic-Minimal"* ]]; then
+ # remove some random help txt files
+ rm -fv /usr/share/gnupg/help*.txt
+
+ # Pruning random things
+ rm /usr/lib/rpm/rpm.daily
+ rm -rfv /usr/lib64/nss/unsupported-tools/ # unsupported
+
+ # Statically linked crap
+ rm -fv /usr/sbin/{glibc_post_upgrade.x86_64,sln}
+ ln /usr/bin/ln usr/sbin/sln
+
+ # Remove some dnf info
+ rm -rfv /var/lib/dnf
+
+ # don't need icons
+ rm -rfv /usr/share/icons/*
+
+ #some random not-that-useful binaries
+ rm -fv /usr/bin/pinky
+
+ # we lose presets by removing /usr/lib/systemd but we do not care
+ rm -rfv /usr/lib/systemd
+ fi
+ if [[ "$kiwi_profiles" == *"Toolbox"* ]]; then
+ # Remove macros.image-language-conf file
+ rm -f /etc/rpm/macros.image-language-conf
+
+ # Remove 'tsflags=nodocs' line from dnf.conf
+ sed -i '/tsflags=nodocs/d' /etc/dnf/dnf.conf
+ fi
+fi
+
exit 0