IGNOREPATH=/etc:/home:/var:/dev:/boot:/root:/tmp:/usr/local:/bin:/sbin:/mnt:/usr/src
STRIPLIB=y
STRIPBIN=y

VERSION=3.0.16
PROGNAME="pidentd $VERSION"
DESC="\
pidentd (TCP/IP IDENT protocol server)                                 \n\
                                                                       \n\
The identd daemon implements the IDENT protocol as specified in        \n\
RFC1413.  When your machine connects to a remote system, the remote    \n\
machine may connect to your identd daemon to find out either the       \n\
user name or other information about the process that initiated        \n\
the connection.  Some remote machines may choose not to allow your     \n\
connections if you do not provide access to an identd daemon.          \n\
                                                                       \n\
The pidentd daemon was written by Peter Eriksson."

BUILD=1
MAINTAINER="Mark Post <mark.post@eds.com>"
SOURCE=ftp://ftp.gnu.org/pub/gnu/pidentd
PKGNAME=pidentd-$VERSION-s390-$BUILD
TAG=OPT

compile() {
   tar -zxvf $CWD/pidentd-$VERSION.tar.gz
   cd pidentd-$VERSION/
   # Disable attempt at writing a PID file... doesn't work since
   # a) it runs as "nobody" b) there may be multiple copies active
   # Also, don't return full username (stops email address harvesting).
   zcat $CWD/pidentd.conf.diff.gz | patch -p1 --backup --verbose
   # This patch prevents identd from trying to drop privs unless it's
   # running as root.
   zcat $CWD/pidentd.dropprivs_only_for_root.diff.gz | patch -p1 --backup --verbose

   ./configure --prefix=/usr \
               --sysconfdir=/etc \
               --with-des-includes=/usr/include/openssl \
               s390-slackware-linux
   make
}

install() {
   make install prefix=/package-pidentd/usr
   mv /package-pidentd/usr/sbin/identd /package-pidentd/usr/sbin/in.identd

   mkdir /package-pidentd/etc
   cp -p etc/identd.conf /package-pidentd/etc/identd.conf.new

   mkdir -p /package-pidentd/usr/doc/pidentd-$VERSION
   cp -a BUGS ChangeLog FAQ INSTALL README Y2K doc/rfc* \
       /package-pidentd/usr/doc/pidentd-$VERSION

   mkdir /package-pidentd/var

   ( cd /package-pidentd/usr/man/man8
     rm -f *.gz
    gzip -9 *.8
   )
   echo ".so man8/identd.8" | gzip -9c > /package-pidentd/usr/man/man8/in.identd.8.gz
}

attributes() {
   chown -R root.bin $PKG/package-pidentd/usr/sbin/
}

special() {
   cd $PKG
   mv package-pidentd/* ./
   rmdir package-pidentd

   cd $CTL
   cat $CWD/slack-desc > slack-desc

   cat $CWD/config.sh >> doinst.sh
   echo config etc/identd.conf.new >> doinst.sh
   sed -e 's%package-pidentd/%%g' doinst.sh > doinst.sh.new
   cat doinst.sh.new > doinst.sh
   rm doinst.sh.new
}

