Make tests pass shellcheck

This commit is contained in:
cytopia 2019-11-21 09:43:00 +01:00
parent 2b58cb5153
commit 2a2167205a
No known key found for this signature in database
GPG Key ID: 6D56EDB8695128A2
31 changed files with 1158 additions and 901 deletions

View File

@ -3,7 +3,7 @@
# -------------------------------------------------------------------------------------------------
# Job Name
# -------------------------------------------------------------------------------------------------
name: Linux
name: Smoke
# -------------------------------------------------------------------------------------------------
@ -48,8 +48,11 @@ jobs:
- "apache-2.4"
- "nginx-stable"
- "nginx-mainline"
config:
- "default"
- "custom"
name: "[PHP ${{ matrix.php }}] vs [${{ matrix.httpd }}]"
name: "[PHP ${{ matrix.php }}] vs [${{ matrix.httpd }}] (${{ matrix.config }})"
steps:
# ------------------------------------------------------------
@ -97,9 +100,25 @@ jobs:
# 3306 is taken, so chose another one
make configure KEY=HOST_PORT_MYSQL VAL=3307
# Test full customization
if [ "${CONFIG}" = "custom" ]; then
make configure KEY=DEBUG_COMPOSE_ENTRYPOINT VAL="$(( RANDOM % 3 ))"
make configure KEY=DOCKER_LOGS VAL="$(( RANDOM % 1 ))"
make configure KEY=TLD_SUFFIX VAL=loc2
make configure KEY=TIMEZONE VAL='Europe/Berlin'
make configure KEY=PHP_MODULES_DISABLE VAL=
make configure KEY=HTTPD_TEMPLATE_DIR VAL=.config
make configure KEY=HOST_PORT_HTTPD VAL=8080
make configure KEY=HOST_PORT_HTTPD_SSL VAL=8443
make configure KEY=MYSQL_ROOT_PASSWORD VAL=mysqlpass
make configure KEY=PGSQL_ROOT_USER VAL=pgroot
make configure KEY=PGSQL_ROOT_PASSWORD VAL=pgsqlpass
fi
env:
PHP: ${{ matrix.php }}
HTTPD: ${{ matrix.httpd }}
CONFIG: ${{ matrix.config }}
- name: Pull images
shell: bash

50
.github/workflows/lint.yml vendored Normal file
View File

@ -0,0 +1,50 @@
---
# -------------------------------------------------------------------------------------------------
# Job Name
# -------------------------------------------------------------------------------------------------
name: Lint
# -------------------------------------------------------------------------------------------------
# When to run
# -------------------------------------------------------------------------------------------------
on:
# Runs on Pull Requests
pull_request:
# Runs on master Branch and Tags
push:
branches:
- master
tags:
# -------------------------------------------------------------------------------------------------
# What to run
# -------------------------------------------------------------------------------------------------
jobs:
lint:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
jobs:
- tests
name: "[Lint ${{ matrix.jobs }}]"
steps:
# ------------------------------------------------------------
# Checkout repository
# ------------------------------------------------------------
- name: Checkout repository
uses: actions/checkout@v1
- name: Lint
shell: bash
run: |
cd .tests/
make lint-tests

View File

@ -15,6 +15,18 @@ update-readme:
yes | mv -f "../README.md.tmp" "../README.md"
# -------------------------------------------------------------------------------------------------
# Linting Targets
# -------------------------------------------------------------------------------------------------
lint-tests:
docker run --rm $(tty -s && echo "-it" || echo) \
-v "$(PWD):/mnt" \
--entrypoint=sh \
koalaman/shellcheck-alpine:stable \
-c "find . -name '*.sh' -print0 | xargs -0 -n1 shellcheck --check-sourced --color=auto --shell=bash"
# -------------------------------------------------------------------------------------------------
# Startup Targets
# -------------------------------------------------------------------------------------------------
@ -25,9 +37,6 @@ update-readme:
configure: ../.env
ifeq ($(KEY),)
$(error Target requires KEY to be set.)
endif
ifeq ($(VAL),)
$(error Target requires VAL to be set.)
endif
@$(PWD)/scripts/env-setvar.sh "$(KEY)" "$(VAL)"
@ -90,7 +99,9 @@ test-smoke-intranet:
###
###
test-smoke-vendors:
$(PWD)/tests/vendor-adminer.sh
$(PWD)/tests/vendor-adminer-mysql.sh
$(PWD)/tests/vendor-adminer-pgsql.sh
$(PWD)/tests/vendor-adminer-mongo.sh
$(PWD)/tests/vendor-phpmyadmin.sh
$(PWD)/tests/vendor-phppgadmin.sh
$(PWD)/tests/vendor-phpredmin.sh

View File

