Handle package cleanup.
[carnet-upgrade.git] / src / functions.sh
index 79c2bfd..5ea115d 100644 (file)
@@ -159,6 +159,14 @@ dist_upgrade () {
   }
 }
 
+apt_autoremove () {
+  log "Running autoremove ..."
+  apt-get -y$s --purge autoremove || {
+    dpkg --configure -a
+    apt-get -yf install
+  }
+}
+
 remove_x() {
   LC_MESSAGES=hr_HR dialog --backtitle "$title" --yesno "$msg_remove_x" 18 75
   if [ $? -eq 0 ]; then
@@ -971,6 +979,8 @@ is_orphaned () {
 remove_orphaned () {
   local package
 
+  apt_autoremove
+
   for package in $orphaned_packages; do
     if is_orphaned $package; then
       pkgrm $package