From 7404ec6547784f19aa86392b5b823842238d5a1f Mon Sep 17 00:00:00 2001 From: Jack Lloyd-Walters Date: Wed, 18 Oct 2023 16:41:58 +0100 Subject: [PATCH] Expose dependencies during runtime (#152) --- centos6/Makefile | 3 +-- centos7/Makefile | 3 +-- centos8-stream/Makefile | 3 +-- centos8/Makefile | 3 +-- rhel7/Makefile | 3 +-- rhel8/Makefile | 3 +-- rhel9/Makefile | 3 +-- rocky8/Makefile | 3 +-- rocky9/Makefile | 3 +-- scripts/check.mk | 15 +++++++++++++-- sles12/Makefile | 3 +-- sles15/Makefile | 3 +-- ubuntu/Makefile | 3 +-- vmware-esxi/Makefile | 3 +-- 14 files changed, 26 insertions(+), 28 deletions(-) diff --git a/centos6/Makefile b/centos6/Makefile index 2c7906e9..bf742dfa 100644 --- a/centos6/Makefile +++ b/centos6/Makefile @@ -11,8 +11,7 @@ export PACKER_LOG KS_PROXY all: centos6.tar.gz -check-deps: - $(call check_packages_deps) +$(eval $(call check_packages_deps)) centos6.tar.gz: check-deps clean http/centos6.ks ${PACKER} init centos6.pkr.hcl && ${PACKER} build centos6.pkr.hcl diff --git a/centos7/Makefile b/centos7/Makefile index fbdcb5f0..0449e1a2 100644 --- a/centos7/Makefile +++ b/centos7/Makefile @@ -11,8 +11,7 @@ export PACKER_LOG KS_PROXY all: centos7.tar.gz -check-deps: - $(call check_packages_deps) +$(eval $(call check_packages_deps)) centos7.tar.gz: clean check-deps http/centos7.ks ${PACKER} init centos7.pkr.hcl && ${PACKER} build centos7.pkr.hcl diff --git a/centos8-stream/Makefile b/centos8-stream/Makefile index cb7e656b..ead8ad60 100644 --- a/centos8-stream/Makefile +++ b/centos8-stream/Makefile @@ -11,8 +11,7 @@ export PACKER_LOG KS_PROXY all: centos8-stream.tar.gz -check-deps: - $(call check_packages_deps) +$(eval $(call check_packages_deps)) centos8-stream.tar.gz: check-deps clean http/centos8-stream.ks ${PACKER} init centos8-stream.pkr.hcl && ${PACKER} build centos8-stream.pkr.hcl diff --git a/centos8/Makefile b/centos8/Makefile index 5565d6aa..976d7c83 100644 --- a/centos8/Makefile +++ b/centos8/Makefile @@ -11,8 +11,7 @@ export PACKER_LOG KS_PROXY all: centos8.tar.gz -check-deps: - $(call check_packages_deps) +$(eval $(call check_packages_deps)) centos8.tar.gz: check-deps clean http/centos8.ks ${PACKER} init centos8.pkr.hcl && ${PACKER} build centos8.pkr.hcl diff --git a/rhel7/Makefile b/rhel7/Makefile index 345fa02a..1a53fff8 100644 --- a/rhel7/Makefile +++ b/rhel7/Makefile @@ -12,8 +12,7 @@ export PACKER_LOG KS_PROXY all: rhel7.tar.gz -check-deps: - $(call check_packages_deps) +$(eval $(call check_packages_deps)) rhel7.tar.gz: check-deps clean http/rhel7.ks ${PACKER} init rhel7.pkr.hcl && ${PACKER} build -var "rhel7_iso_path=${ISO}" rhel7.pkr.hcl diff --git a/rhel8/Makefile b/rhel8/Makefile index 1d83623e..4660c356 100644 --- a/rhel8/Makefile +++ b/rhel8/Makefile @@ -12,8 +12,7 @@ export PACKER_LOG KS_PROXY all: rhel8.tar.gz -check-deps: - $(call check_packages_deps) +$(eval $(call check_packages_deps)) rhel8.tar.gz: check-deps clean http/rhel8.ks ${PACKER} init rhel8.pkr.hcl && ${PACKER} build -var "rhel8_iso_path=${ISO}" rhel8.pkr.hcl diff --git a/rhel9/Makefile b/rhel9/Makefile index ea237cac..a30bdc09 100644 --- a/rhel9/Makefile +++ b/rhel9/Makefile @@ -12,8 +12,7 @@ export PACKER_LOG KS_PROXY all: rhel9.tar.gz -check-deps: - $(call check_packages_deps) +$(eval $(call check_packages_deps)) rhel9.tar.gz: check-deps clean http/rhel9.ks ${PACKER} init rhel9.pkr.hcl && ${PACKER} build -var "rhel9_iso_path=${ISO}" rhel9.pkr.hcl diff --git a/rocky8/Makefile b/rocky8/Makefile index b4da0563..8d52ca14 100644 --- a/rocky8/Makefile +++ b/rocky8/Makefile @@ -11,8 +11,7 @@ export PACKER_LOG KS_PROXY all: rocky8.tar.gz -check-deps: - $(call check_packages_deps) +$(eval $(call check_packages_deps)) rocky8.tar.gz: check-deps clean http/rocky.ks ${PACKER} init rocky8.pkr.hcl && ${PACKER} build rocky8.pkr.hcl diff --git a/rocky9/Makefile b/rocky9/Makefile index 04ca993a..afd3d4d2 100644 --- a/rocky9/Makefile +++ b/rocky9/Makefile @@ -11,8 +11,7 @@ export PACKER_LOG KS_PROXY all: rocky9.tar.gz -check-deps: - $(call check_packages_deps) +$(eval $(call check_packages_deps)) rocky9.tar.gz: check-deps clean http/rocky.ks ${PACKER} init rocky9.pkr.hcl && ${PACKER} build rocky9.pkr.hcl diff --git a/scripts/check.mk b/scripts/check.mk index c5bbe17e..4caa00ee 100644 --- a/scripts/check.mk +++ b/scripts/check.mk @@ -1,7 +1,18 @@ define check_packages_deps +_current_deps := libnbd-bin nbdkit packer fuse2fs $(1) +_focal_deps := libnbd0 nbdkit packer fuse2fs $(2) + +print-deps: @if [ $(shell lsb_release -sr|cut -d. -f1) -ge 22 ];then \ - dpkg -s libnbd-bin nbdkit packer fuse2fs $(1) > /dev/null; \ + echo $$(_current_deps); \ else \ - dpkg -s libnbd0 nbdkit packer fuse2fs $(2)> /dev/null; \ + echo $$(_focal_deps); \ + fi + +check-deps: + @if [ $(shell lsb_release -sr|cut -d. -f1) -ge 22 ];then \ + dpkg -s $$(_current_deps) > /dev/null; \ + else \ + dpkg -s $$(_focal_deps) > /dev/null; \ fi endef diff --git a/sles12/Makefile b/sles12/Makefile index 3eb366a1..99149a6b 100644 --- a/sles12/Makefile +++ b/sles12/Makefile @@ -11,8 +11,7 @@ ISO ?= SLES12-SP5-JeOS.x86_64-12.5-OpenStack-Cloud-GM.qcow2 all: sles12.tar.gz -check-deps: - $(call check_packages_deps) +$(eval $(call check_packages_deps)) sles12.tar.gz: check-deps clean ${PACKER} init sles.pkr.hcl && ${PACKER} build -var "sles12_iso_path=${ISO}" -on-error=ask sles.pkr.hcl diff --git a/sles15/Makefile b/sles15/Makefile index ec251477..a0f54e91 100644 --- a/sles15/Makefile +++ b/sles15/Makefile @@ -11,8 +11,7 @@ ISO ?= SLE-15-SP4-Full-x86_64-GM-Media1.iso all: sles15.tar.gz -check-deps: - $(call check_packages_deps) +$(eval $(call check_packages_deps)) sles15.tar.gz: check-deps clean ${PACKER} init sles.pkr.hcl && ${PACKER} build -var "sles15_iso_path=${ISO}" -on-error=ask sles.pkr.hcl diff --git a/ubuntu/Makefile b/ubuntu/Makefile index 4a166e56..f49d675f 100644 --- a/ubuntu/Makefile +++ b/ubuntu/Makefile @@ -10,8 +10,7 @@ export PACKER_LOG all: custom-cloudimg.tar.gz -check-deps: - $(call check_packages_deps,cloud-image-utils ovmf,cloud-image-utils ovmf) +$(eval $(call check_packages_deps,cloud-image-utils ovmf,cloud-image-utils ovmf)) lint: packer validate . diff --git a/vmware-esxi/Makefile b/vmware-esxi/Makefile index 48be1cdd..9b78a0fe 100644 --- a/vmware-esxi/Makefile +++ b/vmware-esxi/Makefile @@ -13,8 +13,7 @@ VENV := .ve all: vmware-esxi.dd.gz -check-deps: - $(call check_packages_deps,fusefat,fusefat ) +$(eval $(call check_packages_deps,fusefat,fusefat )) scripts.tar.xz: export TMP_DIR=$$(mktemp -d /tmp/packer-maas-XXXX);\