%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' /sbin/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 # 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