Cleanup dpkg available file.
authorValentin Vidic <Valentin.Vidic@CARNet.hr>
Thu, 9 Feb 2012 09:11:54 +0000 (10:11 +0100)
committerValentin Vidic <Valentin.Vidic@CARNet.hr>
Thu, 9 Feb 2012 09:11:54 +0000 (10:11 +0100)
src/actions/main.queue
src/functions.sh

index c087301..12aea51 100644 (file)
@@ -17,6 +17,7 @@ pkg slapd                     backup_slapd_db
 true                           backup_etc_dir          # etc i drugo
 true                           create_sources_list
 true                           apt_update
+true                           cleanup_available
 true                           check_archives_space
 true                           check_kernel_space
 true                           apt_download            # skini pakete
index fa0406b..83fc87d 100644 (file)
@@ -128,6 +128,21 @@ apt_autoremove () {
   }
 }
 
+# remove stale package information from available
+#   warning, in file '/var/lib/dpkg/available'
+#   near line 58185 package 'vim-cn': missing architecture
+cleanup_available () {
+  log "Cleaning dpkg available file"
+
+  available=$(mktemp /var/lib/carnet-upgrade/available.XXXXXX)
+  apt-cache dumpavail > $available
+
+  dpkg --clear-avail
+  dpkg --update-avail $available
+
+  rm -f $available
+}
+
 remove_x() {
   LC_MESSAGES=hr_HR dialog --backtitle "$title" --yesno "$msg_remove_x" 18 75
   if [ $? -eq 0 ]; then