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

# delete 3.10.x kernel coming from 2.8.0 (in case of downgrade)
rm -f  /boot/vmlinuz-3.10.27
rm -f  /boot/System.map-3.10.27
rm -f  /boot/initrd.img-3.10.27
rm -rf /lib/modules/3.10.27 

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

GRUB=/boot/grub/menu.lst
MemTotal=`cat /proc/meminfo | grep MemTotal | cut -d : -f 2  | tr -d [:alpha:] | tr -d [:space:]`
# on 2GB setup, restore imb= command line parameter
if [ ${MemTotal} -gt 1034436 ]; then
	sed s/"root=UUID=7340c0d5-73a8-429a-a254-fe1cb0126280 ro"/"root=UUID=7340c0d5-73a8-429a-a254-fe1cb0126280 imb=0xd0200000,0xd02fffff ro"/g -i $GRUB
fi
if grep -q "pcie_ports=native" $GRUB ; then
	sed s/"pcie_ports=native"// -i $GRUB
fi

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