Fixed some issues with Makefile TEMPLATE_* vars that were expected to be arrays or easily importable as one
This commit is contained in:
parent
73926c1ed3
commit
e586bc1a2f
24
functions.sh
24
functions.sh
@ -146,6 +146,12 @@ templateFlavor() {
|
|||||||
|
|
||||||
templateFlavorPrefix() {
|
templateFlavorPrefix() {
|
||||||
local template_flavor=${1-$(templateFlavor)}
|
local template_flavor=${1-$(templateFlavor)}
|
||||||
|
|
||||||
|
# If TEMPLATE_FLAVOR_PREFIX is not already an array, make it one
|
||||||
|
if ! [[ "$(declare -p TEMPLATE_FLAVOR_PREFIX 2>/dev/null)" =~ ^declare\ -a.* ]] ; then
|
||||||
|
TEMPLATE_FLAVOR_PREFIX=( ${TEMPLATE_FLAVOR_PREFIX} )
|
||||||
|
fi
|
||||||
|
|
||||||
for element in "${TEMPLATE_FLAVOR_PREFIX[@]}"
|
for element in "${TEMPLATE_FLAVOR_PREFIX[@]}"
|
||||||
do
|
do
|
||||||
if [ "${element%:*}" == "${DIST}+${template_flavor}" ]; then
|
if [ "${element%:*}" == "${DIST}+${template_flavor}" ]; then
|
||||||
@ -188,8 +194,11 @@ templateName() {
|
|||||||
|
|
||||||
local template_name="$(templateFlavorPrefix ${template_flavor})${template_flavor}${template_options:++}${template_options}"
|
local template_name="$(templateFlavorPrefix ${template_flavor})${template_flavor}${template_options:++}${template_options}"
|
||||||
|
|
||||||
# Make sure TEMPLATE_LABEL is an array
|
# If TEMPLATE_LABEL is not already an array, make it one
|
||||||
|
if ! [[ "$(declare -p TEMPLATE_LABEL 2>/dev/null)" =~ ^declare\ -a.* ]] ; then
|
||||||
TEMPLATE_LABEL=( ${TEMPLATE_LABEL} )
|
TEMPLATE_LABEL=( ${TEMPLATE_LABEL} )
|
||||||
|
fi
|
||||||
|
|
||||||
for element in "${TEMPLATE_LABEL[@]}"; do
|
for element in "${TEMPLATE_LABEL[@]}"; do
|
||||||
if [ "${element%:*}" == "${template_name}" ]; then
|
if [ "${element%:*}" == "${template_name}" ]; then
|
||||||
template_name="${element#*:}"
|
template_name="${element#*:}"
|
||||||
@ -212,6 +221,11 @@ templateName() {
|
|||||||
templateDir() {
|
templateDir() {
|
||||||
local template_flavor=${1-$(templateFlavor)}
|
local template_flavor=${1-$(templateFlavor)}
|
||||||
|
|
||||||
|
# If TEMPLATE_FLAVOR_DIR is not already an array, make it one
|
||||||
|
if ! [[ "$(declare -p TEMPLATE_FLAVOR_DIR 2>/dev/null)" =~ ^declare\ -a.* ]] ; then
|
||||||
|
TEMPLATE_FLAVOR_DIR=( ${TEMPLATE_FLAVOR_DIR} )
|
||||||
|
fi
|
||||||
|
|
||||||
for element in "${TEMPLATE_FLAVOR_DIR[@]}"
|
for element in "${TEMPLATE_FLAVOR_DIR[@]}"
|
||||||
do
|
do
|
||||||
# (wheezy+whonix-gateway / wheezy+whonix-gateway+gnome[+++] / wheezy+gnome )
|
# (wheezy+whonix-gateway / wheezy+whonix-gateway+gnome[+++] / wheezy+gnome )
|
||||||
@ -332,8 +346,14 @@ getFileLocations() {
|
|||||||
local function="templateFile"
|
local function="templateFile"
|
||||||
|
|
||||||
|
|
||||||
|
#IFS_orig="${IFS}}"; IFS=$'\n'
|
||||||
|
#files=( $(callTemplateFunction "${filename}" "${suffix}" "${function}") )
|
||||||
|
#setArrayAsGlobal files $return_global_var
|
||||||
|
|
||||||
|
files=$(callTemplateFunction "${filename}" "${suffix}" "${function}")
|
||||||
|
|
||||||
IFS_orig="${IFS}}"; IFS=$'\n'
|
IFS_orig="${IFS}}"; IFS=$'\n'
|
||||||
files=( $(callTemplateFunction "${filename}" "${suffix}" "${function}") )
|
files=( "${files}" )
|
||||||
setArrayAsGlobal files $return_global_var
|
setArrayAsGlobal files $return_global_var
|
||||||
|
|
||||||
IFS="${IFS_orig}"
|
IFS="${IFS_orig}"
|
||||||
|
@ -233,7 +233,7 @@ DIST="wheezy"
|
|||||||
DISTS_VM=""
|
DISTS_VM=""
|
||||||
TEMPLATE_FLAVOR="whonix-gateway"
|
TEMPLATE_FLAVOR="whonix-gateway"
|
||||||
TEMPLATE_FLAVOR_PREFIX=""
|
TEMPLATE_FLAVOR_PREFIX=""
|
||||||
TEMPLATE_FLAVOR_DIR="wheezy+whonix-gateway:tests/template-flavors/another_location/whonix gw"
|
TEMPLATE_FLAVOR_DIR=("wheezy+whonix-gateway:tests/template-flavors/another_location/whonix gw")
|
||||||
TEMPLATE_OPTIONS=""
|
TEMPLATE_OPTIONS=""
|
||||||
|
|
||||||
header <<EOF
|
header <<EOF
|
||||||
@ -372,7 +372,10 @@ DIST="wheezy"
|
|||||||
DISTS_VM=""
|
DISTS_VM=""
|
||||||
TEMPLATE_FLAVOR="whonix-gateway"
|
TEMPLATE_FLAVOR="whonix-gateway"
|
||||||
TEMPLATE_FLAVOR_PREFIX=""
|
TEMPLATE_FLAVOR_PREFIX=""
|
||||||
TEMPLATE_FLAVOR_DIR="wheezy+whonix-gateway:tests/template-flavors/another_location/whonix gw"
|
TEMPLATE_FLAVOR_DIR=(
|
||||||
|
'wheezy+whonix-gateway:tests/template-flavors/another_location/whonix gw'
|
||||||
|
'+gnome:$${SCRIPTSDIR}/gnome'
|
||||||
|
)
|
||||||
TEMPLATE_OPTIONS=('gnome')
|
TEMPLATE_OPTIONS=('gnome')
|
||||||
|
|
||||||
header <<EOF
|
header <<EOF
|
||||||
|
Loading…
Reference in New Issue
Block a user