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

VERSION=2.05b
PROGNAME="GNU Bourne Again Shell $VERSION"
DESC="\
bash (sh-compatible shell)                                             \n\
                                                                       \n\
The GNU Bourne-Again SHell.  Bash is a sh-compatible command           \n\
interpreter that executes commands read from the standard input or     \n\
from a file.  Bash also incorporates useful features from the Korn     \n\
and C shells (ksh and csh).  Bash is ultimately intended to be a       \n\
conformant implementation of the IEEE Posix Shell and Tools            \n\
specification (IEEE Working Group 1003.2).                             \n\
                                                                       \n\
Bash must be present for the system to boot properly."

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

compile() {
   tar -xvzf $CWD/bash-$VERSION.tar.gz
   cd bash-$VERSION/
   chown -R root.root .
   find . -perm 664 | xargs chmod 644
   find . -perm 775 | xargs chmod 755
   for patch in $CWD/patches/bash* ; do
     zcat $patch | patch -p0 --verbose
   done

   CFLAGS=-O2 \
   ./configure --prefix=/usr \
               --build=s390-slackware-linux \
               --host=s390-slackware-linux \
               --target=s390-slackware-linux
   make
}

install() {
   make install DESTDIR=/package-bash
   mkdir -p /package-bash/bin
   mv /package-bash/usr/bin/bash /package-bash/bin/bash2.new
   (cd /package-bash/usr/bin
    rm *
    ln -s /bin/bash bash
   )

   cp -a doc/rbash.1 doc/builtins.1 /package-bash/usr/man/man1
   rm /package-bash/usr/man/man1/bashbug.1

   mkdir -p /package-bash/usr/doc/bash-$VERSION
   cp -a AUTHORS CHANGES COMPAT COPYING INSTALL MANIFEST NEWS NOTES \
      README Y2K doc/FAQ doc/INTRO /package-bash/usr/doc/bash-$VERSION

   ( cd doc/
     groff -ms -Tascii article.ms > /package-bash/usr/doc/bash-$VERSION/article.txt
   )

   ( cd /package-bash/usr/info
     rm -f *.gz
     gzip -9 *
   )
   ( cd /package-bash/usr/man/man1
     rm -f *.gz
     gzip -9 *.1
   )
}

attributes() {
   chown -R root.bin $PKG/package-bash/bin/
}

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

   rmdir usr/bin

   cat $CWD/slack-desc > $PKG/install/slack-desc

   cd $CTL
   cat <<"EOF" >> doinst.sh
if [ -r bin/bash ]; then
  mv bin/bash bin/bash.old
fi
mv bin/bash2.new bin/bash
if [ -f bin/bash.old ]; then
  rm -f bin/bash.old
fi
if [ ! -r etc/shells ]; then
  touch etc/shells
  chmod 644 etc/shells
fi
if fgrep "/bin/bash" etc/shells 1> /dev/null 2> /dev/null ; then
  true
else
  echo "/bin/bash" >> etc/shells
fi
EOF

   sed -e 's%package-bash/%%' doinst.sh > doinst.sh.new
   cat doinst.sh.new > doinst.sh
   rm doinst.sh.new
}

