mirror of
https://github.com/docker-mailserver/docker-mailserver.git
synced 2024-01-19 02:48:50 +00:00
Merge pull request #1284 from vortex852456/master
Added optional file user-patches.sh for own patches without recompiling
This commit is contained in:
commit
c882d95deb
1
Makefile
1
Makefile
|
@ -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 \
|
||||
|
|
6
config/user-patches.sh.dist
Normal file
6
config/user-patches.sh.dist
Normal 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"
|
|
@ -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'
|
||||
|
||||
|
|
6
test/config/user-patches/user-patches.sh
Normal file
6
test/config/user-patches/user-patches.sh
Normal 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"
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue