home *** CD-ROM | disk | FTP | other *** search
/ PC World Plus! (NZ) 2001 July / TRIAL_ENTCDJB4.iso / JBuilder / ias / setup.sh < prev    next >
Linux/UNIX/POSIX Shell Script  |  2000-08-30  |  3KB  |  167 lines

  1. #!/bin/sh
  2. #
  3.  
  4. #
  5. # Script variables
  6. #
  7. DONE=NO
  8. #if [ -f "$1" ]; then
  9. if [ ${1} ]; then
  10.   SDIR="$1"
  11.   cd $SDIR
  12. else
  13.   SDIR=`pwd`
  14. fi
  15. if [ ${2} ]; then
  16.   shift
  17.   JREPATH=$1
  18. fi
  19. OS=`uname -s`
  20. OS_VERSION=`uname -a`
  21. OS_DISPLAY="Default"
  22.  
  23. #
  24. # Script functions
  25. #
  26. exit_install()
  27. {
  28.   # Move back to installdir to avoid cleanup errors
  29.   cd $SDIR
  30.  
  31.   PROMPT=0
  32.   if [ "$1" = "-p" ]; then
  33.     PROMPT=1
  34.     shift
  35.   fi
  36.  
  37.   # Wait For Confirmation, Then Bye-Bye
  38.   if [ "$PROMPT" = "1" ]; then
  39.     echo ""
  40.     echo "Hit return to exit..."
  41.     read
  42.   fi
  43.  
  44.   exit $1
  45. }
  46.  
  47. get_platform()
  48. {
  49. case "${OS}"
  50. in
  51.     SunOS )
  52.        OS_DISPLAY="Solaris"
  53.        OS_VERSION="sun5_5_sparc"
  54.        INSTALL_IAS="sun5_5_sparc"
  55.        ;;
  56.     Linux )
  57.        OS_DISPLAY="Linux"
  58.        OS_VERSION="redhat6_1"
  59.        INSTALL_IAS="redhat6_1"
  60.        ;;
  61.     HP-UX)
  62.        OS_VERSION=`uname -a | cut -f3 -d' ' | cut -f2 -d'.'`
  63.        OS_DISPLAY="HP-UX ${OS_VERSION}"
  64.        INSTALL_IAS="hpux_11"
  65.        ;;
  66.     AIX)
  67.        OS_VERSION_MAJOR=`uname -a | cut -f4 -d' '`
  68.        OS_VERSION_MINOR=`uname -a | cut -f3 -d' '`
  69.        OS_DISPLAY="AIX ${OS_VERSION_MAJOR}.${OS_VERSION_MINOR}"
  70.        OS_VERSION="${OS_VERSION_MAJOR}.${OS_VERSION_MINOR}"
  71.        OS_BIT_SIZE=`lslpp -l | grep bos.64bit | grep COMMITTED`
  72.        INSTALL_IAS="aix4_3"
  73.        ;;
  74.     * )
  75.        INSTALL_IAS="sun5_5_sparc"
  76.        ;;
  77. esac
  78. }
  79.  
  80. get_input()
  81. {
  82.   NONULL=
  83.   if [ "$1" = "-n" ]; then
  84.     NONULL=1
  85.     shift
  86.   fi
  87.   PROMPT="$1"
  88.   while [ 1 ]; do
  89.     if [ ! -z "$2" ]; then
  90.       echo "$1 [Default: $2] (q to quit): \c"
  91.     else
  92.       echo "$1 (q to quit): \c"
  93.     fi
  94.     read INPUT
  95.     if [ "$INPUT" = q -o "$INPUT" = Q -o "$INPUT" = quit -o "$INPUT" = QUIT ]; then
  96.       echo "     You can rerun this installation at any time."
  97.       exit_install 2
  98.     fi
  99.     if [ "$NONULL" = "1" -a -z "$INPUT" ]; then
  100.       echo ""
  101.       echo "Entry must not be blank.  Please try again."
  102.       continue
  103.     elif [ -z "$INPUT" -a ! -z "$2" ]; then
  104.       INPUT="$2"
  105.     fi
  106.     break
  107.   done
  108. }
  109.  
  110. DisplayOptions()
  111. {
  112.    echo ""
  113.    echo "   Inprise Application Server 4.1 Installation Selections for ${OS_DISPLAY}"
  114.    LINE=0
  115.    if [ -d $SDIR/install/ias/${INSTALL_IAS} ]
  116.    then
  117.      LINE=`expr $LINE + 1`
  118.      echo "     ${LINE}:  Install Application Server"
  119.    fi
  120. }
  121.  
  122. ProcessOption()
  123. {
  124.    LINE=0
  125.    if [ -d $SDIR/install/ias/${INSTALL_IAS} ]
  126.    then
  127.      cd $SDIR/install/ias/${INSTALL_IAS}
  128.      ./setup "$JREPATH"
  129.      cd ${SDIR}
  130.    fi
  131. }
  132.  
  133. #ProcessOption()
  134. #{
  135.    #LINE=0
  136.    #if [ -d $SDIR/install/ias/${INSTALL_IAS} ]
  137.    #then
  138.      #LINE=`expr $LINE + 1`
  139.      #if [ "${OPTION_SELECT}" = "${LINE}" ]
  140.      #then
  141.        #cd install/ias/${INSTALL_IAS}
  142.        #./setup
  143.        #cd ${SDIR}
  144.      #fi
  145.    #fi
  146. #}
  147.  
  148. #
  149. #  Script "main"
  150. #
  151.  
  152. while [ "${DONE}" = "NO" ]
  153. do
  154.    get_platform
  155.  
  156.    #DisplayOptions
  157.  
  158.    #get_input "        Which would you like to do ? "
  159.    
  160.    #OPTION_SELECT=${INPUT}
  161.  
  162.    ProcessOption
  163.  
  164.    exit
  165. done
  166.  
  167.