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

VERSION=2.3.1
PROGNAME="Device files $VERSION"
DESC="\
devs (system device files)                                             \n\
                                                                       \n\
This package creates special files in the /dev directory that          \n\
represent your system's hardware, and a tool (/dev/MAKEDEV) for        \n\
creating new device files.  These files are required to access         \n\
hardware on a Linux system."

BUILD=1
MAINTAINER="Mark Post <mark.post@eds.com>"
SOURCE=ftp://sunsite.unc.edu/pub/Linux/system/admin/
PKGNAME=devs-$VERSION-s390-$BUILD
TAG=ADD

compile() {
   tar -zxvf $CWD/makedev_$VERSION.orig.tar.gz
   cd MAKEDEV-$VERSION/
   zcat $CWD/makedev_$VERSION-46.2.diff.gz | patch -p1 -E
   zcat $CWD/makedev_$VERSION.slack.diff.gz | patch -p1 -E
   # The following two patches are not needed, as they only apply to IDE disks
   # zcat $CWD/makedev_2.3.1.hd.diff.gz | patch -p1 -E
   # zcat $CWD/makedev.hd.diff.gz | patch -p1 -E
}

install() {
   mkdir -p /package-devs/usr/man/man8
   cat MAKEDEV.man | gzip -9c > /package-devs/usr/man/man8/MAKEDEV.8.gz
   ( cd /package-devs
     tar -zxvpsf $CWD/devs.s390.files.tar.gz
   )
}

attributes() {
   chown root.tty $PKG/package-devs/dev/console
   chmod 600 $PKG/package-devs/dev/console

   chmod 660 $PKG/package-devs/dev/dasd*

   chown root.sys $PKG/package-devs/dev/full
   chmod 666 $PKG/package-devs/dev/full

   chown root.disk $PKG/package-devs/dev/ht*

   chown root.disk $PKG/package-devs/dev/initrd

   chmod 660 $PKG/package-devs/dev/ipauth \
             $PKG/package-devs/dev/ipl \
             $PKG/package-devs/dev/ipnat \
             $PKG/package-devs/dev/ipstate

   chown root.kmem $PKG/package-devs/dev/kmem \
                   $PKG/package-devs/dev/mem \
                   $PKG/package-devs/dev/port

   chown root.disk $PKG/package-devs/dev/loop*
   chmod 660 $PKG/package-devs/dev/loop*

   chown root.lp $PKG/package-devs/dev/lp*
   chmod 660 $PKG/package-devs/dev/lp*

   chown root.disk $PKG/package-devs/dev/md*
   chmod 660 $PKG/package-devs/dev/md*

   chmod 660 $PKG/package-devs/dev/mnd*

   chown root.sys $PKG/package-devs/dev/null
   chmod 666 $PKG/package-devs/dev/null

   chown root.tty $PKG/package-devs/dev/ptmx
   chmod 666 $PKG/package-devs/dev/ptmx

   chown root.tty $PKG/package-devs/dev/pty*
   chmod 666 $PKG/package-devs/dev/pty*

   chown root.disk $PKG/package-devs/dev/ram*

   chown root.disk $PKG/package-devs/dev/raw/raw*
   chmod 660 $PKG/package-devs/dev/raw/raw*

   chmod 660 $PKG/package-devs/dev/route

   chown root.disk $PKG/package-devs/dev/scd* \
                   $PKG/package-devs/dev/sd* \
                   $PKG/package-devs/dev/sr*

   chmod 660 $PKG/package-devs/dev/sexec

   chown root.tty $PKG/package-devs/dev/tty*
   chmod 666 $PKG/package-devs/dev/tty*

   chown root.tty $PKG/package-devs/dev/vcs*
   chmod 620 $PKG/package-devs/dev/vcs*

   chown root.sys $PKG/package-devs/dev/zero
   chmod 666 $PKG/package-devs/dev/zero
}

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

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

   sed -e 's%package-devs/%%g' doinst.sh > doinst.sh.new
   cat doinst.sh.new > doinst.sh
   rm doinst.sh.new

   cat << EOF >> doinst.sh 
# just in case
chmod 666 dev/ptmx
# end just in case
EOF
}

