dockerfiles/mutt/entrypoint.sh

45 lines
1.2 KiB
Bash
Raw Normal View History

2014-12-05 08:09:20 +01:00
#!/bin/bash
set -e
2015-01-07 19:59:35 +01:00
if [ ! "$GMAIL" ]; then
2014-12-05 08:09:20 +01:00
echo >&2 'error: missing GMAIL environment variable'
echo >&2 ' try running again with -e GMAIL=your-email@gmail.com'
echo >&2 ' optionally, you can also specify -e GMAIL_PASS'
2015-01-13 17:52:55 +01:00
echo >&2 ' -e GMAIL_NAME="Your Name" and GMAIL_FROM=email@your-domain.com'
2014-12-05 08:09:20 +01:00
echo >&2 ' if not specified, both default to the value of GMAIL'
exit 1
fi
2015-01-07 19:59:35 +01:00
if [ ! "$GMAIL_NAME" ]; then
GMAIL_NAME="$GMAIL"
2014-12-05 08:09:20 +01:00
fi
2015-01-13 17:52:55 +01:00
if [ ! "$GMAIL_FROM" ]; then
GMAIL_FROM="$GMAIL"
fi
sed -i "s/%GMAIL_LOGIN%/$GMAIL/g" "$HOME/.mutt/muttrc"
sed -i "s/%GMAIL_NAME%/$GMAIL_NAME/g" "$HOME/.mutt/muttrc"
sed -i "s/%GMAIL_PASS%/$GMAIL_PASS/g" "$HOME/.mutt/muttrc"
2015-01-13 17:52:55 +01:00
sed -i "s/%GMAIL_FROM%/$GMAIL_FROM/g" "$HOME/.mutt/muttrc"
2014-12-05 08:09:20 +01:00
2015-01-07 19:59:35 +01:00
if [ -d "$HOME/.gnupg" ]; then
2014-12-05 08:09:20 +01:00
{
echo
echo 'source /usr/share/doc/mutt/examples/gpg.rc'
echo 'set pgp_use_gpg_agent = yes'
2015-01-07 19:59:35 +01:00
if [ "$GPG_ID" ]; then
2014-12-05 08:09:20 +01:00
echo "set pgp_sign_as = $GPG_ID"
fi
echo 'set crypt_replysign = yes'
echo 'set crypt_replysignencrypted = yes'
echo 'set crypt_verify_sig = yes'
} >> "$HOME/.muttrc"
fi
2015-01-07 19:59:35 +01:00
if [ -e "$HOME/.muttrc.local" ]; then
echo "source $HOME/.muttrc.local" >> "$HOME/.mutt/muttrc"
2014-12-05 08:09:20 +01:00
fi
exec "$@"