DataMuseum.dk

Presents historical artifacts from the history of:

Rational R1000/400 Tapes

This is an automatic "excavation" of a thematic subset of
artifacts from Datamuseum.dk's BitArchive.

See our Wiki for more about Rational R1000/400 Tapes

Excavated with: AutoArchaeologist - Free & Open Source Software.


top - metrics - download
Index: T c

⟦7e54d760c⟧ TextFile

    Length: 12630 (0x3156)
    Types: TextFile
    Names: »check_reqs«

Derivation

└─⟦1e97d88e5⟧ Bits:30000533 8mm tape, Rational 1000, RATIONAL ASIS (AIX) 110.2.4.15
    └─⟦this⟧ »./releases/asis.110.2.4.15/install/check_reqs« 

TextFile

#! /bin/sh
# @(#)check_reqs  $Revision: 1.13 $  $Date: 1994/01/17 17:43:00 $
# @(#)Copyright(c) 1993,1994 by Rational.
#
#  MODULE SPECIFICATION
#  Name:
#    check_reqs
# 
#  Subsystem:
#    install
# 
#  Description:
#    Check that system prerequisites are satisfied for the product
#    installation
#
#  Return codes
#    0 - All system parameters checked by this script have been satisfied.
#    1 - One or more recommended system parameters have not been satisfied.
#    2 - One or more required system parameters have not been satisfied.
#    3 - Cannot find prod_desc file
#-----------------------------------------------------------------


#-----------------------------------------------------------------
narrate() {
#-----------------------------------------------------------------
#
# Display a message if verbose flag = 1
#

    if [ $verbose_flag -eq 1 ]
    then
        echo "$*"
    fi
}



#-----------------------------------------------------------------
warn() {
#-----------------------------------------------------------------
#
# Display a warning message
#

    echo "Warning: $*"
}


#-----------------------------------------------------------------
error() {
#-----------------------------------------------------------------
#
# Display an error message
#

    echo "Error:   $*"
}

#-----------------------------------------------------------------
not_root() {
#-----------------------------------------------------------------
#
# If user is not root return 0.  If user is root return 1.
#
    set -- `id`
    if [ "$1" = 'uid=0(root)' ]
    then
        return 1
    else
        return 0
    fi

}

#-----------------------------------------------------------------
check_memory() {
#-----------------------------------------------------------------
#
# Check that system memory is equal or greater than the minimum required.
#

    if [ "$uname" = AIX ]
    then
        if not_root
        then
            echo "Cannot check system memory.  You must run $command as root on $uname."
            return # must have root priv to do lsdev command
        fi

        narrate Checking system memory.
        # The following will produce something like this:
        #     mem0 Available 00-0C 64 MB Memory Card
        set -- `/etc/lsdev -C -t memory`
        mem_M_size=$4
    else
        narrate Checking system memory.
        # The following will produce something like this:
        #     mem = 65536K (0x4000000)
        set -- `/usr/etc/dmesg | grep -i "^mem" | sort -u`
        mem_K_size=`echo $3 | sed -e "s/K//g"`
        mem_M_size=`expr $mem_K_size / 1024 2>/dev/null`
    fi

    if [ -n "$mem_M_size" ]
    then
        if [ $mem_M_size -lt $min_memory ]
        then
            warn "$this_host has ${mem_M_size}M bytes of memory."
            echo "         $vendor recommends ${min_memory}M bytes."
            recommend_warn=1
        fi
    fi
}

#-----------------------------------------------------------------
check_networking() {
#-----------------------------------------------------------------
#
# Check that networking has been configured.
#
    narrate Checking if inetd is running.
    if ps ax | grep -v grep | grep inetd >/dev/null
    then :
    else
        error "inetd is not running."
        required_error=1
    fi

}

#-----------------------------------------------------------------
check_portmap() {
#-----------------------------------------------------------------
#
# Check that the port mapper is running.
#

    if [ "$feature" = rose ]
    then
        # Portmap daemon not necessary for Rose.
        return
    fi

    narrate Checking if the port mapper is running.
    if ps ax | grep -v grep | grep portmap >/dev/null
    then :
    else
        error "The portmap daemon is not running."
        required_error=1
    fi

}

