mirror of
https://github.com/docker-mailserver/docker-mailserver.git
synced 2024-01-19 02:48:50 +00:00
test/config backup & restore (#907)
* backup and restore of test/config folder as done for the regular config folder as well. * permissions fix * preserving permissions and ownership * new backup rule
This commit is contained in:
parent
ee4b434a5c
commit
a7589aa353
33
Makefile
33
Makefile
|
@ -1,8 +1,8 @@
|
||||||
NAME = tvial/docker-mailserver:testing
|
NAME = tvial/docker-mailserver:testing
|
||||||
|
|
||||||
all: build-no-cache generate-accounts run generate-accounts-after-run fixtures tests clean
|
all: build-no-cache backup generate-accounts run generate-accounts-after-run fixtures tests clean
|
||||||
all-fast: build generate-accounts run generate-accounts-after-run fixtures tests clean
|
all-fast: build backup generate-accounts run generate-accounts-after-run fixtures tests clean
|
||||||
no-build: generate-accounts run generate-accounts-after-run fixtures tests clean
|
no-build: backup generate-accounts run generate-accounts-after-run fixtures tests clean
|
||||||
|
|
||||||
build-no-cache:
|
build-no-cache:
|
||||||
cd test/docker-openldap/ && docker build -f Dockerfile -t ldap --no-cache .
|
cd test/docker-openldap/ && docker build -f Dockerfile -t ldap --no-cache .
|
||||||
|
@ -12,6 +12,15 @@ build:
|
||||||
cd test/docker-openldap/ && docker build -f Dockerfile -t ldap .
|
cd test/docker-openldap/ && docker build -f Dockerfile -t ldap .
|
||||||
docker build -t $(NAME) .
|
docker build -t $(NAME) .
|
||||||
|
|
||||||
|
backup:
|
||||||
|
# if backup directories exist, clean hasn't been called, therefore we shouldn't overwrite it. It still contains the original content.
|
||||||
|
@if [ ! -d config.bak ]; then\
|
||||||
|
cp -rp config config.bak; \
|
||||||
|
fi
|
||||||
|
@if [ ! -d testconfig.bak ]; then\
|
||||||
|
cp -rp test/config testconfig.bak ;\
|
||||||
|
fi
|
||||||
|
|
||||||
generate-accounts:
|
generate-accounts:
|
||||||
docker run --rm -e MAIL_USER=user1@localhost.localdomain -e MAIL_PASS=mypassword -t $(NAME) /bin/sh -c 'echo "$$MAIL_USER|$$(doveadm pw -s SHA512-CRYPT -u $$MAIL_USER -p $$MAIL_PASS)"' > test/config/postfix-accounts.cf
|
docker run --rm -e MAIL_USER=user1@localhost.localdomain -e MAIL_PASS=mypassword -t $(NAME) /bin/sh -c 'echo "$$MAIL_USER|$$(doveadm pw -s SHA512-CRYPT -u $$MAIL_USER -p $$MAIL_PASS)"' > test/config/postfix-accounts.cf
|
||||||
docker run --rm -e MAIL_USER=user2@otherdomain.tld -e MAIL_PASS=mypassword -t $(NAME) /bin/sh -c 'echo "$$MAIL_USER|$$(doveadm pw -s SHA512-CRYPT -u $$MAIL_USER -p $$MAIL_PASS)"' >> test/config/postfix-accounts.cf
|
docker run --rm -e MAIL_USER=user2@otherdomain.tld -e MAIL_PASS=mypassword -t $(NAME) /bin/sh -c 'echo "$$MAIL_USER|$$(doveadm pw -s SHA512-CRYPT -u $$MAIL_USER -p $$MAIL_PASS)"' >> test/config/postfix-accounts.cf
|
||||||
|
@ -205,7 +214,6 @@ generate-accounts-after-run:
|
||||||
sleep 10
|
sleep 10
|
||||||
|
|
||||||
fixtures:
|
fixtures:
|
||||||
cp -r config config.bak
|
|
||||||
# Setup sieve & create filtering folder (INBOX/spam)
|
# Setup sieve & create filtering folder (INBOX/spam)
|
||||||
docker cp "`pwd`/test/config/sieve/dovecot.sieve" mail:/var/mail/localhost.localdomain/user1/.dovecot.sieve
|
docker cp "`pwd`/test/config/sieve/dovecot.sieve" mail:/var/mail/localhost.localdomain/user1/.dovecot.sieve
|
||||||
docker exec mail /bin/sh -c "maildirmake.dovecot /var/mail/localhost.localdomain/user1/.INBOX.spam"
|
docker exec mail /bin/sh -c "maildirmake.dovecot /var/mail/localhost.localdomain/user1/.INBOX.spam"
|
||||||
|
@ -262,16 +270,11 @@ clean:
|
||||||
mail_override_hostname
|
mail_override_hostname
|
||||||
|
|
||||||
@if [ -d config.bak ]; then\
|
@if [ -d config.bak ]; then\
|
||||||
sudo rm -rf config ;\
|
rm -rf config ;\
|
||||||
mv config.bak config ;\
|
mv config.bak config ;\
|
||||||
fi
|
fi
|
||||||
-sudo rm -rf test/onedir \
|
@if [ -d testconfig.bak ]; then\
|
||||||
test/config/empty \
|
rm -rf test/config ;\
|
||||||
test/config/keyDefault \
|
mv testconfig.bak test/config ;\
|
||||||
test/config/key2048 \
|
fi
|
||||||
test/config/key1024 \
|
-sudo rm -rf test/onedir
|
||||||
test/config/without-accounts \
|
|
||||||
test/config/without-virtual \
|
|
||||||
test/config/with-domain \
|
|
||||||
test/config/dovecot-lmtp/userdb \
|
|
||||||
test/config/postfix-*-access.cf*
|
|
||||||
|
|
|
@ -1,2 +0,0 @@
|
||||||
user1@localhost.localdomain:{SHA512-CRYPT}$6$pnBf.UoYuOJ0EcxA$AY.2iRKsDftvCs5u2u72jgKcQHdN/tLguweV08YuBNaZGN4Xn9N8ES0NPxErqRR433vqBFUMmOiVNVF3JgMpB.:5000:5000::/var/mail/localhost.localdomain/user1::
|
|
||||||
user2@otherdomain.tld:{SHA512-CRYPT}$6$xkJ0klS8NqpoGeVB$jKmC1YE03GeLtrcwgnQ14AG.nYm8Vj0l0BqUVM.VQ3MVBwYoooJL7JS7czR17gfwM9SRB/311OP8nF/GpNKr5.:5000:5000::/var/mail/otherdomain.tld/user2::
|
|
Loading…
Reference in a new issue