10-init.sh 1.0 KB

123456789101112131415161718192021222324252627282930
  1. # force new copy of hosts there (otherwise links could be outdated)
  2. mkdir -p /var/spool/postfix/etc
  3. cp -f /etc/hosts /var/spool/postfix/etc/hosts
  4. cp -f /etc/resolv.conf /var/spool/postfix/etc/resolv.conf
  5. cp -f /etc/services /var/spool/postfix/etc/services
  6. go-replace --mode=line --regex -s '^[\s]*myhostname[\s]*=.*' -r "myhostname = $HOSTNAME"
  7. # General
  8. go-replace --mode=lineinfile --regex \
  9. -s '^[\s]*myhostname[\s]*=.*.*' -r "myhostname = $HOSTNAME" \
  10. -s '^[\s]*inet_interfaces[\s]*=.*' -r "inet_interfaces = 127.0.0.1" \
  11. -- /etc/postfix/main.cf
  12. ## REPLAYHOST
  13. if [[ -n "${POSTFIX_RELAYHOST+x}" ]]; then
  14. go-replace --mode=lineinfile --regex \
  15. -s '^[\s]*relayhost[\s]*=.*' -r "relayhost = $POSTFIX_RELAYHOST" \
  16. -- /etc/postfix/main.cf
  17. fi
  18. ## MYNETWORKS
  19. if [[ -n "${POSTFIX_MYNETWORKS+x}" ]]; then
  20. go-replace --mode=lineinfile --regex \
  21. -s '^[\s]*mynetworks[\s]*=.*' -r "mynetworks = $POSTFIX_MYNETWORKS" \
  22. -- /etc/postfix/main.cf
  23. fi
  24. # generate aliases db
  25. newaliases || :