Use dpkg-divert to disable apt-listchanges.
[carnet-upgrade.git] / src / functions.sh
index 7474d5e..25ef535 100644 (file)
@@ -479,6 +479,30 @@ restore_configs () {
   fi
 }
 
+# temporary disable listchanges packages to reduce clutter during upgrade
+apt_listchanges () {
+  local file command=$1
+
+  for file in /etc/apt/apt.conf.d/20listchanges \
+              /etc/apt/apt.conf.d/20listchanges-cn
+  do
+      case $command in
+           disable)
+               if [ -f $file ]; then
+                   dpkg-divert --local --rename --divert $file.$backup_ext \
+                               --add $file || true
+               fi
+               ;;
+
+           enable)
+               if [ -f $file.$backup_ext ]; then
+                   dpkg-divert --remove $file || true
+               fi
+               ;;
+     esac
+  done
+}
+
 # make a silent installation of carnet and srce keyrings
 install_keyrings () {
   pkgadd carnet-keyring srce-keyring