From ffa0b43b722e8cdc22c5d8f59ef47e5bbf16c034 Mon Sep 17 00:00:00 2001 From: Bitnami Bot Date: Tue, 23 Jun 2020 00:12:33 +0000 Subject: [PATCH] 5.0.2-debian-10-r90 release --- bitnami/phpmyadmin/5/debian-10/Dockerfile | 2 +- .../bitnami/scripts/phpmyadmin/entrypoint.sh | 1 + .../bitnami/scripts/phpmyadmin/postunpack.sh | 6 ++- .../5/debian-10/rootfs/post-init.d/php.sh | 32 ++++++++---- .../5/debian-10/rootfs/post-init.d/shell.sh | 43 ++++++++++------ .../debian-10/rootfs/post-init.d/sql-mysql.sh | 51 ++++++++++++------- .../5/debian-10/rootfs/post-init.sh | 22 +++++--- bitnami/phpmyadmin/README.md | 2 +- 8 files changed, 105 insertions(+), 54 deletions(-) mode change 100644 => 100755 bitnami/phpmyadmin/5/debian-10/rootfs/post-init.sh diff --git a/bitnami/phpmyadmin/5/debian-10/Dockerfile b/bitnami/phpmyadmin/5/debian-10/Dockerfile index 07b09c4e0578..9a42097faec0 100644 --- a/bitnami/phpmyadmin/5/debian-10/Dockerfile +++ b/bitnami/phpmyadmin/5/debian-10/Dockerfile @@ -29,7 +29,7 @@ ENV ALLOW_EMPTY_PASSWORD="no" \ APACHE_HTTPS_PORT_NUMBER="" \ APACHE_HTTP_PORT_NUMBER="" \ BITNAMI_APP_NAME="phpmyadmin" \ - BITNAMI_IMAGE_VERSION="5.0.2-debian-10-r89" \ + BITNAMI_IMAGE_VERSION="5.0.2-debian-10-r90" \ MARIADB_HOST="mariadb" \ MARIADB_PORT_NUMBER="3306" \ MARIADB_ROOT_PASSWORD="" \ diff --git a/bitnami/phpmyadmin/5/debian-10/rootfs/opt/bitnami/scripts/phpmyadmin/entrypoint.sh b/bitnami/phpmyadmin/5/debian-10/rootfs/opt/bitnami/scripts/phpmyadmin/entrypoint.sh index aa25314f48e3..a148f9093afd 100755 --- a/bitnami/phpmyadmin/5/debian-10/rootfs/opt/bitnami/scripts/phpmyadmin/entrypoint.sh +++ b/bitnami/phpmyadmin/5/debian-10/rootfs/opt/bitnami/scripts/phpmyadmin/entrypoint.sh @@ -24,6 +24,7 @@ if [[ "$1" = "/opt/bitnami/scripts/$(web_server_type)/run.sh" || "$1" = "/opt/bi /opt/bitnami/scripts/"$(web_server_type)"/setup.sh /opt/bitnami/scripts/php/setup.sh /opt/bitnami/scripts/phpmyadmin/setup.sh + /post-init.sh info "** phpMyAdmin setup finished! **" fi diff --git a/bitnami/phpmyadmin/5/debian-10/rootfs/opt/bitnami/scripts/phpmyadmin/postunpack.sh b/bitnami/phpmyadmin/5/debian-10/rootfs/opt/bitnami/scripts/phpmyadmin/postunpack.sh index ba59af1b23d8..a4111733e935 100755 --- a/bitnami/phpmyadmin/5/debian-10/rootfs/opt/bitnami/scripts/phpmyadmin/postunpack.sh +++ b/bitnami/phpmyadmin/5/debian-10/rootfs/opt/bitnami/scripts/phpmyadmin/postunpack.sh @@ -25,8 +25,10 @@ set -o pipefail [[ ! -f "$PHPMYADMIN_CONF_FILE" ]] && cp "${PHPMYADMIN_BASE_DIR}/config.sample.inc.php" "$PHPMYADMIN_CONF_FILE" # Ensure the phpMyAdmin 'tmp' directory exists and has proper permissions -ensure_dir_exists "$PHPMYADMIN_TMP_DIR" -configure_permissions_ownership "$PHPMYADMIN_BASE_DIR" -d "775" -f "664" +for dir in "$PHPMYADMIN_BASE_DIR" "$PHPMYADMIN_TMP_DIR" "$PHPMYADMIN_VOLUME_DIR"; do + ensure_dir_exists "$dir" + configure_permissions_ownership "$dir" -d "775" -f "664" +done # Configure phpMyAdmin based on build-time defaults info "Configuring default phpMyAdmin options" diff --git a/bitnami/phpmyadmin/5/debian-10/rootfs/post-init.d/php.sh b/bitnami/phpmyadmin/5/debian-10/rootfs/post-init.d/php.sh index fb44050dece0..8d76ab8913c9 100755 --- a/bitnami/phpmyadmin/5/debian-10/rootfs/post-init.d/php.sh +++ b/bitnami/phpmyadmin/5/debian-10/rootfs/post-init.d/php.sh @@ -1,21 +1,31 @@ #!/bin/bash # -# Post-init script to execute PHP files +# Executes custom PHP init scripts # shellcheck disable=SC1091 +set -o errexit +set -o nounset +set -o pipefail # set -o xtrace # Uncomment this line for debugging purposes -. /opt/bitnami/base/functions +# Load libraries with logging functions +if [[ -f /opt/bitnami/base/functions ]]; then + . /opt/bitnami/base/functions +else + . /opt/bitnami/scripts/liblog.sh +fi -readonly f="${1:?missing PHP file}" +# Loop through all input files passed via stdin +read -r -a custom_init_scripts <<< "$@" failure=0 +if [[ "${#custom_init_scripts[@]}" -gt 0 ]]; then + for custom_init_script in "${custom_init_scripts[@]}"; do + [[ "$custom_init_script" != *".php" ]] && continue + info "Executing ${custom_init_script} with PHP interpreter" + php "$custom_init_script" || failure=1 + [[ "$failure" -ne 0 ]] && error "Failed to execute ${custom_init_script}" + done +fi -if [[ "$f" == *".php" ]]; then - info "Executing $f with PHP interpreter" - php "$f" || failure=$? -fi -if [[ "$failure" -ne 0 ]]; then - error "Failed to execute ${f}" - exit "$failure" -fi +exit "$failure" diff --git a/bitnami/phpmyadmin/5/debian-10/rootfs/post-init.d/shell.sh b/bitnami/phpmyadmin/5/debian-10/rootfs/post-init.d/shell.sh index e03122ff6f3a..665152ba8b6f 100755 --- a/bitnami/phpmyadmin/5/debian-10/rootfs/post-init.d/shell.sh +++ b/bitnami/phpmyadmin/5/debian-10/rootfs/post-init.d/shell.sh @@ -1,24 +1,37 @@ #!/bin/bash # -# Post-init script to execute Shell files +# Executes custom Bash init scripts -# shellcheck disable=SC1090,SC1091 +# shellcheck disable=SC1090 +# shellcheck disable=SC1091 +set -o errexit +set -o nounset +set -o pipefail # set -o xtrace # Uncomment this line for debugging purposes -. /opt/bitnami/base/functions +# Load libraries with logging functions +if [[ -f /opt/bitnami/base/functions ]]; then + . /opt/bitnami/base/functions +else + . /opt/bitnami/scripts/liblog.sh +fi -readonly f="${1:?missing SHELL file}" +# Loop through all input files passed via stdin +read -r -a custom_init_scripts <<< "$@" failure=0 +if [[ "${#custom_init_scripts[@]}" -gt 0 ]]; then + for custom_init_script in "${custom_init_scripts[@]}"; do + [[ "$custom_init_script" != *".sh" ]] && continue + if [[ -x "$custom_init_script" ]]; then + info "Executing ${custom_init_script}" + "$custom_init_script" || failure="1" + else + info "Sourcing ${custom_init_script} as it is not executable by the current user, any error may cause initialization to fail" + . "$custom_init_script" + fi + [[ "$failure" -ne 0 ]] && error "Failed to execute ${custom_init_script}" + done +fi -if [[ "$f" == *".sh" ]]; then - if [[ -x "$f" ]]; then - info "Executing $f"; "$f" || failure=$? - else - info "Sourcing $f"; . "$f" - fi -fi -if [[ "$failure" -ne 0 ]]; then - error "Failed to execute ${f}" - exit "$failure" -fi +exit "$failure" diff --git a/bitnami/phpmyadmin/5/debian-10/rootfs/post-init.d/sql-mysql.sh b/bitnami/phpmyadmin/5/debian-10/rootfs/post-init.d/sql-mysql.sh index 11b14a25f5bc..f5c8436f2e46 100755 --- a/bitnami/phpmyadmin/5/debian-10/rootfs/post-init.d/sql-mysql.sh +++ b/bitnami/phpmyadmin/5/debian-10/rootfs/post-init.d/sql-mysql.sh @@ -1,29 +1,46 @@ #!/bin/bash # -# Post-init script to execute SQL files with MySQL client +# Executes custom Ruby init scripts # shellcheck disable=SC1091 +set -o errexit +set -o nounset +set -o pipefail # set -o xtrace # Uncomment this line for debugging purposes -. /opt/bitnami/base/functions +# Load libraries with logging functions +if [[ -f /opt/bitnami/base/functions ]]; then + . /opt/bitnami/base/functions +else + . /opt/bitnami/scripts/liblog.sh +fi -readonly f="${1:?missing SQL file}" -failure=0 - -if [[ "$f" =~ ^.*(\.sql|\.sql\.gz)$ ]]; then - info "Executing $f" - mysql_cmd=( mysql -h "$MARIADB_HOST" -P "$MARIADB_PORT_NUMBER" -u "$MARIADB_ROOT_USER" ) +mysql_execute() { + local -r sql_file="${1:?missing file}" + local failure=0 + mysql_cmd=("mysql" "-h" "$MARIADB_HOST" "-P" "$MARIADB_PORT_NUMBER" "-u" "$MARIADB_ROOT_USER") if [[ "${ALLOW_EMPTY_PASSWORD:-no}" != "yes" ]]; then - mysql_cmd+=( -p"$MARIADB_ROOT_PASSWORD" ) + mysql_cmd+=("-p${MARIADB_ROOT_PASSWORD}") fi - if [[ "$f" == *".sql" ]]; then - "${mysql_cmd[@]}" < "$f" || failure=$? - elif [[ "$f" == *".sql.gz" ]]; then - gunzip -c "$f" | "${mysql_cmd[@]}" || failure=$? + if [[ "$sql_file" == *".sql" ]]; then + "${mysql_cmd[@]}" < "$sql_file" || failure=$? + elif [[ "$sql_file" == *".sql.gz" ]]; then + gunzip -c "$sql_file" | "${mysql_cmd[@]}" || failure=$? fi + return "$failure" +} + +# Loop through all input files passed via stdin +read -r -a custom_init_scripts <<< "$@" +failure=0 +if [[ "${#custom_init_scripts[@]}" -gt 0 ]]; then + for custom_init_script in "${custom_init_scripts[@]}"; do + [[ ! "$custom_init_script" =~ ^.*(\.sql|\.sql\.gz)$ ]] && continue + info "Executing ${custom_init_script}" + mysql_execute "$custom_init_script" || failure=1 + [[ "$failure" -ne 0 ]] && error "Failed to execute ${custom_init_script}" + done fi -if [[ "$failure" -ne 0 ]]; then - error "Failed to execute ${f}" - exit "$failure" -fi + +exit "$failure" diff --git a/bitnami/phpmyadmin/5/debian-10/rootfs/post-init.sh b/bitnami/phpmyadmin/5/debian-10/rootfs/post-init.sh old mode 100644 new mode 100755 index 83474e246f55..4bc9338033e8 --- a/bitnami/phpmyadmin/5/debian-10/rootfs/post-init.sh +++ b/bitnami/phpmyadmin/5/debian-10/rootfs/post-init.sh @@ -1,15 +1,23 @@ #!/bin/bash +# shellcheck disable=SC1091 + +set -o errexit +set -o nounset +set -o pipefail # set -o xtrace # Uncomment this line for debugging purposes -. /opt/bitnami/base/functions +# Only execute init scripts once +[[ -f "/bitnami/phpmyadmin/.user_scripts_initialized" ]] && exit -if [[ -d /docker-entrypoint-init.d ]] && [[ ! -f "/bitnami/phpmyadmin/.user_scripts_initialized" ]]; then - for f in /docker-entrypoint-init.d/*; do - for p in /post-init.d/*.sh; do - "$p" "$f" +read -r -a init_scripts <<< "$(find "/docker-entrypoint-init.d" -type f -print0 | xargs -0)" +if [[ "${#init_scripts[@]}" -gt 0 ]] && [[ ! -f "/bitnami/phpmyadmin/.user_scripts_initialized" ]]; then + mkdir -p "/bitnami/phpmyadmin" + for init_script in "${init_scripts[@]}"; do + for init_script_type_handler in /post-init.d/*.sh; do + "$init_script_type_handler" "$init_script" done done - info "Custom scripts were executed" - touch "/bitnami/phpmyadmin/.user_scripts_initialized" fi + +touch "/bitnami/phpmyadmin/.user_scripts_initialized" diff --git a/bitnami/phpmyadmin/README.md b/bitnami/phpmyadmin/README.md index 74a7b50369d1..592d187fdec6 100644 --- a/bitnami/phpmyadmin/README.md +++ b/bitnami/phpmyadmin/README.md @@ -36,7 +36,7 @@ Bitnami containers can be used with [Kubeapps](https://kubeapps.com/) for deploy Learn more about the Bitnami tagging policy and the difference between rolling tags and immutable tags [in our documentation page](https://docs.bitnami.com/tutorials/understand-rolling-tags-containers/). -* [`5-debian-10`, `5.0.2-debian-10-r89`, `5`, `5.0.2`, `latest` (5/debian-10/Dockerfile)](https://github.com/bitnami/bitnami-docker-phpmyadmin/blob/5.0.2-debian-10-r89/5/debian-10/Dockerfile) +* [`5-debian-10`, `5.0.2-debian-10-r90`, `5`, `5.0.2`, `latest` (5/debian-10/Dockerfile)](https://github.com/bitnami/bitnami-docker-phpmyadmin/blob/5.0.2-debian-10-r90/5/debian-10/Dockerfile) Subscribe to project updates by watching the [bitnami/phpmyadmin GitHub repo](https://github.com/bitnami/bitnami-docker-phpmyadmin).