CVS: moonbase/zbeta/linux-devel-svn BUILD, NONE, 1.1 CONFIGURE, NONE, 1.1 DEPENDS, NONE, 1.1 DETAILS, NONE, 1.1 POST_INSTALL, NONE, 1.1 PRE_BUILD, NONE, 1.1

sofar at lunar-linux.org sofar at lunar-linux.org
Sun Jul 20 15:37:16 GMT 2003


Update of /var/cvs/lunar/moonbase/zbeta/linux-devel-svn
In directory dbguin.lunar-linux.org:/tmp/cvs-serv3796/linux-devel-svn

Added Files:
	BUILD CONFIGURE DEPENDS DETAILS POST_INSTALL PRE_BUILD 
Log Message:
Adding two example modules with svn:// urls, note that they might now be fully functional but the lget/download part is tested and OK. Anyone wishing to extend these 2 modules is more than welcome.


--- NEW FILE: BUILD ---
cd  /usr/src/linux-$VERSION

while  
  case  $CONFIG_KERNEL in
      y|Y)  if [ "$CONFIG_METHOD" == "xconfig" ]
          then
	      if [ "$DISPLAY" ]
	      then
	          make xconfig
	      else
	          message xconfig could find display falling back to menuconfig
		  make menuconfig
	      fi
	  else
	      make  $CONFIG_METHOD
	  fi

          if  query  "Repeat $CONFIG_METHOD?  "  n
          then  CONFIG_KERNEL=y
          else  CONFIG_KERNEL=n
          fi     ;;
      *)  false  ;;
  esac
do
  true
done


backup_modules()  {

  if    [  -d  /lib/modules/$VERSION      ];  then
    rm   -rf   /lib/modules/$VERSION.old
    mv         /lib/modules/$VERSION      \
               /lib/modules/$VERSION.old
  fi

}


(

  yes  n  |  make  oldconfig
  cp  .config  $CONFIG_CACHE
  make  bzImage          &&
  make  modules          &&
  prepare_install        &&
  backup_modules         &&
  make  modules_install  &&
  cp    arch/i386/boot/bzImage   /boot/vmlinubz-$VERSION &&
  gcc -Wall -Wstrict-prototypes -O Documentation/networking/ifenslave.c -o /sbin/ifenslave

) > $C_FIFO 2>&1

--- NEW FILE: CONFIGURE ---
if ! module_installed module-init-tools 
then
	message "${MESSAGE_COLOR}This kernel needs ${MODULE_COLOR}module-init-tools${DEFAULT_COLOR}${MESSAGE_COLOR}, which conflicts with ${MODULE_COLOR}modutils${DEFAULT_COLOR}${MESSAGE_COLOR} (needed for 2.4 kernels)."
	if query "Install module-init-tools" y
	then
		message "${MESSAGE_COLOR}Proceeding to install module-init-tools${DEFAULT_COLOR}"
		lin module-init-tools || exit 1;
	else
		message "${PROBLEM_COLOR}Warning:${DEFAULT_COLOR}${MESSAGE_COLOR} You cannot load modules with a 2.5 kernel"
	fi
fi


if  !  grep  -q  "BOOT_LOADER"  $MODULE_CONFIG;  then
#  message  "The Linux Kernel requires a boot loader"
message  "Choose either GRUB or LILO"
# BOOT_LOADER=lilo

if  query  "Use  LILO?"  y
  then  BOOT_LOADER=lilo
  else  BOOT_LOADER=grub
fi

  echo  "BOOT_LOADER=$BOOT_LOADER"  >>  $MODULE_CONFIG
fi

CONFIG_GRUB="n"
CONFIG_LILO="n"

if    grep  -q  "BOOT_LOADER=grub"  $MODULE_CONFIG  &&
      query  "Configure grub?"  n
then  CONFIG_GRUB=y
fi

if    grep  -q  "BOOT_LOADER=lilo"  $MODULE_CONFIG  &&
      query  "Configure lilo?"  n
then  CONFIG_LILO=y
fi


if  !  grep  -q  "CONFIG_METHOD="  $MODULE_CONFIG
then
  if    query  "Do you prefer make menuconfig over make config"  y
  then  CONFIG_METHOD="menuconfig"
  else  CONFIG_METHOD="config"
  fi
  echo  "CONFIG_METHOD=$CONFIG_METHOD"  >>  $MODULE_CONFIG
