From 807e0c35866ab5cc4ba3b9c7d281d3546f1bbe42 Mon Sep 17 00:00:00 2001 From: Paul Wilde Date: Thu, 12 Aug 2021 16:28:37 +0100 Subject: [PATCH] adjusted entrypoint scripts to comment out entire sample files for easier re-configuration --- entrypoint.sh | 29 +++++++++++++++++++++++++---- test-entry.sh | 2 +- test-server.sh | 1 + 3 files changed, 27 insertions(+), 5 deletions(-) diff --git a/entrypoint.sh b/entrypoint.sh index 0ca8f82..57b8053 100644 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -1,8 +1,29 @@ #!/usr/bin/env bash -echo Removing old sample config files… +echo Removing old sample files… rm /var/www/html/config/*.sample.ini -echo Copying new sample config files… -cp /var/www/html/default-config/config.default.ini /var/www/html/config/config.sample.ini -cp /var/www/html/default-config/services.default.ini /var/www/html/config/services.sample.ini + +function write_file() { + while read line; + do + first_char=${line:0:1} + + if [[ $first_char != ";" ]]; then + line="; "$line + fi + echo $line >> $2 + done < $1 +} + +echo Setting up new sample config files… +def_conf="/var/www/html/default-config/config.default.ini" +new_conf="/var/www/html/config/config.sample.ini" +write_file $def_conf $new_conf + +def_serv="/var/www/html/default-config/services.default.ini" +new_serv="/var/www/html/config/services.sample.ini" +write_file $def_serv $new_serv + + + echo Running HTTPD… exec apache2-foreground diff --git a/test-entry.sh b/test-entry.sh index 50df86c..f7d363a 100755 --- a/test-entry.sh +++ b/test-entry.sh @@ -1,4 +1,4 @@ #!/usr/bin/env bash a2enmod rewrite service apache2 stop -exec apache2-foreground +exec bash /entrypoint.sh diff --git a/test-server.sh b/test-server.sh index 17437b2..46e3087 100644 --- a/test-server.sh +++ b/test-server.sh @@ -5,6 +5,7 @@ podman run --name mailautoconf-test \ -v ./src:/var/www/html/ \ -v ./config:/var/www/html/config \ -v ./test-entry.sh:/test-entry.sh \ + -v ./entrypoint.sh:/entrypoint.sh \ --entrypoint "/bin/bash" \ php:7.4-apache \ /test-entry.sh