#!/bin/sh
# Build pcmcia.tgz.
cat << EOF

Before building this, get a non-APM kernel running, and a non-APM kernel tree
in /usr/src/linux, otherwise the binaries will *require* APM, and everyone
will complain.

Modules are now bundled in with the other kernel modules, not in this package
(makes more sense, especially with two very different kernels in this release)

EOF
sleep 15
CWD=`pwd`

VERSION=3.1.33
ARCH=i386
BUILD=1

cd /tmp
tar xzvf $CWD/pcmcia-cs-$VERSION.tar.gz
cd pcmcia-cs-$VERSION
mkdir -p /usr/doc/pcmcia-cs-$VERSION
cp -a BUGS CHANGES COPYING LICENSE MAINTAINERS doc/PCMCIA-HOWTO \
  doc/PCMCIA-PROG README* SUPPORTED.CARDS /usr/doc/pcmcia-cs-$VERSION
chown -R root.root /usr/doc/pcmcia-cs-$VERSION
chmod 644 /usr/doc/pcmcia-cs-$VERSION/*
make clean
./Configure --noapm --nopnp --trust --kernel=/usr/src/linux --noprompt --current --bsd
make all
make install
# I see no good reason to make this setuid root.
chmod 755 /sbin/cardctl
# This version of rc.pcmcia has been modified for use with Slackware.
# It also polls the card slots rather than wasting an IRQ for that.
zcat $CWD/rc.pcmcia.gz > /etc/rc.d/rc.pcmcia
# Patch the config.opts for the correct WebGear wireless defaults:
( cd /etc/pcmcia ; zcat $CWD/config.opts.diff.gz | patch -p0 )
mkdir -p /usr/include/pcmcia
cp -a include/pcmcia/* /usr/include/pcmcia
chmod 644 /usr/include/pcmcia/*
chown root.root /usr/include/pcmcia/*
mkdir -p /install
cat $CWD/slack-desc > /install/slack-desc
