Patch from dcg: detect /etc/ssmtp.conf changes inside update script, instead of touching a /tmp file

This commit is contained in:
John Locke 2015-11-19 11:58:47 -08:00
parent aa6a9d5b12
commit 11b9c43044
2 changed files with 7 additions and 6 deletions

View File

@ -1,11 +1,6 @@
#!/bin/bash #!/bin/bash
if [[ -e /tmp/smtpconfig ]]; then
echo "smtp configured."
else
update_ssmtp.sh update_ssmtp.sh
touch /tmp/smtpconfig
fi
if [[ ! -f ledgersmb.conf ]]; then if [[ ! -f ledgersmb.conf ]]; then

View File

@ -1,4 +1,9 @@
#!/bin/bash #!/bin/bash
ConfiguredComment='# install script update_ssmtp.sh has configured ssmtp'
grep -nc "$ConfiguredComment" /etc/ssmtp.conf && {
echo "smtp configured."
exit
}
sed -i \ sed -i \
-e "s/\(root=\).*\$/\1$SSMTP_ROOT/g" \ -e "s/\(root=\).*\$/\1$SSMTP_ROOT/g" \
@ -10,3 +15,4 @@ sed -i \
[ -z "$SSMTP_AUTH_PASS" ] || echo "AuthPass=$SSMTP_AUTH_PASS" >> /etc/ssmtp/ssmtp.conf [ -z "$SSMTP_AUTH_PASS" ] || echo "AuthPass=$SSMTP_AUTH_PASS" >> /etc/ssmtp/ssmtp.conf
[ -z "$SSMTP_AUTH_METHOD" ] || echo "AuthMethod=$SSMTP_AUTH_METHOD" >> /etc/ssmtp/ssmtp.conf [ -z "$SSMTP_AUTH_METHOD" ] || echo "AuthMethod=$SSMTP_AUTH_METHOD" >> /etc/ssmtp/ssmtp.conf
[ -z "$SSMTP_FROMLINE_OVERRIDE" ] || echo "FromLineOverride=$SSMTP_FROMLINE_OVERRIDE" >> /etc/ssmtp/ssmtp.conf [ -z "$SSMTP_FROMLINE_OVERRIDE" ] || echo "FromLineOverride=$SSMTP_FROMLINE_OVERRIDE" >> /etc/ssmtp/ssmtp.conf
echo "$ConfiguredComment" >> /etc/ssmtp/ssmtp.conf