From a416792606b1f49dfbe9ad2155c7df972ade09d3 Mon Sep 17 00:00:00 2001 From: Llewellyn van der Merwe Date: Sat, 20 Jan 2024 15:13:04 +0200 Subject: [PATCH] Add fix for the configuration.php owner and permissions after auto deploy if the ownership missmatch. --- 4.3/php8.1/apache/docker-entrypoint.sh | 24 +++++++++++++++------- 4.3/php8.1/fpm-alpine/docker-entrypoint.sh | 24 +++++++++++++++------- 4.3/php8.1/fpm/docker-entrypoint.sh | 24 +++++++++++++++------- 4.3/php8.2/apache/docker-entrypoint.sh | 24 +++++++++++++++------- 4.3/php8.2/fpm-alpine/docker-entrypoint.sh | 24 +++++++++++++++------- 4.3/php8.2/fpm/docker-entrypoint.sh | 24 +++++++++++++++------- 4.4/php8.1/apache/docker-entrypoint.sh | 24 +++++++++++++++------- 4.4/php8.1/fpm-alpine/docker-entrypoint.sh | 24 +++++++++++++++------- 4.4/php8.1/fpm/docker-entrypoint.sh | 24 +++++++++++++++------- 4.4/php8.2/apache/docker-entrypoint.sh | 24 +++++++++++++++------- 4.4/php8.2/fpm-alpine/docker-entrypoint.sh | 24 +++++++++++++++------- 4.4/php8.2/fpm/docker-entrypoint.sh | 24 +++++++++++++++------- 5.0/php8.1/apache/docker-entrypoint.sh | 24 +++++++++++++++------- 5.0/php8.1/fpm-alpine/docker-entrypoint.sh | 24 +++++++++++++++------- 5.0/php8.1/fpm/docker-entrypoint.sh | 24 +++++++++++++++------- 5.0/php8.2/apache/docker-entrypoint.sh | 24 +++++++++++++++------- 5.0/php8.2/fpm-alpine/docker-entrypoint.sh | 24 +++++++++++++++------- 5.0/php8.2/fpm/docker-entrypoint.sh | 24 +++++++++++++++------- docker-entrypoint.sh | 24 +++++++++++++++------- 19 files changed, 323 insertions(+), 133 deletions(-) diff --git a/4.3/php8.1/apache/docker-entrypoint.sh b/4.3/php8.1/apache/docker-entrypoint.sh index 198d9d2..06d22d3 100755 --- a/4.3/php8.1/apache/docker-entrypoint.sh +++ b/4.3/php8.1/apache/docker-entrypoint.sh @@ -198,20 +198,30 @@ if [[ "$1" == apache2* ]] || [ "$1" == php-fpm ]; then --db-encryption=0 ) - php installation/joomla.php install "${installJoomlaArgs[@]}" + # Run the auto deploy (install) + if php installation/joomla.php install "${installJoomlaArgs[@]}"; then - # Check the exit status of the PHP command - if [ $? -eq 0 ]; then - # Set configuration to correct owner - chown "$user:$group" configuration.php - # Set configuration to correct permissions - chmod 444 configuration.php # The PHP command succeeded (so we remove the installation folder) rm -rf installation echo >&2 "========================================================================" echo >&2 echo >&2 "This server is now configured to run Joomla!" + + # fix the configuration.php ownership + if [ "$uid" = '0' ] && [ "$(stat -c '%u:%g' configuration.php)" != "$user:$group" ]; then + # Set configuration to correct owner + if ! chown "$user:$group" configuration.php; then + echo >&2 + echo >&2 "Error: Ownership of configuration.php failed to be corrected." + fi + # Set configuration to correct permissions + if ! chmod 444 configuration.php; then + echo >&2 + echo >&2 "Error: Permissions of configuration.php failed to be corrected." + fi + fi + echo >&2 echo >&2 "========================================================================" else diff --git a/4.3/php8.1/fpm-alpine/docker-entrypoint.sh b/4.3/php8.1/fpm-alpine/docker-entrypoint.sh index 198d9d2..06d22d3 100755 --- a/4.3/php8.1/fpm-alpine/docker-entrypoint.sh +++ b/4.3/php8.1/fpm-alpine/docker-entrypoint.sh @@ -198,20 +198,30 @@ if [[ "$1" == apache2* ]] || [ "$1" == php-fpm ]; then --db-encryption=0 ) - php installation/joomla.php install "${installJoomlaArgs[@]}" + # Run the auto deploy (install) + if php installation/joomla.php install "${installJoomlaArgs[@]}"; then - # Check the exit status of the PHP command - if [ $? -eq 0 ]; then - # Set configuration to correct owner - chown "$user:$group" configuration.php - # Set configuration to correct permissions - chmod 444 configuration.php # The PHP command succeeded (so we remove the installation folder) rm -rf installation echo >&2 "========================================================================" echo >&2 echo >&2 "This server is now configured to run Joomla!" + + # fix the configuration.php ownership + if [ "$uid" = '0' ] && [ "$(stat -c '%u:%g' configuration.php)" != "$user:$group" ]; then + # Set configuration to correct owner + if ! chown "$user:$group" configuration.php; then + echo >&2 + echo >&2 "Error: Ownership of configuration.php failed to be corrected." + fi + # Set configuration to correct permissions + if ! chmod 444 configuration.php; then + echo >&2 + echo >&2 "Error: Permissions of configuration.php failed to be corrected." + fi + fi + echo >&2 echo >&2 "========================================================================" else diff --git a/4.3/php8.1/fpm/docker-entrypoint.sh b/4.3/php8.1/fpm/docker-entrypoint.sh index 198d9d2..06d22d3 100755 --- a/4.3/php8.1/fpm/docker-entrypoint.sh +++ b/4.3/php8.1/fpm/docker-entrypoint.sh @@ -198,20 +198,30 @@ if [[ "$1" == apache2* ]] || [ "$1" == php-fpm ]; then --db-encryption=0 ) - php installation/joomla.php install "${installJoomlaArgs[@]}" + # Run the auto deploy (install) + if php installation/joomla.php install "${installJoomlaArgs[@]}"; then - # Check the exit status of the PHP command - if [ $? -eq 0 ]; then - # Set configuration to correct owner - chown "$user:$group" configuration.php - # Set configuration to correct permissions - chmod 444 configuration.php # The PHP command succeeded (so we remove the installation folder) rm -rf installation echo >&2 "========================================================================" echo >&2 echo >&2 "This server is now configured to run Joomla!" + + # fix the configuration.php ownership + if [ "$uid" = '0' ] && [ "$(stat -c '%u:%g' configuration.php)" != "$user:$group" ]; then + # Set configuration to correct owner + if ! chown "$user:$group" configuration.php; then + echo >&2 + echo >&2 "Error: Ownership of configuration.php failed to be corrected." + fi + # Set configuration to correct permissions + if ! chmod 444 configuration.php; then + echo >&2 + echo >&2 "Error: Permissions of configuration.php failed to be corrected." + fi + fi + echo >&2 echo >&2 "========================================================================" else diff --git a/4.3/php8.2/apache/docker-entrypoint.sh b/4.3/php8.2/apache/docker-entrypoint.sh index 198d9d2..06d22d3 100755 --- a/4.3/php8.2/apache/docker-entrypoint.sh +++ b/4.3/php8.2/apache/docker-entrypoint.sh @@ -198,20 +198,30 @@ if [[ "$1" == apache2* ]] || [ "$1" == php-fpm ]; then --db-encryption=0 ) - php installation/joomla.php install "${installJoomlaArgs[@]}" + # Run the auto deploy (install) + if php installation/joomla.php install "${installJoomlaArgs[@]}"; then - # Check the exit status of the PHP command - if [ $? -eq 0 ]; then - # Set configuration to correct owner - chown "$user:$group" configuration.php - # Set configuration to correct permissions - chmod 444 configuration.php # The PHP command succeeded (so we remove the installation folder) rm -rf installation echo >&2 "========================================================================" echo >&2 echo >&2 "This server is now configured to run Joomla!" + + # fix the configuration.php ownership + if [ "$uid" = '0' ] && [ "$(stat -c '%u:%g' configuration.php)" != "$user:$group" ]; then + # Set configuration to correct owner + if ! chown "$user:$group" configuration.php; then + echo >&2 + echo >&2 "Error: Ownership of configuration.php failed to be corrected." + fi + # Set configuration to correct permissions + if ! chmod 444 configuration.php; then + echo >&2 + echo >&2 "Error: Permissions of configuration.php failed to be corrected." + fi + fi + echo >&2 echo >&2 "========================================================================" else diff --git a/4.3/php8.2/fpm-alpine/docker-entrypoint.sh b/4.3/php8.2/fpm-alpine/docker-entrypoint.sh index 198d9d2..06d22d3 100755 --- a/4.3/php8.2/fpm-alpine/docker-entrypoint.sh +++ b/4.3/php8.2/fpm-alpine/docker-entrypoint.sh @@ -198,20 +198,30 @@ if [[ "$1" == apache2* ]] || [ "$1" == php-fpm ]; then --db-encryption=0 ) - php installation/joomla.php install "${installJoomlaArgs[@]}" + # Run the auto deploy (install) + if php installation/joomla.php install "${installJoomlaArgs[@]}"; then - # Check the exit status of the PHP command - if [ $? -eq 0 ]; then - # Set configuration to correct owner - chown "$user:$group" configuration.php - # Set configuration to correct permissions - chmod 444 configuration.php # The PHP command succeeded (so we remove the installation folder) rm -rf installation echo >&2 "========================================================================" echo >&2 echo >&2 "This server is now configured to run Joomla!" + + # fix the configuration.php ownership + if [ "$uid" = '0' ] && [ "$(stat -c '%u:%g' configuration.php)" != "$user:$group" ]; then + # Set configuration to correct owner + if ! chown "$user:$group" configuration.php; then + echo >&2 + echo >&2 "Error: Ownership of configuration.php failed to be corrected." + fi + # Set configuration to correct permissions + if ! chmod 444 configuration.php; then + echo >&2 + echo >&2 "Error: Permissions of configuration.php failed to be corrected." + fi + fi + echo >&2 echo >&2 "========================================================================" else diff --git a/4.3/php8.2/fpm/docker-entrypoint.sh b/4.3/php8.2/fpm/docker-entrypoint.sh index 198d9d2..06d22d3 100755 --- a/4.3/php8.2/fpm/docker-entrypoint.sh +++ b/4.3/php8.2/fpm/docker-entrypoint.sh @@ -198,20 +198,30 @@ if [[ "$1" == apache2* ]] || [ "$1" == php-fpm ]; then --db-encryption=0 ) - php installation/joomla.php install "${installJoomlaArgs[@]}" + # Run the auto deploy (install) + if php installation/joomla.php install "${installJoomlaArgs[@]}"; then - # Check the exit status of the PHP command - if [ $? -eq 0 ]; then - # Set configuration to correct owner - chown "$user:$group" configuration.php - # Set configuration to correct permissions - chmod 444 configuration.php # The PHP command succeeded (so we remove the installation folder) rm -rf installation echo >&2 "========================================================================" echo >&2 echo >&2 "This server is now configured to run Joomla!" + + # fix the configuration.php ownership + if [ "$uid" = '0' ] && [ "$(stat -c '%u:%g' configuration.php)" != "$user:$group" ]; then + # Set configuration to correct owner + if ! chown "$user:$group" configuration.php; then + echo >&2 + echo >&2 "Error: Ownership of configuration.php failed to be corrected." + fi + # Set configuration to correct permissions + if ! chmod 444 configuration.php; then + echo >&2 + echo >&2 "Error: Permissions of configuration.php failed to be corrected." + fi + fi + echo >&2 echo >&2 "========================================================================" else diff --git a/4.4/php8.1/apache/docker-entrypoint.sh b/4.4/php8.1/apache/docker-entrypoint.sh index 198d9d2..06d22d3 100755 --- a/4.4/php8.1/apache/docker-entrypoint.sh +++ b/4.4/php8.1/apache/docker-entrypoint.sh @@ -198,20 +198,30 @@ if [[ "$1" == apache2* ]] || [ "$1" == php-fpm ]; then --db-encryption=0 ) - php installation/joomla.php install "${installJoomlaArgs[@]}" + # Run the auto deploy (install) + if php installation/joomla.php install "${installJoomlaArgs[@]}"; then - # Check the exit status of the PHP command - if [ $? -eq 0 ]; then - # Set configuration to correct owner - chown "$user:$group" configuration.php - # Set configuration to correct permissions - chmod 444 configuration.php # The PHP command succeeded (so we remove the installation folder) rm -rf installation echo >&2 "========================================================================" echo >&2 echo >&2 "This server is now configured to run Joomla!" + + # fix the configuration.php ownership + if [ "$uid" = '0' ] && [ "$(stat -c '%u:%g' configuration.php)" != "$user:$group" ]; then + # Set configuration to correct owner + if ! chown "$user:$group" configuration.php; then + echo >&2 + echo >&2 "Error: Ownership of configuration.php failed to be corrected." + fi + # Set configuration to correct permissions + if ! chmod 444 configuration.php; then + echo >&2 + echo >&2 "Error: Permissions of configuration.php failed to be corrected." + fi + fi + echo >&2 echo >&2 "========================================================================" else diff --git a/4.4/php8.1/fpm-alpine/docker-entrypoint.sh b/4.4/php8.1/fpm-alpine/docker-entrypoint.sh index 198d9d2..06d22d3 100755 --- a/4.4/php8.1/fpm-alpine/docker-entrypoint.sh +++ b/4.4/php8.1/fpm-alpine/docker-entrypoint.sh @@ -198,20 +198,30 @@ if [[ "$1" == apache2* ]] || [ "$1" == php-fpm ]; then --db-encryption=0 ) - php installation/joomla.php install "${installJoomlaArgs[@]}" + # Run the auto deploy (install) + if php installation/joomla.php install "${installJoomlaArgs[@]}"; then - # Check the exit status of the PHP command - if [ $? -eq 0 ]; then - # Set configuration to correct owner - chown "$user:$group" configuration.php - # Set configuration to correct permissions - chmod 444 configuration.php # The PHP command succeeded (so we remove the installation folder) rm -rf installation echo >&2 "========================================================================" echo >&2 echo >&2 "This server is now configured to run Joomla!" + + # fix the configuration.php ownership + if [ "$uid" = '0' ] && [ "$(stat -c '%u:%g' configuration.php)" != "$user:$group" ]; then + # Set configuration to correct owner + if ! chown "$user:$group" configuration.php; then + echo >&2 + echo >&2 "Error: Ownership of configuration.php failed to be corrected." + fi + # Set configuration to correct permissions + if ! chmod 444 configuration.php; then + echo >&2 + echo >&2 "Error: Permissions of configuration.php failed to be corrected." + fi + fi + echo >&2 echo >&2 "========================================================================" else diff --git a/4.4/php8.1/fpm/docker-entrypoint.sh b/4.4/php8.1/fpm/docker-entrypoint.sh index 198d9d2..06d22d3 100755 --- a/4.4/php8.1/fpm/docker-entrypoint.sh +++ b/4.4/php8.1/fpm/docker-entrypoint.sh @@ -198,20 +198,30 @@ if [[ "$1" == apache2* ]] || [ "$1" == php-fpm ]; then --db-encryption=0 ) - php installation/joomla.php install "${installJoomlaArgs[@]}" + # Run the auto deploy (install) + if php installation/joomla.php install "${installJoomlaArgs[@]}"; then - # Check the exit status of the PHP command - if [ $? -eq 0 ]; then - # Set configuration to correct owner - chown "$user:$group" configuration.php - # Set configuration to correct permissions - chmod 444 configuration.php # The PHP command succeeded (so we remove the installation folder) rm -rf installation echo >&2 "========================================================================" echo >&2 echo >&2 "This server is now configured to run Joomla!" + + # fix the configuration.php ownership + if [ "$uid" = '0' ] && [ "$(stat -c '%u:%g' configuration.php)" != "$user:$group" ]; then + # Set configuration to correct owner + if ! chown "$user:$group" configuration.php; then + echo >&2 + echo >&2 "Error: Ownership of configuration.php failed to be corrected." + fi + # Set configuration to correct permissions + if ! chmod 444 configuration.php; then + echo >&2 + echo >&2 "Error: Permissions of configuration.php failed to be corrected." + fi + fi + echo >&2 echo >&2 "========================================================================" else diff --git a/4.4/php8.2/apache/docker-entrypoint.sh b/4.4/php8.2/apache/docker-entrypoint.sh index 198d9d2..06d22d3 100755 --- a/4.4/php8.2/apache/docker-entrypoint.sh +++ b/4.4/php8.2/apache/docker-entrypoint.sh @@ -198,20 +198,30 @@ if [[ "$1" == apache2* ]] || [ "$1" == php-fpm ]; then --db-encryption=0 ) - php installation/joomla.php install "${installJoomlaArgs[@]}" + # Run the auto deploy (install) + if php installation/joomla.php install "${installJoomlaArgs[@]}"; then - # Check the exit status of the PHP command - if [ $? -eq 0 ]; then - # Set configuration to correct owner - chown "$user:$group" configuration.php - # Set configuration to correct permissions - chmod 444 configuration.php # The PHP command succeeded (so we remove the installation folder) rm -rf installation echo >&2 "========================================================================" echo >&2 echo >&2 "This server is now configured to run Joomla!" + + # fix the configuration.php ownership + if [ "$uid" = '0' ] && [ "$(stat -c '%u:%g' configuration.php)" != "$user:$group" ]; then + # Set configuration to correct owner + if ! chown "$user:$group" configuration.php; then + echo >&2 + echo >&2 "Error: Ownership of configuration.php failed to be corrected." + fi + # Set configuration to correct permissions + if ! chmod 444 configuration.php; then + echo >&2 + echo >&2 "Error: Permissions of configuration.php failed to be corrected." + fi + fi + echo >&2 echo >&2 "========================================================================" else diff --git a/4.4/php8.2/fpm-alpine/docker-entrypoint.sh b/4.4/php8.2/fpm-alpine/docker-entrypoint.sh index 198d9d2..06d22d3 100755 --- a/4.4/php8.2/fpm-alpine/docker-entrypoint.sh +++ b/4.4/php8.2/fpm-alpine/docker-entrypoint.sh @@ -198,20 +198,30 @@ if [[ "$1" == apache2* ]] || [ "$1" == php-fpm ]; then --db-encryption=0 ) - php installation/joomla.php install "${installJoomlaArgs[@]}" + # Run the auto deploy (install) + if php installation/joomla.php install "${installJoomlaArgs[@]}"; then - # Check the exit status of the PHP command - if [ $? -eq 0 ]; then - # Set configuration to correct owner - chown "$user:$group" configuration.php - # Set configuration to correct permissions - chmod 444 configuration.php # The PHP command succeeded (so we remove the installation folder) rm -rf installation echo >&2 "========================================================================" echo >&2 echo >&2 "This server is now configured to run Joomla!" + + # fix the configuration.php ownership + if [ "$uid" = '0' ] && [ "$(stat -c '%u:%g' configuration.php)" != "$user:$group" ]; then + # Set configuration to correct owner + if ! chown "$user:$group" configuration.php; then + echo >&2 + echo >&2 "Error: Ownership of configuration.php failed to be corrected." + fi + # Set configuration to correct permissions + if ! chmod 444 configuration.php; then + echo >&2 + echo >&2 "Error: Permissions of configuration.php failed to be corrected." + fi + fi + echo >&2 echo >&2 "========================================================================" else diff --git a/4.4/php8.2/fpm/docker-entrypoint.sh b/4.4/php8.2/fpm/docker-entrypoint.sh index 198d9d2..06d22d3 100755 --- a/4.4/php8.2/fpm/docker-entrypoint.sh +++ b/4.4/php8.2/fpm/docker-entrypoint.sh @@ -198,20 +198,30 @@ if [[ "$1" == apache2* ]] || [ "$1" == php-fpm ]; then --db-encryption=0 ) - php installation/joomla.php install "${installJoomlaArgs[@]}" + # Run the auto deploy (install) + if php installation/joomla.php install "${installJoomlaArgs[@]}"; then - # Check the exit status of the PHP command - if [ $? -eq 0 ]; then - # Set configuration to correct owner - chown "$user:$group" configuration.php - # Set configuration to correct permissions - chmod 444 configuration.php # The PHP command succeeded (so we remove the installation folder) rm -rf installation echo >&2 "========================================================================" echo >&2 echo >&2 "This server is now configured to run Joomla!" + + # fix the configuration.php ownership + if [ "$uid" = '0' ] && [ "$(stat -c '%u:%g' configuration.php)" != "$user:$group" ]; then + # Set configuration to correct owner + if ! chown "$user:$group" configuration.php; then + echo >&2 + echo >&2 "Error: Ownership of configuration.php failed to be corrected." + fi + # Set configuration to correct permissions + if ! chmod 444 configuration.php; then + echo >&2 + echo >&2 "Error: Permissions of configuration.php failed to be corrected." + fi + fi + echo >&2 echo >&2 "========================================================================" else diff --git a/5.0/php8.1/apache/docker-entrypoint.sh b/5.0/php8.1/apache/docker-entrypoint.sh index 198d9d2..06d22d3 100755 --- a/5.0/php8.1/apache/docker-entrypoint.sh +++ b/5.0/php8.1/apache/docker-entrypoint.sh @@ -198,20 +198,30 @@ if [[ "$1" == apache2* ]] || [ "$1" == php-fpm ]; then --db-encryption=0 ) - php installation/joomla.php install "${installJoomlaArgs[@]}" + # Run the auto deploy (install) + if php installation/joomla.php install "${installJoomlaArgs[@]}"; then - # Check the exit status of the PHP command - if [ $? -eq 0 ]; then - # Set configuration to correct owner - chown "$user:$group" configuration.php - # Set configuration to correct permissions - chmod 444 configuration.php # The PHP command succeeded (so we remove the installation folder) rm -rf installation echo >&2 "========================================================================" echo >&2 echo >&2 "This server is now configured to run Joomla!" + + # fix the configuration.php ownership + if [ "$uid" = '0' ] && [ "$(stat -c '%u:%g' configuration.php)" != "$user:$group" ]; then + # Set configuration to correct owner + if ! chown "$user:$group" configuration.php; then + echo >&2 + echo >&2 "Error: Ownership of configuration.php failed to be corrected." + fi + # Set configuration to correct permissions + if ! chmod 444 configuration.php; then + echo >&2 + echo >&2 "Error: Permissions of configuration.php failed to be corrected." + fi + fi + echo >&2 echo >&2 "========================================================================" else diff --git a/5.0/php8.1/fpm-alpine/docker-entrypoint.sh b/5.0/php8.1/fpm-alpine/docker-entrypoint.sh index 198d9d2..06d22d3 100755 --- a/5.0/php8.1/fpm-alpine/docker-entrypoint.sh +++ b/5.0/php8.1/fpm-alpine/docker-entrypoint.sh @@ -198,20 +198,30 @@ if [[ "$1" == apache2* ]] || [ "$1" == php-fpm ]; then --db-encryption=0 ) - php installation/joomla.php install "${installJoomlaArgs[@]}" + # Run the auto deploy (install) + if php installation/joomla.php install "${installJoomlaArgs[@]}"; then - # Check the exit status of the PHP command - if [ $? -eq 0 ]; then - # Set configuration to correct owner - chown "$user:$group" configuration.php - # Set configuration to correct permissions - chmod 444 configuration.php # The PHP command succeeded (so we remove the installation folder) rm -rf installation echo >&2 "========================================================================" echo >&2 echo >&2 "This server is now configured to run Joomla!" + + # fix the configuration.php ownership + if [ "$uid" = '0' ] && [ "$(stat -c '%u:%g' configuration.php)" != "$user:$group" ]; then + # Set configuration to correct owner + if ! chown "$user:$group" configuration.php; then + echo >&2 + echo >&2 "Error: Ownership of configuration.php failed to be corrected." + fi + # Set configuration to correct permissions + if ! chmod 444 configuration.php; then + echo >&2 + echo >&2 "Error: Permissions of configuration.php failed to be corrected." + fi + fi + echo >&2 echo >&2 "========================================================================" else diff --git a/5.0/php8.1/fpm/docker-entrypoint.sh b/5.0/php8.1/fpm/docker-entrypoint.sh index 198d9d2..06d22d3 100755 --- a/5.0/php8.1/fpm/docker-entrypoint.sh +++ b/5.0/php8.1/fpm/docker-entrypoint.sh @@ -198,20 +198,30 @@ if [[ "$1" == apache2* ]] || [ "$1" == php-fpm ]; then --db-encryption=0 ) - php installation/joomla.php install "${installJoomlaArgs[@]}" + # Run the auto deploy (install) + if php installation/joomla.php install "${installJoomlaArgs[@]}"; then - # Check the exit status of the PHP command - if [ $? -eq 0 ]; then - # Set configuration to correct owner - chown "$user:$group" configuration.php - # Set configuration to correct permissions - chmod 444 configuration.php # The PHP command succeeded (so we remove the installation folder) rm -rf installation echo >&2 "========================================================================" echo >&2 echo >&2 "This server is now configured to run Joomla!" + + # fix the configuration.php ownership + if [ "$uid" = '0' ] && [ "$(stat -c '%u:%g' configuration.php)" != "$user:$group" ]; then + # Set configuration to correct owner + if ! chown "$user:$group" configuration.php; then + echo >&2 + echo >&2 "Error: Ownership of configuration.php failed to be corrected." + fi + # Set configuration to correct permissions + if ! chmod 444 configuration.php; then + echo >&2 + echo >&2 "Error: Permissions of configuration.php failed to be corrected." + fi + fi + echo >&2 echo >&2 "========================================================================" else diff --git a/5.0/php8.2/apache/docker-entrypoint.sh b/5.0/php8.2/apache/docker-entrypoint.sh index 198d9d2..06d22d3 100755 --- a/5.0/php8.2/apache/docker-entrypoint.sh +++ b/5.0/php8.2/apache/docker-entrypoint.sh @@ -198,20 +198,30 @@ if [[ "$1" == apache2* ]] || [ "$1" == php-fpm ]; then --db-encryption=0 ) - php installation/joomla.php install "${installJoomlaArgs[@]}" + # Run the auto deploy (install) + if php installation/joomla.php install "${installJoomlaArgs[@]}"; then - # Check the exit status of the PHP command - if [ $? -eq 0 ]; then - # Set configuration to correct owner - chown "$user:$group" configuration.php - # Set configuration to correct permissions - chmod 444 configuration.php # The PHP command succeeded (so we remove the installation folder) rm -rf installation echo >&2 "========================================================================" echo >&2 echo >&2 "This server is now configured to run Joomla!" + + # fix the configuration.php ownership + if [ "$uid" = '0' ] && [ "$(stat -c '%u:%g' configuration.php)" != "$user:$group" ]; then + # Set configuration to correct owner + if ! chown "$user:$group" configuration.php; then + echo >&2 + echo >&2 "Error: Ownership of configuration.php failed to be corrected." + fi + # Set configuration to correct permissions + if ! chmod 444 configuration.php; then + echo >&2 + echo >&2 "Error: Permissions of configuration.php failed to be corrected." + fi + fi + echo >&2 echo >&2 "========================================================================" else diff --git a/5.0/php8.2/fpm-alpine/docker-entrypoint.sh b/5.0/php8.2/fpm-alpine/docker-entrypoint.sh index 198d9d2..06d22d3 100755 --- a/5.0/php8.2/fpm-alpine/docker-entrypoint.sh +++ b/5.0/php8.2/fpm-alpine/docker-entrypoint.sh @@ -198,20 +198,30 @@ if [[ "$1" == apache2* ]] || [ "$1" == php-fpm ]; then --db-encryption=0 ) - php installation/joomla.php install "${installJoomlaArgs[@]}" + # Run the auto deploy (install) + if php installation/joomla.php install "${installJoomlaArgs[@]}"; then - # Check the exit status of the PHP command - if [ $? -eq 0 ]; then - # Set configuration to correct owner - chown "$user:$group" configuration.php - # Set configuration to correct permissions - chmod 444 configuration.php # The PHP command succeeded (so we remove the installation folder) rm -rf installation echo >&2 "========================================================================" echo >&2 echo >&2 "This server is now configured to run Joomla!" + + # fix the configuration.php ownership + if [ "$uid" = '0' ] && [ "$(stat -c '%u:%g' configuration.php)" != "$user:$group" ]; then + # Set configuration to correct owner + if ! chown "$user:$group" configuration.php; then + echo >&2 + echo >&2 "Error: Ownership of configuration.php failed to be corrected." + fi + # Set configuration to correct permissions + if ! chmod 444 configuration.php; then + echo >&2 + echo >&2 "Error: Permissions of configuration.php failed to be corrected." + fi + fi + echo >&2 echo >&2 "========================================================================" else diff --git a/5.0/php8.2/fpm/docker-entrypoint.sh b/5.0/php8.2/fpm/docker-entrypoint.sh index 198d9d2..06d22d3 100755 --- a/5.0/php8.2/fpm/docker-entrypoint.sh +++ b/5.0/php8.2/fpm/docker-entrypoint.sh @@ -198,20 +198,30 @@ if [[ "$1" == apache2* ]] || [ "$1" == php-fpm ]; then --db-encryption=0 ) - php installation/joomla.php install "${installJoomlaArgs[@]}" + # Run the auto deploy (install) + if php installation/joomla.php install "${installJoomlaArgs[@]}"; then - # Check the exit status of the PHP command - if [ $? -eq 0 ]; then - # Set configuration to correct owner - chown "$user:$group" configuration.php - # Set configuration to correct permissions - chmod 444 configuration.php # The PHP command succeeded (so we remove the installation folder) rm -rf installation echo >&2 "========================================================================" echo >&2 echo >&2 "This server is now configured to run Joomla!" + + # fix the configuration.php ownership + if [ "$uid" = '0' ] && [ "$(stat -c '%u:%g' configuration.php)" != "$user:$group" ]; then + # Set configuration to correct owner + if ! chown "$user:$group" configuration.php; then + echo >&2 + echo >&2 "Error: Ownership of configuration.php failed to be corrected." + fi + # Set configuration to correct permissions + if ! chmod 444 configuration.php; then + echo >&2 + echo >&2 "Error: Permissions of configuration.php failed to be corrected." + fi + fi + echo >&2 echo >&2 "========================================================================" else diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh index 198d9d2..06d22d3 100755 --- a/docker-entrypoint.sh +++ b/docker-entrypoint.sh @@ -198,20 +198,30 @@ if [[ "$1" == apache2* ]] || [ "$1" == php-fpm ]; then --db-encryption=0 ) - php installation/joomla.php install "${installJoomlaArgs[@]}" + # Run the auto deploy (install) + if php installation/joomla.php install "${installJoomlaArgs[@]}"; then - # Check the exit status of the PHP command - if [ $? -eq 0 ]; then - # Set configuration to correct owner - chown "$user:$group" configuration.php - # Set configuration to correct permissions - chmod 444 configuration.php # The PHP command succeeded (so we remove the installation folder) rm -rf installation echo >&2 "========================================================================" echo >&2 echo >&2 "This server is now configured to run Joomla!" + + # fix the configuration.php ownership + if [ "$uid" = '0' ] && [ "$(stat -c '%u:%g' configuration.php)" != "$user:$group" ]; then + # Set configuration to correct owner + if ! chown "$user:$group" configuration.php; then + echo >&2 + echo >&2 "Error: Ownership of configuration.php failed to be corrected." + fi + # Set configuration to correct permissions + if ! chmod 444 configuration.php; then + echo >&2 + echo >&2 "Error: Permissions of configuration.php failed to be corrected." + fi + fi + echo >&2 echo >&2 "========================================================================" else