diff options
author | Eric Hameleers <alien@slackware.com> | 2007-03-07 12:34:35 +0000 |
---|---|---|
committer | Eric Hameleers <alien@slackware.com> | 2007-03-07 12:34:35 +0000 |
commit | 56e3561447effb7a86657d7119c44b0d2d4f9fec (patch) | |
tree | c99f8da3051bb1a0a320c3dc02ee50367996df45 /madwifi | |
parent | 23fed85f2e42a0781cadb31691d397fecdcc9641 (diff) | |
download | asb-56e3561447effb7a86657d7119c44b0d2d4f9fec.tar.gz asb-56e3561447effb7a86657d7119c44b0d2d4f9fec.tar.xz |
Made the script work for snapshot tarballs, and new release
Diffstat (limited to 'madwifi')
-rwxr-xr-x | madwifi/build/madwifi.SlackBuild | 99 |
1 files changed, 60 insertions, 39 deletions
diff --git a/madwifi/build/madwifi.SlackBuild b/madwifi/build/madwifi.SlackBuild index 21e77395..c93cd358 100755 --- a/madwifi/build/madwifi.SlackBuild +++ b/madwifi/build/madwifi.SlackBuild @@ -1,9 +1,25 @@ #!/bin/sh # $Id$ # Copyright (c) 2006 Eric Hameleers <alien@slackware.com> -# Distributed under the terms of the GNU General Public License, Version 2 # -# ----------------------------------------------------------------------------- +# Permission to use, copy, modify, and distribute this software for +# any purpose with or without fee is hereby granted, provided that +# the above copyright notice and this permission notice appear in all +# copies. +# +# THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED +# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +# IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF +# USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT +# OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +# SUCH DAMAGE. +# ------------------------------------------------------------------------------ # # Slackware SlackBuild script # =========================== @@ -35,23 +51,23 @@ # * Updated the SlackBuild script, rebuilt for Slackware 11.0. # 0.9.2.1-1: 08/dec/2006 by Eric Hameleers <alien@slackware.com> # * Critical vulnerability bugfix release. +# 0.9.3-1: 15/mar/2007 by Eric Hameleers <alien@slackware.com> +# * Long-anticipated new release, compatible with kernel > 2.6.18 +# Made this SlackBuild actually able to build snapshot releases. +# ----------------------------------------------------------------------------- -# ---------------------------------------------------------------------------- - -SNAPSHOT="" # set to "yes" if you're building a snapshot release. +# Change SNAPSHOT from "" to "yes" below if you're building a snapshot release. +SNAPSHOT=${SNAPSHOT:-""} PRGNAM=madwifi -VERSION=${VERSION:-0.9.2.1} +VERSION=${VERSION:-0.9.3} # Note: for snapshots this value changes further down +SRCVER="" BUILD=1 ARCH=${ARCH:-i486} KVER=${KVER:-`uname -r`} KSRC=${KSRC:-/lib/modules/${KVER}/build} PATCHLEVEL=`echo $KVER|cut -f 2 -d '.'` -if [ -z $SNAPSHOT ]; then # build a stable release - SOURCE="${PRGNAM}-${VERSION}.tar.gz" - SRCURL="http://dl.sourceforge.net/sourceforge/${PRGNAM}/${PRGNAM}-${VERSION}.tar.gz" -fi # Where do we look for sources? CWD=`pwd` @@ -63,13 +79,21 @@ TMP=${TMP:-/tmp/build} PKG=$TMP/package-$PRGNAM OUTPUT=${OUTPUT:-/tmp} +if [ -z $SNAPSHOT ]; then # build a stable release + SOURCE="$SRCDIR/${PRGNAM}-${VERSION}.tar.gz" + SRCURL="http://dl.sourceforge.net/sourceforge/${PRGNAM}/${PRGNAM}-${VERSION}.tar.gz" +else + SOURCE="$SRCDIR/${PRGNAM}-ng-current.tar.gz" + SRCURL="http://snapshots.madwifi.org/${PRGNAM}-ng-current.tar.gz" +fi + ## ## --- with a little luck, you won't have to edit below this point --- ## ## # Exit the script on errors: set -e -trap 'echo "$0 FAILED on line $LINENO!" | tee $CWD/error-${PRGNAM}.log' ERR +trap 'echo "$0 FAILED on line $LINENO!" | tee $OUTPUT/error-${PRGNAM}.log' ERR # Catch unitialized variables: set -u P1=${1:-1} @@ -128,17 +152,20 @@ fi # --- SOURCE FILE AVAILABILITY --- if [ -z $SNAPSHOT ]; then # download stable release - if ! [ -f ${SRCDIR}/${SOURCE} ]; then + if ! [ -f ${SOURCE} ]; then if ! [ "x${SRCURL}" == "x" ]; then - echo "Source '${SOURCE}' not available yet... will download now:" - wget -O "${SRCDIR}/${SOURCE}" "${SRCURL}" || true + # Check if the $SRCDIR is writable at all - if not, download to $OUTPUT + [ -w "$SRCDIR" ] || SOURCE="$OUTPUT/`basename $SOURCE`" + echo "Source '`basename ${SOURCE}`' not available yet..." + echo "Will download file to `dirname $SOURCE`" + wget -O "${SOURCE}" "${SRCURL}" || true if [ $? -ne 0 ]; then - echo "Downloading '${SOURCE}' failed... aborting the build." - mv -f "${SRCDIR}/${SOURCE}" "${SRCDIR}/${SOURCE}".FAIL + echo "Downloading '`basename ${SOURCE}`' failed... aborting the build." + mv -f "${SOURCE}" "${SOURCE}".FAIL exit 1 fi else - echo "File '${SOURCE}' not available... aborting the build." + echo "File '`basename ${SOURCE}`' not available... aborting the build." exit 1 fi fi @@ -149,19 +176,17 @@ if [ "$P1" == "--download" ]; then fi # --- PACKAGE BUILDING --- +# For snapshots we can only determine the VERSION using the tarball: +if [ ! -z $SNAPSHOT ]; then + SRCVER=`tar tf $SOURCE |head -1|cut -d- -f3-|cut -d/ -f1` + VERSION=`echo $SRCVER|tr '-' '_'` +fi echo "+=================+" echo "| $PRGNAM-$VERSION |" echo "+=================+" -rm -f $CWD/*.log -cd $PKG - -# Explode the package framework: -if [ -f $SRCDIR/_$PRGNAM.tar.gz ]; then - explodepkg $SRCDIR/_$PRGNAM.tar.gz -fi - +rm -f $OUTPUT/*.log cd $TMP/tmp-$PRGNAM # Actually to build a snapshot (not the stable release) you must get @@ -176,11 +201,7 @@ cd $TMP/tmp-$PRGNAM # ... or get a snapshot at http://snapshots.madwifi.org/ echo "Extracting the source tarball..." -if [ -z $SNAPSHOT ]; then - tar xzvf $CWD/${PRGNAM}-$VERSION.tar.gz -else - tar xzvf $CWD/${PRGNAM}-ng*$VERSION.tar.gz -fi +tar xzvf "$SOURCE" # I expect a pristine kernel source (freshly installed slackware package) # Madwifi expects the sources at the location that the link @@ -192,10 +213,10 @@ cd - if [ -z $SNAPSHOT ]; then cd ${PRGNAM}-${VERSION} else - cd ${PRGNAM}-ng*${VERSION} + cd ${PRGNAM}-ng-${SRCVER} fi chown -R root:root * -find . -perm 777 -exec chmod 755 {} \; +chmod -R u+w,go+r-w,a-s * # Build the kernel modules and the utilities @@ -209,19 +230,19 @@ echo Building ... LDFLAGS="$SLKLDFLAGS" \ CFLAGS="$SLKCFLAGS" \ make clean all KERNELPATH=${KSRC} KERNELRELEASE=${KVER} \ - 2>&1 | tee $CWD/make-${PRGNAM}.log + 2>&1 | tee $OUTPUT/make-${PRGNAM}.log # Install the kernel module and tools mkdir -p $PKG/usr/{bin,man} # Use installwatch if available: if `which installwatch > /dev/null 2>&1`; then - installwatch -o $CWD/install-${PRGNAM}.log make install DESTDIR=$PKG \ + installwatch -o $OUTPUT/install-${PRGNAM}.log make install DESTDIR=$PKG \ BINDIR=/usr/bin MANDIR=/usr/man KERNELPATH=${KSRC} KERNELRELEASE=${KVER} else make install DESTDIR=$PKG \ BINDIR=/usr/bin MANDIR=/usr/man KERNELPATH=${KSRC} KERNELRELEASE=${KVER} \ - 2>&1 | tee $CWD/install-${PRGNAM}.log + 2>&1 | tee $OUTPUT/install-${PRGNAM}.log fi # Include files (for wpa_supplicant) - note that wpa_supplicant can now also @@ -279,12 +300,12 @@ chmod -R o-w $PKG # Create the package cd $PKG -makepkg -l y -c n $OUTPUT/$PRGNAM-${VERSION}_${KVER}-$ARCH-$BUILD.tgz 2>&1 | tee $CWD/makepkg-${PRGNAM}.log -(cd $OUTPUT && md5sum $PRGNAM-${VERSION}_${KVER}-$ARCH-$BUILD.tgz > $PRGNAM-${VERSION}_${KVER}-$ARCH-$BUILD.tgz.md5) +makepkg -l y -c n $OUTPUT/$PRGNAM-${VERSION}_${KVER}-$ARCH-$BUILD.tgz 2>&1 | tee $OUTPUT/makepkg-${PRGNAM}.log +cd $OUTPUT +md5sum $PRGNAM-${VERSION}_${KVER}-$ARCH-$BUILD.tgz > $PRGNAM-${VERSION}_${KVER}-$ARCH-$BUILD.tgz.md5 +cd - cat $PKG/install/slack-desc | grep "^${PRGNAM}" > $OUTPUT/$PRGNAM-${VERSION}_${KVER}-$ARCH-$BUILD.txt -cd $CWD - # Clean up the extra stuff: if [ "$P1" = "--cleanup" ]; then rm -rf $TMP/tmp-$PRGNAM |