Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow builder plugin to dynamically generate template.conf #30

Merged
merged 1 commit into from
Feb 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions qubesbuilder/plugins/template/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ endif

INSTALL_DIR ?= $(BUILDER_DIR)/mnt
ARTIFACTS_DIR ?= $(BUILDER_DIR)/artifacts
# copied/generate final template.conf
TEMPLATE_CONF ?= $(ARTIFACTS_DIR)/template.conf

# Required env variables for scripts
REQUIRED_ENV := DIST_CODENAME DIST_NAME DIST_VER PLUGINS_DIR ARTIFACTS_DIR CACHE_DIR \
Expand All @@ -26,6 +28,7 @@ TEMPLATE_ENV_WHITELIST ?=
TEMPLATE_ENV_WHITELIST += $(REQUIRED_ENV) \
TEMPLATE_FLAVOR TEMPLATE_OPTIONS \
TEMPLATE_FLAVOR_DIR APPMENUS_DIR CONFIG_DIR \
TEMPLATE_CONF \
VERBOSE DEBUG PATH DISCARD_PREPARED_IMAGE \
TEMPLATE_ROOT_WITH_PARTITIONS TEMPLATE_ROOT_SIZE \
USE_QUBES_REPO_VERSION USE_QUBES_REPO_TESTING \
Expand Down
9 changes: 6 additions & 3 deletions qubesbuilder/plugins/template/scripts/qubeize-image
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ mkdir -p "${INSTALL_DIR}" "${CACHE_DIR}" "${PACKAGES_DIR}"
# ------------------------------------------------------------------------------
# Export needed environment variable
# ------------------------------------------------------------------------------
export INSTALL_DIR LC_ALL BASE_IMG TEMPLATE_NAME IMG
export INSTALL_DIR LC_ALL BASE_IMG TEMPLATE_NAME IMG TEMPLATE_CONF

# ------------------------------------------------------------------------------
# Cleanup function
Expand All @@ -65,6 +65,8 @@ trap cleanup ERR
# Mount qubeized_image
# ------------------------------------------------------------------------------
mkdir -p "${ARTIFACTS_DIR}/qubeized_images/${TEMPLATE_NAME}"
# remove old versions, if any
rm -f "${TEMPLATE_CONF}"

echo "--> Moving $IMG to $IMG..."
mv "${BASE_IMG}" "$IMG" || exit 1
Expand Down Expand Up @@ -104,13 +106,14 @@ cp -r "${appmenus}" "${ARTIFACTS_DIR}/appmenus"

echo "--> Creating template config file..."
_conf_dir="${CONFIG_DIR:-${TEMPLATE_CONTENT_DIR}}"
rm -f "${ARTIFACTS_DIR}/template.conf"

template_conf="$(get_file_or_directory_for_current_flavor "${_conf_dir}/template.conf")"
if [ -z "$template_conf" ]; then
template_conf="${PLUGINS_DIR}/template/template_generic.conf"
fi
cp "${template_conf}" "${ARTIFACTS_DIR}/template.conf"
if ! [ -e "${TEMPLATE_CONF}" ]; then
cp "${template_conf}" "${TEMPLATE_CONF}"
fi

# ------------------------------------------------------------------------------
# Link directories so they can be mounted
Expand Down