%include bootloader-stuff.ksi %post # Setup networking temporarily [ -f /etc/resolv.conf ] || echo "nameserver 1.1.1.1" > /etc/resolv.conf # User setup DEFAULT_USERNAME='rocky' DEFAULT_PASSWORD='rockylinux' DEFAULT_GROUPS='wheel' useradd --comment "Rocky Linux" \ --uid 1000 \ --create-home \ --user-group "${DEFAULT_USERNAME}" \ --groups "${DEFAULT_GROUPS}" echo -e "${DEFAULT_PASSWORD}\n${DEFAULT_PASSWORD}" | passwd "${DEFAULT_USERNAME}" passwd -e "${DEFAULT_USERNAME}" # Lock the root account passwd -l root # 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 # Orange Pi 5 stuff ROOT_PART_UUID=$(grep ' / ' /etc/fstab | awk '{ print $1 }') 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 # 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