2014-10-22 20:37:26 +00:00
|
|
|
#!/bin/bash
|
2014-10-21 13:12:05 +00:00
|
|
|
# vim: set ts=4 sw=4 sts=4 et :
|
|
|
|
|
2014-11-04 04:59:48 +00:00
|
|
|
VERBOSE=1
|
2014-10-21 13:12:05 +00:00
|
|
|
|
|
|
|
pushd ../..
|
2014-10-24 10:48:11 +00:00
|
|
|
ROOT_DIR=$(readlink -m .)
|
2014-10-21 13:12:05 +00:00
|
|
|
|
|
|
|
# ------------------------------------------------------------------------------
|
|
|
|
# Source external scripts
|
|
|
|
# ------------------------------------------------------------------------------
|
|
|
|
. ./functions.sh
|
|
|
|
. ./tests/assert/assert.sh
|
|
|
|
|
2015-03-15 19:04:23 +00:00
|
|
|
set +e
|
|
|
|
|
2014-10-24 10:48:11 +00:00
|
|
|
header() {
|
2014-10-21 13:12:05 +00:00
|
|
|
echo
|
|
|
|
echo
|
|
|
|
info "------------------------------------------------------------------------------"
|
2014-10-24 10:48:11 +00:00
|
|
|
|
|
|
|
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() {
|
2014-11-04 04:59:48 +00:00
|
|
|
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
|
|
|
|
VALUES[$label]="${value}"
|
2014-10-21 13:12:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
info() {
|
2014-11-04 04:59:48 +00:00
|
|
|
output "${bold}${blue}${1}${reset}" || :
|
2014-10-21 13:12:05 +00:00
|
|
|
}
|
|
|
|
|
2014-10-24 10:48:11 +00:00
|
|
|
debug() {
|
2014-11-04 04:59:48 +00:00
|
|
|
output "${magenta}${1}${reset}" || :
|
2014-10-24 10:48:11 +00:00
|
|
|
}
|
2014-10-21 13:12:05 +00:00
|
|
|
|
|
|
|
assertTest(){
|
|
|
|
TEST=True
|
|
|
|
printf "${bold}${red}"
|
|
|
|
assert "$1" "$2"
|
|
|
|
printf "${reset}"
|
|
|
|
unset TEST
|
|
|
|
}
|
|
|
|
|
|
|
|
assertEnd() {
|
|
|
|
printf "${bold}${red}"
|
2014-10-22 20:37:26 +00:00
|
|
|
[[ -n "$1" ]] && assert_end "$1" || assert_end
|
2014-10-21 13:12:05 +00:00
|
|
|
printf "${reset}"
|
|
|
|
}
|
|
|
|
|
|
|
|
# ------------------------------------------------------------------------------
|
2014-10-24 10:48:11 +00:00
|
|
|
# 1. With TEMPLATE_FLAVOR
|
|
|
|
# ------------------------------------------------------------------------------
|
|
|
|
SCRIPTSDIR="tests/template-flavors"
|
|
|
|
DIST="wheezy"
|
2014-10-24 20:17:29 +00:00
|
|
|
DISTS_VM=""
|
2014-10-24 10:48:11 +00:00
|
|
|
TEMPLATE_FLAVOR="whonix-gateway"
|
|
|
|
TEMPLATE_FLAVOR_PREFIX=""
|
2014-10-24 20:17:29 +00:00
|
|
|
TEMPLATE_FLAVOR_DIR=""
|
|
|
|
TEMPLATE_OPTIONS=""
|
2014-10-24 10:48:11 +00:00
|
|
|
|
|
|
|
header <<EOF
|
|
|
|
1. With TEMPLATE_FLAVOR
|
|
|
|
EOF
|
2014-10-22 20:37:26 +00:00
|
|
|
buildStep "$0" "pre"
|
2015-02-10 15:12:53 +00:00
|
|
|
assertTest "buildStep $0 pre" "tests/template-flavors/wheezy+whonix-gateway/test_pre.sh\ntests/template-flavors/wheezy/test_pre.sh\ntests/template-flavors/test_pre.sh"
|
2014-10-22 20:37:26 +00:00
|
|
|
assertEnd
|
2014-10-21 13:12:05 +00:00
|
|
|
|
2014-10-24 10:48:11 +00:00
|
|
|
|
|
|
|
# ------------------------------------------------------------------------------
|
|
|
|
# 2. Without TEMPLATE_FLAVOR
|
2014-10-21 13:12:05 +00:00
|
|
|
# ------------------------------------------------------------------------------
|
2014-10-24 20:17:29 +00:00
|
|
|
SCRIPTSDIR="tests/template-flavors"
|
|
|
|
DIST="wheezy"
|
|
|
|
DISTS_VM=""
|
2014-10-24 10:48:11 +00:00
|
|
|
TEMPLATE_FLAVOR=""
|
2014-10-24 20:17:29 +00:00
|
|
|
TEMPLATE_FLAVOR_PREFIX=""
|
|
|
|
TEMPLATE_FLAVOR_DIR=""
|
|
|
|
TEMPLATE_OPTIONS=""
|
2014-10-24 10:48:11 +00:00
|
|
|
|
|
|
|
header <<EOF
|
|
|
|
2. Without TEMPLATE_FLAVOR
|
|
|
|
EOF
|
2014-10-22 20:37:26 +00:00
|
|
|
buildStep "$0" "pre"
|
2015-02-10 15:12:53 +00:00
|
|
|
assertTest "buildStep $0 pre" "tests/template-flavors/test_pre.sh\ntests/template-flavors/wheezy/test_pre.sh"
|
2014-10-22 20:37:26 +00:00
|
|
|
assertEnd
|
2014-10-21 13:12:05 +00:00
|
|
|
|
2014-10-24 10:48:11 +00:00
|
|
|
|
|
|
|
# ------------------------------------------------------------------------------
|
|
|
|
# 3. Template Options
|
2014-10-21 13:12:05 +00:00
|
|
|
# ------------------------------------------------------------------------------
|
2014-10-24 20:17:29 +00:00
|
|
|
SCRIPTSDIR="tests/template-flavors"
|
|
|
|
DIST="wheezy"
|
|
|
|
DISTS_VM=""
|
2014-10-24 10:48:11 +00:00
|
|
|
TEMPLATE_FLAVOR="whonix-gateway"
|
2014-10-24 20:17:29 +00:00
|
|
|
TEMPLATE_FLAVOR_PREFIX=""
|
|
|
|
TEMPLATE_FLAVOR_DIR=""
|
2014-10-24 10:48:11 +00:00
|
|
|
TEMPLATE_OPTIONS=('gnome' 'kde')
|
|
|
|
|
|
|
|
header <<EOF
|
|
|
|
3. Template Options
|
|
|
|
Options get seperated into TEMPLATE_OPTIONS seperated by spaces
|
|
|
|
EOF
|
2014-10-22 20:37:26 +00:00
|
|
|
buildStep "$0" "pre"
|
2014-10-21 13:12:05 +00:00
|
|
|
debug "Not supposed to find wheezy+whonix-gateway+kde"
|
2015-02-10 15:12:53 +00:00
|
|
|
assertTest "buildStep $0 pre" "tests/template-flavors/wheezy+whonix-gateway/test_pre.sh\ntests/template-flavors/wheezy/test_pre.sh\ntests/template-flavors/wheezy+whonix-gateway+gnome/test_pre.sh\ntests/template-flavors/test_pre.sh"
|
2014-10-22 20:37:26 +00:00
|
|
|
assertEnd
|
2014-10-21 13:12:05 +00:00
|
|
|
|
2014-10-24 10:48:11 +00:00
|
|
|
|
|
|
|
# ------------------------------------------------------------------------------
|
|
|
|
# 4. Template Options with custom prefix
|
2014-10-21 13:12:05 +00:00
|
|
|
# ------------------------------------------------------------------------------
|
2014-10-24 20:17:29 +00:00
|
|
|
SCRIPTSDIR="tests/template-flavors"
|
|
|
|
DIST="wheezy"
|
|
|
|
DISTS_VM=""
|
|
|
|
TEMPLATE_FLAVOR="whonix-gateway"
|
|
|
|
TEMPLATE_FLAVOR_DIR=""
|
|
|
|
TEMPLATE_OPTIONS=('gnome' 'kde')
|
2014-10-24 10:48:11 +00:00
|
|
|
TEMPLATE_FLAVOR_PREFIX=(
|
|
|
|
'wheezy+whonix-gateway:debian+'
|
|
|
|
'wheezy+whonix-workstation:debian+'
|
2014-10-21 13:12:05 +00:00
|
|
|
)
|
2014-10-24 10:48:11 +00:00
|
|
|
header <<EOF
|
|
|
|
4. Template Options with custom prefix
|
|
|
|
EOF
|
2014-10-22 20:37:26 +00:00
|
|
|
buildStep "$0" "pre"
|
2014-10-21 13:12:05 +00:00
|
|
|
debug "Not supposed to find debian+whonix-gateway+kde"
|
2015-02-10 15:12:53 +00:00
|
|
|
assertTest "buildStep $0 pre" "tests/template-flavors/debian+whonix-gateway/test_pre.sh\ntests/template-flavors/wheezy/test_pre.sh\ntests/template-flavors/wheezy+whonix-gateway+gnome/test_pre.sh\ntests/template-flavors/test_pre.sh"
|
2014-10-22 20:37:26 +00:00
|
|
|
assertEnd
|
2014-10-21 13:12:05 +00:00
|
|
|
|
2014-10-24 10:48:11 +00:00
|
|
|
|
|
|
|
# ------------------------------------------------------------------------------
|
|
|
|
# 5. Template Options with NO prefix
|
2014-10-21 13:12:05 +00:00
|
|
|
# ------------------------------------------------------------------------------
|
2014-10-24 20:17:29 +00:00
|
|
|
SCRIPTSDIR="tests/template-flavors"
|
|
|
|
DIST="wheezy"
|
|
|
|
DISTS_VM=""
|
|
|
|
TEMPLATE_FLAVOR="whonix-gateway"
|
|
|
|
TEMPLATE_FLAVOR_DIR=""
|
|
|
|
TEMPLATE_OPTIONS=('gnome' 'kde')
|
2014-10-24 10:48:11 +00:00
|
|
|
TEMPLATE_FLAVOR_PREFIX=(
|
|
|
|
'wheezy+whonix-gateway:'
|
|
|
|
'wheezy+whonix-workstation:'
|
2014-10-21 13:12:05 +00:00
|
|
|
)
|
2014-10-24 10:48:11 +00:00
|
|
|
header <<EOF
|
|
|
|
5. Template Options with NO prefix
|
|
|
|
EOF
|
2014-10-22 20:37:26 +00:00
|
|
|
buildStep "$0" "pre"
|
2014-10-21 13:12:05 +00:00
|
|
|
debug "Not supposed to find whonix-gateway+kde"
|
2015-02-10 15:12:53 +00:00
|
|
|
assertTest "buildStep $0 pre" "tests/template-flavors/whonix-gateway/test_pre.sh\ntests/template-flavors/wheezy/test_pre.sh\ntests/template-flavors/wheezy+whonix-gateway+gnome/test_pre.sh\ntests/template-flavors/test_pre.sh"
|
2014-10-22 20:37:26 +00:00
|
|
|
assertEnd
|
2014-10-21 13:12:05 +00:00
|
|
|
|
2014-10-24 10:48:11 +00:00
|
|
|
|
|
|
|
# ------------------------------------------------------------------------------
|
|
|
|
# 6. Custom template directory for options within \${SCRIPTSDIR}
|
|
|
|
# ------------------------------------------------------------------------------
|
2014-10-24 20:17:29 +00:00
|
|
|
SCRIPTSDIR="tests/template-flavors"
|
|
|
|
DIST="wheezy"
|
|
|
|
DISTS_VM=""
|
|
|
|
TEMPLATE_FLAVOR="whonix-gateway"
|
|
|
|
TEMPLATE_FLAVOR_PREFIX=""
|
|
|
|
TEMPLATE_FLAVOR_DIR="wheezy+whonix-gateway+gnome:${SCRIPTSDIR}/another_location/whonix_gnome"
|
2014-10-24 10:48:11 +00:00
|
|
|
TEMPLATE_OPTIONS=('gnome')
|
|
|
|
|
|
|
|
header <<EOF
|
|
|
|
6. Custom template directory for options within \${SCRIPTSDIR}
|
|
|
|
NOTE: in config file you would need to use \$\${SCRIPTSDIR} or whatever variable
|
|
|
|
and in a bash file use single 'quotes' around string and \${SCRIPTSDIR}
|
|
|
|
EOF
|
|
|
|
buildStep "$0" "pre"
|
2015-04-07 23:38:43 +00:00
|
|
|
assertTest "buildStep $0 pre" "tests/template-flavors/wheezy+whonix-gateway/test_pre.sh\ntests/template-flavors/wheezy/test_pre.sh\ntests/template-flavors/another_location/whonix_gnome/test_pre.sh\ntests/template-flavors/test_pre.sh"
|
2014-10-24 10:48:11 +00:00
|
|
|
assertEnd
|
|
|
|
|
|
|
|
|
|
|
|
# ------------------------------------------------------------------------------
|
|
|
|
# 7. Custom template directory
|
2014-10-21 13:12:05 +00:00
|
|
|
# ------------------------------------------------------------------------------
|
2014-10-24 20:17:29 +00:00
|
|
|
SCRIPTSDIR="tests/template-flavors"
|
|
|
|
DIST="wheezy"
|
|
|
|
DISTS_VM=""
|
|
|
|
TEMPLATE_FLAVOR="whonix-gateway"
|
|
|
|
TEMPLATE_FLAVOR_PREFIX=""
|
2014-10-24 10:48:11 +00:00
|
|
|
TEMPLATE_FLAVOR_DIR="wheezy+whonix-gateway:tests/template-flavors/another_location/whonix-gw"
|
2014-10-24 20:17:29 +00:00
|
|
|
TEMPLATE_OPTIONS=""
|
2014-10-24 10:48:11 +00:00
|
|
|
|
|
|
|
header <<EOF
|
|
|
|
7. Custom template directory
|
|
|
|
EOF
|
2014-10-22 20:37:26 +00:00
|
|
|
buildStep "$0" "pre"
|
2015-03-15 19:04:23 +00:00
|
|
|
assertTest "buildStep $0 pre" "tests/template-flavors/another_location/whonix-gw/test_pre.sh\ntests/template-flavors/wheezy/test_pre.sh\ntests/template-flavors/test_pre.sh"
|
2014-10-22 20:37:26 +00:00
|
|
|
assertEnd
|
2014-10-21 13:12:05 +00:00
|
|
|
|
|
|
|
# ------------------------------------------------------------------------------
|
2014-10-24 10:48:11 +00:00
|
|
|
# 8. Custom template directory with space in name
|
|
|
|
# ------------------------------------------------------------------------------
|
2014-10-24 20:17:29 +00:00
|
|
|
SCRIPTSDIR="tests/template-flavors"
|
|
|
|
DIST="wheezy"
|
|
|
|
DISTS_VM=""
|
|
|
|
TEMPLATE_FLAVOR="whonix-gateway"
|
|
|
|
TEMPLATE_FLAVOR_PREFIX=""
|
2014-10-27 03:55:21 +00:00
|
|
|
TEMPLATE_FLAVOR_DIR=("wheezy+whonix-gateway:tests/template-flavors/another_location/whonix gw")
|
2014-10-24 20:17:29 +00:00
|
|
|
TEMPLATE_OPTIONS=""
|
2014-10-24 10:48:11 +00:00
|
|
|
|
|
|
|
header <<EOF
|
|
|
|
8. Custom template directory with space in name
|
|
|
|
EOF
|
2014-10-22 20:37:26 +00:00
|
|
|
buildStep "$0" "pre"
|
2015-03-15 19:04:23 +00:00
|
|
|
assertTest "buildStep $0 pre" "tests/template-flavors/another_location/whonix gw/test_pre.sh\ntests/template-flavors/wheezy/test_pre.sh\ntests/template-flavors/test_pre.sh"
|
2014-10-22 20:37:26 +00:00
|
|
|
assertEnd
|
|
|
|
|
2014-10-24 10:48:11 +00:00
|
|
|
|
|
|
|
# ------------------------------------------------------------------------------
|
|
|
|
# 9. Custom template directory for options
|
2014-10-22 20:37:26 +00:00
|
|
|
# ------------------------------------------------------------------------------
|
2014-10-24 20:17:29 +00:00
|
|
|
SCRIPTSDIR="tests/template-flavors"
|
|
|
|
DIST="wheezy"
|
|
|
|
DISTS_VM=""
|
|
|
|
TEMPLATE_FLAVOR="whonix-gateway"
|
|
|
|
TEMPLATE_FLAVOR_PREFIX=""
|
2014-10-24 10:48:11 +00:00
|
|
|
TEMPLATE_FLAVOR_DIR="wheezy+whonix-gateway+gnome:tests/template-flavors/another_location/whonix_gnome"
|
2014-10-24 20:17:29 +00:00
|
|
|
TEMPLATE_OPTIONS=('gnome')
|
2014-10-24 10:48:11 +00:00
|
|
|
|
|
|
|
header <<EOF
|
|
|
|
9. Custom template directory for options
|
|
|
|
EOF
|
2014-10-22 20:37:26 +00:00
|
|
|
buildStep "$0" "pre"
|
2015-04-07 23:38:43 +00:00
|
|
|
assertTest "buildStep $0 pre" "tests/template-flavors/wheezy+whonix-gateway/test_pre.sh\ntests/template-flavors/wheezy/test_pre.sh\ntests/template-flavors/another_location/whonix_gnome/test_pre.sh\ntests/template-flavors/test_pre.sh"
|
2014-10-22 20:37:26 +00:00
|
|
|
assertEnd
|
|
|
|
|
2014-10-24 10:48:11 +00:00
|
|
|
|
|
|
|
# ------------------------------------------------------------------------------
|
2014-10-28 08:09:55 +00:00
|
|
|
# 10. Template directory for options within ${SCRIPTSDIR} using short name filter
|
2014-10-24 10:48:11 +00:00
|
|
|
# ------------------------------------------------------------------------------
|
2014-10-24 20:17:29 +00:00
|
|
|
SCRIPTSDIR="tests/template-flavors"
|
|
|
|
DIST="wheezy"
|
|
|
|
DISTS_VM=""
|
|
|
|
TEMPLATE_FLAVOR="whonix-gateway"
|
|
|
|
TEMPLATE_FLAVOR_PREFIX=""
|
|
|
|
TEMPLATE_FLAVOR_DIR="wheezy+proxy:${SCRIPTSDIR}/proxy"
|
2014-10-24 10:48:11 +00:00
|
|
|
TEMPLATE_OPTIONS=('proxy')
|
|
|
|
|
|
|
|
header <<EOF
|
2014-10-28 08:09:55 +00:00
|
|
|
10. Template directory for options within ${SCRIPTSDIR} using short name filter
|
2014-10-24 10:48:11 +00:00
|
|
|
EOF
|
|
|
|
buildStep "$0" "pre"
|
2015-02-10 15:12:53 +00:00
|
|
|
assertTest "buildStep $0 pre" "tests/template-flavors/wheezy+whonix-gateway/test_pre.sh\ntests/template-flavors/wheezy/test_pre.sh\ntests/template-flavors/proxy/test_pre.sh\ntests/template-flavors/test_pre.sh"
|
2014-10-24 10:48:11 +00:00
|
|
|
assertEnd
|
|
|
|
|
|
|
|
|
|
|
|
# ------------------------------------------------------------------------------
|
|
|
|
# 11. Template directory for options within using VERY short name filter (+proxy)
|
|
|
|
# ------------------------------------------------------------------------------
|
2014-10-24 20:17:29 +00:00
|
|
|
SCRIPTSDIR="tests/template-flavors"
|
|
|
|
DIST="wheezy"
|
|
|
|
DISTS_VM=""
|
|
|
|
TEMPLATE_FLAVOR="whonix-gateway"
|
|
|
|
TEMPLATE_FLAVOR_PREFIX=""
|
|
|
|
TEMPLATE_FLAVOR_DIR="+proxy:${SCRIPTSDIR}/proxy"
|
2014-10-24 10:48:11 +00:00
|
|
|
TEMPLATE_OPTIONS=('proxy')
|
|
|
|
|
|
|
|
header <<EOF
|
|
|
|
11. Template directory for options within using VERY short name filter (+proxy)
|
|
|
|
EOF
|
|
|
|
buildStep "$0" "pre"
|
2015-02-10 15:12:53 +00:00
|
|
|
assertTest "buildStep $0 pre" "tests/template-flavors/wheezy+whonix-gateway/test_pre.sh\ntests/template-flavors/wheezy/test_pre.sh\ntests/template-flavors/proxy/test_pre.sh\ntests/template-flavors/test_pre.sh"
|
2014-10-24 10:48:11 +00:00
|
|
|
assertEnd
|
|
|
|
|
|
|
|
|
2014-10-22 20:37:26 +00:00
|
|
|
# ------------------------------------------------------------------------------
|
2014-10-24 20:17:29 +00:00
|
|
|
# 12. Template Name - Custom
|
|
|
|
# ------------------------------------------------------------------------------
|
|
|
|
SCRIPTSDIR="tests/template-flavors"
|
|
|
|
DIST="wheezy"
|
|
|
|
DISTS_VM=""
|
|
|
|
TEMPLATE_FLAVOR="whonix-gateway"
|
|
|
|
TEMPLATE_FLAVOR_PREFIX=""
|
|
|
|
TEMPLATE_FLAVOR_DIR=""
|
|
|
|
TEMPLATE_OPTIONS=""
|
|
|
|
TEMPLATE_LABEL="wheezy+whonix-gateway:whonix-gateway"
|
|
|
|
|
|
|
|
header <<EOF
|
|
|
|
12. Template Name - Custom
|
|
|
|
TEMPLATE_LABEL = wheezy+whonix-gateway:whonix-gateway
|
|
|
|
EOF
|
|
|
|
info "Template name: $(templateName)"
|
|
|
|
assertTest "templateName" "whonix-gateway"
|
|
|
|
assertEnd
|
|
|
|
|
|
|
|
|
|
|
|
# ------------------------------------------------------------------------------
|
|
|
|
# 13. Template Name - Custom with sub-options
|
|
|
|
# ------------------------------------------------------------------------------
|
|
|
|
SCRIPTSDIR="tests/template-flavors"
|
|
|
|
DIST="wheezy"
|
|
|
|
DISTS_VM=""
|
|
|
|
TEMPLATE_FLAVOR="whonix-gateway"
|
|
|
|
TEMPLATE_FLAVOR_PREFIX=""
|
|
|
|
TEMPLATE_FLAVOR_DIR=""
|
|
|
|
TEMPLATE_OPTIONS=('proxy')
|
|
|
|
TEMPLATE_LABEL="wheezy+whonix-gateway+proxy:whonix-gateway"
|
|
|
|
|
|
|
|
header <<EOF
|
|
|
|
13. Template Name - Custom with sub-options
|
|
|
|
TEMPLATE_LABEL = wheezy+whonix-gateway+proxy:whonix-gateway
|
|
|
|
EOF
|
|
|
|
info "Template name: $(templateName)"
|
|
|
|
assertTest "templateName" "whonix-gateway"
|
|
|
|
assertEnd
|
|
|
|
|
|
|
|
|
|
|
|
# ------------------------------------------------------------------------------
|
|
|
|
# 14. Template Name - NO template
|
|
|
|
# ------------------------------------------------------------------------------
|
|
|
|
SCRIPTSDIR="tests/template-flavors"
|
|
|
|
DIST="wheezy"
|
|
|
|
DISTS_VM=""
|
|
|
|
TEMPLATE_FLAVOR=""
|
|
|
|
TEMPLATE_FLAVOR_PREFIX=""
|
|
|
|
TEMPLATE_FLAVOR_DIR=""
|
|
|
|
TEMPLATE_OPTIONS=""
|
|
|
|
TEMPLATE_LABEL="wheezy:debian-7"
|
|
|
|
|
|
|
|
header <<EOF
|
|
|
|
14. Template Name - NO template
|
|
|
|
TEMPLATE_LABEL = wheezy:debian-7
|
|
|
|
EOF
|
|
|
|
info "Template name: $(templateName)"
|
|
|
|
assertTest "templateName" "debian-7"
|
|
|
|
assertEnd
|
|
|
|
|
2015-03-15 19:04:23 +00:00
|
|
|
# ------------------------------------------------------------------------------
|
|
|
|
# 15. Template Name - containsFlavor
|
|
|
|
# ------------------------------------------------------------------------------
|
|
|
|
SCRIPTSDIR="tests/template-flavors"
|
|
|
|
DIST="wheezy"
|
|
|
|
DISTS_VM=""
|
|
|
|
TEMPLATE_FLAVOR="whonix-gateway"
|
|
|
|
TEMPLATE_FLAVOR_PREFIX=""
|
|
|
|
TEMPLATE_FLAVOR_DIR=""
|
|
|
|
TEMPLATE_OPTIONS=('proxy' 'minimal' 'flash' 'gnome')
|
|
|
|
TEMPLATE_LABEL=""
|
|
|
|
|
|
|
|
header <<EOF
|
|
|
|
15. Template Name - containsFlavor
|
|
|
|
containsFlavor flash
|
|
|
|
containsFlavor whonix-gateway
|
|
|
|
EOF
|
|
|
|
assert_raises "containsFlavor flash"
|
|
|
|
assert_raises "containsFlavor whonix-gateway"
|
|
|
|
assertEnd
|
|
|
|
|
|
|
|
# ------------------------------------------------------------------------------
|
|
|
|
# 16. Long Template Name
|
|
|
|
# ------------------------------------------------------------------------------
|
|
|
|
SCRIPTSDIR="tests/template-flavors"
|
|
|
|
DIST="wheezy"
|
|
|
|
DISTS_VM=""
|
|
|
|
TEMPLATE_FLAVOR="tor-gateway"
|
|
|
|
TEMPLATE_FLAVOR_PREFIX=""
|
|
|
|
TEMPLATE_FLAVOR_DIR=""
|
|
|
|
TEMPLATE_OPTIONS=""
|
|
|
|
TEMPLATE_OPTIONS=('minimal' 'proxy' 'flash' 'gnome' 'standard')
|
|
|
|
|
|
|
|
header <<EOF
|
|
|
|
16. Long Template Name
|
|
|
|
EOF
|
|
|
|
info "Template name: $(templateName)"
|
|
|
|
assertTest "templateName" "wheezy+tor-gateway+minimal"
|
|
|
|
assertEnd
|
2014-10-24 20:17:29 +00:00
|
|
|
|
|
|
|
# ------------------------------------------------------------------------------
|
2015-03-15 19:04:23 +00:00
|
|
|
# 17. Configuration Files
|
2014-10-24 10:48:11 +00:00
|
|
|
# ------------------------------------------------------------------------------
|
2014-10-24 20:17:29 +00:00
|
|
|
SCRIPTSDIR="tests/template-flavors"
|
|
|
|
DIST="wheezy"
|
|
|
|
DISTS_VM=""
|
|
|
|
TEMPLATE_FLAVOR="whonix-gateway"
|
|
|
|
TEMPLATE_FLAVOR_PREFIX=""
|
2014-10-27 03:55:21 +00:00
|
|
|
TEMPLATE_FLAVOR_DIR=(
|
|
|
|
'wheezy+whonix-gateway:tests/template-flavors/another_location/whonix gw'
|
|
|
|
'+gnome:$${SCRIPTSDIR}/gnome'
|
|
|
|
)
|
2014-10-24 10:48:11 +00:00
|
|
|
TEMPLATE_OPTIONS=('gnome')
|
|
|
|
|
|
|
|
header <<EOF
|
2015-03-15 19:04:23 +00:00
|
|
|
17. Configuration Files
|
2014-10-24 10:48:11 +00:00
|
|
|
Find packages.list for every template available
|
|
|
|
EOF
|
2014-10-22 20:37:26 +00:00
|
|
|
getFileLocations filelist 'packages.list'
|
|
|
|
for file in "${filelist[@]}"; do
|
|
|
|
echo "Configuration: ${file}"
|
|
|
|
done
|
|
|
|
result="$(echo $(printf "'%s' " "${filelist[@]}"))"
|
2014-11-04 04:59:48 +00:00
|
|
|
assertTest "echo ${result}" "tests/template-flavors/another_location/whonix gw/packages.list tests/template-flavors/wheezy+whonix-gateway+gnome/packages.list tests/template-flavors/packages.list"
|
2014-10-22 20:37:26 +00:00
|
|
|
assertEnd
|
|
|
|
|
2014-10-24 10:48:11 +00:00
|
|
|
|
|
|
|
# ------------------------------------------------------------------------------
|
2015-03-15 19:04:23 +00:00
|
|
|
# 18. Configuration Files - No Template
|
2014-10-22 20:37:26 +00:00
|
|
|
# ------------------------------------------------------------------------------
|
2014-10-24 20:17:29 +00:00
|
|
|
SCRIPTSDIR="tests/template-flavors"
|
|
|
|
DIST="wheezy"
|
|
|
|
DISTS_VM=""
|
|
|
|
TEMPLATE_FLAVOR=""
|
|
|
|
TEMPLATE_FLAVOR_PREFIX=""
|
|
|
|
TEMPLATE_FLAVOR_DIR=""
|
|
|
|
TEMPLATE_OPTIONS=('gnome')
|
2014-10-24 10:48:11 +00:00
|
|
|
|
|
|
|
header <<EOF
|
2015-03-15 19:04:23 +00:00
|
|
|
18. Configuration Files - No Template
|
2014-10-24 10:48:11 +00:00
|
|
|
Find packages.list for every template available
|
|
|
|
EOF
|
2014-10-22 20:37:26 +00:00
|
|
|
getFileLocations filelist 'packages.list'
|
|
|
|
for file in "${filelist[@]}"; do
|
|
|
|
echo "Configuration: ${file}"
|
|
|
|
done
|
|
|
|
result="$(echo $(printf "'%s' " "${filelist[@]}"))"
|
|
|
|
assertTest "echo ${result}" "tests/template-flavors/packages.list"
|
|
|
|
assertEnd
|
|
|
|
|
2014-10-24 10:48:11 +00:00
|
|
|
|
|
|
|
# ------------------------------------------------------------------------------
|
2015-03-15 19:04:23 +00:00
|
|
|
# 19. Configuration Files - No Template - with suffix
|
2014-10-22 20:37:26 +00:00
|
|
|
# ------------------------------------------------------------------------------
|
2014-10-24 20:17:29 +00:00
|
|
|
SCRIPTSDIR="tests/template-flavors"
|
|
|
|
DIST="wheezy"
|
|
|
|
DISTS_VM=""
|
|
|
|
TEMPLATE_FLAVOR=""
|
|
|
|
TEMPLATE_FLAVOR_PREFIX=""
|
|
|
|
TEMPLATE_FLAVOR_DIR=""
|
|
|
|
TEMPLATE_OPTIONS=('gnome')
|
2014-10-24 10:48:11 +00:00
|
|
|
|
|
|
|
header <<EOF
|
2015-03-15 19:04:23 +00:00
|
|
|
19. Configuration Files - No Template - with suffix
|
2014-10-24 10:48:11 +00:00
|
|
|
Find packages.list for every template available
|
|
|
|
EOF
|
2014-10-22 20:37:26 +00:00
|
|
|
getFileLocations filelist 'packages.list' 'wheezy'
|
|
|
|
for file in "${filelist[@]}"; do
|
|
|
|
echo "Configuration: ${file}"
|
|
|
|
done
|
|
|
|
result="$(echo $(printf "'%s' " "${filelist[@]}"))"
|
|
|
|
assertTest "echo ${result}" "tests/template-flavors/packages_wheezy.list"
|
|
|
|
assertEnd
|
2014-10-21 13:12:05 +00:00
|
|
|
|
|
|
|
# ------------------------------------------------------------------------------
|
2015-03-15 19:04:23 +00:00
|
|
|
# 20. Copy files
|
2014-10-24 10:48:11 +00:00
|
|
|
# ------------------------------------------------------------------------------
|
2014-10-24 20:17:29 +00:00
|
|
|
SCRIPTSDIR="tests/template-flavors"
|
|
|
|
DIST="wheezy"
|
|
|
|
DISTS_VM=""
|
2014-10-22 20:37:26 +00:00
|
|
|
TEMPLATE_FLAVOR="whonix-gateway"
|
2014-10-24 20:17:29 +00:00
|
|
|
TEMPLATE_FLAVOR_PREFIX=""
|
2014-10-21 13:12:05 +00:00
|
|
|
TEMPLATE_FLAVOR_DIR=""
|
|
|
|
TEMPLATE_OPTIONS=""
|
2014-10-24 10:48:11 +00:00
|
|
|
INSTALLDIR="${SCRIPTSDIR}/test_copy_location"
|
|
|
|
|
|
|
|
header <<EOF
|
2015-03-15 19:04:23 +00:00
|
|
|
20. Copy files
|
2014-10-24 10:48:11 +00:00
|
|
|
Just test copying from here to ${INSTALLDIR}
|
|
|
|
INSTALLDIR="${SCRIPTSDIR}/test_copy_location"
|
|
|
|
EOF
|
2014-10-28 08:09:55 +00:00
|
|
|
rm -f "${INSTALLDIR}"/test1
|
|
|
|
rm -f "${INSTALLDIR}"/test2
|
|
|
|
rm -f "${INSTALLDIR}"/test3
|
2014-10-22 20:37:26 +00:00
|
|
|
copyTree "files"
|
2014-10-28 08:09:55 +00:00
|
|
|
ls -l "${INSTALLDIR}"
|
|
|
|
assertTest "ls ${INSTALLDIR}" "test1\ntest2\ntest3"
|
2014-10-22 20:37:26 +00:00
|
|
|
assertEnd
|
2014-10-21 13:12:05 +00:00
|
|
|
|
|
|
|
# Done
|
|
|
|
popd
|