Skip to content

Commit d1d18f2

Browse files
committed
added more redhat types for oracle, rocky, centos which are synonyms
for redhat. like ubuntu, they don't do anything diffrent yet
1 parent a476389 commit d1d18f2

1 file changed

Lines changed: 13 additions & 5 deletions

File tree

gen_cloud_template.sh

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,16 @@ TEMPLATE_INDEX="template.rc"
1616
IMGSIZE=20480 # 20GB
1717
ARCH_BASE_PACKAGES="base cloud-init cloud-guest-utils openssh mkinitcpio"
1818
DEB_BASE_PACKAGES="cloud-init cloud-initramfs-growroot cloud-guest-utils openssh-server initramfs-tools locales-all"
19+
# redhat is wierd. groups and packages are installed seperately
20+
REDHAT_BASE_PACKAGES="openssh-server cloud-init"
21+
REDHAT_BASE_GROUPS="Base"
1922
BASE_SYSTEM_SERVICES="sshd cloud-init-local cloud-init cloud-config cloud-final"
2023
BASE_INITRAMDISK_MODULES="virtio virtio_pci virtio_blk virtio_net virtio_ring"
2124
SCRIPT_BASE_DIR="/usr/share/disk-image-scripts"
2225
PACKAGE_LIST_FILE="addedpacks"
2326
COMPRESS_IMAGE="Y"
2427
TIMEZONE="UTC"
25-
VALID_OS_TYPES="arch debian redhat ubuntu"
28+
VALID_OS_TYPES="arch debian centos redhat rocky oracle ubuntu"
2629
DEBMIRROR="http://deb.debian.org/debian/"
2730
DEBDISTRO="stable"
2831
# /Defaults #
@@ -252,9 +255,14 @@ _init_image() {
252255
# Bug: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=878961
253256
as_root arch-chroot "${mount_point}" apt -y --fix-broken install || exit_with_error 1 "Workaround for bug 878961 failed"
254257
;;
255-
redhat)
258+
redhat|centos|rocky|oracle)
256259
#TODO: Write Redhat support
257260
exit_with_error 10 "Redhat support is incomplete, will not run"
261+
# Here be dragons
262+
which yum &> /dev/null || exit_with_error 2 "yum is not installed, may not initialize Red Hat based environments"
263+
# May or may not have to use --config= and/or --releasever
264+
dnf --installroot="${mount_point}" --assumeyes groupinstall ${REDHAT_BASE_GROUPS}
265+
dnf --installroot="${mount_point}" --assumeyes install ${KERNEL} ${BOOTLOADER} ${REDHAT_BASE_PACKAGES} ${packages_from_file}
258266
;;
259267
*)
260268
exit_with_error 2 "Unsupported OS type: ${OSTYPE}"
@@ -273,7 +281,7 @@ _update_image(){
273281
# Nasty kludge that we can't get both to run in the same choort.
274282
_image_shell "apt update" "apt upgrade"
275283
;;
276-
redhat)
284+
redhat|centos|rocky|oracle)
277285
_image_shell "yum update"
278286
;;
279287
*)
@@ -395,8 +403,8 @@ EOF
395403
debian|ubuntu)
396404
as_root install -Dm 644 "${SCRIPT_BASE_DIR}/debian-syslinux.cfg" "${mount_point}/root/syslinux.cfg"
397405
;;
398-
redhat)
399-
warn "Not RH specific code, yet..."
406+
redhat|centos|rocky|oracle)
407+
warn "No RH specific code, yet..."
400408
;;
401409
esac
402410

0 commit comments

Comments
 (0)