#!/bin/bash # # kernel-satan.SlackBuild is free software; you can redistribute it and/or modify it under the # terms of the GNU General Public License as published by the Free Software # Foundation; either version 2 of the License, or any later version. # # kernel-satan.SlackBuild is distributed in the hope that it will be useful, but WITHOUT ANY # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR # A PARTICULAR PURPOSE. See the GNU General Public License for more details. # # You should have received a copy of the GNU General Public License along with # this program; if not, write to the Free Software Foundation, Inc., 59 Temple # Place - Suite 330, Boston, MA 02111-1307, USA # # slackbuild for kernel-satan # by rhatto at riseup.net # CWD="`pwd`" if [ -f ~/.slackbuildrc ]; then source ~/.slackbuildrc elif [ -f /etc/slackbuildrc ]; then source /etc/slackbuildrc fi PACKAGE="kernel-satan" KERNEL_VERSION="2.6.22" EXTRAVERSION="18" ARCH="x86_64" BUILD="2rha" PATCHSET="vs2.2.0.6" PATCH_VERSION="2.6.22.18-$PATCHSET" TMP=${TMP:=/tmp} SRC_DIR=${SRC:=$CWD} REPOS=${REPOS:=$TMP} if [ ! -z "$EXTRAVERSION" ]; then KERNEL_VERSION=$KERNEL_VERSION.$EXTRAVERSION fi KERNEL="linux-$KERNEL_VERSION.tar.bz2" PATCH="patch-$PATCH_VERSION.diff" KERNEL_URL="http://www.kernel.org/pub/linux/kernel/v2.6/$KERNEL" PATCH_URL="http://ftp.linux-vserver.org/pub/kernel/vs2.2/$PATCH" SRC_DIR="$SRC_DIR/kernel" # ------- error codes for createpkg -------------- ERROR_WGET=31; ERROR_MAKE=32; ERROR_INSTALL=33 ERROR_MD5=34; ERROR_CONF=35; ERROR_HELP=36 ERROR_TAR=37; ERROR_MKPKG=38; ERROR_GPG=39 ERROR_PATCH=40 mkdir -p $SRC_DIR if [ ! -f "$SRC_DIR/$KERNEL" ]; then rm -f $SRC_DIR/$KERNEL.sign wget "$KERNEL_URL" -O "$SRC_DIR/$KERNEL" || exit $ERROR_WGET wget "$KERNEL_URL.sign" -O "$SRC_DIR/$KERNEL.sign" || exit $ERROR_WGET fi if [ ! -f "$CWD/$PATCH" ] && [ ! -f "$SRC_DIR/$PATCH" ]; then wget "$PATCH_URL" -O "$SRC_DIR/$PATCH" || exit $ERROR_WGET fi TMP="$TMP/$PACKAGE" mkdir -p $TMP cd $TMP rm -rf linux-$KERNEL_VERSION* tar jxvf $SRC_DIR/$KERNEL || exit $ERROR_TAR if [ ! -z "$PATCHSET" ]; then mv linux-$KERNEL_VERSION linux-$KERNEL_VERSION-$PATCHSET KERNEL_VERSION="$KERNEL_VERSION-$PATCHSET" fi cp $CWD/config-$KERNEL_VERSION linux-$KERNEL_VERSION/.config || exit $ERROR_CONF cd linux-$KERNEL_VERSION if [ -f "$CWD/$PATCH" ]; then patch -p1 < $CWD/$PATCH || exit $ERROR_PATCH else patch -p1 < $SRC_DIR/$PATCH || exit $ERROR_PATCH fi if [ ! -z "$EXTRAVERSION" ] && [ ! -z "$PATCHSET" ]; then sed -e "s/^EXTRAVERSION =*$/EXTRAVERSION = \.$EXTRAVERSION-$PATCHSET/" Makefile > Makefile.tmp elif [ ! -z "$PATCHSET" ]; then sed -e "s/^EXTRAVERSION =*$/EXTRAVERSION = -$PATCHSET/" Makefile > Makefile.tmp fi mv Makefile.tmp Makefile make oldconfig || exit $ERROR_CONF time make || exit $ERROR_MAKE # make the package PKG="$TMP/package-$PACKAGE" mkdir -p $PKG/{install,boot,usr/doc} cp System.map $PKG/boot/System.map-$KERNEL_VERSION cp .config $PKG/boot/config-$KERNEL_VERSION cp arch/$ARCH/boot/bzImage $PKG/boot/vmlinuz-$KERNEL_VERSION cat << EOF > $PKG/install/slack-desc kernel-satan: kernel-satan (kernel for sarava.org's satangoss machine) kernel-satan: kernel-satan: kernel-satan: kernel-satan: kernel-satan: kernel-satan: kernel-satan: kernel-satan: kernel-satan: kernel-satan: EOF VERSION="`echo $KERNEL_VERSION | sed -e 's/-/_/g'`" # docs mkdir -p $PKG/usr/doc/$PACKAGE-$VERSION for file in COPYING CREDITS MAINTAINERS README REPORTING-BUGS; do cp $file* $PKG/usr/doc/$PACKAGE-$VERSION/ done cd $PKG ( cd boot && ln -s vmlinuz-$KERNEL_VERSION vmlinuz ) ( cd boot && ln -s config-$KERNEL_VERSION config ) ( cd boot && ln -s System.map-$KERNEL_VERSION System.map ) makepkg -c y -l y $REPOS/$PACKAGE-$VERSION-$ARCH-$BUILD.tgz || exit $ERROR_MKPKG if [ "$CLEANUP" == "yes" ]; then rm -rf $TMP fi