Fix size detection for CN kernels.
authorValentin Vidic <Valentin.Vidic@CARNet.hr>
Wed, 17 Jun 2009 11:41:35 +0000 (13:41 +0200)
committerValentin Vidic <Valentin.Vidic@CARNet.hr>
Wed, 17 Jun 2009 11:41:35 +0000 (13:41 +0200)
src/functions.sh

index beccc6d..b931651 100644 (file)
@@ -1297,16 +1297,23 @@ check_archives_space() {
 }
 
 check_kernel_space() {
-  local available_disk_space kernel_size
+  local available_disk_space kernel_size linux_images pkg ret
   available_disk_space=$(free_space /)
-  kernel_size=$(installed_size kernel-2.6-cn)
+  linux_images=$(apt-cache show kernel-2.6-cn | grep ^Depends: \
+    | grep -o 'linux-image[^ ]*')
+  for pkg in $linux_images; do
+    kernel_size=$(installed_size $pkg)
+    ret=$?
+    [ $ret -eq 0 ] && break
+  done
 
-  if [ $? -ne 0 ]; then
+  if [ $ret -ne 0 ]; then
     log "Failed to get installed size, skipping check."
     return 0
   fi
 
   log "Free space in /: ${available_disk_space}MB"
+  log "Kernel package: $pkg"
   log "Kernel size: ${kernel_size}MB"
 
   if LC_ALL=C apt-get --yes --print-uris install kernel-2.6-cn \