Refactor templating and drupal 9 support

This commit is contained in:
Tom Wiesing 2020-06-10 15:43:00 +02:00
parent eabf4a2ec4
commit f22e658183
No known key found for this signature in database
GPG key ID: DC1F29F2BC78AB15
16 changed files with 275 additions and 144 deletions

View file

@ -125,4 +125,11 @@ if ! is_valid_number "$PASSWORD_LENGTH"; then
exit 1;
fi
# The 'PUBLIC_PORT' must be a valid number.
if ! is_valid_number "$PUBLIC_PORT"; then
log_error "Variable 'PUBLIC_PORT' is missing or not a valid number. ";
log_info "Please verify that it is set correctly in '.env'. ";
exit 1;
fi
log_ok "Read and validated configuration file. "

View file

@ -62,6 +62,7 @@ GRAPHDB_REPO="${GRAPHDB_REPO_PREFIX}${USERNAME_BASE}"
BASE_DIR="$DRUPAL_ROOT/$INSTANCE_DOMAIN"
COMPOSER_DIR="$BASE_DIR/project"
WEB_DIR="$COMPOSER_DIR/web"
ONTOLOGY_DIR="$WEB_DIR/sites/default/files/ontology"
# Setup aliases for drush and composer.
alias composer="sudo -u $SYSTEM_USER /usr/local/bin/composer"

View file

@ -0,0 +1,34 @@
#!/bin/bash
set -e
# This is a library file.
# It should be 'source'd only, if it is not we bail out here.
if [[ "$0" = "$BASH_SOURCE" ]]; then
echo "This file should not be executed directly, it should be 'source'd only. "
exit 1;
fi
TEMPLATE_DIR="$SCRIPT_DIR/resources/templates/"
# load_template will load a template $1 from the template directory
# and replace ${$2} with $3, ${$4} with $5 etc.
# echoes out the replaced template
function load_template() {
# read the template then remove the argument
TEMPLATE=`cat "$TEMPLATE_DIR/$1"`
shift 1;
# while we have a variable to substiute
while [ ! -z "$1" ]
do
# do the substitution
TEMPLATE="${TEMPLATE//\$\{$1\}/$2}"
shift 2
done;
# finally echo out the template
echo "$TEMPLATE"
}
# path where common apache files will be installed.
WISSKI_COMMON_PATH="/etc/apache2/conf/wisski"

View file

@ -17,4 +17,5 @@ LIB_DIR="$SCRIPT_DIR/lib"
source "$LIB_DIR/00_init.sh";
source "$LIB_DIR/10_config.sh";
source "$LIB_DIR/20_slug.sh";
source "$LIB_DIR/30_utils.sh";
source "$LIB_DIR/30_templates.sh";
source "$LIB_DIR/40_utils.sh";