#!/bin/sh # Set initial variables: PCVER="0.4" TDVER="3.4" CWD=`pwd` if [ "$TMP" = "" ]; then TMP=/tmp fi PKG=$TMP/package-tcpdump if [ ! -d $TMP ]; then mkdir -p $TMP # location to build the source fi if [ ! -d $PKG ]; then mkdir -p $PKG # place for the package to be built fi # Explode the package framework: cd $PKG explodepkg $CWD/_tcpdump.tar.gz echo "+=============+" echo "| libpcap-$PCVER |" echo "+=============+" cd $TMP tar xzvf $CWD/libpcap-$PCVER.tar.gz cd libpcap-$PCVER ./configure --prefix=/usr i386-slackware-linux make cat libpcap.a > $PKG/usr/lib/libpcap.a cat pcap.h > $PKG/usr/include/pcap.h cat pcap-namedb.h > $PKG/usr/include/pcap-namedb.h cat net/bpf.h > $PKG/usr/include/net/bpf.h mkdir -p $PKG/usr/doc/libpcap-$PCVER cp -a CHANGES FILES INSTALL README $PKG/usr/doc/libpcap-$PCVER chown -R root.root $PKG/usr/doc/libpcap-$PCVER mkdir -p $PKG/usr/man/man3 cat pcap.3 | gzip -9c > $PKG/usr/man/man3/pcap.3.gz echo "+=============+" echo "| tcpdump-$TDVER |" echo "+=============+" cd $TMP tar xzvf $CWD/tcpdump-$TDVER.tar.gz cd tcpdump-$TDVER ./configure --prefix=/usr i386-slackware-linux make strip tcpdump cat tcpdump > $PKG/usr/sbin/tcpdump cat tcpdump.1 | gzip -9c > $PKG/usr/man/man1/tcpdump.1.gz mkdir -p $PKG/usr/doc/tcpdump-$TDVER cp -a CHANGES FILES INSTALL README $PKG/usr/doc/tcpdump-$TDVER chown -R root.root $PKG/usr/doc/tcpdump-$TDVER # Build the package: cd $PKG tar czvf $TMP/tcpdump.tgz . # Warn of zero-length files: find . -type f -size 0c | while read file ; do echo "WARNING: zero length file $file" done find . -type f -name '*.gz' -size 20c | while read file ; do echo "WARNING: possible empty gzipped file $file" done # Clean up the extra stuff: if [ "$1" = "--cleanup" ]; then rm -rf $TMP/libpcap-$PCVER rm -rf $TMP/tcpdump-$TDVER rm -rf $PKG fi