#!/bin/sh
# vim: set ts=4 sw=4:
set -eu

readonly SSMTP_CONF='/etc/ssmtp/ssmtp.conf'

if [ ! -f "$SSMTP_CONF" ]; then
	exit 0
fi

if [ "${ROOT_EMAIL:-}" ]; then
	sed -i "s/^[# ]*Root=.*/Root=$ROOT_EMAIL/i" "$SSMTP_CONF"
fi

if [ "${SMTP:-}" ]; then
	sed -i "s/^[# ]*Mailhub=.*/Mailhub=$SMTP/i" "$SSMTP_CONF"
fi
