#!/bin/bash
update-pmon

if [ "`uname -a |grep loongson-3`" ] ;then
 if ! [ "`echo $1|grep loongson-3`" ] ; then
  exit
 fi
else
 if [ "`uname -a |grep loongson-2k`" ] ;then
  if ! [ "`echo $1|grep loongson-2k`" ] ; then
   exit
  fi
 else
  exit
 fi
fi
if ! [ -e /boot/initrd.img-$1 ] ; then
 update-initramfs -c -k $1
fi
if [ -e /boot/vmlinuz ] ; then
 rm -f /boot/vmlinuz.old
 mv /boot/vmlinuz /boot/vmlinuz.old
fi

if [ -e /boot/initrd.img ] ; then
 rm -f /boot/initrd.img.old
 mv /boot/initrd.img /boot/initrd.img.old
fi

ln /boot/vmlinuz-$1 /boot/vmlinuz
ln /boot/initrd.img-$1 /boot/initrd.img

exit 0
