Skip to content

Commit

Permalink
Sort out rhel build
Browse files Browse the repository at this point in the history
  • Loading branch information
xorel committed Oct 31, 2023
1 parent 2f74c87 commit 55c24cb
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 35 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
build/
export/
Makefile.secrets
Makefile.local
context-windows/out/
context-windows/*.msi
context-windows/rhsrvany.exe
Expand Down
16 changes: 4 additions & 12 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
# load targets config
include Makefile.distros

# load optional non-free images vars
-include Makefile.distros-nonfree

# load variables and makefile config
include Makefile.config

# load possible overrides or non-free definitions
-include Makefile.local

#------------------------------------------------------------------------------
# All, alliases
#------------------------------------------------------------------------------
Expand All @@ -19,7 +16,7 @@ $(SERVICES): %: services-% ;

#------------------------------------------------------------------------------
# Packer stage
# - run packer template for given distro
# - run packer build for given distro
#------------------------------------------------------------------------------
packer: $(patsubst %, packer-%, $(DISTROS))

Expand All @@ -31,12 +28,7 @@ ${DIR_EXPORT}/%-${VERSION}-${RELEASE}.qcow2:
$(eval DISTRO_VER := $(shell echo ${*} | sed 's/[a-z]*//'))
packer/build.sh ${DISTRO_NAME} ${DISTRO_VER} ${@}

#------------------------------------------------------------------------------
# clean
#------------------------------------------------------------------------------
clean:
-rm -rf ${DIR_BASE}/*
-rm -rf ${DIR_INSTALL}/*
-rm -rf ${DIR_EXPORT}/*

#------------------------------------------------------------------------------
Expand Down
19 changes: 14 additions & 5 deletions Makefile.config
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,20 @@ RELEASE ?= 1
VERBOSE ?= 1
PACKER_LOG ?= 1
PACKER_HEADLESS ?= false
LIBGUESTFS_DEBUG ?= 1
LIBGUESTFS_TRACE ?= 0
LIBGUESTFS_MEMSIZE ?= 3072
TTY ?= $(shell tty)

DISTROS := alma8 alma9 \
alpine316 alpine317 \
alt9 alt10 \
debian10 debian11 debian12 \
devuan3 devuan4\
fedora37 fedora38 \
freebsd12 freebsd13 \
ol8 ol9 \
opensuse15 \
rocky8 rocky9 \
ubuntu2004 ubuntu2004min ubuntu2204 ubuntu2204min

SERVICES := service_OneKE service_wordpress

# default directories
DIR_BUILD ?= build
Expand Down Expand Up @@ -53,7 +63,6 @@ QEMU_BINARY ?= $(shell \

# logging func
INFO=sh -c 'if [ $(VERBOSE) = 1 ]; then echo [INFO] $$1; fi' INFO
ERROR=sh -c 'echo [ERROR] $$1; exit 1;' ERROR

# export all variables
export
10 changes: 0 additions & 10 deletions Makefile.distros-nonfree

This file was deleted.

10 changes: 8 additions & 2 deletions packer/rhel/rhel.pkr.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ source "qemu" "rhel" {
memory = 2048
accelerator = "kvm"

iso_url = lookup(lookup(var.data, var.version, {}), "iso_url", "")
iso_checksum = lookup(lookup(var.data, var.version, {}), "iso_checksum", "")
iso_url = lookup(lookup(var.rhel, var.version, {}), "iso_url", "")
iso_checksum = lookup(lookup(var.rhel, var.version, {}), "iso_checksum", "")

headless = var.headless

Expand Down Expand Up @@ -62,6 +62,12 @@ build {
[for s in fileset(".", "*.sh") : "${var.input_dir}/${s}"],
[for s in fileset(".", "*.sh.${var.version}") : "${var.input_dir}/${s}"]
))

environment_vars = [
"RHEL_USER=${var.rhel_user}",
"RHEL_PASSWORD=${var.rhel_password}"
]

expect_disconnect = true
}

Expand Down
20 changes: 15 additions & 5 deletions packer/rhel/variables.pkr.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,28 @@ variable "headless" {
default = false
}

variable "data" {
variable "rhel_user" {
type = string
default = false
}

variable "rhel_password" {
type = string
default = false
}

variable "rhel" {
type = map(map(string))

default = {
"8" = {
iso_url = "http://storage/images/base/rhel8.qcow2"
iso_checksum = "02cf0181020c7fa4beb45b62b66bb39940b78f6fb2a301cde2e9131aea1490fb"
iso_url = ""
iso_checksum = ""
}

"9" = {
iso_url = "http://storage/images/base/rhel9.qcow2"
iso_checksum = "53d341fdf6327ac4f12c2a84d6130fea3c9070bbc6919266dca7763820af3cac"
iso_url = ""
iso_checksum = ""
}
}
}

0 comments on commit 55c24cb

Please sign in to comment.