Skip to content

Commit

Permalink
Allow builder plugin to dynamically generate template.conf
Browse files Browse the repository at this point in the history
Export a TEMPLATE_CONF variable with expected location for the
template.conf. Builder plugin can create it dynamically in the
04_install_qubes.sh step. If it doesn't - old logic is used.

QubesOS/qubes-issues#7988
  • Loading branch information
marmarek committed Feb 11, 2023
1 parent c9d6a0a commit 2ead913
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
2 changes: 2 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 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

0 comments on commit 2ead913

Please sign in to comment.