#!/bin/sh -x CLEAN_SRC=${CLEAN_SRC:-NO} PRGNAM=linux VERSION=${VERSION:-$(echo linux-*.tar.?z* | rev | cut -f 3- -d . | cut -f 1 -d - | rev)} BUILD=${BUILD:-1} ARCH=$(uname -m) CWD=$(pwd) SOURCES=/usr/src/ TAG=cyco TMP=/tmp/$TAG PKG=$TMP/pkg-$PRGNAM OUTPUT=/tmp NUMJOBS=${NUMJOBS:-" -j4 "} SRC_URL="http://www.kernel.org/pub/linux/kernel/v$(echo \"$VERSION\" | sed 's|\([0-9]*\.[0-9]*\).*|\1|')$(echo \"$VERSION\" | grep -q \"\-rc\" && echo \"/testing\" )" rm -fr $PKG if [ $CLEAN_SRC != "NO" ] ; then rm -fr $SOURCES/$PRGNAM-$VERSION fi if [ $CLEAN_SRC != "NO" ]; then [ ! -e $CWD/$PRGNAM-$VERSION.tar.?z* ] && wget -c "$SRC_URL/$PRGNAM-$VERSION.tar.bz2" -O $CWD/$PRGNAM-$VERSION.tar.bz2 [ ! -e $SOURCES ] && mkdir -p $SOURCES tar xf $CWD/$PRGNAM-$VERSION.tar.?z* -C $SOURCES fi cd $SOURCES/$PRGNAM-$VERSION if [ $CLEAN_SRC != "NO" ]; then [ -e $CWD/patches/ ] && \ for p in $CWD/patches/*.{diff,patch} ; do patch -p1 -i $p || exit 1 # if patching fail we want to know done [ -e $CWD/patches/$VERSION ] && \ for p in $CWD/patches/$VERSION/*.{diff,patch} ; do patch -p1 -i $p || exit 1 # if patching fail we want to know done fi if [ $CLEAN_SRC != "NO" ] || [ ! -e .config ] ; then if [ -e $CWD/config-$VERSION ] ; then cp $CWD/config-$VERSION .config else if [ -e $CWD/config ]; then cp $CWD/config .config else zcat /proc/config.gz > .config fi fi fi make oldconfig $* make $NUMJOBS make modules_install INSTALL_MOD_PATH=$PKG KERNEL_TAG=$(grep "CONFIG_LOCALVERSION=" .config | sed 's|CONFIG_LOCALVERSION=||' | tr -d \" ) KERNEL_VERSION=$(grep -o "[0-9]\+\.[0-9]\+.*[0-9]" .config)$KERNEL_TAG mkdir -p $PKG/boot/$KERNEL_VERSION cp .config System.map arch/x86/boot/bzImage $PKG/boot/$KERNEL_VERSION mv $PKG/boot/$KERNEL_VERSION/{.,}config mkdir -p $PKG/install cat < $PKG/install/doinst.sh cp /etc/lilo.conf /etc/lilo.conf.orig grep -q "image = /boot/$KERNEL_VERSION/bzImage" /etc/lilo.conf || \ cat <> /etc/lilo.conf # Linux bootable partition config begins image = /boot/$KERNEL_VERSION/bzImage root = /dev/sda1 label = $KERNEL_VERSION read-only # Linux bootable partition config ends EOLILO sed -i "s|default=.*|default=$KERNEL_VERSION|" /etc/lilo.conf lilo EOF VERSION=$(echo $VERSION | tr - _) cat < $PKG/install/slack-desc $PRGNAM-$VERSION: $PRGNAM-$VERSION (kernel) $PRGNAM-$VERSION: $PRGNAM-$VERSION: Linux is a clone of the operating system Unix, written from scratch by $PRGNAM-$VERSION: Linus Torvalds with assistance from a loosely-knit team of hackers $PRGNAM-$VERSION: across the Net. It aims towards POSIX and Single UNIX Specification $PRGNAM-$VERSION: compliance. $PRGNAM-$VERSION: $PRGNAM-$VERSION: It has all the features you would expect in a modern fully-fledged Unix $PRGNAM-$VERSION: $PRGNAM-$VERSION: http://www.kernel.org $PRGNAM-$VERSION: EOF cd $PKG makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$(echo $KERNEL_TAG | tr - _)-$ARCH-$BUILD$TAG.txz