#!/bin/sh
#Still untested hope it would work
printf "Welcome To Kernel Compiler 0.1 - ver. Whatever \n";
echo   "#%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%#";
printf "\n\n\n";
echo "Note This Shit Assumes That You've already used make config";
echo "or make menuconfig to make your kernel configuration";
echo "If you still haven't then go to your kernelpath and do it";
echo "then run the shell script again";
echo -n "Enter Path to the kernel source:";
read kernelpath
echo 'Do you want bzImaged Kernel [y/n]';
read ans
echo -n "Enter The name for the new kernel:";
read kernelname
if [ "$ans" = "y" ] || [ "$ans" = "Y" ]; then
cd "$kernelpath"; make dep && make clean && make bzImage && make modules && make modules_install;
cp  -f "$kernelpath"/arch/i386/boot/bzImage /boot/"$kernelname";;
ln -sf /boot/"$kernelname" vmlinuz-"$kernelname";
echo "#Generated By hipo'z kernel compiler"; > /etc/lilo.conf
#echo "#10x For Using kernel compiler Greetingz to all members of pC-fREAK Org";
#echo "image=/boot/vmlinuz-"$kernelname" > /etc/lilo.conf;
#echo "label=Linux-"$kernelname" > /etc/lilo.conf;
#echo "read-only" > /etc/lilo.conf;
/sbin/lilo -C /etc/lilo.conf
printf "If All is fine you have made a suitable kernel configuration\n"
printf "before using this then you can reboot and boot from the new kernel\n"
printf "If Things goes messy don't blame this stuff it's under The GNU License\n"
printf 'NO WARRANTIES          Enjoy and have fun:] hipod.'
else
cd "$kernelpath"; make dep && make install && make modules && make modules_install;
cp -f "$kernelpath"/arch/i386/boot/*linu* /boot/"$kernelname";
ln -sf /boot/"$kernelname" vmlinuz-"$kernelname";
echo "#Generated By hipo'z kernel compiler" > /etc/lilo.conf;
echo "#Thanx For Using kernel compiler Greetingz to all members of pC-fREAK Org"
echo "image=/boot/vmlinuz-$kernelname" > /etc/lilo.conf;
echo "label=Linux-$kernelname" > /etc/lilo.conf;
echo "read-only" > /etc/lilo.conf;
/sbin/lilo -C /etc/lilo.conf
printf "If All is fine you have made a suitable kernel configuration\n"
printf "before using this then you can reboot and boot from the new kernel\n"
printf "If Things goes messy don't blame this stuff it's under The GNU License\n"
echo 'NO WARRANTIES          Enjoy and have fun:] hipod'
fi

			


