Update kernel space check.
authorValentin Vidic <Valentin.Vidic@CARNet.hr>
Wed, 28 Sep 2011 14:48:21 +0000 (16:48 +0200)
committerValentin Vidic <Valentin.Vidic@CARNet.hr>
Wed, 28 Sep 2011 14:48:21 +0000 (16:48 +0200)
src/functions.sh

index be41f84..776c5dd 100644 (file)
@@ -1254,11 +1254,15 @@ check_archives_space() {
 }
 
 check_kernel_space() {
-  local available_disk_space kernel_size linux_images pkg ret
+  local available_disk_space kernel_size linux_images metapkg pkg ret
   available_disk_space=$(free_space /)
   linux_images=$(apt-cache show kernel-2.6-cn | grep ^Depends: \
-    | grep -o 'linux-image[^ ]*')
-  for pkg in $linux_images; do
+    | grep -o 'linux-image[^, ]*')
+  for metapkg in $linux_images; do
+    pkg=$(apt-cache show $metapkg | grep ^Depends: \
+          | grep -o 'linux-image[^, ]*' | head -1)
+    [ "$pkg" ] || continue
+
     kernel_size=$(installed_size $pkg)
     ret=$?
     [ $ret -eq 0 ] && break