41 lines
1005 B
Bash
Executable File
41 lines
1005 B
Bash
Executable File
#!/bin/bash
|
|
|
|
if [ ${DIB_DEBUG_TRACE:-1} -gt 0 ]; then
|
|
set -x
|
|
fi
|
|
set -eu
|
|
set -o pipefail
|
|
|
|
# Stay compatible
|
|
echo "container-${DIB_YUM_ROCKY_CONTAINER_TYPE}" > /etc/dnf/vars/infra
|
|
|
|
#Generate installtime file record
|
|
/bin/date +%Y%m%d_%H%M > /etc/BUILDTIME
|
|
|
|
# Limit languages to help reduce size.
|
|
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
|
|
|
|
for dir in $(ls -d /usr/share/locale/* | grep -v 'en_US\|all_languages\|locale\.alias'); do rm -fr $dir; done
|
|
|
|
rm -fr /usr/share/man
|
|
|
|
# Cleanup caches left by chroot
|
|
find /usr/lib* -type d -name __pycache__ -print0 | xargs --null -I {} rm -fr {}
|
|
rm -fr /var/cache/dnf/*
|
|
rm -fr /var/lib/dnf/repos/*
|
|
rm -fr /run
|
|
rm -fr /home/ansible/
|
|
|
|
# systemd fixes
|
|
:> /etc/machine-id
|
|
|
|
# Cleanup the image
|
|
rm -fv /etc/udev/hwdb.bin
|
|
rm -rfv /usr/lib/udev/hwdb.d/ \
|
|
/boot /var/lib/dnf/history.* \
|
|
"/tmp/*" "/tmp/.*" /var/log/* || true
|