#!/bin/sh # George Georgakis ########################################## # Set initial variables NAME=nmap VERSION=2.54BETA32 TMP=/tmp CWD=`pwd` PKG=$TMP/package-$NAME # Create the package location, if it doesn't already exist [ ! -d $PKG ] && mkdir -p $PKG # Move the package to the correct name/version/extension convention [ -e $CWD/$NAME-$VERSION.tgz ] && mv $CWD/$NAME-$VERSION.tgz \ $CWD/$NAME-$VERSION.tar.gz # Explode the controller tarball, if one exists ( cd $PKG [ -e $CWD/_$NAME.tar.gz ] && explodepkg $CWD/_$NAME.tar.gz # Start the on-screen information echo "+======+=====+" echo "| $NAME-$VERSION |" echo "+=======+====+" # Explode the source tarball cd $TMP tar xzvf $CWD/$NAME-$VERSION.tar.gz cd $NAME-$VERSION # Compile the source CFLAGS=-O2 LDFLAGS=-s ./configure --prefix=/usr i386-tripleg-linux-gnu CFLAGS=-O2 LDFLAGS=-s make # Create the requisite directories mkdir -p $PKG/install \ $PKG/usr/man/man1 \ $PKG/usr/{bin,doc/$NAME-$VERSION,share/nmap} # Include this with the above if also building nmapfe and xnmap # $PKG/usr/local/gnome/apps/Utilities/ \ # Copy the binary strip nmap cp nmap $PKG/usr/bin/ # Copy the config files cp nmap-* $PKG/usr/share/nmap/ # Uncomment this only if building nmapfe #cp nmapfe.desktop $PKG/usr/local/gnome/apps/Utilities/ # Copy the man pages for EACH in nmap nmapfe xnmap ; do gzip -9c docs/$EACH.1 > $PKG/usr/man/man1/$EACH.1.gz rm docs/$EACH.1 done # Copy the docs cp -r `ls [A-Z]*` $PKG/usr/doc/$NAME-$VERSION/ cp docs/* $PKG/usr/doc/$NAME-$VERSION/ # Add any additional post-install scripts cat << EOF > $PKG/install/doinst.sh # Scripts go here echo echo "$NAME-$VERSION successfully installed" echo EOF # Add the description file cat << EOF > $PKG/install/description PRIORITY: OPT $NAME: $NAME $NAME: $NAME: Nmap is a utility for network exploration or security auditing. It $NAME: supports ping scanning (determine which hosts are up), many port $NAME: scanning techniques (determine what services the hosts are offering), $NAME: and TCP/IP fingerprinting (remote host operating system ID). Nmap $NAME: also offers flexible target and port specification, decoy scanning, $NAME: determination of TCP sequence predictability characteristics, sunRPC $NAME: scanning, reverse-identd scanning and more. Not compiled with $NAME: nmapfe, but as the Makefile says: "GUIs are for wusses" $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 fi # Fork screen output to a log ) 2>&1 | tee $CWD/$NAME.build.log