Merge pull request #1284 from vortex852456/master

Added optional file user-patches.sh for own patches without recompiling
This commit is contained in:
Erik Wramner 2019-11-09 15:13:06 +01:00 committed by GitHub
commit c882d95deb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 32 additions and 1 deletions

View File

@ -30,6 +30,7 @@ run:
-v "`pwd`/test/config":/tmp/docker-mailserver \
-v "`pwd`/test/test-files":/tmp/docker-mailserver-test:ro \
-v "`pwd`/test/onedir":/var/mail-state \
-v "`pwd`/test/config/user-patches/user-patches.sh":/tmp/docker-mailserver/user-patches.sh \
-e ENABLE_CLAMAV=1 \
-e SPOOF_PROTECTION=1 \
-e ENABLE_SPAMASSASSIN=1 \

View File

@ -0,0 +1,6 @@
#!/bin/bash
##
# This user script will be executed between configuration and starting daemons
# To enable it you must save it in your config directory as "user-patches.sh"
##
echo "Default user-patches.sh successfully executed"

View File

@ -174,7 +174,8 @@ function register_functions() {
if [ "$LOGWATCH_TRIGGER" != "none" ]; then
_register_setup_function "_setup_logwatch"
fi
_register_setup_function "_setup_user_patches"
# Compute last as the config files are modified in-place
_register_setup_function "_setup_chksum_file"
@ -1491,6 +1492,18 @@ function _setup_logwatch() {
esac
}
function _setup_user_patches() {
notify 'inf' 'Executing user-patches.sh'
if [ -f /tmp/docker-mailserver/user-patches.sh ]; then
chmod +x /tmp/docker-mailserver/user-patches.sh
/tmp/docker-mailserver/user-patches.sh
notify 'inf' "Executed 'config/user-patches.sh'"
else
notify 'inf' "No user patches executed because optional '/tmp/docker-mailserver/user-patches.sh' is not provided."
fi
}
function _setup_environment() {
notify 'task' 'Setting up /etc/environment'

View File

@ -0,0 +1,6 @@
#!/bin/bash
##
# This user script will be executed between configuration and starting daemons
# To enable it you must save it in your config directory as "user-patches.sh"
##
echo "Default user-patches.sh successfully executed"

View File

@ -27,6 +27,11 @@ function count_processed_changes() {
# configuration checks
#
@test "checking configuration: user-patches.sh executed" {
run echo -n "`docker logs mail | grep 'user\-patches\.sh'`"
assert_output --partial "Default user-patches.sh successfully executed"
}
@test "checking configuration: hostname/domainname" {
run docker run `docker inspect --format '{{ .Config.Image }}' mail`
assert_success