fi


message "Do you wish to give an alternative .config file?"
while [ true ] 
do
	read -p "Write its location, or just press enter for default .config : " configfilelocation
	
	if [ "$configfilelocation" != "" ]; then
		if [ -f $configfilelocation ]; then  
			cp $configfilelocation ${BUILD_DIRECTORY}/linux-$VERSION/.config 
			message "Using user's .config" &&
			break;
		else #the file doesn't exist
			message "$configfilelocation doesn't exist. Please try again"
		fi
	else # user only just pressed enter, so just carry on
		message "no selection made."
		break;
	fi
done
# put a line in between as a separator
message "" 


if  [  !  -f  $CONFIG_CACHE/.config  ];  then
  message  "Preparing to make menuconfig."
  CONFIG_KERNEL="y"
else
  message  "Reconfiguration is optional."
  if    query  "Configure linux kernel?"  n
  then  CONFIG_KERNEL=y
  else  CONFIG_KERNEL=n
  fi
fi

TEMP=`grep  -v  "CONFIG_KERNEL="          $MODULE_CONFIG  |
      grep  -v  "CONFIG_LILO="                           |
      grep  -v  "CONFIG_GRUB="`

echo  "$TEMP"                         >   $MODULE_CONFIG
echo  "CONFIG_KERNEL=$CONFIG_KERNEL"  >>  $MODULE_CONFIG
echo  "CONFIG_LILO=$CONFIG_LILO"      >>  $MODULE_CONFIG
echo  "CONFIG_GRUB=$CONFIG_GRUB"      >>  $MODULE_CONFIG


--- NEW FILE: DEPENDS ---
# must not have an optional depends on tcl-tk because
# linux being lin from the Install/Rescue ISO will not 
# have tcl-tk installed

# depends  $BOOT_LOADER
#
# for some modules to be properly compiled (lftp, apmd) linux module
# must be compiled while there is autconf installed in the system
depends  autoconf

--- NEW FILE: DETAILS ---
          MODULE=linux-devel-svn
         VERSION=2.5
          SOURCE=linux-$VERSION.tar.bz2
   SOURCE_URL[0]=svn://svn.kernel.org/linux-$VERSION/trunk:$MODULE-$VERSION
        WEB_SITE=http://www.kernel.org
         ENTERED=20030720
         UPDATED=20030720
     KEEP_SOURCE="on"
           SHORT="The Linux kernel is the core of a Linux GNU Operating System."
cat << EOF
This is the ultra latest version of the linux kernel (maintained by Linus).

Linux is a clone of the Unix kernel, written from scratch by Linus
Torvalds with assistance from a loosely-knit team of hackers across the
Net. It aims towards POSIX and Single UNIX Specification compliance. It
has all the features you would expect in a modern fully-fledged Unix
kernel, including true multitasking, virtual memory, shared libraries,
demand loading, shared copy-on-write executables, proper memory
management, and TCP/IP networking.
EOF

--- NEW FILE: POST_INSTALL ---
lilo_image_entry()  {

  cat  <<  EOF

image			=	/boot/vmlinubz-$VERSION
	label		=	linux-$VERSION
	read-only
	restricted

EOF

}


grub_image_entry()  {

. $DEPENDS_CONFIG/grub

  cat  <<  EOF

title   linux-$VERSION
kernel  $GRUB_BOOT/vmlinubz-$VERSION
root    $GRUB_ROOT

EOF

}


update_lilo()  {
  if  !  grep  -q  "$VERSION"  /etc/lilo.conf;  then

    IFS_OLD=$IFS
    export  IFS="
"

    rm  -rf  /etc/lilo.conf.new
    cp  /etc/lilo.conf  /etc/lilo.conf.old

    (( IMAGE_COUNT=0  ))

    for  LINE  in  `cat /etc/lilo.conf`;  do

      if   echo  $LINE  |  grep  -q  "image"  ||
           echo  $LINE  |  grep  -q  "other"  ;  then
        if  (( IMAGE_COUNT  == 0  ));  then
          echo  -e  "`lilo_image_entry`"  >>  /etc/lilo.conf.new
        fi
        ((  IMAGE_COUNT++  ))
      fi

      if  ((  IMAGE_COUNT == 14  ));  then
        break
      fi
    
      echo  $LINE  >>  /etc/lilo.conf.new

    done

    if  ((  IMAGE_COUNT ==  0  ));  then
      echo  -e  "`lilo_image_entry`"  >>  /etc/lilo.conf.new
    fi

    cp  /etc/lilo.conf.new  /etc/lilo.conf

    export  IFS=$IFS_OLD

  fi

  case  $CONFIG_LILO in
    y|Y|j|J)  ${EDITOR:-nano}  /etc/lilo.conf  ;;
  esac

  /sbin/lilo

}


