#!/bin/sh

# Note: Slackware 9 doesn't have this.  It uses agetty from util-linux.


VERSION=$1

cd $TMP
rm -rf getty*

tar xzvf $ORIGPATH/getty_ps-$VERSION.tar.gz
cd getty_ps*

make clean
rm -f getty uugetty

CFLAGS=-I${ARMSLACKBINHOME}/usr/include/ make -e "$( grep "^LIBS" Makefile ) -L${ARMSLACKBINHOME}/usr/lib"
# We're having some issues with ARM compiled glibc again.
# It builds both getty and ugetty *if* all that is in the dir we point to
# are the termcap libs & headers.
#CFLAGS=-I${ARMCROSSINCLUDE} make -e "$( grep "^LIBS" Makefile ) -L${ARMSLACKBINHOME}/usr/lib"
make install

# sw - I added this cos I can't get the agetty from util-linux
# to build.
install -m755 getty /sbin/agetty

mkdir /etc
install -m644 Examples/gettydefs /etc/
#install -m644 Examples/ttytype /etc/
mkdir /etc/default
install -m644 Examples/default/* /etc/default
chown root.root ${SLACKTRACKFAKEROOT}/etc/default/*

mkdir /usr/doc/getty-ps-$VERSION
cp -a ANNOUNCE ChangeLog README.* Examples *.lsm INSTALL \
              /usr/doc/getty-ps-$VERSION
find ${SLACKTRACKFAKEROOT}/usr/doc/ -type f -print0 | xargs -0 chmod 644

( cd ${SLACKTRACKFAKEROOT}/usr/man/man1 ; ln -s getty.1.gz uugetty.1.gz )

( cd ${SLACKTRACKFAKEROOT} ; chown -R root.root . )

mkdir /install
install -m644 ${ORIGPATH}/slack-desc /install/

#EOF
