Avoid to overwrite pre-defined /etc/msmtprc

This commit is contained in:
Adrien Ferrand 2020-11-06 14:40:29 +01:00
parent 650333e3aa
commit d79dfd142d
3 changed files with 14 additions and 7 deletions

View File

@ -1,6 +1,10 @@
# Changelog # Changelog
## master - CURRENT ## master - CURRENT
### Added
* The system configuration file `/etc/msmtprc` for `msmtprc` is not overwritten
if it already exists at container initialization.
## 4.4.0-3 - 06/11/2020 ## 4.4.0-3 - 06/11/2020
### Modified ### Modified
* Update base image to Alpine 3.12.1 * Update base image to Alpine 3.12.1

View File

@ -106,14 +106,16 @@ if [ -f /firstrun ]; then
touch /var/log/lighttpd/error.log && chown -R "$BACKUPPC_USERNAME":"$BACKUPPC_GROUPNAME" /var/log/lighttpd touch /var/log/lighttpd/error.log && chown -R "$BACKUPPC_USERNAME":"$BACKUPPC_GROUPNAME" /var/log/lighttpd
# Configure standard mail delivery parameters (may be overriden by backuppc user-wide config) # Configure standard mail delivery parameters (may be overriden by backuppc user-wide config)
echo "account default" > /etc/msmtprc if [ ! -f /etc/msmtprc ]; then
echo "logfile /var/log/msmtp.log" >> /etc/msmtprc echo "account default" > /etc/msmtprc
echo "host ${SMTP_HOST:-mail.example.org}" >> /etc/msmtprc echo "logfile /var/log/msmtp.log" >> /etc/msmtprc
if [ "${SMTP_MAIL_DOMAIN:-}" != "" ]; then echo "host ${SMTP_HOST:-mail.example.org}" >> /etc/msmtprc
echo "from %U@${SMTP_MAIL_DOMAIN}" >> /etc/msmtprc if [ "${SMTP_MAIL_DOMAIN:-}" != "" ]; then
echo "from %U@${SMTP_MAIL_DOMAIN}" >> /etc/msmtprc
fi
touch /var/log/msmtp.log
chown "${BACKUPPC_USERNAME}:${BACKUPPC_GROUPNAME}" /var/log/msmtp.log
fi fi
touch /var/log/msmtp.log
chown "${BACKUPPC_USERNAME}:${BACKUPPC_GROUPNAME}" /var/log/msmtp.log
# Clean # Clean
rm -rf "/root/BackupPC-$BACKUPPC_VERSION.tar.gz" "/root/BackupPC-$BACKUPPC_VERSION" /firstrun rm -rf "/root/BackupPC-$BACKUPPC_VERSION.tar.gz" "/root/BackupPC-$BACKUPPC_VERSION" /firstrun

View File

@ -38,6 +38,7 @@ def main():
"## master - CURRENT\n", "## master - CURRENT\n",
"""\ """\
## master - CURRENT ## master - CURRENT
## {0} - {1} ## {0} - {1}
""".format( """.format(
new_version, today.strftime("%d/%m/%Y") new_version, today.strftime("%d/%m/%Y")