diff --git a/centos6/Makefile b/centos6/Makefile index f92f2faf..2c7906e9 100644 --- a/centos6/Makefile +++ b/centos6/Makefile @@ -1,3 +1,7 @@ +#!/usr/bin/make -f + +include ../scripts/check.mk + PACKER ?= packer PACKER_LOG ?= 0 @@ -8,7 +12,7 @@ export PACKER_LOG KS_PROXY all: centos6.tar.gz check-deps: - dpkg -s libnbd-bin nbdkit packer fuse2fs > /dev/null + $(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 14f2d9d5..fbdcb5f0 100644 --- a/centos7/Makefile +++ b/centos7/Makefile @@ -1,3 +1,7 @@ +#!/usr/bin/make -f + +include ../scripts/check.mk + PACKER ?= packer PACKER_LOG ?= 0 @@ -8,7 +12,7 @@ export PACKER_LOG KS_PROXY all: centos7.tar.gz check-deps: - dpkg -s libnbd-bin nbdkit packer fuse2fs > /dev/null + $(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 060001f1..cb7e656b 100644 --- a/centos8-stream/Makefile +++ b/centos8-stream/Makefile @@ -1,3 +1,7 @@ +#!/usr/bin/make -f + +include ../scripts/check.mk + PACKER ?= packer PACKER_LOG ?= 0 @@ -8,7 +12,7 @@ export PACKER_LOG KS_PROXY all: centos8-stream.tar.gz check-deps: - dpkg -s libnbd-bin nbdkit packer fuse2fs > /dev/null + $(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 e6d64bf3..5565d6aa 100644 --- a/centos8/Makefile +++ b/centos8/Makefile @@ -1,3 +1,7 @@ +#!/usr/bin/make -f + +include ../scripts/check.mk + PACKER ?= packer PACKER_LOG ?= 0 @@ -8,7 +12,7 @@ export PACKER_LOG KS_PROXY all: centos8.tar.gz check-deps: - dpkg -s libnbd-bin nbdkit packer fuse2fs > /dev/null + $(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 278cac02..345fa02a 100644 --- a/rhel7/Makefile +++ b/rhel7/Makefile @@ -1,3 +1,7 @@ +#!/usr/bin/make -f + +include ../scripts/check.mk + PACKER ?= packer PACKER_LOG ?= 0 ISO ?= ${RHEL7_ISO_PATH} @@ -9,7 +13,7 @@ export PACKER_LOG KS_PROXY all: rhel7.tar.gz check-deps: - dpkg -s libnbd-bin nbdkit packer fuse2fs > /dev/null + $(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 1f78aea8..1d83623e 100644 --- a/rhel8/Makefile +++ b/rhel8/Makefile @@ -1,3 +1,7 @@ +#!/usr/bin/make -f + +include ../scripts/check.mk + PACKER ?= packer PACKER_LOG ?= 0 ISO ?= ${RHEL8_ISO_PATH} @@ -9,7 +13,7 @@ export PACKER_LOG KS_PROXY all: rhel8.tar.gz check-deps: - dpkg -s libnbd-bin nbdkit packer fuse2fs > /dev/null + $(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 04110851..ea237cac 100644 --- a/rhel9/Makefile +++ b/rhel9/Makefile @@ -1,3 +1,7 @@ +#!/usr/bin/make -f + +include ../scripts/check.mk + PACKER ?= packer PACKER_LOG ?= 0 ISO ?= rhel-baseos-9.1-x86_64-dvd.iso @@ -9,7 +13,7 @@ export PACKER_LOG KS_PROXY all: rhel9.tar.gz check-deps: - dpkg -s libnbd-bin nbdkit packer fuse2fs > /dev/null + $(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 7df35f1b..b4da0563 100644 --- a/rocky8/Makefile +++ b/rocky8/Makefile @@ -1,3 +1,7 @@ +#!/usr/bin/make -f + +include ../scripts/check.mk + PACKER ?= packer PACKER_LOG ?= 0 @@ -8,7 +12,7 @@ export PACKER_LOG KS_PROXY all: rocky8.tar.gz check-deps: - dpkg -s libnbd-bin nbdkit packer fuse2fs > /dev/null + $(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 10167801..04ca993a 100644 --- a/rocky9/Makefile +++ b/rocky9/Makefile @@ -1,3 +1,7 @@ +#!/usr/bin/make -f + +include ../scripts/check.mk + PACKER ?= packer PACKER_LOG ?= 0 @@ -8,7 +12,7 @@ export PACKER_LOG KS_PROXY all: rocky9.tar.gz check-deps: - dpkg -s libnbd-bin nbdkit packer fuse2fs > /dev/null + $(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 new file mode 100644 index 00000000..c5bbe17e --- /dev/null +++ b/scripts/check.mk @@ -0,0 +1,7 @@ +define check_packages_deps + @if [ $(shell lsb_release -sr|cut -d. -f1) -ge 22 ];then \ + dpkg -s libnbd-bin nbdkit packer fuse2fs $(1) > /dev/null; \ + else \ + dpkg -s libnbd0 nbdkit packer fuse2fs $(2)> /dev/null; \ + fi +endef diff --git a/sles12/Makefile b/sles12/Makefile index 7d7b14da..3eb366a1 100644 --- a/sles12/Makefile +++ b/sles12/Makefile @@ -1,3 +1,7 @@ +#!/usr/bin/make -f + +include ../scripts/check.mk + PACKER ?= packer PACKER_LOG ?= 0 export PACKER_LOG @@ -8,7 +12,7 @@ ISO ?= SLES12-SP5-JeOS.x86_64-12.5-OpenStack-Cloud-GM.qcow2 all: sles12.tar.gz check-deps: - dpkg -s libnbd-bin nbdkit packer fuse2fs > /dev/null + $(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 bf3facb8..ec251477 100644 --- a/sles15/Makefile +++ b/sles15/Makefile @@ -1,3 +1,7 @@ +#!/usr/bin/make -f + +include ../scripts/check.mk + PACKER ?= packer PACKER_LOG ?= 0 export PACKER_LOG @@ -8,7 +12,7 @@ ISO ?= SLE-15-SP4-Full-x86_64-GM-Media1.iso all: sles15.tar.gz check-deps: - dpkg -s libnbd-bin nbdkit packer fuse2fs > /dev/null + $(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 e0a4a877..4a166e56 100644 --- a/ubuntu/Makefile +++ b/ubuntu/Makefile @@ -1,3 +1,7 @@ +#!/usr/bin/make -f + +include ../scripts/check.mk + PACKER ?= packer PACKER_LOG ?= 0 export PACKER_LOG @@ -7,7 +11,7 @@ export PACKER_LOG all: custom-cloudimg.tar.gz check-deps: - dpkg -s libnbd-bin nbdkit packer fuse2fs cloud-image-utils ovmf > /dev/null + $(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 d774447c..9f8f7f99 100644 --- a/vmware-esxi/Makefile +++ b/vmware-esxi/Makefile @@ -1,3 +1,7 @@ +#!/usr/bin/make -f + +include ../scripts/check.mk + PACKER ?= packer PACKER_LOG ?= 0 export PACKER_LOG @@ -10,7 +14,7 @@ VENV := .ve all: vmware-esxi.dd.gz check-deps: - dpkg -s libnbd-bin nbdkit packer fusefat > /dev/null + $(call check_packages_deps,fusefat,fusefat ) scripts.tar.xz: export TMP_DIR=$$(mktemp -d /tmp/packer-maas-XXXX);\