# HG changeset patch # User border # Date 1357407250 18000 # Node ID 47a7ea2215abc3845db4bfe0ece347eb1ecc14a8 # Parent 6b09507225ecf254322c4b6b217533eb62be3a26 Create grub entry based on current root partition. Fix bug78 diff -r 6b09507225ec -r 47a7ea2215ab linux/receipt --- a/linux/receipt Sat Jan 05 14:44:51 2013 +0100 +++ b/linux/receipt Sat Jan 05 12:34:10 2013 -0500 @@ -324,11 +324,21 @@ chroot "$1/" depmod -a $KBASEVER-slitaz # GRUB stuff. if [ -f "$1/boot/grub/menu.lst" ]; then - root_dev=`cat $1/boot/grub/menu.lst | grep root= | sed 's/.*root=\([^ ]*\).*/\1/' | head -n 1` - grub_dev=`cat $1/boot/grub/menu.lst | grep "root (" | head -n 1` - # Add new kernel entry in case of upgrade for installed system. - if ! grep -q vmlinuz-$VERSION-slitaz $1/boot/grub/menu.lst; then - cat >> $1/boot/grub/menu.lst << EOT + root_dev="/dev/`lsblk | grep '/$'| grep -o '[a-z]d[a-z][0-9]*'`" # current root device + grub_part="$(( `echo $root_dev | grep -o '[0-9]*$'`-1 ))" + grub_dev="`grep $(echo $root_dev | grep -o '^/dev/.d.' ) $1/boot/grub/device.map |\ + cut -f1 | sed "s/)$/.$grub_part)/g"`" # use device.map to find grub device number + + # Add and clean kernel entrys in case of upgrade for installed system. + if ! grep -q vmlinuz-$VERSION-slitaz $1/boot/grub/menu.lst; then + + #clean the old entry + # TODO somewhere, the old vmlinuz file is removed. + # but the entry is still there. this cause a grub error:15 when selected + # see http://bugs.slitaz.org/?id=74 + + #add the new + cat >> $1/boot/grub/menu.lst << EOT title SliTaz GNU/Linux (Kernel $VERSION-slitaz) $grub_dev