-# new magic to tell dpkg to go with existing config files. let's see if it works!
-sudo apt-get dist-upgrade -y -o Dpkg::Options::="--force-confold"
+# newest magic to tell dpkg to go with existing config files and force non-interactive version.
+export DEBIAN_FRONTEND=noninteractive
+sudo apt-get dist-upgrade -y -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold"