mirror of
https://github.com/JasonN3/build-container-installer.git
synced 2025-12-25 02:47:56 +01:00
feat: Add support for additional languages (#18)
This commit is contained in:
parent
5c61fa7aec
commit
a69d22bc73
5 changed files with 33 additions and 31 deletions
50
Makefile
50
Makefile
|
|
@ -9,6 +9,7 @@ VARIANT = Server
|
|||
WEB_UI = false
|
||||
REPOS = /etc/yum.repos.d/fedora.repo /etc/yum.repos.d/fedora-updates.repo
|
||||
ADDITIONAL_TEMPLATES = ""
|
||||
ROOTFS_SIZE = 4
|
||||
|
||||
# Generated vars
|
||||
## Formatting = _UPPERCASE
|
||||
|
|
@ -16,9 +17,10 @@ _BASE_DIR = $(shell pwd)
|
|||
_IMAGE_REPO_ESCAPED = $(subst /,\/,$(IMAGE_REPO))
|
||||
_IMAGE_REPO_DOUBLE_ESCAPED = $(subst \,\\\,$(_IMAGE_REPO_ESCAPED))
|
||||
_VOLID = $(firstword $(subst -, ,$(IMAGE_NAME)))-$(ARCH)-$(IMAGE_TAG)
|
||||
_REPO_FILES = $(notdir $(REPOS))
|
||||
_REPO_FILES = $(subst /etc/yum.repos.d,repos,$(REPOS))
|
||||
_LORAX_TEMPLATES = $(subst .in,,$(shell ls lorax_templates/*.tmpl.in))
|
||||
|
||||
ifeq ($(VARIANT),'Server')
|
||||
ifeq ($(VARIANT),Server)
|
||||
_LORAX_ARGS = --macboot --noupgrade
|
||||
else
|
||||
_LORAX_ARGS = --nomacboot
|
||||
|
|
@ -37,30 +39,31 @@ build/deploy.iso: boot.iso container/$(IMAGE_NAME)-$(IMAGE_TAG) xorriso/input.t
|
|||
|
||||
# Step 1: Generate Lorax Templates
|
||||
lorax_templates/%.tmpl: lorax_templates/%.tmpl.in
|
||||
sed 's/@IMAGE_NAME@/$(IMAGE_NAME)/' $(_BASE_DIR)/lorax_templates/$*.tmpl.in > $(_BASE_DIR)/lorax_templates/$*.tmpl
|
||||
$(eval _VARS = IMAGE_NAME IMAGE_TAG IMAGE_REPO_DOUBLE_ESCAPED)
|
||||
$(foreach var,$(_VARS),$(var)=$($(var))) envsubst '$(foreach var,$(_VARS),$$$(var))' < $(_BASE_DIR)/lorax_templates/$*.tmpl.in > $(_BASE_DIR)/lorax_templates/$*.tmpl
|
||||
|
||||
sed 's/@IMAGE_TAG@/$(IMAGE_TAG)/' $(_BASE_DIR)/lorax_templates/$*.tmpl > $(_BASE_DIR)/lorax_templates/$*.tmpl.tmp
|
||||
mv $(_BASE_DIR)/lorax_templates/$*.tmpl{.tmp,}
|
||||
|
||||
sed 's/@IMAGE_REPO_ESCAPED@/$(_IMAGE_REPO_DOUBLE_ESCAPED)/' $(_BASE_DIR)/lorax_templates/$*.tmpl > $(_BASE_DIR)/lorax_templates/$*.tmpl.tmp
|
||||
mv $(_BASE_DIR)/lorax_templates/$*.tmpl{.tmp,}
|
||||
|
||||
# Step 2: Replace vars in repo files
|
||||
%.repo: /etc/yum.repos.d/%.repo
|
||||
cp /etc/yum.repos.d/$*.repo $(_BASE_DIR)/$*.repo
|
||||
sed -i "s/\$$releasever/${VERSION}/g" $(_BASE_DIR)/$*.repo
|
||||
sed -i "s/\$$basearch/${ARCH}/g" $(_BASE_DIR)/$*.repo
|
||||
repos/%.repo: /etc/yum.repos.d/%.repo
|
||||
mkdir repos || true
|
||||
cp /etc/yum.repos.d/$*.repo $(_BASE_DIR)/repos/$*.repo
|
||||
sed -i "s/\$$releasever/${VERSION}/g" $(_BASE_DIR)/repos/$*.repo
|
||||
sed -i "s/\$$basearch/${ARCH}/g" $(_BASE_DIR)/repos/$*.repo
|
||||
|
||||
# Don't do anything for custom repos
|
||||
%.repo:
|
||||
|
||||
# Step 3: Build boot.iso using Lorax
|
||||
boot.iso: lorax_templates/set_installer.tmpl lorax_templates/configure_upgrades.tmpl $(_REPO_FILES)
|
||||
rm -Rf $(_BASE_DIR)/results
|
||||
boot.iso: $(_LORAX_TEMPLATES) $(_REPO_FILES)
|
||||
rm -Rf $(_BASE_DIR)/results || true
|
||||
rm /etc/rpm/macros.image-language-conf || true
|
||||
lorax -p $(IMAGE_NAME) -v $(VERSION) -r $(VERSION) -t $(VARIANT) \
|
||||
--isfinal --buildarch=$(ARCH) --volid=$(_VOLID) \
|
||||
--isfinal --squashfs-only --buildarch=$(ARCH) --volid=$(_VOLID) \
|
||||
$(_LORAX_ARGS) \
|
||||
$(foreach file,$(_REPO_FILES),--repo $(_BASE_DIR)/$(file)) \
|
||||
--add-template $(_BASE_DIR)/lorax_templates/set_installer.tmpl \
|
||||
--add-template $(_BASE_DIR)/lorax_templates/configure_upgrades.tmpl \
|
||||
$(foreach file,$(_LORAX_TEMPLATES),--add-template $(_BASE_DIR)/$(file)) \
|
||||
$(foreach file,$(ADDITIONAL_TEMPLATES),--add-template $(file)) \
|
||||
--rootfs-size $(ROOTFS_SIZE) \
|
||||
$(_BASE_DIR)/results/
|
||||
mv $(_BASE_DIR)/results/images/boot.iso $(_BASE_DIR)/
|
||||
|
||||
|
|
@ -73,13 +76,8 @@ container/$(IMAGE_NAME)-$(IMAGE_TAG):
|
|||
|
||||
# Step 5: Generate xorriso script
|
||||
xorriso/%.sh: xorriso/%.sh.in
|
||||
sed 's/@IMAGE_NAME@/$(IMAGE_NAME)/' $(_BASE_DIR)/xorriso/$*.sh.in > $(_BASE_DIR)/xorriso/$*.sh
|
||||
|
||||
sed 's/@IMAGE_TAG@/$(IMAGE_TAG)/' $(_BASE_DIR)/xorriso/$*.sh > $(_BASE_DIR)/xorriso/$*.sh.tmp
|
||||
mv $(_BASE_DIR)/xorriso/$*.sh{.tmp,}
|
||||
|
||||
sed 's/@ARCH@/$(ARCH)/' $(_BASE_DIR)/xorriso/$*.sh > $(_BASE_DIR)/xorriso/$*.sh.tmp
|
||||
mv $(_BASE_DIR)/xorriso/$*.sh{.tmp,}
|
||||
$(eval _VARS = IMAGE_NAME IMAGE_TAG ARCH VERSION)
|
||||
$(foreach var,$(_VARS),$(var)=$($(var))) envsubst '$(foreach var,$(_VARS),$$$(var))' < $(_BASE_DIR)/xorriso/$*.sh.in > $(_BASE_DIR)/xorriso/$*.sh
|
||||
|
||||
# Step 6: Generate xorriso input
|
||||
xorriso/input.txt: xorriso/gen_input.sh
|
||||
|
|
@ -87,11 +85,12 @@ xorriso/input.txt: xorriso/gen_input.sh
|
|||
|
||||
|
||||
clean:
|
||||
rm -Rf $(_BASE_DIR)/build || true
|
||||
rm -Rf $(_BASE_DIR)/container || true
|
||||
rm -Rf $(_BASE_DIR)/debugdata || true
|
||||
rm -Rf $(_BASE_DIR)/pkglists || true
|
||||
rm -Rf $(_BASE_DIR)/repos || true
|
||||
rm -Rf $(_BASE_DIR)/results || true
|
||||
rm -Rf $(_BASE_DIR)/build || true
|
||||
rm -f $(_BASE_DIR)/lorax_templates/*.tmpl || true
|
||||
rm -f $(_BASE_DIR)/xorriso/input.txt || true
|
||||
rm -f $(_BASE_DIR)/xorriso/*.sh || true
|
||||
|
|
@ -99,6 +98,7 @@ clean:
|
|||
rm -f $(_BASE_DIR)/lorax.conf || true
|
||||
rm -f $(_BASE_DIR)/*.iso || true
|
||||
rm -f $(_BASE_DIR)/*.log || true
|
||||
|
||||
|
||||
install-deps:
|
||||
dnf install -y lorax xorriso podman
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue