wok rev 15685

linux-lxc: add post_install() for update menu.lst
author Stanislas Leduc <shann@slitaz.org>
date Sat Dec 21 07:21:07 2013 +0100 (2013-12-21)
parents 78f8749b32c7
children bd2567cbb9b5
files linux-lxc/receipt
line diff
     1.1 --- a/linux-lxc/receipt	Fri Dec 20 23:12:31 2013 +0100
     1.2 +++ b/linux-lxc/receipt	Sat Dec 21 07:21:07 2013 +0100
     1.3 @@ -20,3 +20,37 @@
     1.4          cp -a $src/lib/firmware $fs/lib
     1.5          chown -R root.root $fs
     1.6  }
     1.7 +
     1.8 +# Pre and post install commands for Tazpkg.
     1.9 +post_install()
    1.10 +{
    1.11 +    echo "Processing post-install commands..."
    1.12 +    chroot "$1/" depmod -a $VERSION-lxc-slitaz
    1.13 +    # GRUB stuff.
    1.14 +    if [ -f "$1/boot/grub/menu.lst" ]; then
    1.15 +        root_dev=`cat $1/boot/grub/menu.lst | grep root= | sed 's/.*root=\([^ 
    1.16 +]*\).*/\1/' | head -n 1`
    1.17 +                grub_dev=`cat $1/boot/grub/menu.lst | grep "root (" | head -n 
    1.18 +1`
    1.19 +                # Add new kernel entry in case of upgrade for installed system.
    1.20 +                if ! grep -q $PACKAGE-$VERSION-lxc-slitaz $1/boot/grub/menu.lst; 
    1.21 +then
    1.22 +                cat >> $1/boot/grub/menu.lst << EOT
    1.23 +
    1.24 +title SliTaz GNU/Linux (Kernel $VERSION-lxc-slitaz)
    1.25 +$grub_dev
    1.26 +kernel /boot/vmlinuz-$VERSION-lxc-slitaz root=$root_dev
    1.27 +EOT
    1.28 +                fi
    1.29 +                # Display information message.
    1.30 +        cat <<EOT
    1.31 +----
    1.32 +GRUB is installed, these tree lines must be in your /boot/grub/menu.lst:
    1.33 +
    1.34 +title  SliTaz GNU/Linux (Kernel $VERSION-lxc-slitaz)
    1.35 +$grub_dev
    1.36 +kernel /boot/vmlinuz-$VERSION-lxc-slitaz root=$root_dev
    1.37 +----
    1.38 +EOT
    1.39 +        fi
    1.40 +}