#!/bin/sh
##
##  aux.prereq.sh -- Platform Pre-Requisite Checks
##  Copyright (c) 2000-2002 Cable & Wireless Deutschland GmbH
##  Copyright (c) 2000-2002 The OpenPKG Project <http://www.openpkg.org/>
##  Copyright (c) 2000-2002 Ralf S. Engelschall <rse@engelschall.com>
##
##  Permission to use, copy, modify, and distribute this software for
##  any purpose with or without fee is hereby granted, provided that
##  the above copyright notice and this permission notice appear in all
##  copies.
##
##  THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
##  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
##  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
##  IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
##  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
##  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
##  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
##  USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
##  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
##  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
##  OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
##  SUCH DAMAGE.
##
##  Usage: aux.prereq.sh source|binary
##

mode=$1

#   determine platform id
platform=`sh ./shtool guessos`

#
#   CHECK: amount of platform support
#
support=no
case $platform in
    *-solaris* )
       support=maybe
       case $platform in
           *-solaris2.[678] )
               support=yes
               ;;
       esac
       ;;
    *-linux* ) 
       support=maybe
       if [ -f /etc/debian_version ]; then
           debian=`cat /etc/debian_version`
           if [ ".$debian" = ".2.2" ]; then
               support=yes
           fi
       fi
       ;;
    *-freebsd* )
       support=maybe
       case $platform in
           *-freebsd4.[12345] )
               support=yes
               ;;
       esac
       ;;
    *-netbsd* )
       support=maybe
       case $platform in
           *-netbsd1.5* )
               support=yes
               ;;
       esac
       ;;
    *-osf* )
       support=maybe
       case $platform in
           *-osf5.[01] )
               support=yes
               ;;
       esac
       ;;
    *-hpux* )
       support=maybe
       case $platform in
           *-hpux10.20 )
               support=yes
               ;;
       esac
       ;;
esac
case $support in
    yes   ) support="Congratulations: fully supported" ;;
    maybe ) support="Good luck: supported but wrong version!" ;;
    no    ) support="Sorry: entirely unsupported!" ;;
esac
echo "++ platform: $platform ($support)"
case $support in
    no ) exit 1 ;;
esac

#
#   CHECK: diskspace requirement
#
case $platform in
    *-solaris* )
       ;;
    *-linux* ) 
       ;;
    *-freebsd* )
       ;;
    *-osf* )
       ;;
esac

#
#   CHECK: available vendor packages
#
case $platform in
    *-solaris* )
       ;;
    *-linux* ) 
       ;;
    *-freebsd* )
       ;;
    *-osf* )
       ;;
esac

# 
#   CHECK: available tools in $PATH
#

# 
#   CHECK: available devices /dev/random, etc.
#

#
#   CHECK: consistency check for /cw (symlink!)
#

