#!/bin/sh # Copyright (c) 2006 Eric Hameleers # Distributed under the terms of the GNU General Public License, Version 2 # $Id: unionfs.SlackBuild,v 1.5 2005/10/12 12:29:25 root Exp root $ # ----------------------------------------------------------------------------- # # Slackware SlackBuild script # =========================== # By: Eric Hameleers # For: unionfs # URL: http://www.fsl.cs.sunysb.edu/project-unionfs.html # Needs: # Changelog: # 1.0.9-1: 17/mar/2005 by Eric Hameleers # * Initial build. # 1.0.13-1: 07/aug/2005 by Eric Hameleers # * New release. # 1.0.14-1: 12/oct/2005 by Eric Hameleers # * New release. I changed detection of the kernel source dir. # # Run 'sh SlackBuild --cleanup' to build a Slackware package. # The package (.tgz) plus descriptive .txt file are created in /tmp . # Install using 'installpkg'. # # ----------------------------------------------------------------------------- # --- INIT --- # Set initial variables: CWD=`pwd` if [ "$TMP" = "" ]; then TMP=/tmp fi PRGNAM=unionfs VERSION=1.0.14 ARCH=${ARCH:-i486} BUILD=${BUILD:-1} KVER=${KVER:-`/bin/uname -r`} KSRC=${KSRC:-/lib/modules/${KVER}/build} if [ "$ARCH" = "i386" ]; then SLKCFLAGS="-O2 -march=i386 -mcpu=i686" elif [ "$ARCH" = "i486" ]; then SLKCFLAGS="-O2 -march=i486 -mcpu=i686" elif [ "$ARCH" = "s390" ]; then SLKCFLAGS="-O2" elif [ "$ARCH" = "x86_64" ]; then SLKCFLAGS="-O2" fi PKG=$TMP/package-${PRGNAM} if [ ! -d $TMP/tmp-$PRGNAM ]; then mkdir -p $TMP/tmp-$PRGNAM # location to build the source fi # --- PACKAGE BUILDING --- echo "++" echo "|| $PRGNAM-$VERSION" echo "++" rm -rf $PKG mkdir -p $PKG cd $PKG # Explode the package framework: if [ -f $CWD/_$PRGNAM.tar.gz ]; then explodepkg $CWD/_$PRGNAM.tar.gz fi cd $TMP/tmp-$PRGNAM rm -rf ${PRGNAM}-$VERSION tar xzvf $CWD/${PRGNAM}-$VERSION.tar.gz cd ${PRGNAM}-$VERSION chown -R root.root . export CFLAGS="$SLKCFLAGS" # Adding this: EXTRACFLAGS=-DUNIONFS_XATTR broke my build of 1.0.13, # whereas it worked before in 1.0.9... in 10.014 it works again :-) cat < fistdev.mk UNIONFS_DEBUG_CFLAG= EXTRACFLAGS=-DNODEBUG -DUNIONFS_XATTR LINUXSRC=${KSRC} PREFIX=/usr KVERS=${KVER} EOT make mkdir -p $PKG/lib/modules/${KVER}/kernel/fs make PREFIX=$PKG/usr MODPREFIX=$PKG install ( cd $PKG/lib/modules find . -type f -name "*.o" -exec gzip -9 {} \; ) # --- DOINST.SH --- # And now write the doinst.sh : mkdir -p $PKG/install cat <<-EEOOTT > $PKG/install/doinst.sh # Only run depmod on matching running kernel # Slackware will run depmod anyway on reboot): MYMODVER=$KVER MYKERNEL=\`uname -r\` if [ "\$MYKERNEL" = "\$MYMODVER" ]; then if [ -x sbin/depmod ]; then chroot . /sbin/depmod -a \$MYKERNEL 1> /dev/null 2> /dev/null fi fi EEOOTT # --- DOCUMENTATION --- DOCS="$CWD/00README.slackware AUTHORS COPYING ChangeLog NEWS README doit.sh" mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION cp -a $DOCS \ $PKG/usr/doc/$PRGNAM-$VERSION chmod -R a-w $PKG/usr/doc/$PRGNAM-$VERSION/* # Compress the man page(s) gzip -9f $PKG/usr/man/*/* # Strip binaries ( cd $PKG find . | xargs file | grep "executable" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null find . | xargs file | grep "shared object" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null ) # Ownership, rights chmod -R o-w $PKG chgrp root:bin $PKG/usr/bin/* $PKG/usr/sbin/* $PKG/bin/* $PKG/sbin/* \ $PKG/usr/X11R6/bin/* $PKG/opt/kde/bin/* 2>/dev/null mkdir -p $PKG/install cat $CWD/slack-desc > $PKG/install/slack-desc cd $PKG makepkg -l y -c n $TMP/${PRGNAM}-${VERSION}_${KVER}-$ARCH-$BUILD.tgz ( cd $TMP && md5sum $PRGNAM-${VERSION}_${KVER}-$ARCH-$BUILD.tgz > $PRGNAM-${VERSION}_${KVER}-$ARCH-$BUILD.tgz.md5 ) cat $PKG/install/slack-desc | grep "^${PRGNAM}" > $TMP/$PRGNAM-${VERSION}_${KVER}-$ARCH-$BUILD.txt # Clean up the extra stuff: if [ "$1" = "--cleanup" ]; then rm -rf $TMP/tmp-$PRGNAM rm -rf $PKG fi