From d076efa5cbf992548013051d5e0eb1f07ca43741 Mon Sep 17 00:00:00 2001 From: Pratham Patel Date: Thu, 27 Jul 2023 19:53:23 +0530 Subject: [PATCH] init branch r9 --- README.md | 3 +++ Rocky-9-aarch64-minimal.ks | 5 +++++ create-image.sh | 24 ++++++++++++++++++++ includes/.rocky-9-repos.ksi | 17 ++++++++++++++ includes/base-config.ksi | 11 +++++++++ includes/disk-layout.ksi | 6 +++++ includes/package-list.ksi | 45 +++++++++++++++++++++++++++++++++++++ includes/post-install.ksi | 38 +++++++++++++++++++++++++++++++ 8 files changed, 149 insertions(+) create mode 100644 README.md create mode 100644 Rocky-9-aarch64-minimal.ks create mode 100755 create-image.sh create mode 100644 includes/.rocky-9-repos.ksi create mode 100644 includes/base-config.ksi create mode 100644 includes/disk-layout.ksi create mode 100644 includes/package-list.ksi create mode 100644 includes/post-install.ksi diff --git a/README.md b/README.md new file mode 100644 index 0000000..14649d0 --- /dev/null +++ b/README.md @@ -0,0 +1,3 @@ +# README + +**Kickstart syntax reference**: https://docs.fedoraproject.org/en-US/fedora/f36/install-guide/appendixes/Kickstart_Syntax_Reference/ diff --git a/Rocky-9-aarch64-minimal.ks b/Rocky-9-aarch64-minimal.ks new file mode 100644 index 0000000..e926322 --- /dev/null +++ b/Rocky-9-aarch64-minimal.ks @@ -0,0 +1,5 @@ +%includes includes/.rocky-9-repos.ksi +%includes includes/base-config.ksi +%includes includes/disk-layout.ksi +%includes includes/package-list.ksi +%includes includes/post-install.ksi diff --git a/create-image.sh b/create-image.sh new file mode 100755 index 0000000..7a56ba5 --- /dev/null +++ b/create-image.sh @@ -0,0 +1,24 @@ +#!/usr/bin/env bash + +REAL_USER=$(who am i | awk '{print $1}') +APPLIANCE_NAME="Rocky-9-aarch64-minimal" +KICKSTARTER_FILENAME="${APPLIANCE_NAME}.ks" + +if [[ ${EUID} -ne 0 ]]; then + >&2 echo "ERROR: Please run this script as root" + exit 1 +fi + +appliance-creator \ + --config "${KICKSTARTER_FILENAME}" \ + --name "${APPLIANCE_NAME}" \ + --format raw \ + --checksum \ + --no-compress \ + --outdir "${PWD}" \ + --debug \ + --verbose \ + 1> Rocky-9-aarch64-minimal.stdout.log \ + 2> Rocky-9-aarch64-minimal.stderr.log + +chown "${REAL_USER}:${REAL_USER}" "${APPLIANCE_NAME}*" diff --git a/includes/.rocky-9-repos.ksi b/includes/.rocky-9-repos.ksi new file mode 100644 index 0000000..637a3aa --- /dev/null +++ b/includes/.rocky-9-repos.ksi @@ -0,0 +1,17 @@ +# Specify where our (Rocky Linux's) "base" resides +url --url=https://download.rockylinux.org/pub/rocky/9/BaseOS/aarch64/os + +# Mirrors for the default repositories +# the 'kernel-*' packages are disabled from these "default" repositories +# because we will use either the LTS kernel or the latest mainline kernel +# from the '' repo +repo --install --excludepkgs=kernel-* --name=AppStream --mirrorlist=https://mirrors.rockylinux.org/mirrorlist?repo=AppStream-9&arch=aarch64 +repo --install --excludepkgs=kernel-* --name=BaseOS --mirrorlist=https://mirrors.rockylinux.org/mirrorlist?repo=BaseOS-9&arch=aarch64 +repo --install --excludepkgs=kernel-* --name=CRB --mirrorlist=https://mirrors.rockylinux.org/mirrorlist?repo=CRB-9&arch=aarch64 + +# Enable two additional repositories +# : All SBC-specific stuff that is not "Enterprise Linux" (uboot, on-board WiFi/BT firmware and other tools) +# : Newer kernels than what RHEL ships ('kernel-ml' and 'kernel-lts-') +#repo --install --name= --mirrorlist=https://mirrors.rockylinux.org/mirrorlist?repo=-9&arch=aarch64 +#repo --install --name= --mirrorlist=https://mirrors.rockylinux.org/mirrorlist?repo=-9&arch=aarch64 +repo --name="instKern" --baseurl=https://rockyrepos.gnulab.org/gen_aarch64_el9/ --cost=100 --install diff --git a/includes/base-config.ksi b/includes/base-config.ksi new file mode 100644 index 0000000..140d713 --- /dev/null +++ b/includes/base-config.ksi @@ -0,0 +1,11 @@ +keyboard us --vckeymap=us --xlayouts=us +lang en_US.UTF-8 +services --enabled=chronyd,NetworkManager,sshd +#services --disabled= +skipx # disable X by default +timezone UTC +selinux --enforcing +firewall --enabled --service=sshd +network --bootproto=dhcp --onboot=on +bootloader --location=mbr --boot-drive=sda +shutdown # power-off after the installation completes diff --git a/includes/disk-layout.ksi b/includes/disk-layout.ksi new file mode 100644 index 0000000..76b785a --- /dev/null +++ b/includes/disk-layout.ksi @@ -0,0 +1,6 @@ +# Remove all partitions +clearpart --drives=sda --disklabel=rocky-linux --all + +# Create partitions +part /boot/efi --asprimary --ondisk=sda --size=1024 --label=boot --fstype=efi +part / --asprimary --ondisk=sda --size=4096 --label=root --fstype=ext4 diff --git a/includes/package-list.ksi b/includes/package-list.ksi new file mode 100644 index 0000000..effd585 --- /dev/null +++ b/includes/package-list.ksi @@ -0,0 +1,45 @@ +%packages + +# Include all packages under '@core' +@core + +# Extra packages to do 'uboot -> grub -> linux' +dracut-config-generic +efibootmgr +grub2-common +grub2-efi-aa64 +grub2-efi-aa64-modules +grubby +kernel +kernel-core +shim-aa64 +systemd-udev +uboot-tools + + +# Other packages +bash-completion +chrony +cloud-utils-growpart +glibc-langpack-en +nano +net-tools +NetworkManager-wifi +tmux + +# SIG/AltArch stuff +uboot-images-armv8 + +# Raspberry Pi firmware +bcm2711-firmware +bcm2835-firmware +bcm283x-firmware + +# Raspberry Pi overlays +bcm283x-overlays + +# Remove some packages +-java-11-* +-dracut-config-rescue + +%end diff --git a/includes/post-install.ksi b/includes/post-install.ksi new file mode 100644 index 0000000..7681730 --- /dev/null +++ b/includes/post-install.ksi @@ -0,0 +1,38 @@ +%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 + +# GRUB setup +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" +GRUB_CMDLINE_LINUX="" +GRUB_DISABLE_RECOVERY="true" +GRUB_DISABLE_OS_PROBER="true" +GRUB_ENABLE_BLSCFG="false" +EOF + +chmod 644 /etc/default/grub + +# Rebuild the RPM database +rpm --rebuilddb + +%end