From Segfault
Jump to: navigation, search

<source lang=bash>

  1. !/bin/sh
  2. (c)
  3. Update & compile kernel, userland and X11

KERNEL="$HOME"/config/VAIO BEGIN="`date +%s`"

  1. use a proper kernelconfig

if [ ! -f "$KERNEL" ]; then KERNEL=GENERIC fi

  1. which flavour do you want to try today?

if [ ! "$1" ]; then echo "Usage: "$0" RELEASE" echo "e.g. "$0" netbsd-3-1-RELEASE" exit 1 else RELEASE="$1" fi

  1. set DEBUG to execute this script without compiling anything

if [ "$DEBUG" ]; then DEBUG=echo clear echo "DEBUG is enabled!" else clear fi

  1. sanity checks

echo echo "This script will compile and install kernel, userland and x11 on `uname -n`." echo "Make sure you can run sudo(8) without a password!" echo -n "Target release is "$RELEASE"/`uname -m`, kernel config is "$KERNEL", continue? (y/N) " && read c if [ ! "$c" = "y" ]; then echo "Aborted." exit 1 fi

  1. kernel_cvs

cd /usr $DEBUG export $DEBUG cvs -q -d$CVSROOT co -r $RELEASE -P src cd src $DEBUG cvs update

  1. kernel_compile

BEGIN_KRN="`date +%s`"

cd /usr/src/sys/arch/`uname -m`/conf $DEBUG cp "$KERNEL" MYCONF $DEBUG /usr/sbin/config MYCONF cd ../compile/MYCONF $DEBUG make depend $DEBUG make $DEBUG sudo mv /netbsd /netbsd.old $DEBUG sudo cp netbsd / END_KRN="`date +%s`" echo "+++ Kernel compiled in `echo "scale=2; ($END_KRN - $BEGIN_KRN) / 60" | bc -l` minutes."

  1. userland_cvs

cd /usr/src $DEBUG cvs -q -r $RELEASE update -P

  1. userland_compile

BEGIN_USR="`date +%s`" $DEBUG sudo make build END_USR="`date +%s`" echo "+++ Userland compiled in `echo "scale=2; ($END_USR - $BEGIN_USR) / 60 / 60" | bc -l` hours."

  1. x11_cvs

cd /usr/xsrc $DEBUG cvs -q -r $RELEASE update -P

  1. x11_compile

BEGIN_X11="`date +%s`" $DEBUG sudo make build END_X11="`date +%s`" echo "+++ X11 compiled in `echo "scale=2; ($END_X11 - $BEGIN_X11) / 60 / 60" | bc -l` hours." echo "+++ Skript took `echo "scale=2; ($END_X11 - $BEGIN) / 60 / 60" | bc -l` hours to complete."