init: kickstart for fedora-container-toolbox

Signed-off-by: Samyak Jain <samyak.jn11@gmail.com>
This commit is contained in:
Samyak Jain 2023-06-08 11:36:08 +05:30
parent 13cc5064a6
commit 48e2c3b559
1 changed files with 160 additions and 0 deletions

160
fedora-container-toolbox.ks Normal file
View File

@ -0,0 +1,160 @@
# Kickstart file for Fedora Toolbox
# See fedora-container-common.ks for details on how to hack on container image kickstarts
# This base is a standard Fedora image with python3 and dnf
%include fedora-container-common.ks
# Install packages
%packages --excludedocs --inst-langs=en --nocore --exclude-weakdeps
@standard
@core
rootfiles
tar # https://bugzilla.redhat.com/show_bug.cgi?id=1409920
vim-enhanced
dnf
dnf-yum # https://fedorahosted.org/fesco/ticket/1312#comment:29
sudo
-glibc-minimal-langpack
-glibc-all-langpacks
acl
bash
coreutils-common
curl
findutils
gawk
gnupg2
grep
gzip
libcap
openssl
p11-kit
pam
python3
rpm
sed
systemd
util-linux-core
bash-completion
bc
bzip2
diffutils
dnf-plugins-core
flatpak-spawn
fpaste
git
gnupg2-smime
gvfs-client
hostname
iproute
iputils
whois
keyutils
krb5-libs
less
lsof
man-db
man-pages
mesa-dri-drivers
mesa-vulkan-drivers
mtr
nano-default-editor
nss-mdns
openssh-clients
passwd
pigz
procps-ng
rsync
shadow-utils
tcpdump
time
traceroute
tree
unzip
util-linux
vte-profile
vulkan-loader
wget
which
words
xorg-x11-xauth
xz
zip
%end
# Pre-installation commands
%pre
# Copy README.md
cp /README.md /mnt/sysimage/README.md
# Remove macros.image-language-conf file
rm -f /mnt/sysimage/etc/rpm/macros.image-language-conf
# Remove 'tsflags=nodocs' line from dnf.conf
sed -i '/tsflags=nodocs/d' /mnt/sysimage/etc/dnf/dnf.conf
# https://bugzilla.redhat.com/show_bug.cgi?id=1343138
# Fix /run/lock breakage since it's not tmpfs in docker
# This unmounts /run (tmpfs) and then recreates the files
# in the /run directory on the root filesystem of the container
#
# We ignore the return code of the systemd-tmpfiles command because
# at this point we have already removed the /etc/machine-id and all
# tmpfiles lines with %m in them will fail and cause a bad return
# code. Example failure:
# [/usr/lib/tmpfiles.d/systemd.conf:26] Failed to replace specifiers: /run/log/journal/%m
#
umount /run
rm -f /run/nologin # https://pagure.io/atomic-wg/issue/316
# Final pruning
rm -rfv /var/cache/* /var/log/* /tmp/*
%end
# Perform any necessary post-installation configurations specific to Fedora Toolbox (nochroot environment)
# Post-installation commands
%post --nochroot --erroronfail --log=/mnt/sysimage/root/anaconda-post-nochroot.log
set -eux
# Swap coreutils-single with coreutils-full
dnf -y swap coreutils-single coreutils-full
# Swap glibc-minimal-langpack with glibc-all-langpacks
dnf -y swap glibc-minimal-langpack glibc-all-langpacks
# Check if specified files exist
declare -a files=(
"/usr/share/man/man1/bash.1*"
"/usr/share/man/man1/cd.1*"
"/usr/share/man/man1/export.1*"
"/usr/share/man/man1/cat.1*"
"/usr/share/man/man1/cp.1*"
"/usr/share/man/man1/ls.1*"
"/usr/share/man/man1/gpg2.1*"
"/usr/share/man/man7/gnupg2.7*"
"/usr/share/man/fr/man8/rpm.8*"
"/usr/share/man/ja/man8/rpm.8*"
"/usr/share/man/man8/rpm.8*"
"/usr/share/man/man1/kill.1*"
"/usr/share/man/man8/mount.8*"
)
ret_val=0
for file in "${files[@]}"; do
if ! compgen -G "$file" >/dev/null; then
echo "$file: No such file or directory" >&2
ret_val=1
break
fi
done
if [ "$ret_val" -ne 0 ]; then
false
fi
# Clean up dnf cache
dnf clean all
%end