|
| 1 | +#!/bin/bash |
| 2 | +# shellcheck disable=SC2154 |
| 3 | +# Lower case environment variables are passed from the workflow and used here |
| 4 | +# We use a validation loop in init to ensure, they're set |
| 5 | +# shellcheck disable=SC2086 |
| 6 | +# We want install_container_options to count as multiple arguments |
| 7 | +set -e |
| 8 | + |
| 9 | +function error() { |
| 10 | + echo -e "\033[0;31m${1}\033[0m" |
| 11 | + exit 1 |
| 12 | +} |
| 13 | + |
| 14 | +function init() { |
| 15 | + for VAR in install_container_method install_container_options install_container_name \ |
| 16 | + install_config_idebug install_is_enterprise; do |
| 17 | + echo -n "Checking, if $VAR is set ..." |
| 18 | + if [ -z ${VAR+x} ]; then |
| 19 | + error "Variable '${VAR}' not set" |
| 20 | + fi |
| 21 | + echo "OK, ${VAR}='${!VAR}'" |
| 22 | + done |
| 23 | + echo -n "Locating oe-console ... " |
| 24 | + cd source || exit 1 |
| 25 | + if [ -f 'bin/oe-console' ]; then |
| 26 | + OE_CONSOLE='bin/oe-console' |
| 27 | + else |
| 28 | + if [ -f 'vendor/bin/oe-console' ]; then |
| 29 | + OE_CONSOLE='vendor/bin/oe-console' |
| 30 | + else |
| 31 | + error "Can't find oe-console in bin or vendor/bin!" |
| 32 | + fi |
| 33 | + fi |
| 34 | + echo "OK, using '${OE_CONSOLE}'" |
| 35 | + if [ -z "${OXID_BUILD_DIRECTORY}" ]; then |
| 36 | + echo "OXID_BUILD_DIRECTORY is not set, setting it to /var/www/var/cache/" |
| 37 | + export OXID_BUILD_DIRECTORY="/var/www/var/cache/" |
| 38 | + else |
| 39 | + echo "OXID_BUILD_DIRECTORY is set to '${OXID_BUILD_DIRECTORY}'" |
| 40 | + fi |
| 41 | + if [ ! -d "${OXID_BUILD_DIRECTORY/\/var\/www/source}" ]; then |
| 42 | + echo "Creating '${OXID_BUILD_DIRECTORY}'" |
| 43 | + docker compose "${install_container_method}" -T \ |
| 44 | + ${install_container_options} \ |
| 45 | + "${install_container_name}" \ |
| 46 | + mkdir -p "${OXID_BUILD_DIRECTORY}" |
| 47 | + fi |
| 48 | +} |
| 49 | + |
| 50 | +init |
| 51 | +cp vendor/oxid-esales/oxideshop-ce/.env.dist ./.env |
| 52 | + |
| 53 | +# Run Install Shop |
| 54 | +docker compose "${install_container_method}" -T \ |
| 55 | + ${install_container_options} \ |
| 56 | + "${install_container_name}" \ |
| 57 | + ${OE_CONSOLE} oe:database:reset --force |
| 58 | + |
| 59 | +# Activate iDebug |
| 60 | +if [ "${install_config_idebug}" == 'true' ]; then |
| 61 | + export OXID_DEBUG_MODE="true" |
| 62 | +fi |
| 63 | + |
| 64 | +# Activate theme |
| 65 | +docker compose "${install_container_method}" -T \ |
| 66 | + ${install_container_options} \ |
| 67 | + "${install_container_name}" \ |
| 68 | + ${OE_CONSOLE} oe:theme:activate apex |
| 69 | + |
| 70 | +# Output PHP error log |
| 71 | +if [ -s data/php/logs/error_log.txt ]; then |
| 72 | + echo -e "\033[0;35mPHP error log\033[0m" |
| 73 | + cat data/php/logs/error_log.txt |
| 74 | +fi |
| 75 | +exit 0 |
0 commit comments