From: Jacob McNamee Date: Wed, 22 May 2024 13:34:08 +0000 (-0700) Subject: lxc-local: fix use of `LXC_PATH` before init X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d7f2a52fd37f28259642c75c29de652d83c881de;p=thirdparty%2Flxc.git lxc-local: fix use of `LXC_PATH` before init Signed-off-by: Jacob McNamee --- diff --git a/templates/lxc-local.in b/templates/lxc-local.in index 4408ff50b..b0c48bc42 100755 --- a/templates/lxc-local.in +++ b/templates/lxc-local.in @@ -18,7 +18,7 @@ MODE="system" COMPAT_LEVEL=5 EXCLUDES="" -TEMPLATE_FILES="${LXC_PATH}/config" +TEMPLATE_FILES="" # Make sure the usual locations are in PATH @@ -169,6 +169,14 @@ process_excludes() { fi } +record_template_file() { + if [ -z "${TEMPLATE_FILES}" ]; then + TEMPLATE_FILES="$1" + else + TEMPLATE_FILES="${TEMPLATE_FILES};$1" + fi +} + extract_config() { # lxc-create will automatically create a config file at ${LXC_PATH}/config. # This function extracts the network config, and any remaining lxc config @@ -237,6 +245,7 @@ process_config() { add_container_config add_extra_config add_network_config + record_template_file "${LXC_PATH}/config" } process_fstab() { @@ -246,7 +255,7 @@ process_fstab() { if [ -e "${fstab}" ]; then echo "lxc.mount.fstab = ${LXC_PATH}/fstab" >> "${LXC_PATH}/config" cp "${fstab}" "${LXC_PATH}/fstab" - TEMPLATE_FILES="${TEMPLATE_FILES};${LXC_PATH}/fstab" + record_template_file "${LXC_PATH}/fstab" fi } @@ -257,7 +266,7 @@ process_templates() { while read -r line; do fullpath="${LXC_ROOTFS}/${line}" [ ! -e "${fullpath}" ] && continue - TEMPLATE_FILES="${TEMPLATE_FILES};${fullpath}" + record_template_file "${fullpath}" done < "${template}" fi }