This commit is contained in:
Pratham Patel 2023-07-28 12:10:01 +05:30
parent f41dbcf134
commit 0d9c130bba
No known key found for this signature in database
7 changed files with 91 additions and 4 deletions

View File

@ -1,3 +1,27 @@
# README
## Rocky Linux 9 generic ARM64/Aarch64 images
### SSH
SSH is enabled on port `22`. Logging-in as **`root` is disabled**, but you can login as user `rocky`.
### User credentials
```
username: rocky
password: rockylinux (you will be forced to change this)
```
```
username: root
password: <disabled>
```
### Expanding the rootfs
`sudo /usr/local/bin/expand-rootfs.sh`
## OTHER
**Kickstart syntax reference**: https://docs.fedoraproject.org/en-US/fedora/f36/install-guide/appendixes/Kickstart_Syntax_Reference/

View File

@ -1,5 +1,5 @@
%include includes/.rocky-9-repos.ksi
%include includes/base-config.ksi
%include includes/disk-layout.ksi
%include includes/package-list.ksi
%include includes/post-install.ksi
%include includes/rocky-9-repos.ksi

View File

@ -23,6 +23,20 @@ appliance-creator \
2> Rocky-9-aarch64-minimal.stderr.log
if [[ -f "${APPLIANCE_NAME}-sda.raw" ]]; then
mv "${APPLIANCE_NAME}-sda.raw" "${APPLIANCE_NAME}.raw"
chown -v "${REAL_USER}:${REAL_USER}" "${APPLIANCE_NAME}*"
set -x
IMAGE_NAME="${APPLIANCE_NAME}-$(date +%Y.%m.%d).raw"
COMPRESSED_IMAGE_NAME="${IMAGE_NAME}.zst"
touch "${APPLIANCE_NAME}-sda.raw"
mv "${APPLIANCE_NAME}-sda.raw" "${IMAGE_NAME}"
zstd -9 -z "${IMAGE_NAME}"
sha256sum "${IMAGE_NAME}" > "${IMAGE_NAME}.sha256"
sha512sum "${IMAGE_NAME}" > "${IMAGE_NAME}.sha512"
sha256sum "${COMPRESSED_IMAGE_NAME}" > "${COMPRESSED_IMAGE_NAME}.sha256"
sha512sum "${COMPRESSED_IMAGE_NAME}" > "${COMPRESSED_IMAGE_NAME}.sha512"
chown -v "${REAL_USER}:${REAL_USER}" "${IMAGE_NAME}*"
fi

View File

@ -6,6 +6,6 @@ skipx # disable X by default
timezone UTC
selinux --enforcing
firewall --enabled --service=sshd
network --bootproto=dhcp --onboot=on
network --device=link --activate --bootproto=dhcp --onboot=on
bootloader --location=mbr --boot-drive=sda
shutdown # power-off after the installation completes

View File

@ -22,6 +22,7 @@ uboot-tools
bash-completion
chrony
cloud-utils-growpart
e2fsprogs
glibc-langpack-en
nano
net-tools

View File

@ -74,7 +74,55 @@ 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
#!/usr/bin/env bash
ROOT_DEVICE=$(mount | grep '/ ' | awk '{print $1}') # "/dev/sda3"
DISK_NAME="/dev/$(lsblk -ls "${ROOT_DEVICE}" | tail -n 1 | awk '{print $1}')" # "/dev/sda"
CUT_LENGTH=$(( ${#DISK_NAME} + 1 )) # how much to cut from "/dev/sda3" to get "3"
if [[ "${DISK_NAME}" =~ "nvme" || "${DISK_NAME}" =~ "mmcblk" ]]; then
# Add an extra character to cut since NVMe and MMC-block devices
# have a partition number _after_ a 'p'
CUT_LENGTH=$(( CUT_LENGTH + 1 ))
fi
PARTITION_NUMBER=$(echo "${ROOT_DEVICE}" | cut -c "${CUT_LENGTH}-") # get "3" from "/dev/sda3"
if [[ -z "${ROOT_DEVICE}" || -z "${DISK_NAME}" || -z "${CUT_LENGTH}" || -z "${PARTITION_NUMBER}" ]]; then
>&2 echo "$0: error: unable to detect root device"
exit 1
fi
if ! command -v growpart > /dev/null; then
>&2 echo "$0: error: unable to find command 'growpart'"
exit 1
fi
if ! command -v resize2fs > /dev/null; then
>&2 echo "$0: error: unable to find command 'resize2fs'"
exit 1
fi
if [[ ${EUID} -ne 0 || ${UID} -ne 0 ]]; then
>&2 echo "$0: error: please run this script as root"
exit 1
fi
set -x
growpart "${DISK_NAME}" "${PARTITION_NUMBER}"
resize2fs "${ROOT_DEVICE}"
EOF
chmod +x /usr/local/bin/expand-rootfs.sh
# Rebuild the RPM database
rpm --rebuilddb
# Remove 'ifcfg-link' on generated images
rm -f /etc/sysconfig/network-scripts/ifcfg-link
# The 'machine-id' needs to be unique for each machine so remove ours to prevent duplication
rm -f /etc/machine-id
touch /etc/machine-id
%end