Skip to content

Commit

Permalink
use specific mirror from ENV (#168)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexsander-souza authored Nov 28, 2023
1 parent aef63ca commit 4659bc4
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 deletions.
16 changes: 13 additions & 3 deletions centos7/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,18 @@ include ../scripts/check.mk

PACKER ?= packer
PACKER_LOG ?= 0
KS_MIRROR ?= http://mirrorlist.centos.org
export PACKER_LOG KS_PROXY KS_MIRROR

ifneq (${KS_MIRROR},)
KS_OS_REPOS := --url="${KS_MIRROR}/os/x86_64"
KS_UPDATES_REPOS := --baseurl="${KS_MIRROR}/updates/x86_64"
KS_EXTRA_REPOS := --baseurl="${KS_MIRROR}/extras/x86_64"
else
KS_OS_REPOS := --mirrorlist="http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=os"
KS_UPDATES_REPOS := --mirrorlist="http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=updates"
KS_EXTRA_REPOS := --mirrorlist="http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=extras"
endif

export PACKER_LOG KS_PROXY KS_OS_REPOS KS_UPDATES_REPOS KS_EXTRA_REPOS

.PHONY: all clean check-deps

Expand All @@ -17,7 +27,7 @@ centos7.tar.gz: clean check-deps http/centos7.ks
${PACKER} init centos7.pkr.hcl && ${PACKER} build centos7.pkr.hcl

http/centos7.ks: http/centos7.ks.in
envsubst '$${KS_PROXY} $${KS_MIRROR}' < $< | tee $@
envsubst '$${KS_PROXY} $${KS_OS_REPOS} $${KS_UPDATES_REPOS} $${KS_EXTRA_REPOS}' < $< | tee $@

clean:
${RM} -rf output-centos7 centos7.tar.gz http/centos7.ks
Expand Down
6 changes: 3 additions & 3 deletions centos7/http/centos7.ks.in
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
url --mirrorlist="${KS_MIRROR}/?release=7&arch=x86_64&repo=os" ${KS_PROXY}
url ${KS_OS_REPOS} ${KS_PROXY}
poweroff
firewall --enabled --service=ssh
firstboot --disable
Expand All @@ -12,8 +12,8 @@ timezone UTC --isUtc
bootloader --location=mbr --driveorder="vda" --timeout=1
rootpw --plaintext password

repo --name="Updates" --mirrorlist="${KS_MIRROR}/?release=7&arch=x86_64&repo=updates" ${KS_PROXY}
repo --name="Extras" --mirrorlist="${KS_MIRROR}/?release=7&arch=x86_64&repo=extras" ${KS_PROXY}
repo --name="Updates" ${KS_UPDATES_REPOS} ${KS_PROXY}
repo --name="Extras" ${KS_EXTRA_REPOS} ${KS_PROXY}

zerombr
clearpart --all --initlabel
Expand Down

0 comments on commit 4659bc4

Please sign in to comment.