#!/bin/bash # vim: set ts=4 sw=4 sts=4 et : VERBOSE=2 DEBUG=1 pushd ../.. ROOT_DIR=$(readlink -m .) # ------------------------------------------------------------------------------ # Source external scripts # ------------------------------------------------------------------------------ . ./functions.sh . ./tests/assert/assert.sh header() { echo echo info "------------------------------------------------------------------------------" IFS= read -r title; info "${title}" while IFS= read -r line; do echo "${bold}${magenta}${line}${reset}" done; echo values SCRIPTSDIR values DIST values DISTS_VM values TEMPLATE_FLAVOR values TEMPLATE_FLAVOR_PREFIX values TEMPLATE_FLAVOR_DIR values TEMPLATE_OPTIONS echo } declare -A VALUES=( [SCRIPTSDIR]="" [DIST]="" [DISTS_VM]="" [TEMPLATE_FLAVOR]="" [TEMPLATE_FLAVOR_DIR]="" [TEMPLATE_FLAVOR_PREFIX]="" [TEMPLATE_OPTIONS]="" ) values() { [[ -z ${TEST} ]] && { label=${1} value="${1}[@]" value="${!value}" if [ "${VALUES[$label]}" == "${value}" ]; then printf " ${bold}${magenta}%-22s = ${value}${reset}\n" "${label}" || : else printf " ${bold}${black}%-22s = ${value}${reset}\n" "${label}" || : fi #printf "${bold}${black}%s=\"${value}\"${reset}\n" "${label}" || : VALUES[$label]="${value}" } } info() { [[ -z ${TEST} ]] && echo "${bold}${blue}${1}${reset}" || : } debug() { [[ -z ${TEST} ]] && echo -e "${magenta}${1}${reset}" || : } assertTest(){ TEST=True printf "${bold}${red}" assert "$1" "$2" printf "${reset}" unset TEST } assertEnd() { printf "${bold}${red}" [[ -n "$1" ]] && assert_end "$1" || assert_end printf "${reset}" } # ------------------------------------------------------------------------------ # 1. With TEMPLATE_FLAVOR # ------------------------------------------------------------------------------ SCRIPTSDIR="tests/template-flavors" DIST="wheezy" DISTS_VM="" TEMPLATE_FLAVOR="whonix-gateway" TEMPLATE_FLAVOR_PREFIX="" TEMPLATE_FLAVOR_DIR="" TEMPLATE_OPTIONS="" header <