should work now, if the reference sites are right about the variable for non-interactive. the var was not passed in before since sudo is not like a sub-shell. now the two pieces needed, setting the var and running command that listens to var, are done in a single multi-line bash command.
sudo apt-get update -y
test_or_die "problem while doing 'apt-get update'"
+
# 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"
+sudo bash -c "\
+ export DEBIAN_FRONTEND=noninteractive; \
+ apt-get dist-upgrade -y -o Dpkg::Options::=\"--force-confdef\" \
+ -o Dpkg::Options::=\"--force-confold\"; \
+"
test_or_die "problem while doing 'apt-get dist-upgrade'"