Skip to content

Instantly share code, notes, and snippets.

@xuru
Created July 10, 2012 17:42
Show Gist options
  • Save xuru/3084995 to your computer and use it in GitHub Desktop.
Save xuru/3084995 to your computer and use it in GitHub Desktop.
non-interactive debian/ubuntu upgrade
#! /bin/sh
PATH=/usr/sbin:/sbin:/usr/bin:/bin
cat <<EOF > /etc/apt/apt.conf.noninteractive
APT::Get::Assume-Yes "true";
APT::Get::Show-Upgraded "true";
APT::Quiet "true";
DPkg::Options {"--force-confmiss";"--force-confold"};
DPkg::Pre-Install-Pkgs {"/usr/sbin/dpkg-preconfigure --apt";};
Dir::Etc::SourceList "/etc/apt/sources.list";
APT::ExtractTemplates::TempDir "/tmp";
EOF
if [ ! "`apt-get -q update | grep ^Fetched`" ]
then
exit 0
fi
# Packages updated: do an upgrade
export DEBIAN_FRONTEND=noninteractive
export DEBIAN_PRIORITY=critical
/usr/bin/apt-get --config-file /etc/apt/apt.conf.noninteractive -y --force-yes upgrade
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment