mirror of
https://github.com/JasonN3/build-container-installer.git
synced 2025-12-25 10:57:55 +01:00
general fixes
This commit is contained in:
parent
70bc2264ba
commit
c48c28120b
13 changed files with 357 additions and 173 deletions
122
Makefile
122
Makefile
|
|
@ -1,85 +1,97 @@
|
|||
arch = x86_64
|
||||
version = 39
|
||||
base_dir = $(shell pwd)
|
||||
image_repo = ghcr.io/ublue-os
|
||||
image_name = base-main
|
||||
image_tag = $(version)
|
||||
variant = Silverblue
|
||||
web_ui = false
|
||||
# Configuration vars
|
||||
## Formatting = UPPERCASE
|
||||
ARCH = x86_64
|
||||
VERSION = 39
|
||||
IMAGE_REPO = ghcr.io/ublue-os
|
||||
IMAGE_NAME = base-main
|
||||
IMAGE_TAG = $(version)
|
||||
VARIANT = Silverblue
|
||||
WEB_UI = false
|
||||
|
||||
image_repo_escaped = $(subst /,\/,$(image_repo))
|
||||
image_repo_double_escaped = $(subst \,\\\,$(image_repo_escaped))
|
||||
# Generated vars
|
||||
## Formatting = _UPPERCASE
|
||||
_BASE_DIR = $(shell pwd)
|
||||
_IMAGE_REPO_ESCAPED = $(subst /,\/,$(IMAGE_REPO))
|
||||
_IMAGE_REPO_DOUBLE_ESCAPED = $(subst \,\\\,$(_IMAGE_REPO_ESCAPED))
|
||||
|
||||
ifeq ($(variant),'Server')
|
||||
lorax_args = --macboot --noupgrade
|
||||
ifeq ($(VARIANT),'Server')
|
||||
_LORAX_ARGS = --macboot --noupgrade
|
||||
else
|
||||
lorax_args = --nomacboot
|
||||
_LORAX_ARGS = --nomacboot
|
||||
endif
|
||||
|
||||
ifeq ($(web_ui),true)
|
||||
lorax_args += -i anaconda-webui
|
||||
ifeq ($(WEB_UI),true)
|
||||
_LORAX_ARGS += -i anaconda-webui
|
||||
endif
|
||||
|
||||
$(image_name)-$(version).iso: boot.iso container/$(image_name)-$(image_tag) xorriso/input.txt
|
||||
xorriso -dialog on < $(base_dir)/xorriso/input.txt
|
||||
# Step 6: Build end ISO file
|
||||
## Default action
|
||||
$(IMAGE_NAME)-$(IMAGE_TAG).iso: boot.iso container/$(IMAGE_NAME)-$(IMAGE_TAG) xorriso/input.txt
|
||||
mkdir $(_BASE_DIR)/output
|
||||
xorriso -dialog on < $(_BASE_DIR)/xorriso/input.txt
|
||||
|
||||
# Step 2: Build boot.iso using Lorax
|
||||
boot.iso: lorax_templates/set_installer.tmpl lorax_templates/configure_upgrades.tmpl
|
||||
rm -Rf $(base_dir)/results
|
||||
lorax -p $(image_name) -v $(version) -r $(version) -t $(variant) \
|
||||
--isfinal --buildarch=$(arch) --volid=$(image_name)-$(arch)-$(version) \
|
||||
$(lorax_args) \
|
||||
rm -Rf $(_BASE_DIR)/results
|
||||
lorax -p $(IMAGE_NAME) -v $(VERSION) -r $(VERSION) -t $(VARIANT) \
|
||||
--isfinal --buildarch=$(ARCH) --volid=$(IMAGE_NAME)-$(ARCH)-$(VERSION) \
|
||||
$(_LORAX_ARGS) \
|
||||
--repo /etc/yum.repos.d/fedora.repo \
|
||||
--repo /etc/yum.repos.d/fedora-updates.repo \
|
||||
--add-template $(base_dir)/lorax_templates/set_installer.tmpl \
|
||||
--add-template $(base_dir)/lorax_templates/configure_upgrades.tmpl \
|
||||
$(base_dir)/results/
|
||||
mv $(base_dir)/results/images/boot.iso $(base_dir)/
|
||||
--add-template $(_BASE_DIR)/lorax_templates/set_installer.tmpl \
|
||||
--add-template $(_BASE_DIR)/lorax_templates/configure_upgrades.tmpl \
|
||||
$(_BASE_DIR)/results/
|
||||
mv $(_BASE_DIR)/results/images/boot.iso $(_BASE_DIR)/
|
||||
|
||||
container/$(image_name)-$(image_tag):
|
||||
# Step 3: Download container image
|
||||
container/$(IMAGE_NAME)-$(IMAGE_TAG):
|
||||
mkdir container
|
||||
podman pull $(image_repo)/$(image_name):$(image_tag)
|
||||
podman save --format oci-dir -o $(base_dir)/container/$(image_name)-$(image_tag) $(image_repo)/$(image_name):$(image_tag)
|
||||
podman rmi $(image_repo)/$(image_name):$(image_tag)
|
||||
podman pull $(IMAGE_REPO)/$(IMAGE_NAME):$(IMAGE_TAG)
|
||||
podman save --format oci-dir -o $(_BASE_DIR)/container/$(IMAGE_NAME)-$(IMAGE_TAG) $(IMAGE_REPO)/$(IMAGE_NAME):$(IMAGE_TAG)
|
||||
podman rmi $(IMAGE_REPO)/$(IMAGE_NAME):$(IMAGE_TAG)
|
||||
|
||||
install-deps:
|
||||
dnf install -y lorax xorriso podman git rpm-ostree
|
||||
|
||||
|
||||
|
||||
# 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
|
||||
sed 's/@IMAGE_REPO@/$(image_repo_escaped)/' $(base_dir)/lorax_templates/$*.tmpl > $(base_dir)/lorax_templates/$*.tmpl.tmp
|
||||
mv $(base_dir)/lorax_templates/$*.tmpl{.tmp,}
|
||||
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,}
|
||||
sed 's/@IMAGE_NAME@/$(IMAGE_NAME)/' $(_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 5: Generate xorriso input
|
||||
xorriso/input.txt: xorriso/gen_input.sh
|
||||
bash $(base_dir)/xorriso/gen_input.sh | tee $(base_dir)/xorriso/input.txt
|
||||
bash $(_BASE_DIR)/xorriso/gen_input.sh | tee $(_BASE_DIR)/xorriso/input.txt
|
||||
|
||||
# Step 4: Generate xorriso script
|
||||
xorriso/%.sh: xorriso/%.sh.in
|
||||
sed 's/@IMAGE_NAME@/$(image_name)/' $(base_dir)/xorriso/$*.sh.in > $(base_dir)/xorriso/$*.sh.in2
|
||||
sed 's/@IMAGE_TAG@/$(image_tag)/' $(base_dir)/xorriso/$*.sh.in2 > $(base_dir)/xorriso/$*.sh
|
||||
sed 's/@VERSION@/$(version)/' $(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,}
|
||||
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,}
|
||||
|
||||
|
||||
clean:
|
||||
rm -Rf $(base_dir)/container || true
|
||||
rm -Rf $(base_dir)/debugdata || true
|
||||
rm -Rf $(base_dir)/pkglists || true
|
||||
rm -Rf $(base_dir)/results || true
|
||||
rm -f $(base_dir)/lorax_templates/*.tmpl || true
|
||||
rm -f $(base_dir)/xorriso/input.txt || true
|
||||
rm -f $(base_dir)/xorriso/*.sh || true
|
||||
rm -f $(base_dir)/{original,final}-pkgsizes.txt || true
|
||||
rm -f $(base_dir)/lorax.conf || true
|
||||
rm -f $(base_dir)/*.iso || true
|
||||
rm -f $(base_dir)/*.log || true
|
||||
rm -Rf $(_BASE_DIR)/container || true
|
||||
rm -Rf $(_BASE_DIR)/debugdata || true
|
||||
rm -Rf $(_BASE_DIR)/pkglists || true
|
||||
rm -Rf $(_BASE_DIR)/results || true
|
||||
rm -f $(_BASE_DIR)/lorax_templates/*.tmpl || true
|
||||
rm -f $(_BASE_DIR)/xorriso/input.txt || true
|
||||
rm -f $(_BASE_DIR)/xorriso/*.sh || true
|
||||
rm -f $(_BASE_DIR)/{original,final}-pkgsizes.txt || true
|
||||
rm -f $(_BASE_DIR)/lorax.conf || true
|
||||
rm -f $(_BASE_DIR)/*.iso || true
|
||||
rm -f $(_BASE_DIR)/*.log || true
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue