From 157379235c42f7bce8672a8122bd023ce99511c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timoth=C3=A9e=20Floure?= Date: Mon, 9 Dec 2019 09:53:14 +0100 Subject: [PATCH] Fedora image: reset systemd machine-id and random-seed, clean dnf database --- fedora-build-opennebula-image.sh | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/fedora-build-opennebula-image.sh b/fedora-build-opennebula-image.sh index 40f5d12..6222efc 100755 --- a/fedora-build-opennebula-image.sh +++ b/fedora-build-opennebula-image.sh @@ -134,6 +134,8 @@ run_root ln -sf /usr/share/zoneinfo/UTC /etc/localtime run_root systemctl enable systemd-timesyncd.service # Install kernel and bootloader. +# Note: linux-firmware is not required our environment and takes almost 200M +# uncompressed but is a direct dependency of kernel-core... run_root dnf -y install kernel grub2 run_root grub2-install --target=i386-pc "${NBD_DEVICE}" run_root grub2-mkconfig -o /boot/grub2/grub.cfg @@ -150,5 +152,14 @@ UUID=$boot_uuid /boot ext4 rw,relatime,data=ordered 0 2 UUID=$root_uuid / ext4 rw,relatime,data=ordered 0 1 EOF +# Reset systemd's environment. +run_root rm -f /etc/machine-id +run_root touch /etc/machine-id +rm -f /var/lib/systemd/random-seed + +# Remove temporary files and reclaim freed disk space. +# Note: build logs could be removed as well. +run_root dnf clean all + # Make sure everything is written to disk before exiting. sync