#!/bin/sh # https://linuxhint.com/enable-disable-unattended-upgrades-ubuntu/ # https://newbedev.com/how-is-unattended-upgrades-started-and-how-can-i-modify-its-schedule # https://haydenjames.io/how-to-enable-unattended-upgrades-on-ubuntu-debian/ # https://askubuntu.com/questions/921162/how-can-i-automate-a-conffile-prompt-in-unattended-upgrades # https://github.com/mvo5/unattended-upgrades/blob/master/README.md # To run from Internet: # sudo sh -c "$(curl -s http://apps.control2net.com/apt/install-dingo-stack-upgrade)" FILE="/etc/apt/apt.conf.d/50unattended-upgrades" if [ -f "$FILE" ]; then echo "DINGO-STACK UPGRADE IS ALREADY INSTALLED !" echo "" echo "Edit /etc/apt/apt.conf.d/50unattended-upgrades" echo ' Add "site=apps.control2net.com,component=main";' echo " to section: Unattended-Upgrade::Origins-Pattern " echo " Also add this section:" echo " Dpkg::Options {" echo ' "--force-confdef";' echo ' "--force-confold";' echo " };" echo "" echo "Also check /etc/apt/apt.conf.d/20auto-upgrades" #exit 0 else apt update -y apt -y --force-yes install unattended-upgrades cd /etc/apt/apt.conf.d/ wget -O 50unattended-upgrades http://apps.control2net.com/apt/misc/50unattended-upgrades exists=`grep -F 'Download-Upgradeable-Packages' /etc/apt/apt.conf.d/20auto-upgrades` if [ -z "$exists" ] then bash -c "echo 'APT::Periodic::Download-Upgradeable-Packages \"1\";' >> /etc/apt/apt.conf.d/20auto-upgrades" fi fi echo "Finished." echo "These files control the behavior:" echo " /etc/apt/apt.conf.d/50unattended-upgrades" echo " /etc/apt/apt.conf.d/20auto-upgrades" echo "Log files:" echo " /var/log/unattended-upgrades/unattended-upgrades-dpkg.log" echo " /unattended-upgrades.log"