@ -1,3 +1,5 @@
#!/usr/bin/env bash
set -e
set -u
set -o pipefail
@ -16,6 +18,90 @@ fi
# Functions
# -------------------------------------------------------------------------------------------------
###
### Get PHP Version
###
get_php_version() {
local root_path="${1}"
local retries=10
local host_port_httpd
local env_version
local cli_version
local web_version
if ! host_port_httpd="$( "${root_path}/.tests/scripts/env-getvar.sh" "HOST_PORT_HTTPD" )"; then
>&2 echo "Error, failed to retrieve HOST_PORT_HTTPD port from .env"
return 1
fi
# Check .env file
>&2 printf "Fetching PHP version from .env: "
if ! env_version="$( "${root_path}/.tests/scripts/env-getvar.sh" "PHP_SERVER" )"; then
>&2 printf "FAILED\\n"
>&2 echo "Error, failed to retrieve valid PHP version from .env"
return 1
fi
>&2 printf "%s\\n" "${env_version}"
# Check php -v
>&2 printf "Fetching PHP version from php -v: "
if ! cli_version="$( run "docker-compose exec -T php php -v \
| head -1 \
| grep -Eo 'PHP[[:space:]]+[0-9]+\\.[0-9]+' \
| grep -Eo '[0-9]+\\.[0-9]+'" \
"${retries}" "${root_path}" "0" )"; then
>&2 printf "FAILED\\n"
>&2 echo "Error, failed to retrieve valid PHP version from php container"
return 1
fi
>&2 printf "%s\\n" "${cli_version}"
# Check intranet
>&2 printf "Fetching PHP version from intranet: "
if ! web_version="$( run "\
curl -sS --fail 'http://localhost:${host_port_httpd}/index.php' \
| tac \
| tac \
| grep -Eo 'PHP.*?\\([.0-9]+' \
| grep -Eo '\\([.0-9]+' \
| grep -Eo '[0-9]+\\.[0-9]+'" \
"${retries}" "" "0" )"; then
>&2 printf "FAILED\\n"
>&2 echo "Error, failed to retrieve valid PHP version from intranet"
return 1
fi
>&2 printf "%s\\n" "${web_version}"
# Check if versions are non-empty
if [ -z "${env_version}" ]; then
>&2 echo "Error, no PHP version found in .env"
return 1
fi
if [ -z "${cli_version}" ]; then
>&2 echo "Error, no PHP version found via php -v"
return 1
fi
if [ -z "${web_version}" ]; then
>&2 echo "Error, no PHP version found from intranet"
return 1
fi
# Check if versions match
if [ "${env_version}" != "${cli_version}" ]; then
>&2 printf "Error, PHP .env version (%s) does not match php -v version (%s)\\n" "${env_version}" "${cli_version}"
return 1
fi
if [ "${env_version}" != "${web_version}" ]; then
>&2 printf "Error, PHP .env version (%s) does not match intranet version (%s)\\n" "${env_version}" "${web_version}"
return 1
fi
# Return PHP version
echo "${env_version}"
}
###
### X-platform In-file replace
###
@ -37,8 +123,8 @@ replace() {
###
run() {
local cmd="${1}"
local workdir=
local retries=1
local workdir=
local verbose=1
# retry?
@ -55,27 +141,27 @@ run() {
verbose="${4}"
fi
local red="\033[0;31m"
local green="\033[0;32m"
local yellow="\033[0;33m"
local reset="\033[0m"
local red="\\033[0;31m"
local green="\\033[0;32m"
local yellow="\\033[0;33m"
local reset="\\033[0m"
if [ "${verbose}" -eq "1" ]; then
>&2 printf "${yellow}%s \$${reset} %s\n" "$(whoami)" "${cmd}"
>&2 printf "${yellow}%s \$${reset} %s\\n" "$(whoami)" "${cmd}"
fi
for ((i=0; i<${retries}; i++)); do
for ((i=0; i<retries; i++)); do
if [ -n "${workdir}" ]; then
if bash -c "set -e && set -u && set -o pipefail && cd ${workdir} && ${cmd}"; then
if [ "${verbose}" -eq "1" ]; then
>&2 printf "${green}[%s: in %s rounds]${reset}\n" "OK" "$((i+1))"
>&2 printf "${green}[%s: in %s rounds]${reset}\\n" "OK" "$((i+1))"
fi
return 0
fi
else
if bash -c "set -e && set -u && set -o pipefail && ${cmd}"; then
if [ "${verbose}" -eq "1" ]; then
>&2 printf "${green}[%s: in %s rounds]${reset}\n" "OK" "$((i+1))"
>&2 printf "${green}[%s: in %s rounds]${reset}\\n" "OK" "$((i+1))"
fi
return 0
fi
@ -83,7 +169,7 @@ run() {
sleep 1
done
if [ "${verbose}" -eq "1" ]; then
>&2 printf "${red}[%s: in %s rounds]${reset}\n" "FAIL" "${retries}"
>&2 printf "${red}[%s: in %s rounds]${reset}\\n" "FAIL" "${retries}"
fi
return 1
}
@ -112,27 +198,27 @@ run_fail() {
verbose="${4}"
fi
local red="\033[0;31m"
local green="\033[0;32m"
local yellow="\033[0;33m"
local reset="\033[0m"
local red="\\033[0;31m"
local green="\\033[0;32m"
local yellow="\\033[0;33m"
local reset="\\033[0m"
if [ "${verbose}" -eq "1" ]; then
>&2 printf "${yellow}%s \$${reset} %s\n" "$(whoami)" "${cmd}"
>&2 printf "${yellow}%s \$${reset} %s\\n" "$(whoami)" "${cmd}"
fi
for ((i=0; i<${retries}; i++)); do
for ((i=0; i<retries; i++)); do
if [ -n "${workdir}" ]; then
if ! bash -c "set -e && set -u && set -o pipefail && cd ${workdir} && ${cmd}"; then
if [ "${verbose}" -eq "1" ]; then
>&2 printf "${green}[%s: in %s rounds]${reset}\n" "OK" "$((i+1))"
>&2 printf "${green}[%s: in %s rounds]${reset}\\n" "OK" "$((i+1))"
fi
return 0
fi
else
if ! bash -c "set -e && set -u && set -o pipefail && ${cmd}"; then
if [ "${verbose}" -eq "1" ]; then
>&2 printf "${green}[%s: in %s rounds]${reset}\n" "OK" "$((i+1))"
>&2 printf "${green}[%s: in %s rounds]${reset}\\n" "OK" "$((i+1))"
fi
return 0
fi
@ -140,7 +226,7 @@ run_fail() {
sleep 1
done
if [ "${verbose}" -eq "1" ]; then
>&2 printf "${red}[%s: in %s rounds]${reset}\n" "FAIL" "${retries}"
>&2 printf "${red}[%s: in %s rounds]${reset}\\n" "FAIL" "${retries}"
fi
return 1
}

View File

@ -1,189 +1,160 @@
#!/usr/bin/env bash
SCRIPTPATH="$( cd "$(dirname "$0")" ; pwd -P )"
COMPOSEPATH="${SCRIPTPATH}/../.."
PHP_TAG="$( grep 'devilbox/php' "${COMPOSEPATH}/docker-compose.yml" | sed 's/^.*-work-//g' )"
# NOTE: Parsing curl to tac to circumnvent "failed writing body"
# https://stackoverflow.com/questions/16703647/why-curl-return-and-error-23-failed-writing-body
set -e
set -u
set -o pipefail
SCRIPT_PATH="$( cd "$(dirname "$0")" && pwd -P )"
DVLBOX_PATH="$( cd "${SCRIPT_PATH}/../.." && pwd -P )"
# shellcheck disable=SC1090
. "${SCRIPT_PATH}/.lib.sh"
RETRIES=10
# -------------------------------------------------------------------------------------------------
# FUNCTIONS
# -------------------------------------------------------------------------------------------------
PHP_TAG="$( grep 'devilbox/php' "${DVLBOX_PATH}/docker-compose.yml" | sed 's/^.*-work-//g' )"
###
### Get PHP core modules (5 rounds)
###
if ! PHP52_BASE="$( run "\
curl -sS 'https://raw.githubusercontent.com/devilbox/docker-php-fpm/${PHP_TAG}/README.md' \
| tac \
| tac \
| grep -E '52-base' \
| sed \
-e 's/.*\">//g' \
-e 's/<.*//g'" "${RETRIES}" )"; then
>&2 echo "Failed to retrieve modules for PHP 5.2"
exit 1
fi
if ! PHP52_BASE="$( curl -sS https://raw.githubusercontent.com/devilbox/docker-php-fpm/${PHP_TAG}/README.md | tac | tac | grep -E '52-base' | sed -e 's/.*">//g' -e 's/<.*//g' )"; then
sleep 5;
if ! PHP52_BASE="$( curl -sS https://raw.githubusercontent.com/devilbox/docker-php-fpm/${PHP_TAG}/README.md | tac | tac | grep -E '52-base' | sed -e 's/.*">//g' -e 's/<.*//g' )"; then
sleep 5;
if ! PHP52_BASE="$( curl -sS https://raw.githubusercontent.com/devilbox/docker-php-fpm/${PHP_TAG}/README.md | tac | tac | grep -E '52-base' | sed -e 's/.*">//g' -e 's/<.*//g' )"; then
sleep 5;
if ! PHP52_BASE="$( curl -sS https://raw.githubusercontent.com/devilbox/docker-php-fpm/${PHP_TAG}/README.md | tac | tac | grep -E '52-base' | sed -e 's/.*">//g' -e 's/<.*//g' )"; then
sleep 5;
if ! PHP52_BASE="$( curl -sS https://raw.githubusercontent.com/devilbox/docker-php-fpm/${PHP_TAG}/README.md | tac | tac | grep -E '52-base' | sed -e 's/.*">//g' -e 's/<.*//g' )"; then
>&2 echo "Failed to retrieve modules for PHP 5.2"
exit 1
fi
fi
fi
fi
if ! PHP53_BASE="$( run "\
curl -sS 'https://raw.githubusercontent.com/devilbox/docker-php-fpm/${PHP_TAG}/README.md' \
| tac \
| tac \
| grep -E '53-base' \
| sed \
-e 's/.*\">//g' \
-e 's/<.*//g'" "${RETRIES}" )"; then
>&2 echo "Failed to retrieve modules for PHP 5.3"
exit 1
fi
if ! PHP53_BASE="$( curl -sS https://raw.githubusercontent.com/devilbox/docker-php-fpm/${PHP_TAG}/README.md | tac | tac | grep -E '53-base' | sed -e 's/.*">//g' -e 's/<.*//g' )"; then
sleep 5;
if ! PHP53_BASE="$( curl -sS https://raw.githubusercontent.com/devilbox/docker-php-fpm/${PHP_TAG}/README.md | tac | tac | grep -E '53-base' | sed -e 's/.*">//g' -e 's/<.*//g' )"; then
sleep 5;
if ! PHP53_BASE="$( curl -sS https://raw.githubusercontent.com/devilbox/docker-php-fpm/${PHP_TAG}/README.md | tac | tac | grep -E '53-base' | sed -e 's/.*">//g' -e 's/<.*//g' )"; then
sleep 5;
if ! PHP53_BASE="$( curl -sS https://raw.githubusercontent.com/devilbox/docker-php-fpm/${PHP_TAG}/README.md | tac | tac | grep -E '53-base' | sed -e 's/.*">//g' -e 's/<.*//g' )"; then
sleep 5;
if ! PHP53_BASE="$( curl -sS https://raw.githubusercontent.com/devilbox/docker-php-fpm/${PHP_TAG}/README.md | tac | tac | grep -E '53-base' | sed -e 's/.*">//g' -e 's/<.*//g' )"; then
>&2 echo "Failed to retrieve modules for PHP 5.3"
exit 1
fi
fi
fi
fi
if ! PHP54_BASE="$( run "\
curl -sS 'https://raw.githubusercontent.com/devilbox/docker-php-fpm/${PHP_TAG}/README.md' \
| tac \
| tac \
| grep -E '54-base' \
| sed \
-e 's/.*\">//g' \
-e 's/<.*//g'" "${RETRIES}" )"; then
>&2 echo "Failed to retrieve modules for PHP 5.4"
exit 1
fi
if ! PHP54_BASE="$( curl -sS https://raw.githubusercontent.com/devilbox/docker-php-fpm/${PHP_TAG}/README.md | tac | tac | grep -E '54-base' | sed -e 's/.*">//g' -e 's/<.*//g' )"; then
sleep 5;
if ! PHP54_BASE="$( curl -sS https://raw.githubusercontent.com/devilbox/docker-php-fpm/${PHP_TAG}/README.md | tac | tac | grep -E '54-base' | sed -e 's/.*">//g' -e 's/<.*//g' )"; then
sleep 5;
if ! PHP54_BASE="$( curl -sS https://raw.githubusercontent.com/devilbox/docker-php-fpm/${PHP_TAG}/README.md | tac | tac | grep -E '54-base' | sed -e 's/.*">//g' -e 's/<.*//g' )"; then
sleep 5;
if ! PHP54_BASE="$( curl -sS https://raw.githubusercontent.com/devilbox/docker-php-fpm/${PHP_TAG}/README.md | tac | tac | grep -E '54-base' | sed -e 's/.*">//g' -e 's/<.*//g' )"; then
sleep 5;
if ! PHP54_BASE="$( curl -sS https://raw.githubusercontent.com/devilbox/docker-php-fpm/${PHP_TAG}/README.md | tac | tac | grep -E '54-base' | sed -e 's/.*">//g' -e 's/<.*//g' )"; then
>&2 echo "Failed to retrieve modules for PHP 5.4"
exit 1
fi
fi
fi
fi
if ! PHP55_BASE="$( run "\
curl -sS 'https://raw.githubusercontent.com/devilbox/docker-php-fpm/${PHP_TAG}/README.md' \
| tac \
| tac \
| grep -E '55-base' \
| sed \
-e 's/.*\">//g' \
-e 's/<.*//g'" "${RETRIES}" )"; then
>&2 echo "Failed to retrieve modules for PHP 5.5"
exit 1
fi
if ! PHP55_BASE="$( curl -sS https://raw.githubusercontent.com/devilbox/docker-php-fpm/${PHP_TAG}/README.md | tac | tac | grep -E '55-base' | sed -e 's/.*">//g' -e 's/<.*//g' )"; then
sleep 5;
if ! PHP55_BASE="$( curl -sS https://raw.githubusercontent.com/devilbox/docker-php-fpm/${PHP_TAG}/README.md | tac | tac | grep -E '55-base' | sed -e 's/.*">//g' -e 's/<.*//g' )"; then
sleep 5;
if ! PHP55_BASE="$( curl -sS https://raw.githubusercontent.com/devilbox/docker-php-fpm/${PHP_TAG}/README.md | tac | tac | grep -E '55-base' | sed -e 's/.*">//g' -e 's/<.*//g' )"; then
sleep 5;
if ! PHP55_BASE="$( curl -sS https://raw.githubusercontent.com/devilbox/docker-php-fpm/${PHP_TAG}/README.md | tac | tac | grep -E '55-base' | sed -e 's/.*">//g' -e 's/<.*//g' )"; then
sleep 5;
if ! PHP55_BASE="$( curl -sS https://raw.githubusercontent.com/devilbox/docker-php-fpm/${PHP_TAG}/README.md | tac | tac | grep -E '55-base' | sed -e 's/.*">//g' -e 's/<.*//g' )"; then
>&2 echo "Failed to retrieve modules for PHP 5.5"
exit 1
fi
fi
fi
fi
if ! PHP56_BASE="$( run "\
curl -sS 'https://raw.githubusercontent.com/devilbox/docker-php-fpm/${PHP_TAG}/README.md' \
| tac \
| tac \
| grep -E '56-base' \
| sed \
-e 's/.*\">//g' \
-e 's/<.*//g'" "${RETRIES}" )"; then
>&2 echo "Failed to retrieve modules for PHP 5.6"
exit 1
fi
if ! PHP56_BASE="$( curl -sS https://raw.githubusercontent.com/devilbox/docker-php-fpm/${PHP_TAG}/README.md | tac | tac | grep -E '56-base' | sed -e 's/.*">//g' -e 's/<.*//g' )"; then
sleep 5;
if ! PHP56_BASE="$( curl -sS https://raw.githubusercontent.com/devilbox/docker-php-fpm/${PHP_TAG}/README.md | tac | tac | grep -E '56-base' | sed -e 's/.*">//g' -e 's/<.*//g' )"; then
sleep 5;
if ! PHP56_BASE="$( curl -sS https://raw.githubusercontent.com/devilbox/docker-php-fpm/${PHP_TAG}/README.md | tac | tac | grep -E '56-base' | sed -e 's/.*">//g' -e 's/<.*//g' )"; then
sleep 5;
if ! PHP56_BASE="$( curl -sS https://raw.githubusercontent.com/devilbox/docker-php-fpm/${PHP_TAG}/README.md | tac | tac | grep -E '56-base' | sed -e 's/.*">//g' -e 's/<.*//g' )"; then
sleep 5;
if ! PHP56_BASE="$( curl -sS https://raw.githubusercontent.com/devilbox/docker-php-fpm/${PHP_TAG}/README.md | tac | tac | grep -E '56-base' | sed -e 's/.*">//g' -e 's/<.*//g' )"; then
>&2 echo "Failed to retrieve modules for PHP 5.6"
exit 1
fi
fi
fi
fi
if ! PHP70_BASE="$( run "\
curl -sS 'https://raw.githubusercontent.com/devilbox/docker-php-fpm/${PHP_TAG}/README.md' \
| tac \
| tac \
| grep -E '70-base' \
| sed \
-e 's/.*\">//g' \
-e 's/<.*//g'" "${RETRIES}" )"; then
>&2 echo "Failed to retrieve modules for PHP 7.0"
exit 1
fi
if ! PHP70_BASE="$( curl -sS https://raw.githubusercontent.com/devilbox/docker-php-fpm/${PHP_TAG}/README.md | tac | tac | grep -E '70-base' | sed -e 's/.*">//g' -e 's/<.*//g' )"; then
sleep 5;
if ! PHP70_BASE="$( curl -sS https://raw.githubusercontent.com/devilbox/docker-php-fpm/${PHP_TAG}/README.md | tac | tac | grep -E '70-base' | sed -e 's/.*">//g' -e 's/<.*//g' )"; then
sleep 5;
if ! PHP70_BASE="$( curl -sS https://raw.githubusercontent.com/devilbox/docker-php-fpm/${PHP_TAG}/README.md | tac | tac | grep -E '70-base' | sed -e 's/.*">//g' -e 's/<.*//g' )"; then
sleep 5;
if ! PHP70_BASE="$( curl -sS https://raw.githubusercontent.com/devilbox/docker-php-fpm/${PHP_TAG}/README.md | tac | tac | grep -E '70-base' | sed -e 's/.*">//g' -e 's/<.*//g' )"; then
sleep 5;
if ! PHP70_BASE="$( curl -sS https://raw.githubusercontent.com/devilbox/docker-php-fpm/${PHP_TAG}/README.md | tac | tac | grep -E '70-base' | sed -e 's/.*">//g' -e 's/<.*//g' )"; then
>&2 echo "Failed to retrieve modules for PHP 7.0"
exit 1
fi
fi
fi
fi
if ! PHP71_BASE="$( run "\
curl -sS 'https://raw.githubusercontent.com/devilbox/docker-php-fpm/${PHP_TAG}/README.md' \
| tac \
| tac \
| grep -E '71-base' \
| sed \
-e 's/.*\">//g' \
-e 's/<.*//g'" "${RETRIES}" )"; then
>&2 echo "Failed to retrieve modules for PHP 7.1"
exit 1
fi
if ! PHP71_BASE="$( curl -sS https://raw.githubusercontent.com/devilbox/docker-php-fpm/${PHP_TAG}/README.md | tac | tac | grep -E '71-base' | sed -e 's/.*">//g' -e 's/<.*//g' )"; then
sleep 5;
if ! PHP71_BASE="$( curl -sS https://raw.githubusercontent.com/devilbox/docker-php-fpm/${PHP_TAG}/README.md | tac | tac | grep -E '71-base' | sed -e 's/.*">//g' -e 's/<.*//g' )"; then
sleep 5;
if ! PHP71_BASE="$( curl -sS https://raw.githubusercontent.com/devilbox/docker-php-fpm/${PHP_TAG}/README.md | tac | tac | grep -E '71-base' | sed -e 's/.*">//g' -e 's/<.*//g' )"; then
sleep 5;
if ! PHP71_BASE="$( curl -sS https://raw.githubusercontent.com/devilbox/docker-php-fpm/${PHP_TAG}/README.md | tac | tac | grep -E '71-base' | sed -e 's/.*">//g' -e 's/<.*//g' )"; then
sleep 5;
if ! PHP71_BASE="$( curl -sS https://raw.githubusercontent.com/devilbox/docker-php-fpm/${PHP_TAG}/README.md | tac | tac | grep -E '71-base' | sed -e 's/.*">//g' -e 's/<.*//g' )"; then
>&2 echo "Failed to retrieve modules for PHP 7.1"
exit 1
fi
fi
fi
fi
if ! PHP72_BASE="$( run "\
curl -sS 'https://raw.githubusercontent.com/devilbox/docker-php-fpm/${PHP_TAG}/README.md' \
| tac \
| tac \
| grep -E '72-base' \
| sed \
-e 's/.*\">//g' \
-e 's/<.*//g'" "${RETRIES}" )"; then
>&2 echo "Failed to retrieve modules for PHP 7.2"
exit 1
fi
if ! PHP72_BASE="$( curl -sS https://raw.githubusercontent.com/devilbox/docker-php-fpm/${PHP_TAG}/README.md | tac | tac | grep -E '72-base' | sed -e 's/.*">//g' -e 's/<.*//g' )"; then
sleep 5;
if ! PHP72_BASE="$( curl -sS https://raw.githubusercontent.com/devilbox/docker-php-fpm/${PHP_TAG}/README.md | tac | tac | grep -E '72-base' | sed -e 's/.*">//g' -e 's/<.*//g' )"; then
sleep 5;
if ! PHP72_BASE="$( curl -sS https://raw.githubusercontent.com/devilbox/docker-php-fpm/${PHP_TAG}/README.md | tac | tac | grep -E '72-base' | sed -e 's/.*">//g' -e 's/<.*//g' )"; then
sleep 5;
if ! PHP72_BASE="$( curl -sS https://raw.githubusercontent.com/devilbox/docker-php-fpm/${PHP_TAG}/README.md | tac | tac | grep -E '72-base' | sed -e 's/.*">//g' -e 's/<.*//g' )"; then
sleep 5;
if ! PHP72_BASE="$( curl -sS https://raw.githubusercontent.com/devilbox/docker-php-fpm/${PHP_TAG}/README.md | tac | tac | grep -E '72-base' | sed -e 's/.*">//g' -e 's/<.*//g' )"; then
>&2 echo "Failed to retrieve modules for PHP 7.2"
exit 1
fi
fi
fi
fi
if ! PHP73_BASE="$( run "\
curl -sS 'https://raw.githubusercontent.com/devilbox/docker-php-fpm/${PHP_TAG}/README.md' \
| tac \
| tac \
| grep -E '73-base' \
| sed \
-e 's/.*\">//g' \
-e 's/<.*//g'" "${RETRIES}" )"; then
>&2 echo "Failed to retrieve modules for PHP 7.3"
exit 1
fi
if ! PHP73_BASE="$( curl -sS https://raw.githubusercontent.com/devilbox/docker-php-fpm/${PHP_TAG}/README.md | tac | tac | grep -E '73-base' | sed -e 's/.*">//g' -e 's/<.*//g' )"; then
sleep 5;
if ! PHP73_BASE="$( curl -sS https://raw.githubusercontent.com/devilbox/docker-php-fpm/${PHP_TAG}/README.md | tac | tac | grep -E '73-base' | sed -e 's/.*">//g' -e 's/<.*//g' )"; then
sleep 5;
if ! PHP73_BASE="$( curl -sS https://raw.githubusercontent.com/devilbox/docker-php-fpm/${PHP_TAG}/README.md | tac | tac | grep -E '73-base' | sed -e 's/.*">//g' -e 's/<.*//g' )"; then
sleep 5;
if ! PHP73_BASE="$( curl -sS https://raw.githubusercontent.com/devilbox/docker-php-fpm/${PHP_TAG}/README.md | tac | tac | grep -E '73-base' | sed -e 's/.*">//g' -e 's/<.*//g' )"; then
sleep 5;
if ! PHP73_BASE="$( curl -sS https://raw.githubusercontent.com/devilbox/docker-php-fpm/${PHP_TAG}/README.md | tac | tac | grep -E '73-base' | sed -e 's/.*">//g' -e 's/<.*//g' )"; then
>&2 echo "Failed to retrieve modules for PHP 7.3"
exit 1
fi
fi
fi
fi
if ! PHP74_BASE="$( run "\
curl -sS 'https://raw.githubusercontent.com/devilbox/docker-php-fpm/${PHP_TAG}/README.md' \
| tac \
| tac \
| grep -E '74-base' \
| sed \
-e 's/.*\">//g' \
-e 's/<.*//g'" "${RETRIES}" )"; then
>&2 echo "Failed to retrieve modules for PHP 7.4"
exit 1
fi
if ! PHP74_BASE="$( curl -sS https://raw.githubusercontent.com/devilbox/docker-php-fpm/${PHP_TAG}/README.md | tac | tac | grep -E '74-base' | sed -e 's/.*">//g' -e 's/<.*//g' )"; then
sleep 5;
if ! PHP74_BASE="$( curl -sS https://raw.githubusercontent.com/devilbox/docker-php-fpm/${PHP_TAG}/README.md | tac | tac | grep -E '74-base' | sed -e 's/.*">//g' -e 's/<.*//g' )"; then
sleep 5;
if ! PHP74_BASE="$( curl -sS https://raw.githubusercontent.com/devilbox/docker-php-fpm/${PHP_TAG}/README.md | tac | tac | grep -E '74-base' | sed -e 's/.*">//g' -e 's/<.*//g' )"; then
sleep 5;
if ! PHP74_BASE="$( curl -sS https://raw.githubusercontent.com/devilbox/docker-php-fpm/${PHP_TAG}/README.md | tac | tac | grep -E '74-base' | sed -e 's/.*">//g' -e 's/<.*//g' )"; then
sleep 5;
if ! PHP74_BASE="$( curl -sS https://raw.githubusercontent.com/devilbox/docker-php-fpm/${PHP_TAG}/README.md | tac | tac | grep -E '74-base' | sed -e 's/.*">//g' -e 's/<.*//g' )"; then
>&2 echo "Failed to retrieve modules for PHP 7.4"
exit 1
fi
fi
fi
fi
fi
if ! PHP80_BASE="$( curl -sS https://raw.githubusercontent.com/devilbox/docker-php-fpm/${PHP_TAG}/README.md | tac | tac | grep -E '80-base' | sed -e 's/.*">//g' -e 's/<.*//g' )"; then
sleep 5;
if ! PHP80_BASE="$( curl -sS https://raw.githubusercontent.com/devilbox/docker-php-fpm/${PHP_TAG}/README.md | tac | tac | grep -E '80-base' | sed -e 's/.*">//g' -e 's/<.*//g' )"; then
sleep 5;
if ! PHP80_BASE="$( curl -sS https://raw.githubusercontent.com/devilbox/docker-php-fpm/${PHP_TAG}/README.md | tac | tac | grep -E '80-base' | sed -e 's/.*">//g' -e 's/<.*//g' )"; then
sleep 5;
if ! PHP80_BASE="$( curl -sS https://raw.githubusercontent.com/devilbox/docker-php-fpm/${PHP_TAG}/README.md | tac | tac | grep -E '80-base' | sed -e 's/.*">//g' -e 's/<.*//g' )"; then
sleep 5;
if ! PHP80_BASE="$( curl -sS https://raw.githubusercontent.com/devilbox/docker-php-fpm/${PHP_TAG}/README.md | tac | tac | grep -E '80-base' | sed -e 's/.*">//g' -e 's/<.*//g' )"; then
>&2 echo "Failed to retrieve modules for PHP 8.0"
exit 1
fi
fi
fi
fi
if ! PHP80_BASE="$( run "\
curl -sS 'https://raw.githubusercontent.com/devilbox/docker-php-fpm/${PHP_TAG}/README.md' \
| tac \
| tac \
| grep -E '80-base' \
| sed \
-e 's/.*\">//g' \
-e 's/<.*//g'" "${RETRIES}" )"; then
>&2 echo "Failed to retrieve modules for PHP 8.0"
exit 1
fi
@ -191,181 +162,136 @@ fi
### Get PHP mods modules (5 rounds)
###
if ! PHP52_MODS="$( curl -sS https://raw.githubusercontent.com/devilbox/docker-php-fpm/${PHP_TAG}/README.md | tac | tac | grep -E '52-mods' | sed -e 's/.*">//g' -e 's/<.*//g' )"; then
sleep 5;
if ! PHP52_MODS="$( curl -sS https://raw.githubusercontent.com/devilbox/docker-php-fpm/${PHP_TAG}/README.md | tac | tac | grep -E '52-mods' | sed -e 's/.*">//g' -e 's/<.*//g' )"; then
sleep 5;
if ! PHP52_MODS="$( curl -sS https://raw.githubusercontent.com/devilbox/docker-php-fpm/${PHP_TAG}/README.md | tac | tac | grep -E '52-mods' | sed -e 's/.*">//g' -e 's/<.*//g' )"; then
sleep 5;
if ! PHP52_MODS="$( curl -sS https://raw.githubusercontent.com/devilbox/docker-php-fpm/${PHP_TAG}/README.md | tac | tac | grep -E '52-mods' | sed -e 's/.*">//g' -e 's/<.*//g' )"; then
sleep 5;
if ! PHP52_MODS="$( curl -sS https://raw.githubusercontent.com/devilbox/docker-php-fpm/${PHP_TAG}/README.md | tac | tac | grep -E '52-mods' | sed -e 's/.*">//g' -e 's/<.*//g' )"; then
>&2 echo "Failed to retrieve modules for PHP 5.2"
exit 1
fi
fi
fi
fi
if ! PHP52_MODS="$( run "\
curl -sS 'https://raw.githubusercontent.com/devilbox/docker-php-fpm/${PHP_TAG}/README.md' \
| tac \
| tac \
| grep -E '52-mods' \
| sed \
-e 's/.*\">//g' \
-e 's/<.*//g'" "${RETRIES}" )"; then
>&2 echo "Failed to retrieve modules for PHP 5.2"
exit 1
fi
if ! PHP53_MODS="$( curl -sS https://raw.githubusercontent.com/devilbox/docker-php-fpm/${PHP_TAG}/README.md | tac | tac | grep -E '53-mods' | sed -e 's/.*">//g' -e 's/<.*//g' )"; then
sleep 5;
if ! PHP53_MODS="$( curl -sS https://raw.githubusercontent.com/devilbox/docker-php-fpm/${PHP_TAG}/README.md | tac | tac | grep -E '53-mods' | sed -e 's/.*">//g' -e 's/<.*//g' )"; then
sleep 5;
if ! PHP53_MODS="$( curl -sS https://raw.githubusercontent.com/devilbox/docker-php-fpm/${PHP_TAG}/README.md | tac | tac | grep -E '53-mods' | sed -e 's/.*">//g' -e 's/<.*//g' )"; then
sleep 5;
if ! PHP53_MODS="$( curl -sS https://raw.githubusercontent.com/devilbox/docker-php-fpm/${PHP_TAG}/README.md | tac | tac | grep -E '53-mods' | sed -e 's/.*">//g' -e 's/<.*//g' )"; then
sleep 5;
if ! PHP53_MODS="$( curl -sS https://raw.githubusercontent.com/devilbox/docker-php-fpm/${PHP_TAG}/README.md | tac | tac | grep -E '53-mods' | sed -e 's/.*">//g' -e 's/<.*//g' )"; then
>&2 echo "Failed to retrieve modules for PHP 5.3"
exit 1
fi
fi
fi
fi
if ! PHP53_MODS="$( run "\
curl -sS 'https://raw.githubusercontent.com/devilbox/docker-php-fpm/${PHP_TAG}/README.md' \
| tac \
| tac \
| grep -E '53-mods' \
| sed \
-e 's/.*\">//g' \
-e 's/<.*//g'" "${RETRIES}" )"; then
>&2 echo "Failed to retrieve modules for PHP 5.3"
exit 1
fi
if ! PHP54_MODS="$( curl -sS https://raw.githubusercontent.com/devilbox/docker-php-fpm/${PHP_TAG}/README.md | tac | tac | grep -E '54-mods' | sed -e 's/.*">//g' -e 's/<.*//g' )"; then
sleep 5;
if ! PHP54_MODS="$( curl -sS https://raw.githubusercontent.com/devilbox/docker-php-fpm/${PHP_TAG}/README.md | tac | tac | grep -E '54-mods' | sed -e 's/.*">//g' -e 's/<.*//g' )"; then
sleep 5;
if ! PHP54_MODS="$( curl -sS https://raw.githubusercontent.com/devilbox/docker-php-fpm/${PHP_TAG}/README.md | tac | tac | grep -E '54-mods' | sed -e 's/.*">//g' -e 's/<.*//g' )"; then
sleep 5;
if ! PHP54_MODS="$( curl -sS https://raw.githubusercontent.com/devilbox/docker-php-fpm/${PHP_TAG}/README.md | tac | tac | grep -E '54-mods' | sed -e 's/.*">//g' -e 's/<.*//g' )"; then
sleep 5;
if ! PHP54_MODS="$( curl -sS https://raw.githubusercontent.com/devilbox/docker-php-fpm/${PHP_TAG}/README.md | tac | tac | grep -E '54-mods' | sed -e 's/.*">//g' -e 's/<.*//g' )"; then
>&2 echo "Failed to retrieve modules for PHP 5.4"
exit 1
fi
fi
fi
fi
if ! PHP54_MODS="$( run "\
curl -sS 'https://raw.githubusercontent.com/devilbox/docker-php-fpm/${PHP_TAG}/README.md' \
| tac \
| tac \
| grep -E '54-mods' \
| sed \
-e 's/.*\">//g' \
-e 's/<.*//g'" "${RETRIES}" )"; then
>&2 echo "Failed to retrieve modules for PHP 5.4"
exit 1
fi
if ! PHP55_MODS="$( curl -sS https://raw.githubusercontent.com/devilbox/docker-php-fpm/${PHP_TAG}/README.md | tac | tac | grep -E '55-mods' | sed -e 's/.*">//g' -e 's/<.*//g' )"; then
sleep 5;
if ! PHP55_MODS="$( curl -sS https://raw.githubusercontent.com/devilbox/docker-php-fpm/${PHP_TAG}/README.md | tac | tac | grep -E '55-mods' | sed -e 's/.*">//g' -e 's/<.*//g' )"; then
sleep 5;
if ! PHP55_MODS="$( curl -sS https://raw.githubusercontent.com/devilbox/docker-php-fpm/${PHP_TAG}/README.md | tac | tac | grep -E '55-mods' | sed -e 's/.*">//g' -e 's/<.*//g' )"; then
sleep 5;
if ! PHP55_MODS="$( curl -sS https://raw.githubusercontent.com/devilbox/docker-php-fpm/${PHP_TAG}/README.md | tac | tac | grep -E '55-mods' | sed -e 's/.*">//g' -e 's/<.*//g' )"; then
sleep 5;
if ! PHP55_MODS="$( curl -sS https://raw.githubusercontent.com/devilbox/docker-php-fpm/${PHP_TAG}/README.md | tac | tac | grep -E '55-mods' | sed -e 's/.*">//g' -e 's/<.*//g' )"; then
>&2 echo "Failed to retrieve modules for PHP 5.5"
exit 1
fi
fi
fi
fi
if ! PHP55_MODS="$( run "\
curl -sS 'https://raw.githubusercontent.com/devilbox/docker-php-fpm/${PHP_TAG}/README.md' \
| tac \
| tac \
| grep -E '55-mods' \
| sed \
-e 's/.*\">//g' \
-e 's/<.*//g'" "${RETRIES}" )"; then
>&2 echo "Failed to retrieve modules for PHP 5.5"
exit 1
fi
if ! PHP56_MODS="$( curl -sS https://raw.githubusercontent.com/devilbox/docker-php-fpm/${PHP_TAG}/README.md | tac | tac | grep -E '56-mods' | sed -e 's/.*">//g' -e 's/<.*//g' )"; then
sleep 5;
if ! PHP56_MODS="$( curl -sS https://raw.githubusercontent.com/devilbox/docker-php-fpm/${PHP_TAG}/README.md | tac | tac | grep -E '56-mods' | sed -e 's/.*">//g' -e 's/<.*//g' )"; then
sleep 5;
if ! PHP56_MODS="$( curl -sS https://raw.githubusercontent.com/devilbox/docker-php-fpm/${PHP_TAG}/README.md | tac | tac | grep -E '56-mods' | sed -e 's/.*">//g' -e 's/<.*//g' )"; then
sleep 5;
if ! PHP56_MODS="$( curl -sS https://raw.githubusercontent.com/devilbox/docker-php-fpm/${PHP_TAG}/README.md | tac | tac | grep -E '56-mods' | sed -e 's/.*">//g' -e 's/<.*//g' )"; then
sleep 5;
if ! PHP56_MODS="$( curl -sS https://raw.githubusercontent.com/devilbox/docker-php-fpm/${PHP_TAG}/README.md | tac | tac | grep -E '56-mods' | sed -e 's/.*">//g' -e 's/<.*//g' )"; then
>&2 echo "Failed to retrieve modules for PHP 5.6"
exit 1
fi
fi
fi
fi
if ! PHP56_MODS="$( run "\
curl -sS 'https://raw.githubusercontent.com/devilbox/docker-php-fpm/${PHP_TAG}/README.md' \
| tac \
| tac \
| grep -E '56-mods' \
| sed \
-e 's/.*\">//g' \
-e 's/<.*//g'" "${RETRIES}" )"; then
>&2 echo "Failed to retrieve modules for PHP 5.6"
exit 1
fi
if ! PHP70_MODS="$( curl -sS https://raw.githubusercontent.com/devilbox/docker-php-fpm/${PHP_TAG}/README.md | tac | tac | grep -E '70-mods' | sed -e 's/.*">//g' -e 's/<.*//g' )"; then
sleep 5;
if ! PHP70_MODS="$( curl -sS https://raw.githubusercontent.com/devilbox/docker-php-fpm/${PHP_TAG}/README.md | tac | tac | grep -E '70-mods' | sed -e 's/.*">//g' -e 's/<.*//g' )"; then
sleep 5;
if ! PHP70_MODS="$( curl -sS https://raw.githubusercontent.com/devilbox/docker-php-fpm/${PHP_TAG}/README.md | tac | tac | grep -E '70-mods' | sed -e 's/.*">//g' -e 's/<.*//g' )"; then
sleep 5;
if ! PHP70_MODS="$( curl -sS https://raw.githubusercontent.com/devilbox/docker-php-fpm/${PHP_TAG}/README.md | tac | tac | grep -E '70-mods' | sed -e 's/.*">//g' -e 's/<.*//g' )"; then
sleep 5;
if ! PHP70_MODS="$( curl -sS https://raw.githubusercontent.com/devilbox/docker-php-fpm/${PHP_TAG}/README.md | tac | tac | grep -E '70-mods' | sed -e 's/.*">//g' -e 's/<.*//g' )"; then
>&2 echo "Failed to retrieve modules for PHP 7.0"
exit 1
fi
fi
fi
fi
if ! PHP70_MODS="$( run "\
curl -sS 'https://raw.githubusercontent.com/devilbox/docker-php-fpm/${PHP_TAG}/README.md' \
| tac \
| tac \
| grep -E '70-mods' \
| sed \
-e 's/.*\">//g' \
-e 's/<.*//g'" "${RETRIES}" )"; then
>&2 echo "Failed to retrieve modules for PHP 7.0"
exit 1
fi
if ! PHP71_MODS="$( curl -sS https://raw.githubusercontent.com/devilbox/docker-php-fpm/${PHP_TAG}/README.md | tac | tac | grep -E '71-mods' | sed -e 's/.*">//g' -e 's/<.*//g' )"; then
sleep 5;
if ! PHP71_MODS="$( curl -sS https://raw.githubusercontent.com/devilbox/docker-php-fpm/${PHP_TAG}/README.md | tac | tac | grep -E '71-mods' | sed -e 's/.*">//g' -e 's/<.*//g' )"; then
sleep 5;
if ! PHP71_MODS="$( curl -sS https://raw.githubusercontent.com/devilbox/docker-php-fpm/${PHP_TAG}/README.md | tac | tac | grep -E '71-mods' | sed -e 's/.*">//g' -e 's/<.*//g' )"; then
sleep 5;
if ! PHP71_MODS="$( curl -sS https://raw.githubusercontent.com/devilbox/docker-php-fpm/${PHP_TAG}/README.md | tac | tac | grep -E '71-mods' | sed -e 's/.*">//g' -e 's/<.*//g' )"; then
sleep 5;
if ! PHP71_MODS="$( curl -sS https://raw.githubusercontent.com/devilbox/docker-php-fpm/${PHP_TAG}/README.md | tac | tac | grep -E '71-mods' | sed -e 's/.*">//g' -e 's/<.*//g' )"; then
>&2 echo "Failed to retrieve modules for PHP 7.1"
exit 1
fi
fi
fi
fi
if ! PHP71_MODS="$( run "\
curl -sS 'https://raw.githubusercontent.com/devilbox/docker-php-fpm/${PHP_TAG}/README.md' \
| tac \
| tac \
| grep -E '71-mods' \
| sed \
-e 's/.*\">//g' \
-e 's/<.*//g'" "${RETRIES}" )"; then
>&2 echo "Failed to retrieve modules for PHP 7.1"
exit 1
fi
if ! PHP72_MODS="$( curl -sS https://raw.githubusercontent.com/devilbox/docker-php-fpm/${PHP_TAG}/README.md | tac | tac | grep -E '72-mods' | sed -e 's/.*">//g' -e 's/<.*//g' )"; then
sleep 5;
if ! PHP72_MODS="$( curl -sS https://raw.githubusercontent.com/devilbox/docker-php-fpm/${PHP_TAG}/README.md | tac | tac | grep -E '72-mods' | sed -e 's/.*">//g' -e 's/<.*//g' )"; then
sleep 5;
if ! PHP72_MODS="$( curl -sS https://raw.githubusercontent.com/devilbox/docker-php-fpm/${PHP_TAG}/README.md | tac | tac | grep -E '72-mods' | sed -e 's/.*">//g' -e 's/<.*//g' )"; then
sleep 5;
if ! PHP72_MODS="$( curl -sS https://raw.githubusercontent.com/devilbox/docker-php-fpm/${PHP_TAG}/README.md | tac | tac | grep -E '72-mods' | sed -e 's/.*">//g' -e 's/<.*//g' )"; then
sleep 5;
if ! PHP72_MODS="$( curl -sS https://raw.githubusercontent.com/devilbox/docker-php-fpm/${PHP_TAG}/README.md | tac | tac | grep -E '72-mods' | sed -e 's/.*">//g' -e 's/<.*//g' )"; then
>&2 echo "Failed to retrieve modules for PHP 7.2"
exit 1
fi
fi
fi
fi
if ! PHP72_MODS="$( run "\
curl -sS 'https://raw.githubusercontent.com/devilbox/docker-php-fpm/${PHP_TAG}/README.md' \
| tac \
| tac \
| grep -E '72-mods' \
| sed \
-e 's/.*\">//g' \
-e 's/<.*//g'" "${RETRIES}" )"; then
>&2 echo "Failed to retrieve modules for PHP 7.2"
exit 1
fi
if ! PHP73_MODS="$( curl -sS https://raw.githubusercontent.com/devilbox/docker-php-fpm/${PHP_TAG}/README.md | tac | tac | grep -E '73-mods' | sed -e 's/.*">//g' -e 's/<.*//g' )"; then
sleep 5;
if ! PHP73_MODS="$( curl -sS https://raw.githubusercontent.com/devilbox/docker-php-fpm/${PHP_TAG}/README.md | tac | tac | grep -E '73-mods' | sed -e 's/.*">//g' -e 's/<.*//g' )"; then
sleep 5;
if ! PHP73_MODS="$( curl -sS https://raw.githubusercontent.com/devilbox/docker-php-fpm/${PHP_TAG}/README.md | tac | tac | grep -E '73-mods' | sed -e 's/.*">//g' -e 's/<.*//g' )"; then
sleep 5;
if ! PHP73_MODS="$( curl -sS https://raw.githubusercontent.com/devilbox/docker-php-fpm/${PHP_TAG}/README.md | tac | tac | grep -E '73-mods' | sed -e 's/.*">//g' -e 's/<.*//g' )"; then
sleep 5;
if ! PHP73_MODS="$( curl -sS https://raw.githubusercontent.com/devilbox/docker-php-fpm/${PHP_TAG}/README.md | tac | tac | grep -E '73-mods' | sed -e 's/.*">//g' -e 's/<.*//g' )"; then
>&2 echo "Failed to retrieve modules for PHP 7.3"
exit 1
fi
fi
fi
fi
if ! PHP73_MODS="$( run "\
curl -sS 'https://raw.githubusercontent.com/devilbox/docker-php-fpm/${PHP_TAG}/README.md' \
| tac \
| tac \
| grep -E '73-mods' \
| sed \
-e 's/.*\">//g' \
-e 's/<.*//g'" "${RETRIES}" )"; then
>&2 echo "Failed to retrieve modules for PHP 7.3"
exit 1
fi
if ! PHP74_MODS="$( curl -sS https://raw.githubusercontent.com/devilbox/docker-php-fpm/${PHP_TAG}/README.md | tac | tac | grep -E '74-mods' | sed -e 's/.*">//g' -e 's/<.*//g' )"; then
sleep 5;
if ! PHP74_MODS="$( curl -sS https://raw.githubusercontent.com/devilbox/docker-php-fpm/${PHP_TAG}/README.md | tac | tac | grep -E '74-mods' | sed -e 's/.*">//g' -e 's/<.*//g' )"; then
sleep 5;
if ! PHP74_MODS="$( curl -sS https://raw.githubusercontent.com/devilbox/docker-php-fpm/${PHP_TAG}/README.md | tac | tac | grep -E '74-mods' | sed -e 's/.*">//g' -e 's/<.*//g' )"; then
sleep 5;
if ! PHP74_MODS="$( curl -sS https://raw.githubusercontent.com/devilbox/docker-php-fpm/${PHP_TAG}/README.md | tac | tac | grep -E '74-mods' | sed -e 's/.*">//g' -e 's/<.*//g' )"; then
sleep 5;
if ! PHP74_MODS="$( curl -sS https://raw.githubusercontent.com/devilbox/docker-php-fpm/${PHP_TAG}/README.md | tac | tac | grep -E '74-mods' | sed -e 's/.*">//g' -e 's/<.*//g' )"; then
>&2 echo "Failed to retrieve modules for PHP 7.4"
exit 1
fi
fi
fi
fi
if ! PHP74_MODS="$( run "\
curl -sS 'https://raw.githubusercontent.com/devilbox/docker-php-fpm/${PHP_TAG}/README.md' \
| tac \
| tac \
| grep -E '74-mods' \
| sed \
-e 's/.*\">//g' \
-e 's/<.*//g'" "${RETRIES}" )"; then
>&2 echo "Failed to retrieve modules for PHP 7.4"
exit 1
fi
if ! PHP80_MODS="$( curl -sS https://raw.githubusercontent.com/devilbox/docker-php-fpm/${PHP_TAG}/README.md | tac | tac | grep -E '80-mods' | sed -e 's/.*">//g' -e 's/<.*//g' )"; then
sleep 5;
if ! PHP80_MODS="$( curl -sS https://raw.githubusercontent.com/devilbox/docker-php-fpm/${PHP_TAG}/README.md | tac | tac | grep -E '80-mods' | sed -e 's/.*">//g' -e 's/<.*//g' )"; then
sleep 5;
if ! PHP80_MODS="$( curl -sS https://raw.githubusercontent.com/devilbox/docker-php-fpm/${PHP_TAG}/README.md | tac | tac | grep -E '80-mods' | sed -e 's/.*">//g' -e 's/<.*//g' )"; then
sleep 5;
if ! PHP80_MODS="$( curl -sS https://raw.githubusercontent.com/devilbox/docker-php-fpm/${PHP_TAG}/README.md | tac | tac | grep -E '80-mods' | sed -e 's/.*">//g' -e 's/<.*//g' )"; then
sleep 5;
if ! PHP80_MODS="$( curl -sS https://raw.githubusercontent.com/devilbox/docker-php-fpm/${PHP_TAG}/README.md | tac | tac | grep -E '80-mods' | sed -e 's/.*">//g' -e 's/<.*//g' )"; then
>&2 echo "Failed to retrieve modules for PHP 8.0"
exit 1
fi
fi
fi
fi
if ! PHP80_MODS="$( run "\
curl -sS 'https://raw.githubusercontent.com/devilbox/docker-php-fpm/${PHP_TAG}/README.md' \
| tac \
| tac \
| grep -E '80-mods' \
| sed \
-e 's/.*\">//g' \
-e 's/<.*//g'" "${RETRIES}" )"; then
>&2 echo "Failed to retrieve modules for PHP 8.0"
exit 1
fi
@ -378,7 +304,7 @@ MODS="$( echo "${PHP52_MODS}, ${PHP53_MODS}, ${PHP54_MODS}, ${PHP55_MODS}, ${PHP
###
### Get disabled modules
###
DISABLED=",blackfire,ioncube,$( grep -E '^PHP_MODULES_DISABLE=' "${COMPOSEPATH}/env-example" | sed 's/.*=//g' ),"
DISABLED=",blackfire,ioncube,$( grep -E '^PHP_MODULES_DISABLE=' "${DVLBOX_PATH}/env-example" | sed 's/.*=//g' ),"
#echo $DISABLED
B="✔" # Enabled base modules (cannot be disabled)
E="🗸" # Enabled mods modules (can be disabled)
@ -387,7 +313,7 @@ U=" " # Unavailable
echo "| Modules | PHP 5.2 | PHP 5.3 | PHP 5.4 | PHP 5.5 | PHP 5.6 | PHP 7.0 | PHP 7.1 | PHP 7.2 | PHP 7.3 | PHP 7.4 | PHP 8.0 |"
echo "|----------------|---------|---------|---------|---------|---------|---------|---------|---------|---------|---------|---------|"
echo "${MODS}" | while read line; do
echo "${MODS}" | while read -r line; do
printf "| %-15s%s" "${line}" "|"
# ---------- PHP 5.2 ----------#
@ -555,5 +481,5 @@ echo "${MODS}" | while read line; do
printf " %s |" "${U}" # Not available
fi
printf "\n"
printf "\\n"
done

View File

@ -27,9 +27,9 @@ echo
# Pre-check
# -------------------------------------------------------------------------------------------------
PHP_SERVER="$( "${SCRIPT_PATH}/../scripts/env-getvar.sh" "PHP_SERVER" )"
if [[ ${DISABLED_VERSIONS[*]} =~ ${PHP_SERVER} ]]; then
printf "[SKIP] Skipping all checks for PHP %s\\n" "${PHP_SERVER}"
PHP_VERSION="$( get_php_version "${DVLBOX_PATH}" )"
if [[ ${DISABLED_VERSIONS[*]} =~ ${PHP_VERSION} ]]; then
printf "[SKIP] Skipping all checks for PHP %s\\n" "${PHP_VERSION}"
exit 0
fi
@ -38,7 +38,6 @@ fi
# ENTRYPOINT
# -------------------------------------------------------------------------------------------------
###
### Get autostart files
###

View File

@ -27,9 +27,9 @@ echo
# Pre-check
# -------------------------------------------------------------------------------------------------
PHP_SERVER="$( "${SCRIPT_PATH}/../scripts/env-getvar.sh" "PHP_SERVER" )"
if [[ ${DISABLED_VERSIONS[*]} =~ ${PHP_SERVER} ]]; then
printf "[SKIP] Skipping all checks for PHP %s\\n" "${PHP_SERVER}"
PHP_VERSION="$( get_php_version "${DVLBOX_PATH}" )"
if [[ ${DISABLED_VERSIONS[*]} =~ ${PHP_VERSION} ]]; then
printf "[SKIP] Skipping all checks for PHP %s\\n" "${PHP_VERSION}"
exit 0
fi
@ -38,7 +38,6 @@ fi
# ENTRYPOINT
# -------------------------------------------------------------------------------------------------
###
### Get required env values
###
@ -48,7 +47,7 @@ HOST_PORT_HTTPD="$( "${SCRIPT_PATH}/../scripts/env-getvar.sh" "HOST_PORT_HTTPD"
### Xdebug available
###
printf "[TEST] Xdebug available"
if ! run "curl -sS --fail 'http://localhost:${HOST_PORT_HTTPD}/info_php.php' | tac | tac | grep -q 'xdebug.remote_enable'" "${RETRIES}" "" "0"; then
if ! run "curl -sS --fail 'http://localhost:${HOST_PORT_HTTPD}/info_php.php' | tac | tac | grep 'xdebug.remote_enable' >/dev/null" "${RETRIES}" "" "0"; then
printf "\\r[FAIL] Xdebug available\\n"
run "curl -sS 'http://localhost:${HOST_PORT_HTTPD}/info_php.php' || true"
exit 1
@ -61,7 +60,7 @@ fi
### Xdebug default disabled
###
printf "[TEST] Xdebug default disabled"
if ! run "curl -sS --fail 'http://localhost:${HOST_PORT_HTTPD}/info_php.php' | tac | tac | grep 'xdebug.remote_enable' | grep -Eq 'Off.+Off'" "${RETRIES}" "" "0"; then
if ! run "curl -sS --fail 'http://localhost:${HOST_PORT_HTTPD}/info_php.php' | tac | tac | grep 'xdebug.remote_enable' | grep -E 'Off.+Off' >/dev/null" "${RETRIES}" "" "0"; then
printf "\\r[FAIL] Xdebug default disabled\\n"
run "curl -sS 'http://localhost:${HOST_PORT_HTTPD}/info_php.php' | grep 'xdebug.remote_enable' || true"
exit 1
@ -74,7 +73,7 @@ fi
### Xdebug autostart disabled
###
printf "[TEST] Xdebug autostart disabled"
if ! run "curl -sS --fail 'http://localhost:${HOST_PORT_HTTPD}/info_php.php' | tac | tac | grep 'xdebug.remote_autostart' | grep -Eq 'Off.+Off'" "${RETRIES}" "" "0"; then
if ! run "curl -sS --fail 'http://localhost:${HOST_PORT_HTTPD}/info_php.php' | tac | tac | grep 'xdebug.remote_autostart' | grep -E 'Off.+Off' >/dev/null" "${RETRIES}" "" "0"; then
printf "\\r[FAIL] Xdebug autostart disabled\\n"
run "curl 'http://localhost:${HOST_PORT_HTTPD}/info_php.php' | grep 'xdebug.remote_autostart' || true"
exit 1

View File

@ -27,9 +27,9 @@ echo
# Pre-check
# -------------------------------------------------------------------------------------------------
PHP_SERVER="$( "${SCRIPT_PATH}/../scripts/env-getvar.sh" "PHP_SERVER" )"
if [[ ${DISABLED_VERSIONS[*]} =~ ${PHP_SERVER} ]]; then
printf "[SKIP] Skipping all checks for PHP %s\\n" "${PHP_SERVER}"
PHP_VERSION="$( get_php_version "${DVLBOX_PATH}" )"
if [[ ${DISABLED_VERSIONS[*]} =~ ${PHP_VERSION} ]]; then
printf "[SKIP] Skipping all checks for PHP %s\\n" "${PHP_VERSION}"
exit 0
fi
@ -42,6 +42,7 @@ fi
### Get required env values
###
MYSQL_ROOT_PASSWORD="$( "${SCRIPT_PATH}/../scripts/env-getvar.sh" "MYSQL_ROOT_PASSWORD" )"
TLD_SUFFIX="$( "${SCRIPT_PATH}/../scripts/env-getvar.sh" "TLD_SUFFIX" )"
# Setup CakePHP project
@ -58,26 +59,26 @@ run "docker-compose exec --user devilbox -T php sed -i\"\" \"s/'database' =>.*/'
# Test CakePHP
ERROR=0
if ! run "docker-compose exec --user devilbox -T php curl -sS --fail http://cakephp.loc | tac | tac | grep '\"bullet success\"' | grep 'mbstring'" "${RETRIES}" "${DVLBOX_PATH}"; then
if ! run "docker-compose exec --user devilbox -T php curl -sS --fail 'http://cakephp.${TLD_SUFFIX}' | tac | tac | grep '\"bullet success\"' | grep 'mbstring'" "${RETRIES}" "${DVLBOX_PATH}"; then
ERROR=1
fi
if ! run "docker-compose exec --user devilbox -T php curl -sS --fail http://cakephp.loc | tac | tac | grep '\"bullet success\"' | grep 'openssl'" "${RETRIES}" "${DVLBOX_PATH}"; then
if ! run "docker-compose exec --user devilbox -T php curl -sS --fail 'http://cakephp.${TLD_SUFFIX}' | tac | tac | grep '\"bullet success\"' | grep 'openssl'" "${RETRIES}" "${DVLBOX_PATH}"; then
ERROR=1
fi
if ! run "docker-compose exec --user devilbox -T php curl -sS --fail http://cakephp.loc | tac | tac | grep '\"bullet success\"' | grep 'intl'" "${RETRIES}" "${DVLBOX_PATH}"; then
if ! run "docker-compose exec --user devilbox -T php curl -sS --fail 'http://cakephp.${TLD_SUFFIX}' | tac | tac | grep '\"bullet success\"' | grep 'intl'" "${RETRIES}" "${DVLBOX_PATH}"; then
ERROR=1
fi
if ! run "docker-compose exec --user devilbox -T php curl -sS --fail http://cakephp.loc | tac | tac | grep '\"bullet success\"' | grep 'tmp directory'" "${RETRIES}" "${DVLBOX_PATH}"; then
if ! run "docker-compose exec --user devilbox -T php curl -sS --fail 'http://cakephp.${TLD_SUFFIX}' | tac | tac | grep '\"bullet success\"' | grep 'tmp directory'" "${RETRIES}" "${DVLBOX_PATH}"; then
ERROR=1
fi
if ! run "docker-compose exec --user devilbox -T php curl -sS --fail http://cakephp.loc | tac | tac | grep '\"bullet success\"' | grep 'logs directory'" "${RETRIES}" "${DVLBOX_PATH}"; then
if ! run "docker-compose exec --user devilbox -T php curl -sS --fail 'http://cakephp.${TLD_SUFFIX}' | tac | tac | grep '\"bullet success\"' | grep 'logs directory'" "${RETRIES}" "${DVLBOX_PATH}"; then
ERROR=1
fi
if ! run "docker-compose exec --user devilbox -T php curl -sS --fail http://cakephp.loc | tac | tac | grep '\"bullet success\"' | grep 'connect to the database'" "${RETRIES}" "${DVLBOX_PATH}"; then
if ! run "docker-compose exec --user devilbox -T php curl -sS --fail 'http://cakephp.${TLD_SUFFIX}' | tac | tac | grep '\"bullet success\"' | grep 'connect to the database'" "${RETRIES}" "${DVLBOX_PATH}"; then
ERROR=1
fi
if [ "${ERROR}" = "1" ]; then
run "docker-compose exec --user devilbox -T php curl http://cakephp.loc || true"
run "docker-compose exec --user devilbox -T php curl 'http://cakephp.${TLD_SUFFIX}' || true" "1" "${DVLBOX_PATH}"
exit 1
fi

View File

@ -27,9 +27,9 @@ echo
# Pre-check
# -------------------------------------------------------------------------------------------------
PHP_SERVER="$( "${SCRIPT_PATH}/../scripts/env-getvar.sh" "PHP_SERVER" )"
if [[ ${DISABLED_VERSIONS[*]} =~ ${PHP_SERVER} ]]; then
printf "[SKIP] Skipping all checks for PHP %s\\n" "${PHP_SERVER}"
PHP_VERSION="$( get_php_version "${DVLBOX_PATH}" )"
if [[ ${DISABLED_VERSIONS[*]} =~ ${PHP_VERSION} ]]; then
printf "[SKIP] Skipping all checks for PHP %s\\n" "${PHP_VERSION}"
exit 0
fi
@ -59,6 +59,7 @@ fi
### Get required env values
###
MYSQL_ROOT_PASSWORD="$( "${SCRIPT_PATH}/../scripts/env-getvar.sh" "MYSQL_ROOT_PASSWORD" )"
TLD_SUFFIX="$( "${SCRIPT_PATH}/../scripts/env-getvar.sh" "TLD_SUFFIX" )"
# Setup Drupal project
@ -71,7 +72,7 @@ run "docker-compose exec --user devilbox -T php mysql -u root -h mysql --passwor
run "docker-compose exec --user devilbox -T php bash -c 'cd /shared/httpd/drupal/htdocs/; ${DRUSH} site-install standard --db-url='mysql://root:${MYSQL_ROOT_PASSWORD}@mysql/my_drupal' --site-name=Example -y'" "${RETRIES}" "${DVLBOX_PATH}"
# Test Drupal
if ! run "docker-compose exec --user devilbox -T php curl -sS --fail http://drupal.loc | tac | tac | grep 'Welcome to Example'" "${RETRIES}" "${DVLBOX_PATH}"; then
run "docker-compose exec --user devilbox -T php curl http://drupal.loc || true"
if ! run "docker-compose exec --user devilbox -T php curl -sS --fail 'http://drupal.${TLD_SUFFIX}' | tac | tac | grep 'Welcome to Example'" "${RETRIES}" "${DVLBOX_PATH}"; then
run "docker-compose exec --user devilbox -T php curl 'http://drupal.${TLD_SUFFIX}' || true"
exit 1
fi

View File

@ -27,9 +27,9 @@ echo
# Pre-check
# -------------------------------------------------------------------------------------------------
PHP_SERVER="$( "${SCRIPT_PATH}/../scripts/env-getvar.sh" "PHP_SERVER" )"
if [[ ${DISABLED_VERSIONS[*]} =~ ${PHP_SERVER} ]]; then
printf "[SKIP] Skipping all checks for PHP %s\\n" "${PHP_SERVER}"
PHP_VERSION="$( get_php_version "${DVLBOX_PATH}" )"
if [[ ${DISABLED_VERSIONS[*]} =~ ${PHP_VERSION} ]]; then
printf "[SKIP] Skipping all checks for PHP %s\\n" "${PHP_VERSION}"
exit 0
fi

View File

@ -27,9 +27,9 @@ echo
# Pre-check
# -------------------------------------------------------------------------------------------------
PHP_SERVER="$( "${SCRIPT_PATH}/../scripts/env-getvar.sh" "PHP_SERVER" )"
if [[ ${DISABLED_VERSIONS[*]} =~ ${PHP_SERVER} ]]; then
printf "[SKIP] Skipping all checks for PHP %s\\n" "${PHP_SERVER}"
PHP_VERSION="$( get_php_version "${DVLBOX_PATH}" )"
if [[ ${DISABLED_VERSIONS[*]} =~ ${PHP_VERSION} ]]; then
printf "[SKIP] Skipping all checks for PHP %s\\n" "${PHP_VERSION}"
exit 0
fi

View File

@ -27,9 +27,9 @@ echo
# Pre-check
# -------------------------------------------------------------------------------------------------
PHP_SERVER="$( "${SCRIPT_PATH}/../scripts/env-getvar.sh" "PHP_SERVER" )"
if [[ ${DISABLED_VERSIONS[*]} =~ ${PHP_SERVER} ]]; then
printf "[SKIP] Skipping all checks for PHP %s\\n" "${PHP_SERVER}"
PHP_VERSION="$( get_php_version "${DVLBOX_PATH}" )"
if [[ ${DISABLED_VERSIONS[*]} =~ ${PHP_VERSION} ]]; then
printf "[SKIP] Skipping all checks for PHP %s\\n" "${PHP_VERSION}"
exit 0
fi
@ -54,7 +54,7 @@ fi
HOST_PORT_HTTPD="$( "${SCRIPT_PATH}/../scripts/env-getvar.sh" "HOST_PORT_HTTPD" )"
printf "[TEST] devilbox-version key in Memcached"
if ! run "curl -sS --fail 'http://localhost:${HOST_PORT_HTTPD}/db_memcd.php' | tac | tac | grep -q 'devilbox-version'" "${RETRIES}" "" "0"; then
if ! run "curl -sS --fail 'http://localhost:${HOST_PORT_HTTPD}/db_memcd.php' | tac | tac | grep 'devilbox-version' >/dev/null" "${RETRIES}" "" "0"; then
printf "\\r[FAIL] devilbox-version key in Memcached\\n"
run "curl 'http://localhost:${HOST_PORT_HTTPD}/db_memcd.php' || true"
exit 1

View File

@ -27,9 +27,9 @@ echo
# Pre-check
# -------------------------------------------------------------------------------------------------
PHP_SERVER="$( "${SCRIPT_PATH}/../scripts/env-getvar.sh" "PHP_SERVER" )"
if [[ ${DISABLED_VERSIONS[*]} =~ ${PHP_SERVER} ]]; then
printf "[SKIP] Skipping all checks for PHP %s\\n" "${PHP_SERVER}"
PHP_VERSION="$( get_php_version "${DVLBOX_PATH}" )"
if [[ ${DISABLED_VERSIONS[*]} =~ ${PHP_VERSION} ]]; then
printf "[SKIP] Skipping all checks for PHP %s\\n" "${PHP_VERSION}"
exit 0
fi
@ -54,7 +54,7 @@ fi
HOST_PORT_HTTPD="$( "${SCRIPT_PATH}/../scripts/env-getvar.sh" "HOST_PORT_HTTPD" )"
printf "[TEST] devilbox-version key in Redis"
if ! run "curl -sS --fail 'http://localhost:${HOST_PORT_HTTPD}/db_redis.php' | tac | tac | grep -q 'devilbox-version'" "${RETRIES}" "" "0"; then
if ! run "curl -sS --fail 'http://localhost:${HOST_PORT_HTTPD}/db_redis.php' | tac | tac | grep 'devilbox-version' >/dev/null" "${RETRIES}" "" "0"; then
printf "\\r[FAIL] devilbox-version key in Redis\\n"
run "curl 'http://localhost:${HOST_PORT_HTTPD}/db_redis.php' || true"
exit 1

View File

@ -27,9 +27,9 @@ echo
# Pre-check
# -------------------------------------------------------------------------------------------------
PHP_SERVER="$( "${SCRIPT_PATH}/../scripts/env-getvar.sh" "PHP_SERVER" )"
if [[ ${DISABLED_VERSIONS[*]} =~ ${PHP_SERVER} ]]; then
printf "[SKIP] Skipping all checks for PHP %s\\n" "${PHP_SERVER}"
PHP_VERSION="$( get_php_version "${DVLBOX_PATH}" )"
if [[ ${DISABLED_VERSIONS[*]} =~ ${PHP_VERSION} ]]; then
printf "[SKIP] Skipping all checks for PHP %s\\n" "${PHP_VERSION}"
exit 0
fi

View File

@ -27,9 +27,9 @@ echo
# Pre-check
# -------------------------------------------------------------------------------------------------
PHP_SERVER="$( "${SCRIPT_PATH}/../scripts/env-getvar.sh" "PHP_SERVER" )"
if [[ ${DISABLED_VERSIONS[*]} =~ ${PHP_SERVER} ]]; then
printf "[SKIP] Skipping all checks for PHP %s\\n" "${PHP_SERVER}"
PHP_VERSION="$( get_php_version "${DVLBOX_PATH}" )"
if [[ ${DISABLED_VERSIONS[*]} =~ ${PHP_VERSION} ]]; then
printf "[SKIP] Skipping all checks for PHP %s\\n" "${PHP_VERSION}"
exit 0
fi
@ -71,12 +71,17 @@ fi
HOST_PORT_HTTPD="$( "${SCRIPT_PATH}/../scripts/env-getvar.sh" "HOST_PORT_HTTPD" )"
TLD_SUFFIX="$( "${SCRIPT_PATH}/../scripts/env-getvar.sh" "TLD_SUFFIX" )"
###
### Store the error
###
ERROR=0
###
### Get vhost files
###
FILES="$( cd "${TESTS}" && find . -name '*.php' | sort )"
ERRORS=0
echo
echo "#--------------------------------------------------------------------------------"
@ -89,15 +94,15 @@ for file in ${FILES}; do
if ! run "curl -sS --fail --header 'Host: ${VHOST}.${TLD_SUFFIX}' -o /dev/null -I -w '%{http_code}' 'http://localhost:${HOST_PORT_HTTPD}/${name}' | tac | tac | grep -E '200'" "${RETRIES}"; then
run "curl -sS --header 'Host: ${VHOST}.${TLD_SUFFIX}' -o /dev/null -I -w '%{http_code}' 'http://localhost:${HOST_PORT_HTTPD}/${name}' || true"
ERRORS="$(( ERRORS + 1))"
ERROR=1
fi
if ! run "curl -sS --fail --header 'Host: ${VHOST}.${TLD_SUFFIX}' 'http://localhost:${HOST_PORT_HTTPD}/${name}' | tac | tac | grep -E '^(OK|SKIP)$'" "${RETRIES}"; then
run "curl -sS --header 'Host: ${VHOST}.${TLD_SUFFIX}' 'http://localhost:${HOST_PORT_HTTPD}/${name}'"
ERRORS="$(( ERRORS + 1))"
ERROR=1
fi
if ! run_fail "curl -sS --fail --header 'Host: ${VHOST}.${TLD_SUFFIX}' 'http://localhost:${HOST_PORT_HTTPD}/${name}' 2>&1 | tac | tac | grep -Ei 'fatal|except|err|warn|notice' >/dev/null" "${RETRIES}"; then
run "curl -sS --header 'Host: ${VHOST}.${TLD_SUFFIX}' 'http://localhost:${HOST_PORT_HTTPD}/${name}'"
ERRORS="$(( ERRORS + 1))"
ERROR=1
fi
done
@ -113,16 +118,20 @@ for file in ${FILES}; do
if ! run "docker-compose exec -T php curl -sS --fail -o /dev/null -I -w '%{http_code}' 'http://${VHOST}.${TLD_SUFFIX}/${name}' | tac | tac | grep -E '200'" "${RETRIES}" "${DVLBOX_PATH}"; then
run "docker-compose exec -T php curl -sS -o /dev/null -I -w '%{http_code}' 'http://${VHOST}.${TLD_SUFFIX}/${name}'" "1" "${DVLBOX_PATH}"
ERRORS="$(( ERRORS + 1))"
ERROR=1
fi
if ! run "docker-compose exec -T php curl -sS --fail 'http://${VHOST}.${TLD_SUFFIX}/${name}' | tac | tac | grep -E '^(OK|SKIP)$'" "${RETRIES}" "${DVLBOX_PATH}"; then
run "docker-compose exec -T php curl -sS 'http://${VHOST}.${TLD_SUFFIX}/${name}'" "1" "${DVLBOX_PATH}"
ERRORS="$(( ERRORS + 1))"
ERROR=1
fi
if ! run_fail "docker-compose exec -T php curl -sS --fail 'http://${VHOST}.${TLD_SUFFIX}/${name}' 2>&1 | tac | tac | grep -Ei 'fatal|except|err|war|notice' >/dev/null" "${RETRIES}" "${DVLBOX_PATH}"; then
run "docker-compose exec -T php curl -sS 'http://${VHOST}.${TLD_SUFFIX}/${name}'" "1" "${DVLBOX_PATH}"
ERRORS="$(( ERRORS + 1))"
ERROR=1
fi
done
exit "${ERRORS}"
###
### Return error or success
###
exit "${ERROR}"

View File

@ -27,9 +27,9 @@ echo
# Pre-check
# -------------------------------------------------------------------------------------------------
PHP_SERVER="$( "${SCRIPT_PATH}/../scripts/env-getvar.sh" "PHP_SERVER" )"
if [[ ${DISABLED_VERSIONS[*]} =~ ${PHP_SERVER} ]]; then
printf "[SKIP] Skipping all checks for PHP %s\\n" "${PHP_SERVER}"
PHP_VERSION="$( get_php_version "${DVLBOX_PATH}" )"
if [[ ${DISABLED_VERSIONS[*]} =~ ${PHP_VERSION} ]]; then
printf "[SKIP] Skipping all checks for PHP %s\\n" "${PHP_VERSION}"
exit 0
fi
@ -60,6 +60,12 @@ fi
# ENTRYPOINT
# -------------------------------------------------------------------------------------------------
###
### Store the error
###
ERROR=0
###
### Get vhost files
###
@ -69,10 +75,16 @@ for file in ${FILES}; do
name="${file#./}"
if ! run "docker-compose exec -T --user devilbox php php /shared/httpd/${VHOST}/htdocs/${name} | grep -E '^(OK|SKIP)$'" "${RETRIES}" "${DVLBOX_PATH}"; then
run "docker-compose exec -T --user devilbox php php /shared/httpd/${VHOST}/htdocs/${name} || true" "1" "${DVLBOX_PATH}"
exit 1
ERROR=1
fi
if ! run_fail "docker-compose exec -T --user devilbox php php /shared/httpd/${VHOST}/htdocs/${name} 2>&1 | grep -Ei 'fatal|except|err|warn|notice' > /dev/null" "${RETRIES}" "${DVLBOX_PATH}"; then
run "docker-compose exec -T --user devilbox php php /shared/httpd/${VHOST}/htdocs/${name} || true" "1" "${DVLBOX_PATH}"
exit 1
ERROR=1
fi
done
###
### Return error or success
###
exit "${ERROR}"

View File

@ -27,9 +27,9 @@ echo
# Pre-check
# -------------------------------------------------------------------------------------------------
PHP_SERVER="$( "${SCRIPT_PATH}/../scripts/env-getvar.sh" "PHP_SERVER" )"
if [[ ${DISABLED_VERSIONS[*]} =~ ${PHP_SERVER} ]]; then
printf "[SKIP] Skipping all checks for PHP %s\\n" "${PHP_SERVER}"
PHP_VERSION="$( get_php_version "${DVLBOX_PATH}" )"
if [[ ${DISABLED_VERSIONS[*]} =~ ${PHP_VERSION} ]]; then
printf "[SKIP] Skipping all checks for PHP %s\\n" "${PHP_VERSION}"
exit 0
fi
@ -42,7 +42,6 @@ fi
###
### Get required env values
###
HOST_PORT_HTTPD="$( "${SCRIPT_PATH}/../scripts/env-getvar.sh" "HOST_PORT_HTTPD" )"
TLD_SUFFIX="$( "${SCRIPT_PATH}/../scripts/env-getvar.sh" "TLD_SUFFIX" )"
HTTPD_TEMPLATE_DIR="$( "${SCRIPT_PATH}/../scripts/env-getvar.sh" "HTTPD_TEMPLATE_DIR" )"
@ -96,16 +95,16 @@ run "sleep 4"
###
### Start rproxy application
###
run "docker-compose exec --user devilbox -T php bash -c 'cd /shared/httpd/${RPROXY_NAME}/js && pm2 start index.js'" "${RETRIES}" "${DVLBOX_PATH}"
run "docker-compose exec --user devilbox -T php bash -c 'cd /shared/httpd/${RPROXY_NAME}/js && pm2 start index.js -f'" "${RETRIES}" "${DVLBOX_PATH}"
###
### Test rhost
###
printf "[TEST] rproxy javascript"
if ! run "docker-compose exec --user devilbox -T php curl -sS --fail 'http://${RPROXY_NAME}.${TLD_SUFFIX}:${HOST_PORT_HTTPD}' | tac | tac | grep -E '^${OUTPUT}$' >/dev/null" "${RETRIES}" "${DVLBOX_PATH}" "0"; then
if ! run "docker-compose exec --user devilbox -T php curl -sS --fail 'http://${RPROXY_NAME}.${TLD_SUFFIX}' | tac | tac | grep -E '^${OUTPUT}$' >/dev/null" "${RETRIES}" "${DVLBOX_PATH}" "0"; then
printf "\\r[FAIL] rproxy javascript\\n"
run "docker-compose exec --user devilbox -T php curl -v 'http://${RPROXY_NAME}.${TLD_SUFFIX}:${HOST_PORT_HTTPD}' || true' || true" "1" "${DVLBOX_PATH}"
run "docker-compose exec --user devilbox -T php curl -v 'http://${RPROXY_NAME}.${TLD_SUFFIX}' || true" "1" "${DVLBOX_PATH}"
exit 1
else
printf "\\r[OK] rproxy javascript\\n"

View File

@ -27,9 +27,9 @@ echo
# Pre-check
# -------------------------------------------------------------------------------------------------
PHP_SERVER="$( "${SCRIPT_PATH}/../scripts/env-getvar.sh" "PHP_SERVER" )"
if [[ ${DISABLED_VERSIONS[*]} =~ ${PHP_SERVER} ]]; then
printf "[SKIP] Skipping all checks for PHP %s\\n" "${PHP_SERVER}"
PHP_VERSION="$( get_php_version "${DVLBOX_PATH}" )"
if [[ ${DISABLED_VERSIONS[*]} =~ ${PHP_VERSION} ]]; then
printf "[SKIP] Skipping all checks for PHP %s\\n" "${PHP_VERSION}"
exit 0
fi
@ -51,10 +51,13 @@ fi
###
### Get required env values
###
HOST_PORT_HTTPD="$( "${SCRIPT_PATH}/../scripts/env-getvar.sh" "HOST_PORT_HTTPD" )"
HOST_PORT_HTTPD_SSL="$( "${SCRIPT_PATH}/../scripts/env-getvar.sh" "HOST_PORT_HTTPD_SSL" )"
TLD_SUFFIX="$( "${SCRIPT_PATH}/../scripts/env-getvar.sh" "TLD_SUFFIX" )"
HTTPD_SERVER="$( "${SCRIPT_PATH}/../scripts/env-getvar.sh" "HTTPD_SERVER" )"
###
### Store the error
###
ERROR=0
###
@ -64,7 +67,7 @@ printf "[TEST] https Intranet / from host"
if ! run "curl -sS --fail --cacert ${DVLBOX_PATH}/ca/devilbox-ca.crt 'https://localhost:${HOST_PORT_HTTPD_SSL}' >/dev/null" "${RETRIES}" "" "0"; then
printf "\\r[FAIL] https Intranet / from host\\n"
run "curl -v --cacert ${DVLBOX_PATH}/ca/devilbox-ca.crt 'https://localhost:${HOST_PORT_HTTPD_SSL}' || true" "1"
exit 1
ERROR=1
else
printf "\\r[OK] https Intranet / from host\\n"
fi
@ -77,7 +80,7 @@ printf "[TEST] https Intranet / from container"
if ! run "docker-compose exec -T php curl -sS --fail 'https://httpd' >/dev/null" "${RETRIES}" "${DVLBOX_PATH}" "0"; then
printf "\\r[FAIL] https Intranet / from container\\n"
run "docker-compose exec -T php curl -v 'https://httpd' || true" "1" "${DVLBOX_PATH}"
exit 1
ERROR=1
else
printf "\\r[OK] https Intranet / from container\\n"
fi
@ -90,7 +93,7 @@ printf "[TEST] https Intranet /credits.php from host"
if ! run "curl -sS --fail --cacert ${DVLBOX_PATH}/ca/devilbox-ca.crt 'https://localhost:${HOST_PORT_HTTPD_SSL}/credits.php' | tac | tac | grep -E 'https:\\/\\/github\\.com\\/cytopia' >/dev/null" "${RETRIES}" "" "0"; then
printf "\\r[FAIL] https Intranet /credits.php from host\\n"
run "curl -v --cacert ${DVLBOX_PATH}/ca/devilbox-ca.crt 'https://localhost:${HOST_PORT_HTTPD_SSL}/credits.php' || true" "1"
exit 1
ERROR=1
else
printf "\\r[OK] https Intranet /credits.php from host\\n"
fi
@ -103,7 +106,13 @@ printf "[TEST] https Intranet /credits.php from container"
if ! run "docker-compose exec -T php curl -sS --fail 'https://httpd/credits.php' | tac | tac | grep -E 'https:\\/\\/github\\.com\\/cytopia' >/dev/null" "${RETRIES}" "${DVLBOX_PATH}" "0"; then
printf "\\r[FAIL] https Intranet /credits.php from container\\n"
run "docker-compose exec -T php curl -v 'https://httpd/credits.php' || true" "1" "${DVLBOX_PATH}"
exit 1
ERROR=1
else
printf "\\r[OK] https Intranet /credits.php from container\\n"
fi
###
### Return error or success
###
exit "${ERROR}"

View File

@ -27,9 +27,9 @@ echo
# Pre-check
# -------------------------------------------------------------------------------------------------
PHP_SERVER="$( "${SCRIPT_PATH}/../scripts/env-getvar.sh" "PHP_SERVER" )"
if [[ ${DISABLED_VERSIONS[*]} =~ ${PHP_SERVER} ]]; then
printf "[SKIP] Skipping all checks for PHP %s\\n" "${PHP_SERVER}"
PHP_VERSION="$( get_php_version "${DVLBOX_PATH}" )"
if [[ ${DISABLED_VERSIONS[*]} =~ ${PHP_VERSION} ]]; then
printf "[SKIP] Skipping all checks for PHP %s\\n" "${PHP_VERSION}"
exit 0
fi
@ -62,6 +62,12 @@ TLD_SUFFIX="$( "${SCRIPT_PATH}/../scripts/env-getvar.sh" "TLD_SUFFIX" )"
VHOST=test-ssl-vhost
###
### Store the error
###
ERROR=0
###
### Create vhost directory
###
@ -79,7 +85,7 @@ printf "[TEST] https vhost / from host"
if ! run "curl -sS --fail --resolve ${VHOST}.${TLD_SUFFIX}:${HOST_PORT_HTTPD_SSL}:127.0.0.1 --cacert ${DVLBOX_PATH}/ca/devilbox-ca.crt 'https://${VHOST}.${TLD_SUFFIX}:${HOST_PORT_HTTPD_SSL}' >/dev/null" "${RETRIES}" "" "0"; then
printf "\\r[FAIL] https vhost / from host\\n"
run "curl -v --resolve ${VHOST}.${TLD_SUFFIX}:${HOST_PORT_HTTPD_SSL}:127.0.0.1 --cacert ${DVLBOX_PATH}/ca/devilbox-ca.crt 'https://${VHOST}.${TLD_SUFFIX}:${HOST_PORT_HTTPD_SSL}' || true" "1"
exit 1
ERROR=1
else
printf "\\r[OK] https vhost / from host\\n"
fi
@ -92,7 +98,13 @@ printf "[TEST] https vhost / from container"
if ! run "docker-compose exec -T php curl -sS --fail 'https://${VHOST}.${TLD_SUFFIX}' >/dev/null" "${RETRIES}" "${DVLBOX_PATH}" "0"; then
printf "\\r[FAIL] https vhost / from container\\n"
run "docker-compose exec -T php curl -v 'https://${VHOST}.${TLD_SUFFIX}' || true" "1" "${DVLBOX_PATH}" "0"
exit 1
ERROR=1
else
printf "\\r[OK] https vhost / from container\\n"
fi
###
### Return error or success
###
exit "${ERROR}"

View File

@ -0,0 +1,99 @@
#!/usr/bin/env bash
# NOTE: Parsing curl to tac to circumnvent "failed writing body"
# https://stackoverflow.com/questions/16703647/why-curl-return-and-error-23-failed-writing-body
set -e
set -u
set -o pipefail
SCRIPT_PATH="$( cd "$(dirname "$0")" && pwd -P )"
DVLBOX_PATH="$( cd "${SCRIPT_PATH}/../.." && pwd -P )"
# shellcheck disable=SC1090
. "${SCRIPT_PATH}/../scripts/.lib.sh"
RETRIES=10
DISABLED_VERSIONS=()
echo
echo "# --------------------------------------------------------------------------------------------------"
echo "# [Vendor] Adminer: MongoDB"
echo "# --------------------------------------------------------------------------------------------------"
echo
# -------------------------------------------------------------------------------------------------
# Pre-check
# -------------------------------------------------------------------------------------------------
PHP_VERSION="$( get_php_version "${DVLBOX_PATH}" )"
if [[ ${DISABLED_VERSIONS[*]} =~ ${PHP_VERSION} ]]; then
printf "[SKIP] Skipping all checks for PHP %s\\n" "${PHP_VERSION}"
exit 0
fi
# -------------------------------------------------------------------------------------------------
# ENTRYPOINT
# -------------------------------------------------------------------------------------------------
###
### Get required env values
###
HOST_PORT_HTTPD="$( "${SCRIPT_PATH}/../scripts/env-getvar.sh" "HOST_PORT_HTTPD" )"
###
### Retrieve URL for current Adminer version.
###
printf "[TEST] Retrieve Adminer URL"
if ! URL="$( run "\
curl -sS --fail 'http://localhost:${HOST_PORT_HTTPD}/index.php' \
| tac \
| tac \
| grep -Eo '/vendor/adminer-[.0-9]+-en\\.php'" \
"${RETRIES}" "" "0" )"; then
printf "\\r[FAILED] Retrieve Adminer URL\\n"
run "curl -sS 'http://localhost:${HOST_PORT_HTTPD}/index.php' || true"
exit 1
else
printf "\\r[OK] Retrieve Adminer URL: %s\\n" "${URL}"
fi
###
### Ensure given Adminer version works
###
printf "[TEST] Fetch %s" "${URL}"
if ! run "\
curl -sS --fail 'http://localhost:${HOST_PORT_HTTPD}${URL}' \
| tac \
| tac \
| grep -Ei 'Login.+Adminer' >/dev/null" \
"${RETRIES}" "" "0"; then
printf "\\r[FAILED] Fetch %s\\n" "${URL}"
run "curl -sS 'http://localhost:${HOST_PORT_HTTPD}${URL}' || true"
exit 1
else
printf "\\r[OK] Fetch %s\\n" "${URL}"
fi
###
### Test Adminer MongoDB login
###
printf "[TEST] Adminer Mongo login"
if ! run "\
curl -sS --fail 'http://localhost:${HOST_PORT_HTTPD}${URL}?mongo=mongo&username=' \
| tac \
| tac \
| grep -Ei 'Database.+Collation.+Tables' >/dev/null" \
"${RETRIES}" "" "0"; then
printf "\\r[FAIL] Adminer Mongo login\\n"
run "curl -sS 'http://localhost:${HOST_PORT_HTTPD}${URL}?mongo=mongo&username=' || true"
run "curl -sS -I 'http://localhost:${HOST_PORT_HTTPD}${URL}?mongo=mongo&username=' || true"
exit 1
else
printf "\\r[OK] Adminer Mongo login\\n"
fi

View File

@ -0,0 +1,124 @@
#!/usr/bin/env bash
# NOTE: Parsing curl to tac to circumnvent "failed writing body"
# https://stackoverflow.com/questions/16703647/why-curl-return-and-error-23-failed-writing-body
set -e
set -u
set -o pipefail
SCRIPT_PATH="$( cd "$(dirname "$0")" && pwd -P )"
DVLBOX_PATH="$( cd "${SCRIPT_PATH}/../.." && pwd -P )"
# shellcheck disable=SC1090
. "${SCRIPT_PATH}/../scripts/.lib.sh"
RETRIES=10
DISABLED_VERSIONS=()
echo
echo "# --------------------------------------------------------------------------------------------------"
echo "# [Vendor] Adminer: MySQL"
echo "# --------------------------------------------------------------------------------------------------"
echo
# -------------------------------------------------------------------------------------------------
# Pre-check
# -------------------------------------------------------------------------------------------------
PHP_VERSION="$( get_php_version "${DVLBOX_PATH}" )"
if [[ ${DISABLED_VERSIONS[*]} =~ ${PHP_VERSION} ]]; then
printf "[SKIP] Skipping all checks for PHP %s\\n" "${PHP_VERSION}"
exit 0
fi
# -------------------------------------------------------------------------------------------------
# ENTRYPOINT
# -------------------------------------------------------------------------------------------------
###
### Get required env values
###
HOST_PORT_HTTPD="$( "${SCRIPT_PATH}/../scripts/env-getvar.sh" "HOST_PORT_HTTPD" )"
###
### Retrieve URL for current Adminer version.
###
printf "[TEST] Retrieve Adminer URL"
if ! URL="$( run "\
curl -sS --fail 'http://localhost:${HOST_PORT_HTTPD}/index.php' \
| tac \
| tac \
| grep -Eo '/vendor/adminer-[.0-9]+-en\\.php'" \
"${RETRIES}" "" "0" )"; then
printf "\\r[FAILED] Retrieve Adminer URL\\n"
run "curl -sS 'http://localhost:${HOST_PORT_HTTPD}/index.php' || true"
exit 1
else
printf "\\r[OK] Retrieve Adminer URL: %s\\n" "${URL}"
fi
###
### Ensure given Adminer version works
###
printf "[TEST] Fetch %s" "${URL}"
if ! run "\
curl -sS --fail 'http://localhost:${HOST_PORT_HTTPD}${URL}' \
| tac \
| tac \
| grep -Ei 'Login.+Adminer' >/dev/null" \
"${RETRIES}" "" "0"; then
printf "\\r[FAILED] Fetch %s\\n" "${URL}"
run "curl -sS 'http://localhost:${HOST_PORT_HTTPD}${URL}' || true"
exit 1
else
printf "\\r[OK] Fetch %s\\n" "${URL}"
fi
###
### Test Adminer MySQL login
###
MYSQL_ROOT_PASSWORD="$( "${SCRIPT_PATH}/../scripts/env-getvar.sh" "MYSQL_ROOT_PASSWORD" )"
printf "[TEST] Adminer MySQL login"
if ! run "\
curl -sS --fail -c cookie.txt -b cookie.txt \
-L \
--data 'auth[driver]=server' \
--data 'auth[server]=mysql' \
--data 'auth[username]=root' \
--data 'auth[password]=${MYSQL_ROOT_PASSWORD}' \
--data 'auth[db]=' \
'http://localhost:${HOST_PORT_HTTPD}${URL}?server=mysql&username=root' \
| tac \
| tac \
| grep -Ei 'Database.+Collation.+Tables' >/dev/null" \
"${RETRIES}" "" "0"; then
printf "\\r[FAIL] Adminer MySQL login\\n"
run "curl -sS -c cookie.txt -b cookie.txt \
-L \
--data 'auth[driver]=server' \
--data 'auth[server]=mysql' \
--data 'auth[username]=root' \
--data 'auth[password]=${MYSQL_ROOT_PASSWORD}' \
--data 'auth[db]=' \
'http://localhost:${HOST_PORT_HTTPD}${URL}?server=mysql&username=root|| true'" "1"
run "curl -sS -I -c cookie.txt -b cookie.txt \
-L \
--data 'auth[driver]=server' \
--data 'auth[server]=mysql' \
--data 'auth[username]=root' \
--data 'auth[password]=${MYSQL_ROOT_PASSWORD}' \
--data 'auth[db]=' \
'http://localhost:${HOST_PORT_HTTPD}${URL}?server=mysql&username=root|| true'" "1"
rm -f cookie.txt
exit 1
else
printf "\\r[OK] Adminer MySQL login\\n"
fi
rm -f cookie.txt

View File

@ -0,0 +1,125 @@
#!/usr/bin/env bash
# NOTE: Parsing curl to tac to circumnvent "failed writing body"
# https://stackoverflow.com/questions/16703647/why-curl-return-and-error-23-failed-writing-body
set -e
set -u
set -o pipefail
SCRIPT_PATH="$( cd "$(dirname "$0")" && pwd -P )"
DVLBOX_PATH="$( cd "${SCRIPT_PATH}/../.." && pwd -P )"
# shellcheck disable=SC1090
. "${SCRIPT_PATH}/../scripts/.lib.sh"
RETRIES=10
DISABLED_VERSIONS=()
echo
echo "# --------------------------------------------------------------------------------------------------"
echo "# [Vendor] Adminer: PostgreSQL"
echo "# --------------------------------------------------------------------------------------------------"
echo
# -------------------------------------------------------------------------------------------------
# Pre-check
# -------------------------------------------------------------------------------------------------
PHP_VERSION="$( get_php_version "${DVLBOX_PATH}" )"
if [[ ${DISABLED_VERSIONS[*]} =~ ${PHP_VERSION} ]]; then
printf "[SKIP] Skipping all checks for PHP %s\\n" "${PHP_VERSION}"
exit 0
fi
# -------------------------------------------------------------------------------------------------
# ENTRYPOINT
# -------------------------------------------------------------------------------------------------
###
### Get required env values
###
HOST_PORT_HTTPD="$( "${SCRIPT_PATH}/../scripts/env-getvar.sh" "HOST_PORT_HTTPD" )"
###
### Retrieve URL for current Adminer version.
###
printf "[TEST] Retrieve Adminer URL"
if ! URL="$( run "\
curl -sS --fail 'http://localhost:${HOST_PORT_HTTPD}/index.php' \
| tac \
| tac \
| grep -Eo '/vendor/adminer-[.0-9]+-en\\.php'" \
"${RETRIES}" "" "0" )"; then
printf "\\r[FAILED] Retrieve Adminer URL\\n"
run "curl -sS 'http://localhost:${HOST_PORT_HTTPD}/index.php' || true"
exit 1
else
printf "\\r[OK] Retrieve Adminer URL: %s\\n" "${URL}"
fi
###
### Ensure given Adminer version works
###
printf "[TEST] Fetch %s" "${URL}"
if ! run "\
curl -sS --fail 'http://localhost:${HOST_PORT_HTTPD}${URL}' \
| tac \
| tac \
| grep -Ei 'Login.+Adminer' >/dev/null" \
"${RETRIES}" "" "0"; then
printf "\\r[FAILED] Fetch %s\\n" "${URL}"
run "curl -sS 'http://localhost:${HOST_PORT_HTTPD}${URL}' || true"
exit 1
else
printf "\\r[OK] Fetch %s\\n" "${URL}"
fi
###
### Test Adminer PostgreSQL login
###
PGSQL_ROOT_USER="$( "${SCRIPT_PATH}/../scripts/env-getvar.sh" "PGSQL_ROOT_USER" )"
PGSQL_ROOT_PASSWORD="$( "${SCRIPT_PATH}/../scripts/env-getvar.sh" "PGSQL_ROOT_PASSWORD" )"
printf "[TEST] Adminer PgSQL login"
if ! run "\
curl -sS --fail -c cookie.txt -b cookie.txt \
-L \
--data 'auth[driver]=pgsql' \
--data 'auth[server]=pgsql' \
--data 'auth[username]=${PGSQL_ROOT_USER}' \
--data 'auth[password]=${PGSQL_ROOT_PASSWORD}' \
--data 'auth[db]=' \
'http://localhost:${HOST_PORT_HTTPD}${URL}?pgsql=pgsql' \
| tac \
| tac \
| grep -Ei 'Database.+Collation.+Tables' >/dev/null" \
"${RETRIES}" "" "0"; then
printf "\\r[FAIL] Adminer PgSQL login\\n"
run "curl -sS -c cookie.txt -b cookie.txt \
-L \
--data 'auth[driver]=pgsql' \
--data 'auth[server]=pgsql' \
--data 'auth[username]=${PGSQL_ROOT_USER}' \
--data 'auth[password]=${PGSQL_ROOT_PASSWORD}' \
--data 'auth[db]=' \
'http://localhost:${HOST_PORT_HTTPD}${URL}?pgsql=pgsql' || true" "1"
run "curl -sS -I -c cookie.txt -b cookie.txt \
-L \
--data 'auth[driver]=pgsql' \
--data 'auth[server]=pgsql' \
--data 'auth[username]=${PGSQL_ROOT_USER}' \
--data 'auth[password]=${PGSQL_ROOT_PASSWORD}' \
--data 'auth[db]=' \
'http://localhost:${HOST_PORT_HTTPD}${URL}?pgsql=pgsql' || true" "1"
rm -f cookie.txt
exit 1
else
printf "\\r[OK] Adminer PgSQL login\\n"
fi
rm -f cookie.txt

View File

@ -1,156 +0,0 @@
#!/usr/bin/env bash
# NOTE: Parsing curl to tac to circumnvent "failed writing body"
# https://stackoverflow.com/questions/16703647/why-curl-return-and-error-23-failed-writing-body
set -e
set -u
set -o pipefail
SCRIPT_PATH="$( cd "$(dirname "$0")" && pwd -P )"
DVLBOX_PATH="$( cd "${SCRIPT_PATH}/../.." && pwd -P )"
# shellcheck disable=SC1090
. "${SCRIPT_PATH}/../scripts/.lib.sh"
RETRIES=10
DISABLED_VERSIONS_MONGO=("")
echo
echo "# --------------------------------------------------------------------------------------------------"
echo "# [Vendor] Adminer"
echo "# --------------------------------------------------------------------------------------------------"
echo
# -------------------------------------------------------------------------------------------------
# ENTRYPOINT
# -------------------------------------------------------------------------------------------------
###
### Get required env values
###
HOST_PORT_HTTPD="$( "${SCRIPT_PATH}/../scripts/env-getvar.sh" "HOST_PORT_HTTPD" )"
###
### Get current PHP version
###
printf "[TEST] Retrieve PHP version"
if ! PHP_VERSION="$( run "\
curl -sS --fail 'http://localhost:${HOST_PORT_HTTPD}/index.php' \
| tac \
| tac \
| grep -Eo 'PHP.*?\\([.0-9]+' \
| grep -Eo '\\([.0-9]+' \
| grep -Eo '[0-9]+\\.[0-9]+'" \
"${RETRIES}" "" "0" )"; then
printf "\\r[FAILED] Retrieve PHP version\\n"
run "curl -v 'http://localhost:${HOST_PORT_HTTPD}/index.php' || true"
exit 1
else
printf "\\r[OK] Retrieve PHP version: %s\\n" "${PHP_VERSION}"
fi
###
### Retrieve URL for current Adminer version.
###
printf "[TEST] Retrieve Adminer URL"
if ! URL="$( run "\
curl -sS --fail 'http://localhost:${HOST_PORT_HTTPD}/index.php' \
| tac \
| tac \
| grep -Eo '/vendor/adminer-[.0-9]+-en\\.php'" \
"${RETRIES}" "" "0" )"; then
printf "\\r[FAILED] Retrieve Adminer URL\\n"
run "curl -v 'http://localhost:${HOST_PORT_HTTPD}/index.php' || true"
exit 1
else
printf "\\r[OK] Retrieve Adminer URL: %s\\n" "${URL}"
fi
###
### Ensure given Adminer version works
###
printf "[TEST] Fetch %s" "${URL}"
if ! run "\
curl -sS --fail 'http://localhost:${HOST_PORT_HTTPD}${URL}' \
| tac \
| tac \
| grep -Ei 'Login.+Adminer' >/dev/null" \
"${RETRIES}" "" "0"; then
printf "\\r[FAILED] Fetch %s\\n" "${URL}"
run "curl -v 'http://localhost:${HOST_PORT_HTTPD}${URL}' || true"
exit 1
else
printf "\\r[OK] Fetch %s\\n" "${URL}"
fi
###
### Test Adminer MySQL login
###
# TODO: password
printf "[TEST] Adminer MySQL login"
if ! run "\
curl -sS --fail 'http://localhost:${HOST_PORT_HTTPD}${URL}?server=mysql&username=root' \
| tac \
| tac \
| grep -Ei 'Database.+Collation.+Tables' >/dev/null" \
"${RETRIES}" "" "0"; then
printf "\\r[FAIL] Adminer MySQL login\\n"
run "curl -v 'http://localhost:${HOST_PORT_HTTPD}${URL}?server=mysql&username=root' || true"
run "curl -vI 'http://localhost:${HOST_PORT_HTTPD}${URL}?server=mysql&username=root' || true"
exit 1
else
printf "\\r[OK] Adminer MySQL login\\n"
fi
###
### Test Adminer PostgreSQL login
###
printf "[TEST] Adminer PgSQL login"
if ! run "\
curl -sS --fail 'http://localhost:${HOST_PORT_HTTPD}${URL}?pgsql=pgsql&username=postgres' \
| tac \
| tac \
| grep -Ei 'Database.+Collation.+Tables' >/dev/null" \
"${RETRIES}" "" "0"; then
printf "\\r[FAIL] Adminer PgSQL login\\n"
run "curl -v 'http://localhost:${HOST_PORT_HTTPD}${URL}?pgsql=pgsql&username=postgres' || true"
run "curl -vI 'http://localhost:${HOST_PORT_HTTPD}${URL}?pgsql=pgsql&username=postgres' || true"
exit 1
else
printf "\\r[OK] Adminer PgSQL login\\n"
fi
###
### Ensure only to check against desired versions
###
if [[ ${DISABLED_VERSIONS_MONGO[*]} =~ ${PHP_VERSION} ]]; then
echo "Skipping Adminer Mongo login test for PHP ${PHP_VERSION}"
exit 0
fi
###
### Test Adminer MongoDB login
###
printf "[TEST] Adminer Mongo login"
if ! run "\
curl -sS --fail 'http://localhost:${HOST_PORT_HTTPD}${URL}?mongo=mongo&username=' \
| tac \
| tac \
| grep -Ei 'Database.+Collation.+Tables' >/dev/null" \
"${RETRIES}" "" "0"; then
printf "\\r[FAIL] Adminer Mongo login\\n"
run "curl -v 'http://localhost:${HOST_PORT_HTTPD}${URL}?mongo=mongo&username=' || true"
run "curl -vI 'http://localhost:${HOST_PORT_HTTPD}${URL}?mongo=mongo&username=' || true"
exit 1
else
printf "\\r[OK] Adminer Mongo login\\n"
fi

View File

@ -23,72 +23,43 @@ echo "# ------------------------------------------------------------------------
echo
# -------------------------------------------------------------------------------------------------
# Pre-check
# -------------------------------------------------------------------------------------------------
PHP_VERSION="$( get_php_version "${DVLBOX_PATH}" )"
if [[ ${DISABLED_VERSIONS[*]} =~ ${PHP_VERSION} ]]; then
printf "[SKIP] Skipping all checks for PHP %s\\n" "${PHP_VERSION}"
exit 0
fi
# -------------------------------------------------------------------------------------------------
# ENTRYPOINT
# -------------------------------------------------------------------------------------------------
###
### Get current PHP version
### Get required env values
###
printf "[TEST] Get PHP version"
# 1st Try
if ! PHP_VERSION="$( curl -sS --fail localhost/index.php | tac | tac | grep -Eo 'PHP.*?\([.0-9]+' | grep -Eo '\([.0-9]+' | grep -Eo '[0-9]+\.[0-9]+' )"; then
# 2nd Try
sleep 1
if ! PHP_VERSION="$( curl -sS --fail localhost/index.php | tac | tac | grep -Eo 'PHP.*?\([.0-9]+' | grep -Eo '\([.0-9]+' | grep -Eo '[0-9]+\.[0-9]+' )"; then
# 3rd Try
sleep 1
if ! PHP_VERSION="$( curl -sS --fail localhost/index.php | tac | tac | grep -Eo 'PHP.*?\([.0-9]+' | grep -Eo '\([.0-9]+' | grep -Eo '[0-9]+\.[0-9]+' )"; then
printf "\r[FAIL] Get PHP version\n"
curl localhost/index.php | tac | tac | grep -Eo 'PHP.*?\([.0-9]+' || true
exit 1
else
printf "\r[OK] Get PHP version (3 rounds): %s\n" "${PHP_VERSION}"
fi
else
printf "\r[OK] Get PHP version (2 rounds): %s\n" "${PHP_VERSION}"
fi
else
printf "\r[OK] Get PHP version (1 round): %s\n" "${PHP_VERSION}"
fi
###
### Ensure only to check against desired versions
###
if [[ ${DISABLED_VERSIONS[*]} =~ ${PHP_VERSION} ]]; then
printf "[SKIP] Skipping all checks for PHP ${PHP_VERSION}\n"
exit 0
fi
HOST_PORT_HTTPD="$( "${SCRIPT_PATH}/../scripts/env-getvar.sh" "HOST_PORT_HTTPD" )"
###
### Retrieve URL for current PHP version.
### Older PHP versions are presented a link with a different version due to compatibility.
###
printf "[TEST] Retrieve phpMyAdmin URL"
# 1st Try
if ! URL="$( curl -sS --fail localhost/index.php | grep -Eo "/vendor/phpmyadmin-[.0-9]+/index\.php" )"; then
# 2nd Try
sleep 1
if ! URL="$( curl -sS --fail localhost/index.php | grep -Eo "/vendor/phpmyadmin-[.0-9]+/index\.php" )"; then
# 3rd Try
sleep 1
if ! URL="$( curl -sS --fail localhost/index.php | grep -Eo "/vendor/phpmyadmin-[.0-9]+/index\.php" )"; then
printf "\r[FAILED] Retrieve phpMyAdmin URL\n"
curl localhost/index.php | grep -Eo "/vendor/phpmyadmin-[.0-9]+/index\.php" || true
exit 1
else
printf "\r[OK] Retrieve phpMyAdmin URL (3 rounds): ${URL}\n"
fi
else
printf "\r[OK] Retrieve phpMyAdmin URL (2 rounds): ${URL}\n"
fi
if ! URL="$( run "\
curl -sS --fail 'http://localhost:${HOST_PORT_HTTPD}/index.php' \
| tac \
| tac \
| grep -Eo '/vendor/phpmyadmin-[.0-9]+/index\\.php'" \
"${RETRIES}" "" "0" )"; then
printf "\\r[FAILED] Retrieve phpMyAdmin URL\\n"
run "curl -sS 'http://localhost:${HOST_PORT_HTTPD}/index.php' || true"
exit 1
else
printf "\r[OK] Retrieve phpMyAdmin URL (1 round): ${URL}\n"
printf "\\r[OK] Retrieve phpMyAdmin URL: %s\\n" "${URL}"
fi
@ -105,18 +76,18 @@ fi
# # 3rd Try
# sleep 1
# if ! curl -sS localhost${URL} | tac | tac | grep -Eiq "welcome to.+phpMyAdmin"; then
# printf "\r[FAIL] Fetch ${URL}\n"
# printf "\\r[FAIL] Fetch ${URL}\\n"
# curl -sS localhost/${URL} || true
# curl -sSI localhost/${URL} || true
# exit 1
# else
# printf "\r[OK] Fetch ${URL} (3 rounds)\n"
# printf "\\r[OK] Fetch ${URL} (3 rounds)\\n"
# fi
# else
# printf "\r[OK] Fetch ${URL} (2 rounds)\n"
# printf "\\r[OK] Fetch ${URL} (2 rounds)\\n"
# fi
#else
# printf "\r[OK] Fetch ${URL} (1 round)\n"
# printf "\\r[OK] Fetch ${URL} (1 round)\\n"
#fi
#
#
@ -237,7 +208,7 @@ fi
# # All set
# break
#done
#printf "\r[OK] Retrieve phpMyAdmin login page\r\n"
#printf "\\r[OK] Retrieve phpMyAdmin login page\r\\n"
#
#
#printf "[TEST] Exract phpMyAdmin login token"
@ -246,22 +217,22 @@ fi
# | head -1 \
# | grep -Eo "value=\".+\"" \
# | sed -e 's/^value="//g' -e 's/"$//g' )"; then
# printf "\r[FAIL] Exract phpMyAdmin login token\n"
# printf "\\r[FAIL] Exract phpMyAdmin login token\\n"
# rm -f cookie.txt || true
# echo "${CONTENT}"
# exit 1
#fi
#printf "\r[OK] Exract phpMyAdmin login token: \"%s\"\n" "${TOKEN}"
#printf "\\r[OK] Exract phpMyAdmin login token: \"%s\"\\n" "${TOKEN}"
#
#printf "[TEST] Extract phpMyAdmin login session"
#if ! SESSION="$( echo "${CONTENT}" \
# | grep -Eo "name=\"set_session\" value=\"[A-Fa-f0-9]+\"" \
# | grep -Eo "value=\"[A-Fa-f0-9]+\"" \
# | sed -e 's/^value="//g' -e 's/"$//g' )"; then
# printf "\r[OK] Extract phpMyAdmin login session (not available)\n"
# printf "\\r[OK] Extract phpMyAdmin login session (not available)\\n"
# SESSION=""
#else
# printf "\r[OK] Extract phpMyAdmin login session: \"%s\"\n" "${SESSION}"
# printf "\\r[OK] Extract phpMyAdmin login session: \"%s\"\\n" "${SESSION}"
#fi
#
#
@ -274,43 +245,39 @@ fi
# # 3rd Try
# sleep 1
# if ! curl -sS -c cookie.txt -b cookie.txt -d "pma_username=root&pma_password=&server=1&target=index.php&token=${TOKEN}&set_session=${SESSION}" localhost${URL}; then
# printf "\r[FAIL] Submit phpMyAdmin POST login\n"
# printf "\\r[FAIL] Submit phpMyAdmin POST login\\n"
# curl -sS -c cookie.txt -b cookie.txt localhost/${URL} || true
# curl -sSI -c cookie.txt -b cookie.txt localhost/${URL} || true
# rm -f cookie.txt || true
# exit 1
# else
# printf "\r[OK] Submit phpMyAdmin POST login (3 rounds)\n"
# printf "\\r[OK] Submit phpMyAdmin POST login (3 rounds)\\n"
# fi
# else
# printf "\r[OK] Submit phpMyAdmin POST login (2 rounds)\n"
# printf "\\r[OK] Submit phpMyAdmin POST login (2 rounds)\\n"
# fi
#else
# printf "\r[OK] Submit phpMyAdmin POST login (1 round)\n"
# printf "\\r[OK] Submit phpMyAdmin POST login (1 round)\\n"
#fi
###
### Evaluate if we're logged in
###
printf "[TEST] Evaluate successful phpMyAdmin login"
# 1st Try
if [ "$( curl -sS --fail -c cookie.txt -b cookie.txt localhost${URL} | tac | tac | grep -Ec "(Databases<.+SQL<.+Status<.+Users<.+Export<)|(\"User accounts\")" )" != "1" ]; then
# 2nd Try
sleep 1
if [ "$( curl -sS --fail -c cookie.txt -b cookie.txt localhost${URL} | tac | tac | grep -Ec "(Databases<.+SQL<.+Status<.+Users<.+Export<|(\"User accounts\")" )" != "1" ]; then
# 3rd Try
sleep 1
if [ "$( curl -sS --fail -c cookie.txt -b cookie.txt localhost${URL} | tac | tac | grep -Ec "(Databases<.+SQL<.+Status<.+Users<.+Export<|(\"User accounts\")" )" != "1" ]; then
printf "\r[FAIL] Evaluate successful phpMyAdmin login\n"
curl -c cookie.txt -b cookie.txt localhost/${URL} || true
curl -I -c cookie.txt -b cookie.txt localhost/${URL} || true
rm -f cookie.txt || true
exit 1
else
printf "\r[OK] Evaluate successful phpMyAdmin login (3 rounds)\n"
fi
else
printf "\r[OK] Evaluate successful phpMyAdmin login (2 rounds)\n"
fi
if [ "$( run "\
curl -sS --fail -c cookie.txt -b cookie.txt 'http://localhost:${HOST_PORT_HTTPD}${URL}' \
| tac \
| tac \
| grep -Ec '(Databases<.+SQL<.+Status<.+Users<.+Export<)|(\"User accounts\")'" \
"${RETRIES}" "" "0" )" != "1" ]; then
printf "\\r[FAIL] Evaluate successful phpMyAdmin login\\n"
run "curl -sS -c cookie.txt -b cookie.txt 'http://localhost:${HOST_PORT_HTTPD}${URL}' || true"
run "curl -sS -I -c cookie.txt -b cookie.txt 'http://localhost:${HOST_PORT_HTTPD}${URL}' || true"
rm -f cookie.txt || true
exit 1
else
printf "\r[OK] Evaluate successful phpMyAdmin login (1 round)\n"
printf "\\r[OK] Evaluate successful phpMyAdmin login\\n"
fi
rm -f cookie.txt || true
@ -324,99 +291,117 @@ CONFIGPATH="${DVLBOXPATH}/.devilbox/www/htdocs${URL%index\.php}config.inc.php"
printf "[TEST] config.inc.php exists"
if [ ! -f "${CONFIGPATH}" ]; then
printf "\r[FAIL] config.inc.php exists: no\n"
printf "\\r[FAIL] config.inc.php exists: no\\n"
exit 1
else
printf "\r[OK] config.inc.php exists: yes\n"
printf "\\r[OK] config.inc.php exists: yes\\n"
fi
# error_reporting(-1);
printf "[TEST] config.inc.php check: error_reporting(-1);"
if ! grep -q "^error_reporting(-1);" "${CONFIGPATH}"; then
printf "\r[FAIL] config.inc.php check: error_reporting(-1);\n"
cat "${CONFIGPATH}"
if ! grep -E "^error_reporting\\(-1\\);" "${CONFIGPATH}" >/dev/null; then
printf "\\r[FAIL] config.inc.php check: error_reporting(-1);\\n"
if ! grep 'error_reporting' "${CONFIGPATH}"; then
cat "${CONFIGPATH}"
fi
exit 1
else
printf "\r[OK] config.inc.php check: error_reporting(-1);\n"
printf "\\r[OK] config.inc.php check: error_reporting(-1);\\n"
fi
# $cfg['TempDir'] = '/tmp';
printf "[TEST] config.inc.php check: \$cfg['TempDir'] = '/tmp';"
if ! grep -q "^\$cfg\['TempDir'\]\s*=\s*'/tmp';" "${CONFIGPATH}"; then
printf "\r[FAIL] config.inc.php check: \$cfg['TempDir'] = '/tmp';\n"
cat "${CONFIGPATH}"
if ! grep -E "^\\\$cfg\\['TempDir'\\][[:space:]]*=[[:space:]]*'/tmp';" "${CONFIGPATH}" >/dev/null; then
printf "\\r[FAIL] config.inc.php check: \$cfg['TempDir'] = '/tmp';\\n"
if ! grep 'TempDir' "${CONFIGPATH}"; then
cat "${CONFIGPATH}"
fi
exit 1
else
printf "\r[OK] config.inc.php check: \$cfg['TempDir'] = '/tmp';\n"
printf "\\r[OK] config.inc.php check: \$cfg['TempDir'] = '/tmp';\\n"
fi
# $cfg['CheckConfigurationPermissions'] = false;
printf "[TEST] config.inc.php check: \$cfg['CheckConfigurationPermissions'] = false;"
if ! grep -q "^\$cfg\['CheckConfigurationPermissions'\]\s*=\s*false;" "${CONFIGPATH}"; then
printf "\r[FAIL] config.inc.php check: \$cfg['CheckConfigurationPermissions'] = false;\n"
cat "${CONFIGPATH}"
if ! grep -E "^\\\$cfg\\['CheckConfigurationPermissions'\\][[:space:]]*=[[:space:]]*false;" "${CONFIGPATH}" >/dev/null; then
printf "\\r[FAIL] config.inc.php check: \$cfg['CheckConfigurationPermissions'] = false;\\n"
if ! grep 'CheckConfigurationPermissions' "${CONFIGPATH}"; then
cat "${CONFIGPATH}"
fi
exit 1
else
printf "\r[OK] config.inc.php check: \$cfg['CheckConfigurationPermissions'] = false;\n"
printf "\\r[OK] config.inc.php check: \$cfg['CheckConfigurationPermissions'] = false;\\n"
fi
# $cfg['blowfish_secret'] = '...'
printf "[TEST] config.inc.php check: \$cfg['blowfish_secret'] = '...';"
if ! grep -qE '^\$cfg\['"'"'blowfish_secret'"'"'\]\s*=\s*'"'"'.{32,}'"'"';' "${CONFIGPATH}"; then
printf "\r[FAIL] config.inc.php check: \$cfg['blowfish_secret'] = '...';\n"
cat "${CONFIGPATH}"
if ! grep -E "^\\\$cfg\\['blowfish_secret'\\][[:space:]]*=[[:space:]]*'.{32,}';" "${CONFIGPATH}" >/dev/null; then
printf "\\r[FAIL] config.inc.php check: \$cfg['blowfish_secret'] = '...';\\n"
if ! grep 'blowfish_secret' "${CONFIGPATH}"; then
cat "${CONFIGPATH}"
fi
exit 1
else
printf "\r[OK] config.inc.php check: \$cfg['blowfish_secret'] = '...';\n"
printf "\\r[OK] config.inc.php check: \$cfg['blowfish_secret'] = '...';\\n"
fi
# $cfg['SendErrorReports'] = 'never';
printf "[TEST] config.inc.php check: \$cfg['SendErrorReports'] = 'never';"
if ! grep -q "^\$cfg\['SendErrorReports'\]\s*=\s*'never';" "${CONFIGPATH}"; then
printf "\r[FAIL] config.inc.php check: \$cfg['SendErrorReports'] = 'never';\n"
cat "${CONFIGPATH}"
if ! grep "^\\\$cfg\\['SendErrorReports'\\][[:space:]]*=[[:space:]]*'never';" "${CONFIGPATH}" >/dev/null; then
printf "\\r[FAIL] config.inc.php check: \$cfg['SendErrorReports'] = 'never';\\n"
if ! grep 'SendErrorReports' "${CONFIGPATH}"; then
cat "${CONFIGPATH}"
fi
exit 1
else
printf "\r[OK] config.inc.php check: \$cfg['SendErrorReports'] = 'never';\n"
printf "\\r[OK] config.inc.php check: \$cfg['SendErrorReports'] = 'never';\\n"
fi
# $cfg['Servers'][$i]['host'] = 'mysql';
printf "[TEST] config.inc.php check: \$cfg['Servers'][\$i]['host'] = 'mysql';"
if ! grep -q "^\$cfg\['Servers'\]\[\$i\]\['host'\]\s*=\s*'mysql';" "${CONFIGPATH}"; then
printf "\r[FAIL] config.inc.php check: \$cfg['Servers'][\$i]['host'] = 'mysql';\n"
cat "${CONFIGPATH}"
if ! grep "^\\\$cfg\\['Servers'\\]\\[\$i\\]\\['host'\\][[:space:]]*=[[:space:]]*'mysql';" "${CONFIGPATH}" >/dev/null; then
printf "\\r[FAIL] config.inc.php check: \$cfg['Servers'][\$i]['host'] = 'mysql';\\n"
if ! grep 'Servers' "${CONFIGPATH}" | grep 'host'; then
cat "${CONFIGPATH}"
fi
exit 1
else
printf "\r[OK] config.inc.php check: \$cfg['Servers'][\$i]['host'] = 'mysql';\n"
printf "\\r[OK] config.inc.php check: \$cfg['Servers'][\$i]['host'] = 'mysql';\\n"
fi
# $cfg['Servers'][$i]['connect_type'] = 'tcp';
printf "[TEST] config.inc.php check: \$cfg['Servers'][\$i]['connect_type'] = 'tcp';"
if ! grep -q "^\$cfg\['Servers'\]\[\$i\]\['connect_type'\]\s*=\s*'tcp';" "${CONFIGPATH}"; then
printf "\r[FAIL] config.inc.php check: \$cfg['Servers'][\$i]['connect_type'] = 'tcp';\n"
cat "${CONFIGPATH}"
if ! grep "^\\\$cfg\\['Servers'\\]\\[\$i\\]\\['connect_type'\\][[:space:]]*=[[:space:]]*'tcp';" "${CONFIGPATH}" >/dev/null; then
printf "\\r[FAIL] config.inc.php check: \$cfg['Servers'][\$i]['connect_type'] = 'tcp';\\n"
if ! grep 'Servers' "${CONFIGPATH}" | grep 'connect_type'; then
cat "${CONFIGPATH}"
fi
exit 1
else
printf "\r[OK] config.inc.php check: \$cfg['Servers'][\$i]['connect_type'] = 'tcp';\n"
printf "\\r[OK] config.inc.php check: \$cfg['Servers'][\$i]['connect_type'] = 'tcp';\\n"
fi
# $cfg['Servers'][$i]['compress'] = false;
printf "[TEST] config.inc.php check: \$cfg['Servers'][\$i]['compress'] = false;"
if ! grep -q "^\$cfg\['Servers'\]\[\$i\]\['compress'\]\s*=\s*false;" "${CONFIGPATH}"; then
printf "\r[FAIL] config.inc.php check: \$cfg['Servers'][\$i]['compress'] = false;\n"
cat "${CONFIGPATH}"
if ! grep "^\\\$cfg\\['Servers'\\]\\[\$i\\]\\['compress'\\][[:space:]]*=[[:space:]]*false;" "${CONFIGPATH}" >/dev/null; then
printf "\\r[FAIL] config.inc.php check: \$cfg['Servers'][\$i]['compress'] = false;\\n"
if ! grep 'Servers' "${CONFIGPATH}" | grep 'compress'; then
cat "${CONFIGPATH}"
fi
exit 1
else
printf "\r[OK] config.inc.php check: \$cfg['Servers'][\$i]['compress'] = false;\n"
printf "\\r[OK] config.inc.php check: \$cfg['Servers'][\$i]['compress'] = false;\\n"
fi
# $cfg['Servers'][$i]['AllowNoPassword'] = true;
printf "[TEST] config.inc.php check: \$cfg['Servers'][\$i]['compress'] = false;"
if ! grep -q "^\$cfg\['Servers'\]\[\$i\]\['AllowNoPassword'\]\s*=\s*true;" "${CONFIGPATH}"; then
printf "\r[FAIL] config.inc.php check: \$cfg['Servers'][\$i]['AllowNoPassword'] = true;\n"
cat "${CONFIGPATH}"
printf "[TEST] config.inc.php check: \$cfg['Servers'][\$i]['AllowNoPassword'] = false;"
if ! grep "^\\\$cfg\\['Servers'\\]\\[\$i\\]\\['AllowNoPassword'\\][[:space:]]*=[[:space:]]*true;" "${CONFIGPATH}" >/dev/null; then
printf "\\r[FAIL] config.inc.php check: \$cfg['Servers'][\$i]['AllowNoPassword'] = true;\\n"
if ! grep 'Servers' "${CONFIGPATH}" | grep 'AllowNoPassword'; then
cat "${CONFIGPATH}"
fi
exit 1
else
printf "\r[OK] config.inc.php check: \$cfg['Servers'][\$i]['AllowNoPassword'] = true;\n"
printf "\\r[OK] config.inc.php check: \$cfg['Servers'][\$i]['AllowNoPassword'] = true;\\n"
fi

View File

@ -12,7 +12,7 @@ DVLBOX_PATH="$( cd "${SCRIPT_PATH}/../.." && pwd -P )"
# shellcheck disable=SC1090
. "${SCRIPT_PATH}/../scripts/.lib.sh"
RETRIES=10
#RETRIES=10
DISABLED_VERSIONS=("8.0")
@ -23,128 +23,105 @@ echo "# ------------------------------------------------------------------------
echo
# -------------------------------------------------------------------------------------------------
# Pre-check
# -------------------------------------------------------------------------------------------------
PHP_VERSION="$( get_php_version "${DVLBOX_PATH}" )"
if [[ ${DISABLED_VERSIONS[*]} =~ ${PHP_VERSION} ]]; then
printf "[SKIP] Skipping all checks for PHP %s\\n" "${PHP_VERSION}"
exit 0
fi
# -------------------------------------------------------------------------------------------------
# ENTRYPOINT
# -------------------------------------------------------------------------------------------------
###
### Get current PHP version
### Get required env values
###
printf "[TEST] Get PHP version"
# 1st Try
if ! PHP_VERSION="$( curl -sS --fail localhost/index.php | tac | tac | grep -Eo 'PHP.*?\([.0-9]+' | grep -Eo '\([.0-9]+' | grep -Eo '[0-9]+\.[0-9]+' )"; then
# 2nd Try
sleep 1
if ! PHP_VERSION="$( curl -sS --fail localhost/index.php | tac | tac | grep -Eo 'PHP.*?\([.0-9]+' | grep -Eo '\([.0-9]+' | grep -Eo '[0-9]+\.[0-9]+' )"; then
# 3rd Try
sleep 1
if ! PHP_VERSION="$( curl -sS --fail localhost/index.php | tac | tac | grep -Eo 'PHP.*?\([.0-9]+' | grep -Eo '\([.0-9]+' | grep -Eo '[0-9]+\.[0-9]+' )"; then
printf "\r[FAIL] Get PHP version\n"
curl localhost/index.php | tac | tac | grep -Eo 'PHP.*?\([.0-9]+' || true
exit 1
else
printf "\r[OK] Get PHP version (3 rounds): %s\n" "${PHP_VERSION}"
fi
else
printf "\r[OK] Get PHP version (2 rounds): %s\n" "${PHP_VERSION}"
fi
else
printf "\r[OK] Get PHP version (1 round): %s\n" "${PHP_VERSION}"
fi
###
### Ensure only to check against desired versions
###
if [[ ${DISABLED_VERSIONS[*]} =~ ${PHP_VERSION} ]]; then
printf "[SKIP] Skipping all checks for PHP ${PHP_VERSION}\n"
exit 0
fi
HOST_PORT_HTTPD="$( "${SCRIPT_PATH}/../scripts/env-getvar.sh" "HOST_PORT_HTTPD" )"
###
### Retrieve URL for current PHP version.
### Older PHP versions are presented a link with a different version due to compatibility.
###
printf "[TEST] Retrieve phpPgAdmin URL"
# 1st Try
if ! URL="$( curl -sS --fail localhost/index.php | grep -Eo "/vendor/phppgadmin-[.0-9]+/" )"; then
if ! URL="$( curl -sS --fail "http://localhost:${HOST_PORT_HTTPD}/index.php" | grep -Eo "/vendor/phppgadmin-[.0-9]+/" )"; then
# 2nd Try
sleep 1
if ! URL="$( curl -sS --fail localhost/index.php | grep -Eo "/vendor/phppgadmin-[.0-9]+/" )"; then
if ! URL="$( curl -sS --fail "http://localhost:${HOST_PORT_HTTPD}/index.php" | grep -Eo "/vendor/phppgadmin-[.0-9]+/" )"; then
# 3rd Try
sleep 1
if ! URL="$( curl -sS --fail localhost/index.php | grep -Eo "/vendor/phppgadmin-[.0-9]+/" )"; then
printf "\r[FAILED] Retrieve phpMyAdmin URL\n"
curl localhost/index.php | grep -Eo "/vendor/phppgadmin-[.0-9]+/" || true
if ! URL="$( curl -sS --fail "http://localhost:${HOST_PORT_HTTPD}/index.php" | grep -Eo "/vendor/phppgadmin-[.0-9]+/" )"; then
printf "\\r[FAILED] Retrieve phpMyAdmin URL\\n"
curl -sS "http://localhost:${HOST_PORT_HTTPD}/index.php" | grep -Eo "/vendor/phppgadmin-[.0-9]+/" || true
exit 1
else
printf "\r[OK] Retrieve phpPgAdmin URL (3 rounds): ${URL}\n"
printf "\\r[OK] Retrieve phpPgAdmin URL (3 rounds): %s\\n" "${URL}"
fi
else
printf "\r[OK] Retrieve phpPgAdmin URL (2 rounds): ${URL}\n"
printf "\\r[OK] Retrieve phpPgAdmin URL (2 rounds): %s\\n" "${URL}"
fi
else
printf "\r[OK] Retrieve phpPgAdmin URL (1 round): ${URL}\n"
printf "\\r[OK] Retrieve phpPgAdmin URL (1 round): %s\\n" "${URL}n"
fi
###
### Ensure given phpPgAdmin version works
###
printf "[TEST] Fetch ${URL}intro.php"
printf "[TEST] Fetch %sintro.php" "${URL}"
# 1st Try
if ! curl -sS --fail localhost${URL}intro.php | tac | tac | grep -Eiq "welcome to phpPgAdmin"; then
if ! curl -sS --fail "http://localhost:${HOST_PORT_HTTPD}${URL}intro.php" | tac | tac | grep -Eiq "welcome to phpPgAdmin"; then
# 2nd Try
sleep 1
if ! curl -sS --fail localhost${URL}intro.php | tac | tac | grep -Eiq "welcome to phpPgAdmin"; then
if ! curl -sS --fail "http://localhost:${HOST_PORT_HTTPD}${URL}intro.php" | tac | tac | grep -Eiq "welcome to phpPgAdmin"; then
# 3rd Try
sleep 1
if ! curl -sS --fail localhost${URL}intro.php | tac | tac | grep -Eiq "welcome to phpPgAdmin"; then
printf "\r[FAIL] Fetch ${URL}intro.php\n"
curl localhost/${URL}intro.php || true
curl -I localhost/${URL}intro.php || true
if ! curl -sS --fail "http://localhost:${HOST_PORT_HTTPD}${URL}intro.php" | tac | tac | grep -Eiq "welcome to phpPgAdmin"; then
printf "\\r[FAIL] Fetch %sintro.php\\n" "${URL}"
curl -sS "http://localhost:${HOST_PORT_HTTPD}${URL}intro.php" || true
curl -sS -I "http://localhost:${HOST_PORT_HTTPD}${URL}intro.php" || true
exit 1
else
printf "\r[OK] Fetch ${URL}intro.php (3 rounds)\n"
printf "\\r[OK] Fetch %sintro.php (3 rounds)\\n" "${URL}"
fi
else
printf "\r[OK] Fetch ${URL}intro.php (2 rounds)\n"
printf "\\r[OK] Fetch %sintro.php (2 rounds)\\n" "${URL}"
fi
else
printf "\r[OK] Fetch ${URL}intro.php (1 round)\n"
printf "\\r[OK] Fetch %sintro.php (1 round)\\n" "${URL}"
fi
###
### Evaluate successful phpPgAdmin login
###
printf "[TEST] Evaluate successful phpPgAdmin login"
# 1st Try
if [ "$(curl -sS --fail "localhost${URL}redirect.php?subject=server&server=pgsql%3A5432%3Aallow&" | tac | tac | grep -Ec 'data">(Database|Owner|Collation|Tablespace)')" != "4" ]; then
if [ "$(curl -sS --fail "http://localhost:${HOST_PORT_HTTPD}${URL}redirect.php?subject=server&server=pgsql%3A5432%3Aallow&" | tac | tac | grep -Ec 'data">(Database|Owner|Collation|Tablespace)')" != "4" ]; then
# 2nd Try
sleep 1
if [ "$(curl -sS --fail "localhost${URL}redirect.php?subject=server&server=pgsql%3A5432%3Aallow&" | tac | tac | grep -Ec 'data">(Database|Owner|Collation|Tablespace)')" != "4" ]; then
if [ "$(curl -sS --fail "http://localhost:${HOST_PORT_HTTPD}${URL}redirect.php?subject=server&server=pgsql%3A5432%3Aallow&" | tac | tac | grep -Ec 'data">(Database|Owner|Collation|Tablespace)')" != "4" ]; then
# 3rd Try
sleep 1
if [ "$(curl -sS --fail "localhost${URL}redirect.php?subject=server&server=pgsql%3A5432%3Aallow&" | tac | tac | grep -Ec 'data">(Database|Owner|Collation|Tablespace)')" != "4" ]; then
printf "\r[FAIL] Evaluate successful phpPgAdmin login\n"
curl "localhost/${URL}redirect.php?subject=server&server=pgsql%3A5432%3Aallow&" || true
curl -I "localhost/${URL}redirect.php?subject=server&server=pgsql%3A5432%3Aallow&" || true
if [ "$(curl -sS --fail "http://localhost:${HOST_PORT_HTTPD}${URL}redirect.php?subject=server&server=pgsql%3A5432%3Aallow&" | tac | tac | grep -Ec 'data">(Database|Owner|Collation|Tablespace)')" != "4" ]; then
printf "\\r[FAIL] Evaluate successful phpPgAdmin login\\n"
curl -sS "http://localhost:${HOST_PORT_HTTPD}${URL}redirect.php?subject=server&server=pgsql%3A5432%3Aallow&" || true
curl -sS -I "http://localhost:${HOST_PORT_HTTPD}${URL}redirect.php?subject=server&server=pgsql%3A5432%3Aallow&" || true
exit 1
else
printf "\r[OK] Evaluate successful phpPgAdmin login (3 rounds)\n"
printf "\\r[OK] Evaluate successful phpPgAdmin login (3 rounds)\\n"
fi
else
printf "\r[OK] Evaluate successful phpPgAdmin login (2 rounds)\n"
printf "\\r[OK] Evaluate successful phpPgAdmin login (2 rounds)\\n"
fi
else
printf "\r[OK] Evaluate successful phpPgAdmin login (1 round)\n"
printf "\\r[OK] Evaluate successful phpPgAdmin login (1 round)\\n"
fi
@ -160,7 +137,7 @@ fi
# # 3rd Try
# sleep 1
# if ! TOKEN_URL="$( curl -sS -c cookie.txt localhost${URL}servers.php | tac | tac | grep -Eo "\"redirect\.php\?subject=server.+\"" )"; then
# printf "\r[FAIL] Retrieve phpPgAdmin login page\n"
# printf "\\r[FAIL] Retrieve phpPgAdmin login page\\n"
# curl -sS localhost/${URL}servers.php || true
# curl -sSI localhost/${URL}servers.php || true
# rm -f cookie.txt
@ -168,17 +145,17 @@ fi
# else
# TOKEN_URL="$( echo "${TOKEN_URL}" | sed 's/"//g' )"
# TOKEN_URL="$( echo "${TOKEN_URL}" | sed 's/&amp;/\&/g' )"
# printf "\r[OK] Retrieve phpPgAdmin token page (3 rounds): ${TOKEN_URL}\n"
# printf "\\r[OK] Retrieve phpPgAdmin token page (3 rounds): ${TOKEN_URL}\\n"
# fi
# else
# TOKEN_URL="$( echo "${TOKEN_URL}" | sed 's/"//g' )"
# TOKEN_URL="$( echo "${TOKEN_URL}" | sed 's/&amp;/\&/g' )"
# printf "\r[OK] Retrieve phpPgAdmin login token (2 rounds): ${TOKEN_URL}\n"
# printf "\\r[OK] Retrieve phpPgAdmin login token (2 rounds): ${TOKEN_URL}\\n"
# fi
#else
# TOKEN_URL="$( echo "${TOKEN_URL}" | sed 's/"//g' )"
# TOKEN_URL="$( echo "${TOKEN_URL}" | sed 's/&amp;/\&/g' )"
# printf "\r[OK] Retrieve phpPgAdmin token page (1 round): ${TOKEN_URL}\n"
# printf "\\r[OK] Retrieve phpPgAdmin token page (1 round): ${TOKEN_URL}\\n"
#fi
#
#
@ -195,22 +172,22 @@ fi
# # 3rd Try
# sleep 1
# if ! TOKEN="$( curl -sS -c cookie.txt -b cookie.txt "localhost${URL}${TOKEN_URL}" | tac | tac | grep -Eo "loginPassword_[a-zA-Z0-9]+" )"; then
# printf "\r[FAIL] Retrieve phpPgAdmin login token\n"
# printf "\\r[FAIL] Retrieve phpPgAdmin login token\\n"
# curl -sS "${TOKEN_URL_URL}" || true
# curl -sSI "${TOKEN_URL_URL}" || true
# rm -f cookie.txt
# exit 1
# else
# TOKEN="$( echo "${TOKEN}" | head -1 )"
# printf "\r[OK] Retrieve phpPgAdmin login token (3 rounds): ${TOKEN}\n"
# printf "\\r[OK] Retrieve phpPgAdmin login token (3 rounds): ${TOKEN}\\n"
# fi
# else
# TOKEN="$( echo "${TOKEN}" | head -1 )"
# printf "\r[OK] Retrieve phpPgAdmin login token (2 rounds): ${TOKEN}\n"
# printf "\\r[OK] Retrieve phpPgAdmin login token (2 rounds): ${TOKEN}\\n"
# fi
#else
# TOKEN="$( echo "${TOKEN}" | head -1 )"
# printf "\r[OK] Retrieve phpPgAdmin login token (1 round): ${TOKEN}\n"
# printf "\\r[OK] Retrieve phpPgAdmin login token (1 round): ${TOKEN}\\n"
#fi
#
#
@ -233,7 +210,7 @@ fi
# if ! curl -sS -c cookie.txt -b cookie.txt \
# -d "subject=server&server=pgsql%3A5432%3Aallow&loginServer=pgsql%3A5432%3Aallow&loginUsername=postgres&${TOKEN}=&loginSubmit=Login" \
# localhost${URL}redirect.php 2>/dev/null | grep -q "Create database"; then
# printf "\r[FAIL] Submit phpPgAdmin POST login\n"
# printf "\\r[FAIL] Submit phpPgAdmin POST login\\n"
# curl -sS -c cookie.txt -b cookie.txt \
# -d "subject=server&server=pgsql%3A5432%3Aallow&loginServer=pgsql%3A5432%3Aallow&loginUsername=postgres&${TOKEN}=&loginSubmit=Login" \
# localhost${URL}redirect.php || true
@ -243,13 +220,13 @@ fi
# rm -f cookie.txt || true
# exit 1
# else
# printf "\r[OK] Submit phpPgAdmin POST login (3 rounds)\n"
# printf "\\r[OK] Submit phpPgAdmin POST login (3 rounds)\\n"
# fi
# else
# printf "\r[OK] Submit phpPgAdmin POST login (2 rounds)\n"
# printf "\\r[OK] Submit phpPgAdmin POST login (2 rounds)\\n"
# fi
#else
# printf "\r[OK] Submit phpPgAdmin POST login (1 round)\n"
# printf "\\r[OK] Submit phpPgAdmin POST login (1 round)\\n"
#fi
#
#rm -f cookie.txt || true

View File

@ -18,108 +18,67 @@ DISABLED_VERSIONS=("5.2" "5.3" "5.4")
echo
echo "# --------------------------------------------------------------------------------------------------"
echo "# [Vendor] phpReadmin"
echo "# [Vendor] phpRedmin"
echo "# --------------------------------------------------------------------------------------------------"
echo
# -------------------------------------------------------------------------------------------------
# Pre-check
# -------------------------------------------------------------------------------------------------
PHP_VERSION="$( get_php_version "${DVLBOX_PATH}" )"
if [[ ${DISABLED_VERSIONS[*]} =~ ${PHP_VERSION} ]]; then
printf "[SKIP] Skipping all checks for PHP %s\\n" "${PHP_VERSION}"
exit 0
fi
# -------------------------------------------------------------------------------------------------
# ENTRYPOINT
# -------------------------------------------------------------------------------------------------
###
### Get required env values
###
HOST_PORT_HTTPD="$( "${SCRIPT_PATH}/../scripts/env-getvar.sh" "HOST_PORT_HTTPD" )"
###
### Ensure PHPRedmin works
###
URL="/vendor/phpredmin/public/index.php"
printf "[TEST] Fetch ${URL}"
# 1st Try
if [ "$(curl -sS --fail localhost${URL} | tac | tac | grep -Ec "Strings|Hashes|Lists|Sets|Sorted Sets")" != "5" ]; then
# 2nd Try
sleep 1
if [ "$(curl -sS --fail localhost${URL} | tac | tac | grep -Ec "Strings|Hashes|Lists|Sets|Sorted Sets")" != "5" ]; then
# 3rd Try
sleep 1
if [ "$(curl -sS --fail localhost${URL} | tac | tac | grep -Ec "Strings|Hashes|Lists|Sets|Sorted Sets")" != "5" ]; then
printf "\r[FAIL] Fetch ${URL}\n"
curl localhost/${URL} || true
curl -I localhost/${URL} || true
exit 1
else
printf "\r[OK] Fetch ${URL} (3 rounds)\n"
fi
else
printf "\r[OK] Fetch ${URL} (2 rounds)\n"
fi
printf "[TEST] Fetch %s" "${URL}"
if [ "$( run "\
curl -sS --fail 'http://localhost:${HOST_PORT_HTTPD}${URL}' \
| tac \
| tac \
| grep -Ec 'Strings|Hashes|Lists|Sets|Sorted Sets'" \
"${RETRIES}" "" "0" )" != "5" ]; then
printf "\\r[FAIL] Fetch %s\\n" "${URL}"
run "curl -sS 'http://localhost:${HOST_PORT_HTTPD}${URL}' || true"
run "curl -sS -I 'http://localhost:${HOST_PORT_HTTPD}${URL}' || true"
exit 1
else
printf "\r[OK] Fetch ${URL} (1 round)\n"
fi
###
### Get current PHP version
###
printf "[TEST] Get PHP version"
# 1st Try
if ! PHP_VERSION="$( curl -sS --fail localhost/index.php | tac | tac | grep -Eo 'PHP.*?\([.0-9]+' | grep -Eo '\([.0-9]+' | grep -Eo '[0-9]+\.[0-9]+' )"; then
# 2nd Try
sleep 1
if ! PHP_VERSION="$( curl -sS --fail localhost/index.php | tac | tac | grep -Eo 'PHP.*?\([.0-9]+' | grep -Eo '\([.0-9]+' | grep -Eo '[0-9]+\.[0-9]+' )"; then
# 3rd Try
sleep 1
if ! PHP_VERSION="$( curl -sS --fail localhost/index.php | tac | tac | grep -Eo 'PHP.*?\([.0-9]+' | grep -Eo '\([.0-9]+' | grep -Eo '[0-9]+\.[0-9]+' )"; then
printf "\r[FAIL] Get PHP version\n"
curl localhost/index.php | tac | tac | grep -Eo 'PHP.*?\([.0-9]+' || true
exit 1
else
printf "\r[OK] Get PHP version (3 rounds): %s\n" "${PHP_VERSION}"
fi
else
printf "\r[OK] Get PHP version (2 rounds): %s\n" "${PHP_VERSION}"
fi
else
printf "\r[OK] Get PHP version (1 round): %s\n" "${PHP_VERSION}"
fi
###
### Ensure only to check against desired versions
###
if [[ ${DISABLED_VERSIONS[*]} =~ ${PHP_VERSION} ]]; then
printf "[SKIP] Skipping all checks for PHP ${PHP_VERSION}\n"
exit 0
printf "\\r[OK] Fetch %s\\n" "${URL}"
fi
###
### Ensure PHPRedmin works in subdirectory
###
URL="/vendor/phpredmin/public/index.php/welcome/info/0/0"
printf "[TEST] Fetch ${URL}"
# 1st Try
if [ "$(curl -sS --fail localhost${URL} | tac | tac | grep -Ec "(Version:)|(Mode:)|(Role:)|(OS:)|(Uptime:)")" != "5" ]; then
# 2nd Try
sleep 1
if [ "$(curl -sS --fail localhost${URL} | tac | tac | grep -Ec "(Version:)|(Mode:)|(Role:)|(OS:)|(Uptime:)")" != "5" ]; then
# 3rd Try
sleep 1
if [ "$(curl -sS --fail localhost${URL} | tac | tac | grep -Ec "(Version:)|(Mode:)|(Role:)|(OS:)|(Uptime:)")" != "5" ]; then
printf "\r[FAIL] Fetch ${URL}\n"
curl localhost/${URL} | tac | tac | grep -Ec "(Version:)|(Mode:)|(Role:)|(OS:)|(Uptime:)" || true
curl localhost/${URL} || true
curl -I localhost/${URL} || true
exit 1
else
printf "\r[OK] Fetch ${URL} (3 rounds)\n"
fi
else
printf "\r[OK] Fetch ${URL} (2 rounds)\n"
fi
printf "[TEST] Fetch %s" "${URL}"
if [ "$( run "\
curl -sS --fail 'http://localhost:${HOST_PORT_HTTPD}${URL}' \
| tac \
| tac \
| grep -Ec '(Version:)|(Mode:)|(Role:)|(OS:)|(Uptime:)'" \
"${RETRIES}" "" "0" )" != "5" ]; then
printf "\\r[FAIL] Fetch %s\\n" "${URL}"
run "curl -sS 'http://localhost:${HOST_PORT_HTTPD}${URL}' || true"
run "curl -sS -I 'http://localhost:${HOST_PORT_HTTPD}${URL}' || true"
exit 1
else
printf "\r[OK] Fetch ${URL} (1 round)\n"
printf "\\r[OK] Fetch %s\\n" "${URL}"
fi

View File

@ -27,9 +27,9 @@ echo
# Pre-check
# -------------------------------------------------------------------------------------------------
PHP_SERVER="$( "${SCRIPT_PATH}/../scripts/env-getvar.sh" "PHP_SERVER" )"
if [[ ${DISABLED_VERSIONS[*]} =~ ${PHP_SERVER} ]]; then
printf "[SKIP] Skipping all checks for PHP %s\\n" "${PHP_SERVER}"
PHP_VERSION="$( get_php_version "${DVLBOX_PATH}" )"
if [[ ${DISABLED_VERSIONS[*]} =~ ${PHP_VERSION} ]]; then
printf "[SKIP] Skipping all checks for PHP %s\\n" "${PHP_VERSION}"
exit 0
fi
@ -70,6 +70,11 @@ run "docker-compose exec --user devilbox -T php mkdir -p /shared/httpd/${VHOST}/
run "sleep 4"
###
### Store the error
###
ERROR=0
###
### index.htm should be served by default
@ -79,7 +84,7 @@ printf "[TEST] index.htm should be served by default"
if ! run "docker-compose exec --user devilbox -T php curl -sS --fail 'http://${VHOST}.${TLD_SUFFIX}' | tac | tac | grep -E '^indexhtm$' >/dev/null" "${RETRIES}" "${DVLBOX_PATH}" "0"; then
printf "\\r[FAIL] index.htm should be served by default\\n"
run "docker-compose exec --user devilbox -T php curl -sS 'http://${VHOST}.${TLD_SUFFIX}' || true" "1" "${DVLBOX_PATH}"
exit 1
ERROR=1
else
printf "\\r[OK] index.htm should be served by default\\n"
fi
@ -93,7 +98,7 @@ printf "[TEST] index.html should be served by default"
if ! run "docker-compose exec --user devilbox -T php curl -sS --fail 'http://${VHOST}.${TLD_SUFFIX}' | tac | tac | grep -E '^indexhtml$' >/dev/null" "${RETRIES}" "${DVLBOX_PATH}" "0"; then
printf "\\r[FAIL] index.html should be served by default\\n"
run "docker-compose exec --user devilbox -T php curl -sS 'http://${VHOST}.${TLD_SUFFIX}' || true" "1" "${DVLBOX_PATH}"
exit 1
ERROR=1
else
printf "\\r[OK] index.html should be served by default\\n"
fi
@ -107,7 +112,7 @@ printf "[TEST] index.php should be served by default"
if ! run "docker-compose exec --user devilbox -T php curl -sS --fail 'http://${VHOST}.${TLD_SUFFIX}' | tac | tac | grep -E '^indexphp$' >/dev/null" "${RETRIES}" "${DVLBOX_PATH}" "0"; then
printf "\\r[FAIL] index.php should be served by default\\n"
run "docker-compose exec --user devilbox -T php curl -sS 'http://${VHOST}.${TLD_SUFFIX}' || true" "1" "${DVLBOX_PATH}"
exit 1
ERROR=1
else
printf "\\r[OK] index.php should be served by default\\n"
fi
@ -121,7 +126,7 @@ printf "[TEST] index.htm is available via direct path"
if ! run "docker-compose exec --user devilbox -T php curl -sS --fail 'http://${VHOST}.${TLD_SUFFIX}/index.htm' | tac | tac | grep -E '^indexhtm$' >/dev/null" "${RETRIES}" "${DVLBOX_PATH}" "0"; then
printf "\\r[FAIL] index.htm is available via direct path\\n"
run "docker-compose exec --user devilbox -T php curl -sS 'http://${VHOST}.${TLD_SUFFIX}/index.htm' || true" "1" "${DVLBOX_PATH}"
exit 1
ERROR=1
else
printf "\\r[OK] index.htm is available via direct path\\n"
fi
@ -134,7 +139,7 @@ printf "[TEST] index.html is available via direct path"
if ! run "docker-compose exec --user devilbox -T php curl -sS --fail 'http://${VHOST}.${TLD_SUFFIX}/index.html' | tac | tac | grep -E '^indexhtml$' >/dev/null" "${RETRIES}" "${DVLBOX_PATH}" "0"; then
printf "\\r[FAIL] index.html is available via direct path\\n"
run "docker-compose exec --user devilbox -T php curl -sS 'http://${VHOST}.${TLD_SUFFIX}/index.html' || true" "1" "${DVLBOX_PATH}"
exit 1
ERROR=1
else
printf "\\r[OK] index.html is available via direct path\\n"
fi
@ -147,7 +152,13 @@ printf "[TEST] index.php is available via direct path"
if ! run "docker-compose exec --user devilbox -T php curl -sS --fail 'http://${VHOST}.${TLD_SUFFIX}/index.php' | tac | tac | grep -E '^indexphp$' >/dev/null" "${RETRIES}" "${DVLBOX_PATH}" "0"; then
printf "\\r[FAIL] index.php is available via direct path\\n"
run "docker-compose exec --user devilbox -T php curl -sS 'http://${VHOST}.${TLD_SUFFIX}/index.php' || true" "1" "${DVLBOX_PATH}"
exit 1
ERROR=1
else
printf "\\r[OK] index.php is available via direct path\\n"
fi
###
### Return error or success
###
exit "${ERROR}"

View File

@ -27,9 +27,9 @@ echo
# Pre-check
# -------------------------------------------------------------------------------------------------
PHP_SERVER="$( "${SCRIPT_PATH}/../scripts/env-getvar.sh" "PHP_SERVER" )"
if [[ ${DISABLED_VERSIONS[*]} =~ ${PHP_SERVER} ]]; then
printf "[SKIP] Skipping all checks for PHP %s\\n" "${PHP_SERVER}"
PHP_VERSION="$( get_php_version "${DVLBOX_PATH}" )"
if [[ ${DISABLED_VERSIONS[*]} =~ ${PHP_VERSION} ]]; then
printf "[SKIP] Skipping all checks for PHP %s\\n" "${PHP_VERSION}"
exit 0
fi

View File

@ -27,9 +27,9 @@ echo
# Pre-check
# -------------------------------------------------------------------------------------------------
PHP_SERVER="$( "${SCRIPT_PATH}/../scripts/env-getvar.sh" "PHP_SERVER" )"
if [[ ${DISABLED_VERSIONS[*]} =~ ${PHP_SERVER} ]]; then
printf "[SKIP] Skipping all checks for PHP %s\\n" "${PHP_SERVER}"
PHP_VERSION="$( get_php_version "${DVLBOX_PATH}" )"
if [[ ${DISABLED_VERSIONS[*]} =~ ${PHP_VERSION} ]]; then
printf "[SKIP] Skipping all checks for PHP %s\\n" "${PHP_VERSION}"
exit 0
fi

View File

@ -10,7 +10,7 @@ error_reporting(-1);
$MY_HOST = 'mysql';
$MY_USER = 'root';
$MY_PASS = '';
$MY_PASS = getenv('MYSQL_ROOT_PASSWORD');
$link = mysqli_connect($MY_HOST, $MY_USER, $MY_PASS, 'mysql');

View File

@ -9,8 +9,8 @@ error_reporting(-1);
$MY_HOST = 'pgsql';
$MY_USER = 'postgres';
$MY_PASS = '';
$MY_USER = getenv('PGSQL_ROOT_USER');
$MY_PASS = getenv('PGSQL_ROOT_PASSWORD');
$link = pg_connect('host='.$MY_HOST.' dbname=postgres user='.$MY_USER.' password='.$MY_PASS);