#!/bin/sh # George Georgakis NAME=netcat VERSION=1.10 TMP=/tmp CWD=`pwd` PKG=$TMP/package-$NAME # Create the package location, if it doesn't already exist if [ ! -d $PKG ]; then mkdir -p $PKG fi # Explode the controller tarball ( cd $PKG if [ -e $CWD/_$NAME.tar.gz ]; then explodepkg $CWD/_$NAME.tar.gz fi # Start the on-screen information echo "+======+======+" echo "| $NAME-$VERSION |" echo "+=======+=====+" # Move the tarball to an apropriate name if [ -e $CWD/nc110.tgz ]; then mv $CWD/nc110.tgz $CWD/$NAME-$VERSION.tar.gz fi # Untargz the source tarball mkdir -p $TMP/$NAME-$VERSION cd $TMP/$NAME-$VERSION tar xzvf $CWD/$NAME-$VERSION.tar.gz # Rename nc to netcat cat Makefile | sed -e 's/nc/netcat/g' > out mv out Makefile # Compile the source make linux # Create the requisite directories mkdir -p $PKG/sbin \ $PKG/install \ $PKG/usr/doc/$NAME-$VERSION # Copy the binaries strip netcat cp netcat $PKG/sbin/ # Copy the docs cp -r `ls [A-Z]*` $PKG/usr/doc/$NAME-$VERSION/ cp -r scripts/ $PKG/usr/doc/$NAME-$VERSION/ gzip -9 $PKG/usr/man/man8/netcat.8 # Add the description file cat << EOF > $PKG/install/description PRIORITY: OPT netcat: Netcat-1.10 netcat: netcat: Netcat is a simple Unix utility which reads and writes data netcat: across network connections, using TCP or UDP protocol. netcat: It is designed to be a reliable "back-end" tool that can netcat: be used directly or easily driven by other programs and netcat: scripts. At the same time, it is a feature-rich network netcat: debugging and exploration tool, since it can create almost netcat: any kind of connection you would need and has several netcat: interesting built-in capabilities. netcat: 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 # Fork screen output to a log ) 2>&1 | tee $CWD/$NAME.build.log