rocky-linux-generic-images/includes/post-install.ksi

49 lines
1.5 KiB
Plaintext
Raw Normal View History

2023-07-28 07:24:36 +00:00
%include bootloader-stuff.ksi
2023-07-28 04:44:57 +00:00
2023-07-28 07:24:36 +00:00
%post
2023-07-27 14:23:23 +00:00
2023-07-29 07:57:37 +00:00
# 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
2023-07-28 06:40:01 +00:00
# The script that expands root partition
2023-07-28 08:25:52 +00:00
[ -d /usr/local/bin ] || mkdir --verbose /usr/local/bin
2023-07-28 09:23:02 +00:00
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
2023-07-28 06:40:01 +00:00
2023-07-29 16:09:25 +00:00
# Remove all network connections and/or links
2023-07-28 08:25:52 +00:00
rm -v -f /etc/sysconfig/network-scripts/ifcfg-link
2023-07-29 16:09:25 +00:00
rm -v -f /etc/NetworkManager/system-connections/*.nmconnection
2023-07-28 06:40:01 +00:00
2023-07-28 09:21:09 +00:00
# Remove the temporary 'resolv.conf' file
2023-07-28 14:30:34 +00:00
rm -v -f /etc/resolv.conf
2023-07-28 09:21:09 +00:00
2023-07-28 06:40:01 +00:00
# The 'machine-id' needs to be unique for each machine so remove ours to prevent duplication
2023-07-28 08:25:52 +00:00
rm -v -f /etc/machine-id
2023-07-28 06:40:01 +00:00
touch /etc/machine-id
2023-07-29 13:48:13 +00:00
# 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*
2023-07-27 14:23:23 +00:00
%end