diff --git a/install-debian.sh b/install-debian.sh index bc4fd86..23a3c45 100644 --- a/install-debian.sh +++ b/install-debian.sh @@ -1,5 +1,10 @@ #!/usr/bin/env bash +# hotfix for strange strato configuration +# Copyright (C) 2017 Andreas Fendt - All Rights Reserved +# Permission to copy and modify is granted under the MIT license +# Last revised 18.11.2017 + # check if root if [[ $EUID -ne 0 ]]; then echo "This script must be run as root" 1>&2 diff --git a/unattended-upgrades.sh b/unattended-upgrades.sh new file mode 100644 index 0000000..323ef53 --- /dev/null +++ b/unattended-upgrades.sh @@ -0,0 +1,68 @@ +#!/usr/bin/env bash + +# configure unattended-upgrades on debian plattforms +# Copyright (C) 2017 Andreas Fendt - All Rights Reserved +# Permission to copy and modify is granted under the MIT license +# Last revised 18.11.2017 + +# check if root +if [[ $EUID -ne 0 ]]; then + echo "This script must be run as root" 1>&2 + exit 1 +fi + +# check if debian +if [ ! "$(grep -Ei 'debian|buntu' /etc/*release)" ]; then + echo "This script must be run on a debian system" 1>&2 + exit 1 +fi + +# update system +apt-get update -y +apt-get dist-upgrade -y + +# install required packages +apt-get install -y unattended-upgrades apt-listchanges + +# configure 50unattended-upgrades +sed -i -e ' +s/ "origin=Debian,codename=${distro_codename},label=Debian-Security";/\/\/ "origin=Debian,codename=${distro_codename},label=Debian-Security";\n "o=*";/g +s/\/\/Unattended-Upgrade::AutoFixInterruptedDpkg "false"/Unattended-Upgrade::AutoFixInterruptedDpkg "true"/g +s/\/\/Unattended-Upgrade::MinimalSteps "true"/Unattended-Upgrade::MinimalSteps "true"/g +s/\/\/Unattended-Upgrade::InstallOnShutdown "true"/Unattended-Upgrade::InstallOnShutdown "false"/g +s/\/\/Unattended-Upgrade::Mail "root"/Unattended-Upgrade::Mail "root"/g +s/\/\/Unattended-Upgrade::MailOnlyOnError "true"/Unattended-Upgrade::MailOnlyOnError "true"/g +s/\/\/Unattended-Upgrade::Remove-Unused-Dependencies "false"/Unattended-Upgrade::Remove-Unused-Dependencies "true"/g +s/\/\/Unattended-Upgrade::Automatic-Reboot "false"/Unattended-Upgrade::Automatic-Reboot "true"/g +s/\/\/Unattended-Upgrade::Automatic-Reboot-Time "02:00"/Unattended-Upgrade::Automatic-Reboot-Time "02:00"/g +' /etc/apt/apt.conf.d/50unattended-upgrades + +# configure 02periodic +cat > /etc/apt/apt.conf.d/02periodic </dev/null, add -d) +// 3: + trace on +APT::Periodic::Verbose "2"; +EOL