#-----------------------------------------------------------------
check_hostnames() {
#-----------------------------------------------------------------
#
# On RS/6000s, check that hostname matches system uname.
#

    if [ "$uname" = AIX ]
    then
        narrate  Checking hostname.
        uname_n=`uname -n`
        if [ "$host" != "$uname_n" ]
        then
            error "hostname [$host] does not match uname [$uname_n]."
            required_error=1
        fi
    fi

}

#-----------------------------------------------------------------
check_page_space() {
#-----------------------------------------------------------------
#
# Check that system page space is equal or greater than the minimum required.
#
    if [ "$uname" = AIX ]
    then
        total_ps=0
        swap_page=page
        narrate Checking the system page space.
        # The following will produce something like:
        # Page Space Physical Volume  Volume Group Size %Used Active Auto Type
        # hd61      hdisk1            rootvg       40MB     6    yes  yes   lv
        # hd6       hdisk0            rootvg       40MB    21    yes  yes   lv
        lsps -a | grep -v "Page Space" | sed -e "s/MB//g" |
        while read PS PV VG Size Other
        do
            total_ps=`expr $total_ps + $Size 2>/dev/null`
            echo total_ps=$total_ps > $TMP
        done
        . $TMP
    else
        swap_page=swap
        narrate Checking the system swap space.
        # The following will produce something like:
        #   43244k allocated + 4908k reserved = 48152k used, 394200k available
        set -- `/etc/pstat -s | sed -e "s/k//g"`
        used=$7
        available=$9
        total_ps=`expr \( $used + $available \) / 1024 2>/dev/null`
    fi
    
    if [ -n "$total_ps" ]
    then
        if [ $total_ps -lt $min_pagespace ]
        then
            warn "$this_host has ${total_ps}M bytes of $swap_page space."
            echo "         $vendor recommends ${min_pagespace}M bytes."
            recommend_warn=1
        fi
    fi

}

#-----------------------------------------------------------------
check_ptys() {
#-----------------------------------------------------------------
#
# Check that the number of pseudo terminals configured is equal or
# greater than the minimum required.
#
    narrate Checking the number of pseudo terminals configured.
    if [ "$uname" = AIX ]
    then
        # The following will produce something like:
        #   num        16        N/A
        set -- `lsattr -D -t pty | grep "^num"`
        num_ptys=$2
    else
        num_ptys=`/bin/ls -1 /dev/pty* 2>/dev/null | wc -l`
    fi

    if [ -n "$num_ptys" ]
    then
        if [ $num_ptys -lt $min_ptys ]
        then
            warn $this_host has ${num_ptys} pseudo terminals configured.
            echo "         $vendor recommends ${min_ptys} pseudo terminals."
            recommend_warn=1
        fi
    fi
}

#-----------------------------------------------------------------
check_procs() {
#-----------------------------------------------------------------
#
# Check that the number of user processes configured is equal or
# greater than the minimum required.
#
    : narrate Checking the number of user processes.

}

#-----------------------------------------------------------------
check_limits() {
#-----------------------------------------------------------------
#
# Check that user resource limits are equal or greater than the
# minimum required.
#
# csh limit command returns:
#    cputime
#    filesize
#    datasize
#    stacksize
#    coredumpsize
#    memoryuse
# csh limit returns:

    narrate Checking user limits.
    # Initialize: cputime filesize datasize stacksize coredumpsize memoryuse
    /bin/csh -c limit |
    while read resource limit units
    do
        echo $resource=$limit >> $LIMITS
    done

    . $LIMITS

    for limit in cputime filesize datasize stacksize coredumpsize memoryuse
    do
        eval actual=\$$limit
        eval needed=\$min_$limit
        if [ "$actual" = unlimited ]
        then
            narrate "         $limit: $actual okay"
            continue

        elif [ "$needed" = 0 ]
        then
            narrate "         $limit: $actual okay"
            continue

        elif [ "$actual" -ge "$needed" ]
        then
            narrate "         $limit: $actual okay"
            continue
        else
            warn "$limit: actual [$actual] less than needed [$needed]"
            recommend_warn=1
        fi
    done

}

