#!/bin/sh
# Set initial variables:

PKGNAM=etc
VERSION=12.2
ARCH=x86_64 # Slamd64 - This gets reset to noarch later
BUILD=1

. /etc/pkghelpers
pkghelpers_env

cd $TMP
rm -rf $PKG
mkdir $PKG

# Explode the package framework:
cd $PKG
explodepkg $CWD/_etc.tar.gz
cp -a $CWD/termcap-BSD.gz etc/termcap-BSD.gz
gzip -d --force etc/termcap-BSD.gz
chown root:root etc/termcap-BSD
chmod 644 etc/termcap-BSD
zcat $CWD/nsswitch.conf.gz > $PKG/etc/nsswitch.conf.new
mkdir -p $PKG/install
cat $CWD/slack-desc > $PKG/install/slack-desc

if [ $ARCH != "i486" ]; then
  sed -i s/i486/$ARCH/ $PKG/etc/ld.so.conf.new
fi

if [ $DISTRO != "slackware" ]; then
  sed -i s/slackware/$DISTRO/ $PKG/etc/ld.so.conf.new
fi

if [ $LIBSUFFIX != "" ]; then
  sed -i s%local/lib%local/lib$LIBSUFFIX% $PKG/etc/ld.so.conf.new
fi

# Build the package:
cd $PKG

export PKGARCH=noarch_${DISTRO}
makepkg -l n -c n $TMP/$PKGNAM-$VERSION-$PKGARCH-$BUILD.tgz
