From 9ea87383abcbf49b21fafad0a1b92199381df54f Mon Sep 17 00:00:00 2001 From: Frederick Ding Date: Thu, 30 Jul 2015 22:04:01 -0400 Subject: [PATCH] Copy .fetchmailrc from /config/ in entrypoint wrapper --- docker-entrypoint.sh | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh index e69de29..ee1511e 100755 --- a/docker-entrypoint.sh +++ b/docker-entrypoint.sh @@ -0,0 +1,25 @@ +#!/bin/bash + +# verify maildir +if [ -d /var/mail/working ]; then + echo "/var/mail/working exists" +else + maildirmake /var/mail/working + echo "to /var/mail/working" > /root/.mailfilter +fi + +# check for user config fetchmailrc +if [ -f /config/.fetchmailrc ]; then + cp /config/.fetchmailrc /root/.fetchmailrc + chmod 0700 /root/.fetchmailrc + echo "Installed .fetchmailrc" +fi + +if [ "$1" = 'cron' ] || [ "$1" = '/opt/save-attachments.sh' ]; then + if [ ! -f /root/.fetchmailrc ]; then + echo "Cannot start container without .fetchmailrc" + exit 1 + fi +fi + +exec "$@"