#!/bin/sh ############################# ## Build script for: p0f ## Creator: kaneda@bohater.net ## Date: 13 Jul 04 ## Builds package: Yes ## Source location: http://lcamtuf.coredump.cx/p0f.shtml ## Downloads Source: Yes ## Build script version: 1.0 ## Requirements: None ## ## Notes: Any special notes the person may need to edit this file. ## ## Include the slackware-pkg conf file if [ -a /etc/slack-package.conf ]; then . /etc/slack-package.conf else echo "Sorry you need to have the slack-package.conf file to run these" echo "please install the slackbuilds package from LinuxPackages.net" exit fi ## Lets set the name of the program here so we can use it later. NAME=p0f ## Set the versions for packages here, these must match the source file version. PROGRAM_VER=2.0.5 ## Set the BUILD the $MYIN comes from the global config file in /etc BUILD=1$MYIN ## Location to download the source SRC_LOC="http://lcamtuf.coredump.cx/$NAME.tgz" ## Set initial variables these should be standard in most packages: PKG=$TMP/package-$NAME ## Now we go grab the source for the user. Again global config has the wget line ## We will check if it is here and if not then download if [ -a $CWD/$NAME.tgz ]; then echo "Source present not downloading" else $WGET $SRC_LOC || true fi ## Ok time to make sure the area is clean and unarchive the file rm -rf $PKG mkdir -p $PKG cd $TMP rm -rf $NAME tar xvzf $CWD/$NAME.tgz ## Now from this point on we do all the package prep and building. I like to organize them in sections ## like compile, prepare, description, build like below as an example compile() { cd $TMP/$NAME chown -R root.root . if [ ! -f /usr/lib/gcc-lib/i486-slackware-linux/3.2.3/include/net/bpf.h ] && \ [ ! -f /usr/include/net/bpf.h ] ; then ln -s /usr/include/pcap-bpf.h /usr/include/net/bpf.h fi sed s/-O3/"-O3 -march=i486 -mcpu=i686"/ $TMP/$NAME/mk/Linux > $TMP/$NAME/mk/Linux.tmp mv -f $TMP/$NAME/mk/Linux.tmp $TMP/$NAME/mk/Linux make mkdir -p $PKG/etc/$NAME mkdir -p $PKG/usr/sbin/ mkdir -p $PKG/usr/man/man1 cp -f $TMP/$NAME/$NAME $PKG/usr/sbin/ cp -f $TMP/$NAME/${NAME}rep $PKG/usr/sbin/ cp -f $TMP/$NAME/${NAME}.fp $PKG/etc/$NAME cp -f $TMP/$NAME/${NAME}a.fp $PKG/etc/$NAME cp -f $TMP/$NAME/${NAME}r.fp $PKG/etc/$NAME cp -f $TMP/$NAME/${NAME}.1 $PKG/usr/man/man1 } ## The next area I use for getting the documents set and maybe config files. prepare() { mkdir -p $PKG/usr/doc/$NAME-$PROGRAM_VER cp -rf $TMP/$NAME/doc/* $PKG/usr/doc/$NAME-$PROGRAM_VER ##Some functions from the global config to help with the cleanup ( cd $PKG strip_bin # Strips the libs files reduces the size and removes unneeded cruft strip_lib ) # Every good package should gzip those man pages gzip_man $PKG # Set group ownership for the bin directory #bin_perms $PKG # Set group ownership for the sbin directory sbin_perms $PKG } ## The next area is for the description. You can use this method or just cat a slack-desc file into ## the install area. I will use apache here as a sample description() { mkdir -p $PKG/install cat > $PKG/install/slack-desc << END |-----handy-ruler------------------------------------------------------| p0f: $NAME $PROGRAM_VER (passive OS fingerprinting tool) p0f: p0f: Versatile passive OS fingerprinting tool.Can identify the Operating p0f: System on: machines that connect to your box / machines you connect p0f: to / machine you cannot connect to / machines whose communications p0f: you can observe. P0f can also do many other tricks, and can detect or p0f: measure the following: firewall presence or masquerading (useful for p0f: policy enforcement) / the distance to the remote system and its p0f: uptime / other guy's network hookup (DSL,OC3,avian carriers). p0f: p0f: My other Slack packages:http://kaneda.bohater.net/slackware END } ## The last part is the build build() { # Build the package: cd $PKG makepkg -l y -c n $TMP/$NAME-$PROGRAM_VER-$ARCH-$BUILD.tgz mv $TMP/$NAME-$PROGRAM_VER-$ARCH-$BUILD.tgz $PKG_DIR/ echo "Your $NAME package is complete, make sure you open it up before installing it." echo "It is located in $PKG_DIR thanks for your support The Linuxpackages.net Folks" } ### Now we call all those functions in order compile prepare description build