rocky-linux-generic-images/includes/post-install.ksi
2023-08-09 18:38:19 +05:30

39 lines
1.5 KiB
Plaintext

%include bootloader-stuff.ksi
%post
ROOT_PART_UUID=$(grep ' / ' /etc/fstab | awk '{ print $1 }')
# Setup networking temporarily
[ -f /etc/resolv.conf ] || echo "nameserver 1.1.1.1" > /etc/resolv.conf
# Orange Pi 5 stuff
curl 'https://git.rockylinux.org/thefossguy/opi5-boot/-/raw/r9/boot.cmd' --output /boot/boot.cmd
curl 'https://git.rockylinux.org/thefossguy/opi5-boot/-/raw/r9/boot.scr' --output /boot/boot.scr
curl 'https://git.rockylinux.org/thefossguy/opi5-boot/-/raw/r9/orangepiEnv.txt' --output /boot/orangepiEnv.txt
sed -i "s/REPLACE_WITH_UUID_HERE_6969/${ROOT_PART_UUID}/g" /boot/orangepiEnv.txt
# The script that expands root partition
[ -d /usr/local/bin ] || mkdir --verbose /usr/local/bin
curl 'https://git.resf.org/thefossguy/rocky-linux-generic-images/raw/branch/r9/scripts/expand-rootfs.sh' --output /usr/local/bin/expand-rootfs.sh
[ -f /usr/local/bin/expand-rootfs.sh ] && \
chmod --verbose +x /usr/local/bin/expand-rootfs.sh
# Remove all network connections and/or links
rm -v -f /etc/sysconfig/network-scripts/ifcfg-link
rm -v -f /etc/NetworkManager/system-connections/*.nmconnection
# Remove the temporary 'resolv.conf' file
rm -v -f /etc/resolv.conf
# The 'machine-id' needs to be unique for each machine so remove ours to prevent duplication
rm -v -f /etc/machine-id
touch /etc/machine-id
# Like 'machine-id', the 'random-seed' must be generated by the machine on its own
rm -v -f /var/lib/systemd/random-seed
# Remove the RPM database, let it be re-created when the image boots for the first time
rm -v -f /var/lib/rpm/__db*
%end