#!/bin/bash # Script para Recompilar el Kernel ;-) # Date: 01/08/2003 # Author: Fermat # variables globales nbre="linux-2.4.21" tarball="linux-2.4.21.tar.bz2" # $nbre.tar.bz2 config="xconfig" # modificalo por menuconfig o config a sekas, según la forma de escoger las opciones para tu kernel image="bzImage" # por defecto es la mejor opción para compilar tu tocho-kernel function verifica { while [ "1" -eq "1" ] do read opt case $opt in s|S|y|Y) return 0 ;; n|N) return 1 ;; esac done } function seguir { echo "Acabas de hacer ''$1'', ¿deseas seguir con ''$2''? (s/n)" verifica return $? # con q valor acaba la funcion ""verifica"" } if [ `/usr/bin/whoami` != "root" ];then echo Necesitas ser ROOT para ejecutar este script else \cd /usr/src/ if [ $? -eq 0 -a -f $tarball ];then # SI (conseguimos entrar en /usr/src/ && existe el tarball) ENTONCES /bin/tar xjvf $tarball && \cd $nbre if [ $? -eq 0 ];then #''make xconfig'' o ''make menuconfig'' o ''make config'' echo "Ésta es la parte más importante.. la hora de escoger las opciones incluídas en tu kernel" seguir "DESCOMPRESION" "make $config" if [ $? -ne 0 ];then exit 1 else \make $config fi seguir "make $config" "make dep" if [ $? -ne 0 ];then exit 1 else \make dep fi seguir "make dep" "make clean" if [ $? -ne 0 ];then exit 1 else \make clean fi seguir "make clean" "make $image" if [ $? -ne 0 ];then exit 1 else \make $image fi seguir "make $image" "make modules && make modules_install" if [ $? -ne 0 ];then exit 1 else \make modules modules_install fi seguir "make modules && make modules_install" "make install" if [ $? -ne 0 ];then exit 1 else \make install fi echo "Si has configurado bien el kernel según el sistema que tienes, no tendrías más que reiniciar ;-)" echo "Si has sido tan *valiente* de llegar hasta aquí, escríbeme por favor ;-)" fi else echo "No encuentro el $tarball para descomprimirlo y empezar con el proceso de compilación" echo "$tarball tiene que estar en /usr/src/" fi fi