update_grub()  {
  if  !  grep  -q  "$VERSION"  /boot/grub/menu.lst;  then

    IFS_OLD=$IFS
    export  IFS="
"

    rm  -rf  /boot/grub/menu.lst.new
    cp  /boot/grub/menu.lst  /boot/grub/menu.lst.old

    (( IMAGE_COUNT=0  ))

    for  LINE  in  `cat /boot/grub/menu.lst`;  do

      if   echo  $LINE  |  grep  -q  "title";  then
        if  (( IMAGE_COUNT  == 0  ));  then
          echo  -e  "`grub_image_entry`"  >>  /boot/grub/menu.lst.new
        fi
        ((  IMAGE_COUNT++  ))
      fi

      if  ((  IMAGE_COUNT == 14  ));  then
        break
      fi
    
      echo  $LINE  >>  /boot/grub/menu.lst.new

    done

    if  ((  IMAGE_COUNT ==  0  ));  then
      echo  -e  "`grub_image_entry`"  >>  /boot/grub/menu.lst.new
    fi

    cp  /boot/grub/menu.lst.new  /boot/grub/menu.lst

    export  IFS=$IFS_OLD

  fi

  case  $CONFIG_GRUB in

    y|Y)  if [ -n "$EDITOR" ];             then
            $EDITOR  /boot/grub/menu.lst;  else
            nano     /boot/grub/menu.lst
          fi
          ;;
  esac

  message "Install GRUB into MBR of first drive? [y|Y]"
  read GRUB_FIRST_DRIVE
  case $GRUB_FIRST_DRIVE in
    y|Y) GRUB_BOOT_DEVICE="(hd0)" ;; 
    *  ) 
         message "Otherwise please specify in GRUB notation the desired drive/partition"
         message "Using parenthesis and NO spaces!"
         message "Samples: (hd1)    2nd drive MBR"
         message "         (hd1,0)  2nd drive with 1st partition"
         message "         (hd0,2)  1st drive with 3rd partition"
         echo -n "GRUB_BOOT_DEVICE=(hd#,#):  "
         read GRUB_BOOT_DEVICE
  esac

  /usr/sbin/grub-install "$GRUB_BOOT_DEVICE"
  sleep 4

}


case  $BOOT_LOADER  in
  lilo)  update_lilo  ;;
  grub)  update_grub  ;;
esac


#  Reinstall packages that add their own kernel modules

rm  -f  $BOOST_LOCK
if  module_installed  ftpfs;          then  lin  ftpfs;          fi
if  module_installed  cvsfs;          then  lin  cvsfs;          fi
if  module_installed  NVIDIA_kernel;  then  lin  NVIDIA_kernel;  fi
if  module_installed  alsa-driver;    then  lin  alsa-driver;    fi
if  module_installed  cryptoapi;      then  lin  cryptoapi;      fi
if  module_installed  pcmcia-cs;      then  lin -r -c pcmcia-cs; fi
if  module_installed  mwavem;         then  lin  mwavem;         fi
if  module_installed  cipe;           then  lin  cipe;           fi
if  module_installed  snare-core;     then  lin  snare-core;     fi

--- NEW FILE: PRE_BUILD ---

message "${WARNING_COLOR}Preserving current /usr/src/linux!${NORMAL_COLOR}"

cd $BUILD_DIRECTORY

unpack $SOURCE

if [ -f $CONFIG_CACHE/.config ] ; then
  cp $CONFIG_CACHE/.config /usr/src/linux
fi

chown -R root:root /usr/src/linux-$VERSION
cd /usr/src/linux-$VERSION





More information about the Lunar-commits mailing list