refcodes-batch.0.3.0.source-code.validate-typo3-template-config.job Maven / Gradle / Ivy
#!/bin/bash
# -----------------------------------------------------------------------------
# Shows the according config:
# -----------------------------------------------------------------------------
function showTypo3TemplateConfiguration {
echo "The switch \"-j $JOB\" validates all \"TYPO3_TEMPLATE\" specific " >&2
echo "settings in the CONFIG file. Supported properties in the CONFIG file are: " >&2
# echo "--------------------------------------------------------------------------------" >&2
logSeparator
echo "TYPO3_TEMPLATE = (set to 'y' if we have a \"typo3_template\" based site, else 'n')" >&2
echo "TYPO3_TEMPLATE_DIR = (the path to your \"typo3_template\" installation) " >&2
# echo "--------------------------------------------------------------------------------" >&2
logSeparator
if [[ $# -eq 1 ]] ; then
showError "$1"
fi
}
# ------------------------------------------------------------------------------
# Missing property:
# $1: The missing property's name (without prepended "$").
# ------------------------------------------------------------------------------
function exitOnMissingTypo3TemplateProperty {
if [ -z "$1" ] ; then
showError "Argument missing: The function \"exitOnMissingTypo3TemplateProperty\" expects an argument !!!" >&2
exit $EXIT_BUG
fi
# $VALUE is the value of the variable passed as $1:
eval "VALUE=\$$1"
if [ -z "$VALUE" ] ; then
showTypo3TemplateConfiguration "Missing or empty property \"$1\" !!!"
exit $EXIT_ERROR
fi
}
# ------------------------------------------------------------------------------
# File defined in $CONFIG_FILE non exisiting:
# $1 The property name (without prepended "$") with the (non exisitent) path.
# ------------------------------------------------------------------------------
function exitOnMissingTypo3TemplatePropertyPath {
if [ -z "$1" ] ; then
showError "Argument missing: The function \"exitOnMissingTypo3TemplatePropertyPath\" expects an argument !!!" >&2
exit $EXIT_BUG
fi
# $VALUE is the value of the variable passed as $1:
eval "VALUE=\$$1"
if [ ! -e "$VALUE" ] && [ ! -L "$VALUE" ] ; then
showTypo3TemplateConfiguration "Path or file \"$VALUE\" not found defined in property \"$1\" of the \"$CONFIG\" config !!!"
exit $EXIT_ERROR
fi
}
# -----------------------------------------------------------------------------
if [[ $VERBOSE = y ]] ; then
echo "\"TYPO3_TEMPLATE\" configuration validation is activated ..." >&2
# echo "--------------------------------------------------------------------------------" >&2
logSeparator
fi
if [[ $HELP = y ]] ; then
showTypo3TemplateConfiguration
fi
if [[ $HELP = n ]] ; then
if [[ $VERBOSE = y ]] ; then
showProperty "TYPO3_TEMPLATE"
showProperty "TYPO3_TEMPLATE_DIR"
# echo "--------------------------------------------------------------------------------" >&2
logSeparator
fi
if [[ $TYPO3_TEMPLATE = y ]] ; then
exitOnMissingTypo3TemplateProperty "TYPO3_TEMPLATE_DIR"
exitOnMissingTypo3TemplatePropertyPath "TYPO3_TEMPLATE_DIR"
fi
if [[ $TYPO3 = n ]] ; then
if [[ $TYPO3_TEMPLATE = y ]] ; then
showTypo3TemplateConfiguration "Setting \"TYPO3_TEMPLATE=y\") not possible whilst \"TYPO3=n\" !!!"
exit $EXIT_ERROR
fi
fi
showSuccess "\"TYPO3_TEMPLATE\" configuration for \"$CONFIG\" validated !"
fi