core-extra/packaging/bsd/core-kernel-deinstall-8.x.sh
2013-08-29 14:21:13 +00:00

21 lines
418 B
Bash
Executable file

#!/bin/sh
PREV=""
if [ ! -e "/boot/kernel.old" ] ; then
if [ ! -e "/boot/GENERIC" ] ; then
echo Previous kernel does not exist in /boot/kernel.old or /boot/GENERIC !
exit 1;
else
PREV="/boot/GENERIC"
fi;
else
PREV="/boot/kernel.old"
fi;
echo Removing current kernel...
chflags -R noschg /boot/kernel
rm -rf /boot/kernel
echo Restoring previous kernel from $PREV...
mv $PREV /boot/kernel
exit 0;