#!/bin/sh
#
# dcp2000/kernel package post installation script
#

# delete old 2.6.18 kernel
rm -f  /boot/vmlinuz-2.6.18.2
rm -f  /boot/System.map-2.6.18.2
rm -f  /boot/initrd.img-2.6.18.2
rm -rf /lib/modules/2.6.18.2 

# adjust symlink in /boot
UNAME="3.10.27"
ln -sf vmlinuz-$UNAME    /boot/vmlinuz
ln -sf System.map-$UNAME /boot/System.map
ln -sf initrd.img-$UNAME /boot/initrd.img

# update grub (required)
GRUB=/boot/grub/menu.lst
if grep -q "imb=0x88100000" $GRUB ; then
	sed s/"imb=0x88100000,0x881fffff"//g -i $GRUB
fi
if grep -q "imb=0xd0200000" $GRUB ; then
	sed s/"imb=0xd0200000,0xd02fffff"//g -i $GRUB
fi
if ! grep -q "pcie_ports=native" $GRUB ; then
	sed s/"rootdelay=10"/"rootdelay=10 pcie_ports=native"/ -i $GRUB
fi

# depmod (just in case)
depmod -a "$UNAME"