#-----------------------------------------------------------------
check_X() {
#-----------------------------------------------------------------
#
# Check that the X window system is installed.
#
    narrate Checking if X window system has been installed.
    if [ "$uname" = AIX ]
    then
        if lslpp -h | grep -i x11 >/dev/null
        then :
        else
            warn "X11 does not appear to be installed"
            recommend_warn=1
        fi
    else
        if [ ! -d /usr/bin/X11 ]
        then
            warn "/usr/bin/X11 not found.  X may not be installed"
            recommend_warn=1
        elif [ ! -d /usr/lib/X11 ]
        then
            warn "/usr/lib/X11 not found.  X may not be installed"
            recommend_warn=1
        elif [ ! -d /usr/include/X11 ]
        then
            warn "/usr/include/X11 not found.  X may not be installed"
            recommend_warn=1
        fi
    fi

    if /usr/ucb/which mwm | grep "no mwm in " > /dev/null
    then
        warn "no OSF/Motif window manager (mwm) found"
	echo "         Searched all directories in \$PATH"
        recommend_warn=1
    fi
}

#-----------------------------------------------------------------
check_year() {
#-----------------------------------------------------------------
#
# Check that the date/year has been set on the machine.
#

    narrate Checking date/year.
    year=`date +%y`
    if [ "$year" -le 99 ]
    then
        year=19$year
    else
        year=20$year
    fi

    if [ "$year" -lt 1993 ]
    then
        warn "$this_host may not have the date set properly.  Is it $year?"
        recommend_warn=1
    fi
}

#=========================================================================
# Main
#=========================================================================

command=`basename $0`
dirname=`dirname $0`
dir=`(cd $dirname;pwd)`
status=0
recommend_warn=0
required_error=0
verbose_flag=0
doing=user_check

while true
do
    case $1 in
        -verbose ) 
            verbose_flag=1
            shift
            ;;
        -install )
            doing=install
            shift
            ;;
        * )
            break
            ;;
    esac
done

uname=`uname -s`
host=`hostname`
if [ -n "$host" ]
then
    this_host=$host
else
    this_host="This machine"
fi

if [ "$uname" = AIX ]
then
    arch=rs6k
else
    arch=sun4
fi

LIMITS=/tmp/limits.$$
TMP=/tmp/scratch.$$
trap '/bin/rm -f $LIMITS $TMP; exit $status' 0 1 2 3 15

# Set minimum requirements for feature
if [ "`basename $dir`" = install ]
then
    # prod_desc file is in the install directory.
    . ./prod_desc.$arch
else
    # Find the prod_desc file by following the symbolic link
    set -- `file $0 | sed -e "s/\.$//"`
    if [ "$2 $3 $4" = 'symbolic link to' ]
    then
        # extract real dirname from sym link.
        dirname=`dirname $5`
    fi

    if [ -f $dirname/prod_desc.$arch ]
    then
        . $dirname/prod_desc.$arch
    else
        error "Cannot find prod_desc.$arch file"
        status=3
        exit
    fi
fi

narrate Checking system prerequisites ...

eval min_memory=\$${feature}_min_memory
eval min_pagespace=\$${feature}_min_ps_$arch
eval min_ptys=\$${feature}_min_ptys
eval min_procs=\$${feature}_min_procs
eval min_cputime=\$${feature}_min_cputime
eval min_filesize=\$${feature}_min_filesize
eval min_datasize=\$${feature}_min_datasize
eval min_stacksize=\$${feature}_min_stacksize
eval min_coredumpsize=\$${feature}_min_coredumpsize
eval min_memoryuse=\$${feature}_min_memoryuse

# Start checking.
# Functions will set recommend_warn=1 if the minimum
#     recommended resource is not met.
# Functions will set required_error=1 if the minimum
#     required resource is not met.
if [ $doing = install ]
then
    check_networking
    check_portmap
    check_hostnames
    check_year
else
    check_memory
    check_networking
    check_portmap
    check_hostnames
    check_page_space
    check_ptys
    check_procs
    check_limits
    check_X
    check_year
fi


if [ $recommend_warn -eq 1 ]
then
    echo
    echo "Warnings indicate which recommended system parameters have not been satisfied."
    status=1
fi

if [ $required_error -eq 1 ]
then
    echo
    echo "Errors indicate which required system parameters have not been satisfied."
    status=2
fi

exit