#!/bin/sh 

# 
# Sample script to accept licenses and install RSCT packages
# For AIX:
#    do nothing - RSCT gets installed with base AIX
# For Linux:
#    install the rsct rpms


OS=`uname`
INSTALL_DIR='/install'
RSCT_DIR=$rsctdir

if [ -z "$RSCT_DIR" ]; then
   # try to default
   RSCT_DIR=$INSTALL_DIR/post/otherpkgs/$OSVER/$ARCH/rsct
fi



if [ $OS != "AIX" ]; then
    #if [ $NODESETSTATE == "install" ] || [ $NODESETSTATE == "boot" ] ; then
    #  Being run from a stateful install postscript
    #  Do nothing - use rsct.otherpkgs.pkglist to install the
    #  rsct rpms
    #fi
 

    if [ $NODESETSTATE == "genimage" ]; then
    # Being called from <image>.postinstall script
    # Assume we are on the same machine
        if [[ $OS = sles* ]] || [[ $OS = suse* ]] || [[ -f /etc/SuSE-release ]]; then
        # For SLES, assume zypper is available on the system running genimage
            # rsct don't need license. So not install and accept the rsct license on the MN
            
            # Install RSCT product rpms
            INUCLIENTS=1 INUBOSTYPE=1 zypper -n -R $installroot install $RSCT_DIR/src-*.rpm $RSCT_DIR/rsct.core-*.rpm $RSCT_DIR/rsct.core.utils-*.rpm 
        else
        # For Redhat, etc., assume yum is available on the system running genimage
            # rsct don't need license. So not install and accept the rsct license on the MN
            # Install RSCT product rpms
            INUCLIENTS=1 INUBOSTYPE=1 yum -y --installroot $installroot --nogpgcheck install $RSCT_DIR/src-*.rpm $RSCT_DIR/rsct.core-*.rpm $RSCT_DIR/rsct.core.utils-*.rpm 
        fi
    fi



fi  


