Update configure auto updates method

Signed-off-by: Alban Vidal <alban.vidal@zordhak.fr>
This commit is contained in:
Alban Vidal 2018-05-15 17:27:13 +00:00
parent 57623a2cb8
commit 7d95af1423

View File

@ -110,11 +110,24 @@ apt-get -y install \
apt-listchanges \
logrotate
################################################################################
# Configure auto updates
sed -i \
-e "s#^//Unattended-Upgrade::Mail .*#Unattended-Upgrade::Mail '$UNATTENDED_EMAIL';#" \
-e 's#^//Unattended-Upgrade::MailOnlyOnError .*#Unattended-Upgrade::MailOnlyOnError "true";#' \
/etc/apt/apt.conf.d/50unattended-upgrades
UNA_FILE="/etc/apt/apt.conf.d/50unattended-upgrades"
# email setting
if ! grep -q '^Unattended-Upgrade::Mail ' $UNA_FILE ; then
echo "Unattended-Upgrade::Mail '$UNATTENDED_EMAIL';" >> $UNA_FILE
else
sed -i "s/Unattended-Upgrade::Mail .*/Unattended-Upgrade::Mail '$UNATTENDED_EMAIL';/" $UNA_FILE
fi
# MailOnlyOnError
if ! grep -q '^Unattended-Upgrade::MailOnlyOnError ' $UNA_FILE ; then
echo "Unattended-Upgrade::MailOnlyOnError 'true';" >> $UNA_FILE
else
sed -i "s/Unattended-Upgrade::MailOnlyOnError .*/Unattended-Upgrade::MailOnlyOnError 'true';/" $UNA_FILE
fi
################################################################################
# Set git global config
git config --global user.name "$GIT_USERNAME"