ummmmm idk

This commit is contained in:
Pratham Patel 2023-07-28 12:54:36 +05:30
parent 0d9c130bba
commit e2796f245a
No known key found for this signature in database
4 changed files with 68 additions and 74 deletions

View File

@ -1,3 +1,4 @@
%include includes/user-setup.ksi
%include includes/base-config.ksi
%include includes/disk-layout.ksi
%include includes/package-list.ksi

View File

@ -0,0 +1,60 @@
%post
# U-Boot binaries for 32-bit and 64-bit Raspberry Pi models
# (these are loaded by /boot/efi/config.txt)
cp -f /usr/share/uboot/rpi_3/u-boot.bin /boot/efi/rpi3-u-boot.bin
cp -f /usr/share/uboot/rpi_4/u-boot.bin /boot/efi/rpi4-u-boot.bin
# Remove the 'dracut-config-generic' package if found installed
dnf list installed | grep 'dracut-config-generic' > /dev/null && \
rpm -e dracut-config-generic
# TODO: Add a comment to show what this is doing
if [ -x /lib/kernel/install.d/10-devicetree.install ]; then
/lib/kernel/install.d/10-devicetree.install remove
fi
# remove '/boot/dtb' because the kernel should use '/boot/dtb'
if [ -d /boot/dtb ]; then
rm -rf /boot/dtb
fi
# Kernel selection at boot
cat << EOF > /etc/sysconfig/kernel
# This file was generated by the Kickstart repository used to create this disk image
# PLEASE DO NOT MODIFY THIS UNLESS EITHER
# 1. You know what you are doing
# 2. You are told to modify this file by a Rocky Linux support member
# The 'UPDATEDEFAULT' option makes a newly installed kernel as the default in the boot entry selection
UPDATEDEFAULT=yes
# The 'DEFAULTKERNEL' options specifies what package type will be used as the default
DEFAULTKERNEL=kernel-core
EOF
chmod 644 /etc/sysconfig/kernel
# GRUB setup
if [ -d /boot/efi/EFI/rocky ] && [ -f /boot/efi/EFI/rocky/grubaa64.efi ]; then
mv -f /boot/grub2/grub.cfg /boot/efi/EFI/rocky/grub.cfg
ln -s ../efi/EFI/rocky/grub.cfg /boot/grub2/grub.cfg
[ -d /boot/efi/EFI/BOOT ] || mkdir -p /boot/efi/EFI/BOOT
cp -f /boot/efi/EFI/rocky/grubaa64.efi /boot/efi/EFI/BOOT/BOOTAA64.EFI
fi
# Write GRUB defaults
cat << EOF > /etc/default/grub
GRUB_TIMEOUT=5
GRUB_DISTRIBUTOR="$(sed 's, release .*$,,g' /etc/system-release)"
GRUB_DEFAULT=saved
GRUB_DISABLE_SUBMENU=true
GRUB_TERMINAL_OUTPUT="console serial"
GRUB_CMDLINE_LINUX="console=tty0 console=ttyS0,115200"
GRUB_DISABLE_RECOVERY="true"
GRUB_DISABLE_OS_PROBER="true"
GRUB_ENABLE_BLSCFG="false"
EOF
chmod 644 /etc/default/grub
%end

View File

@ -1,79 +1,7 @@
%include bootloader-stuff.ksi
%post
# 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
# U-Boot binaries for 32-bit and 64-bit Raspberry Pi models
# (these are loaded by /boot/efi/config.txt)
cp -f /usr/share/uboot/rpi_3/u-boot.bin /boot/efi/rpi3-u-boot.bin
cp -f /usr/share/uboot/rpi_4/u-boot.bin /boot/efi/rpi4-u-boot.bin
# Remove the 'dracut-config-generic' package if found installed
dnf list installed | grep 'dracut-config-generic' > /dev/null && \
rpm -e dracut-config-generic
# TODO: Add a comment to show what this is doing
if [ -x /lib/kernel/install.d/10-devicetree.install ]; then
/lib/kernel/install.d/10-devicetree.install remove
fi
# remove '/boot/dtb' because the kernel should use '/boot/dtb'
if [ -d /boot/dtb ]; then
rm -rf /boot/dtb
fi
# Kernel selection at boot
cat << EOF > /etc/sysconfig/kernel
# This file was generated by the Kickstart repository used to create this disk image
# PLEASE DO NOT MODIFY THIS UNLESS EITHER
# 1. You know what you are doing
# 2. You are told to modify this file by a Rocky Linux support member
# The 'UPDATEDEFAULT' option makes a newly installed kernel as the default in the boot entry selection
UPDATEDEFAULT=yes
# The 'DEFAULTKERNEL' options specifies what package type will be used as the default
DEFAULTKERNEL=kernel-core
EOF
chmod 644 /etc/sysconfig/kernel
# GRUB setup
if [ -d /boot/efi/EFI/rocky ] && [ -f /boot/efi/EFI/rocky/grubaa64.efi ]; then
mv -f /boot/grub2/grub.cfg /boot/efi/EFI/rocky/grub.cfg
ln -s ../efi/EFI/rocky/grub.cfg /boot/grub2/grub.cfg
[ -d /boot/efi/EFI/BOOT ] || mkdir -p /boot/efi/EFI/BOOT
cp -f /boot/efi/EFI/rocky/grubaa64.efi /boot/efi/EFI/BOOT/BOOTAA64.EFI
fi
# Write GRUB defaults
cat << EOF > /etc/default/grub
GRUB_TIMEOUT=5
GRUB_DISTRIBUTOR="$(sed 's, release .*$,,g' /etc/system-release)"
GRUB_DEFAULT=saved
GRUB_DISABLE_SUBMENU=true
GRUB_TERMINAL_OUTPUT="console serial"
GRUB_CMDLINE_LINUX="console=tty0 console=ttyS0,115200"
GRUB_DISABLE_RECOVERY="true"
GRUB_DISABLE_OS_PROBER="true"
GRUB_ENABLE_BLSCFG="false"
EOF
chmod 644 /etc/default/grub
# The script that expands root partition
mkdir -v /usr/local/bin
cat << EOF > /usr/local/bin/expand-rootfs.sh

5
includes/user-setup.ksi Normal file
View File

@ -0,0 +1,5 @@
# Create user 'rocky' with password 'rockylinux' and added in group 'wheel'
user --name=rocky --groups=wheel --homedir=/home/rocky --plaintext --password=rockylinux --uid=1000 --gid=1000
# Lock the root user account
user --name=root --lock