Bug#381737: update-grub: Does not like my custom built kernel

era eriksson era at iki.fi
Sat Dec 27 17:32:08 UTC 2008


retitle 381737 update-grub: incorrect regex discards some kernels
thanks

> for kern in $(/bin/ls -1vr /boot | grep -v "dpkg-*" | grep -v "xen" | grep "^vmlinuz-") ; do

The quoted shell script snippet is actually incorrect for the dpkg-
case, too.  I assume what is meant is simply "dpkg-" but the asterisk
will discard any line containing "dpkg", without the dash too (in
regular expression syntax, the asterisk means "zero or more occurrences
of the previous regular expression").

As a matter of fact, I would suggest to refactor the code into

  for kern in $(/bin/ls -1vr /boot); do
    case $kern in
      *.dpkg-*|*-xen-*) continue;;
      vmlinuz-*)  ;;
      *) continue ;;
    esac

The *-xen-* wildcard seems to match the file names given to Xen kernels,
although I could be mistaken on that.  (Unlike grep, the case statement
uses shell wildcards, not true regular expressions.  The continue
statement causes the loop to skip to the next iteration.)

/* era */

-- 
If this were a real .signature, it would suck less.  Well, maybe not.






More information about the Pkg-grub-devel mailing list