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

VERSION=2003_08_05
PROGNAME="hotplug $VERSION"
DESC="\
hotplug (scripts to handle hotplugging Cardbus and USB devices)        \n\
                                                                       \n\
This package contains scripts used to initialize and configure         \n\
Cardbus and USB hardware at boot time or when it is plugged into the   \n\
machine (aka hotplugging).  The /sbin/hotplug script is called by the  \n\
kernel to load the appropriate support modules and set up the device.  \n\
                                                                       \n\
Linux hotplug support is developed by the Linux Hotplugging Project:   \n\
  http://linux-hotplug.sourceforge.net/"

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

compile() {
   tar -yxvf $CWD/hotplug-$VERSION.tar.bz2
   cd hotplug-$VERSION/
   chown -R root.root .
   find . -perm 775 | xargs chmod 755
   find . -perm 664 | xargs chmod 644

   # Expand the list of modules to not load automatically:
   zcat $CWD/hotplug.blacklist.diff.gz | patch -p1
   # Fix net.agent to use rc.inet1:
   zcat $CWD/hotplug.netagent.diff.gz | patch -p1
   # Use usbfs, not usbdevfs.
   zcat $CWD/hotplug.usbfs.diff.gz | patch -p1
}

install() {
   make install prefix=/package-hotplug mandir=/package-hotplug/usr/man

   mkdir -p /package-hotplug/usr/doc/hotplug-$VERSION
   cp -a ChangeLog README /package-hotplug/usr/doc/hotplug-$VERSION

   mkdir -p /package-hotplug/etc/rc.d
   mv /package-hotplug/etc/init.d/hotplug /package-hotplug/etc/rc.d/rc.hotplug
   rmdir /package-hotplug/etc/init.d

   mv /package-hotplug/etc/hotplug/blacklist /package-hotplug/etc/hotplug/blacklist.new
   mv /package-hotplug/etc/hotplug/usb.usermap /package-hotplug/etc/hotplug/usb.usermap.new

   mkdir -p /package-hotplug/var/log/setup
   cp -a $CWD/setup.hotplug /package-hotplug/var/log/setup/setup.hotplug 

   ( cd /package-hotplug/usr/man/man8
     rm -f *.gz
     gzip -9 *.8
   )

   rm -rf /package-hotplug/etc/rc.d/init.d \
          /package-hotplug/var/log/hotplug \
          /package-hotplug/var/run
}

attributes() {
   chown -R root.bin $PKG/package-hotplug/sbin
   chmod 755 $PKG/package-hotplug/var/log/setup/setup.hotplug
   chmod 644 $PKG/package-hotplug/etc/hotplug/hotplug.functions
}

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

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

   zcat $CWD/doinst.sh.gz >> doinst.sh
   sed -e 's%package-hotplug/%%g' doinst.sh > doinst.sh.new
   cat doinst.sh.new > doinst.sh
   rm doinst.sh.new
}

