#!/bin/sh # George Georgakis ########################################## # Set initial variables NAME=changemac VERSION=1.0 TMP=/tmp CWD=`pwd` PKG=$TMP/package-$NAME # Create the package location, if it doesn't already exist [ ! -d $PKG ] && mkdir -p $PKG ( # Start the on-screen information echo "+======+=====+" echo "| $NAME-$VERSION |" echo "+=======+====+" # Explode the source tarball cd $TMP tar xzvf $CWD/$NAME-$VERSION.tgz cd $NAME-$VERSION # Fix display, spelling and grammatical errors. zcat $CWD/changemac.patch.gz | patch -p0 zcat $CWD/changemac.8.patch.gz | patch -p0 # Compile the source gcc changemac.c -o changemac # Create the requisite directories mkdir -p $PKG/usr/sbin \ $PKG/install \ $PKG/usr/man/man8 \ $PKG/usr/doc/$NAME-$VERSION # Copy the binaries cp changemac $PKG/usr/sbin/ # Copy the docs cp -r `ls [A-Z]*` $PKG/usr/doc/$NAME-$VERSION/ cp *lsm $PKG/usr/doc/$NAME-$VERSION/ # Copy the man pages for MAN in 1 4 5 8 ; do for EACH in `find . -name "*.$MAN"` ; do gzip -9c $EACH > $PKG/usr/man/man$MAN/`basename $EACH`.gz done done # Add the description file cat << EOF > $PKG/install/description PRIORITY: OPT $NAME: $NAME $NAME: $NAME: changemac allows you to change the MAC address on any $NAME: Linux box. It could probably work on other U*ix machines $NAME: with a simple change of the ioctl call in the source code. $NAME: $NAME: The code is relatively unchanged from the 1998 release, but $NAME: the many display, spelling and grammatical errors have been $NAME: patched in this particular package. $NAME: $NAME: EOF # Build the package cd $PKG tar czvf $TMP/$NAME-$VERSION.tgz . # Warn of zero-length files for file in `find . -type f -print` ; do if [ "`filesize $file`" = "0" ]; then echo "WARNING: zero length file $file" # Use below line if these files are to be deleted # echo "Removed zero length file $file..." ; rm $file fi if [ "`filesize $file`" = "20" ]; then echo "WARNING: possible empty gzipped file $file" # Use below line if these files are to be deleted # echo "Removed possibly empty gzipped file $file..." ; rm $file fi done # Clean up the build directories if [ "$1" = "--cleanup" ]; then rm -rf $TMP/$NAME-$VERSION rm -rf $PKG fi # Move the completed package into this directory if [ "$1" != "--nomove" -a "$2" != "--nomove" ]; then mkdir -p $CWD/package mv $TMP/$NAME-$VERSION.tgz $CWD/package/ echo echo "The finished $NAME-$VERSION is now in the package/ directory" echo echo fi # Fork screen output to a log ) 2>&1 | tee $CWD/$NAME.build.log