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

VERSION=1.3.0
PROGNAME="Linux/390 tools $VERSION"
DESC="\
s390-tools                                                           \n\
                                                                     \n\
This package contains utilities related to Linux for S/390.          \n\
Currently, the following programs are provided:                      \n\
   - dasdfmt, which is used to low-level format ECKD DASD with       \n\
     either the classic linux disk layout or the new z/OS            \n\
     compatible disk layout.                                         \n\
   - dasdview, which displays DASD and VTOC information and          \n\
     dump the content of a DASD to the console.                      \n\
   - dbginfo.sh, a script to collect some configuration, trace, and  \n\
     debug information about the S390 Linux system                   \n\
   - fdasd, which is used to create or modify partitions on          \n\
     ECKD DASD formatted with the z/OS compatible disk layout.       \n\
   - ip_watcher looks for addresses in the HiperSockets and sets     \n\
     them as Proxy ARP on the OSAs. Also adds routing entries        \n\
     towards the HiperSockets interfaces for all IP addresses in it. \n\
   - osasnmpd, a SNMP subagent for the ucd-snmp 4.2.x package and    \n\
     supports the MIBs provided by an IBM OSA-Express network card.  \n\
   - qetharp, which is used for querying and purging address data    \n\
     in the OSA and Hipersocket hardware.                            \n\
   - qethconf, a script to simplify the usage of OSA-Express cards.  \n\
   - tape390_display, which displays messages on the display         \n\
     unit of a zSeries tape device.                                  \n\
   - zfcpdump, to create linux system dumps on SCSI disks.           \n\
   - zipl, which is used to make either DASD or tapes bootable       \n\
     for system IPL or system dump.                                  \n\
   - zgetdump, which is used to retrieve system dumps from either    \n\
     tapes or DASD."

BUILD=1
MAINTAINER="Mark Post <mark.post@eds.com>"
SOURCE=http://www10.software.ibm.com/developerworks/opensource/linux390/
PKGNAME=s390-tools-$VERSION-s390-$BUILD
TAG=ADD

compile() {
   cd $TMP
   tar -zxvf $CWD/s390-tools-$VERSION-april2004.tar.gz

   cd s390-tools-$VERSION
   chown -R root.root .
   cat $CWD/common.mak.diff | patch -p1

   ( cd zfcpdump
     cat $CWD/zfcdump.config.diff | patch -p2
     sh get_files.sh 
   )
   make
}

install() {
   mkdir -p /package-s390-tools/bin/
   make install INSTROOT=/package-s390-tools

   mkdir -p /package-s390-tools/boot/
   cp -p $CWD/parmfile.sample /package-s390-tools/boot/parmfile.new

   ( cd /package-s390-tools/usr/man/
     for dir in 5 8; do
       ( cd man$dir
         rm -f *.gz
         gzip -9f *.$dir
       )
     done
   )
}

attributes() {
   chown -R root.bin $PKG/package-s390-tools/sbin \
                     $PKG/package-s390-tools/usr/sbin
   chmod 644 $PKG/package-s390-tools/usr/man/man*/*
}

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

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

   cat << EOF >> doinst.sh
if [ -x sbin/ldconfig ]; then
  sbin/ldconfig 2> /dev/null
fi
EOF

   sed -e 's%package-s390-tools/%%g' doinst.sh > doinst.sh.new
   cat doinst.sh.new > doinst.sh
   rm doinst.sh.new

   cat $CWD/config.sh >> doinst.sh
   echo config boot/parmfile.new >> doinst.sh
}

