From 55c24cbe56282fcafe3105246cd61f86a1656af3 Mon Sep 17 00:00:00 2001 From: Jan Orel Date: Tue, 31 Oct 2023 21:53:38 +0100 Subject: [PATCH] Sort out rhel build --- .gitignore | 2 +- Makefile | 16 ++++------------ Makefile.config | 19 ++++++++++++++----- Makefile.distros-nonfree | 10 ---------- packer/rhel/rhel.pkr.hcl | 10 ++++++++-- packer/rhel/variables.pkr.hcl | 20 +++++++++++++++----- 6 files changed, 42 insertions(+), 35 deletions(-) delete mode 100644 Makefile.distros-nonfree diff --git a/.gitignore b/.gitignore index 323c3d4d..13820a65 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,6 @@ build/ export/ -Makefile.secrets +Makefile.local context-windows/out/ context-windows/*.msi context-windows/rhsrvany.exe diff --git a/Makefile b/Makefile index 246e14e1..c9548f26 100644 --- a/Makefile +++ b/Makefile @@ -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 #------------------------------------------------------------------------------ @@ -19,7 +16,7 @@ $(SERVICES): %: services-% ; #------------------------------------------------------------------------------ # Packer stage -# - run packer template for given distro +# - run packer build for given distro #------------------------------------------------------------------------------ packer: $(patsubst %, packer-%, $(DISTROS)) @@ -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}/* #------------------------------------------------------------------------------ diff --git a/Makefile.config b/Makefile.config index 505c8457..a3ca3785 100644 --- a/Makefile.config +++ b/Makefile.config @@ -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 @@ -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 diff --git a/Makefile.distros-nonfree b/Makefile.distros-nonfree deleted file mode 100644 index 822cb993..00000000 --- a/Makefile.distros-nonfree +++ /dev/null @@ -1,10 +0,0 @@ -#ifeq (${NONFREE}, yes) --include Makefile.secrets -DISTROS += rhel8 rhel9 - -URL_rhel8 := http://storage/images/base/rhel8.qcow2 -URL_rhel9 := http://storage/images/base/rhel9.qcow2 - -SHA256_rhel8 := 02cf0181020c7fa4beb45b62b66bb39940b78f6fb2a301cde2e9131aea1490fb -SHA256_rhel9 := 53d341fdf6327ac4f12c2a84d6130fea3c9070bbc6919266dca7763820af3cac -#endif diff --git a/packer/rhel/rhel.pkr.hcl b/packer/rhel/rhel.pkr.hcl index d70950dc..0dbd6c9d 100644 --- a/packer/rhel/rhel.pkr.hcl +++ b/packer/rhel/rhel.pkr.hcl @@ -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 @@ -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 } diff --git a/packer/rhel/variables.pkr.hcl b/packer/rhel/variables.pkr.hcl index 9ef26567..e414a8db 100644 --- a/packer/rhel/variables.pkr.hcl +++ b/packer/rhel/variables.pkr.hcl @@ -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 = "" } } }