#! /bin/sh
#
# Usage:        batch4.sh install_arguments
#
# Abstract:     This Bourne Shell script performs a license manager only
#		(type 4) type of installation in batch.
#
# Options:
#		install_arguments - arguments simply passed on without
#				    parsing to install_matlab.
#
# Note(s):	1. Supply values for the right hand side for the
#		   following 2 variables in this script. See the
#		   README in the MATLAB ./install directory for further
#		   explanation.
#
#                  WATCH OUT!
#
#                  If the MATLAB root directory is part of an AUTOMOUNTED
#                  directory supply a directory path for MATLAB that does
#                  not include any mount point information. It must be a
#                  path that forces a mount to be done if it is currently
#                  unmounted.
#
#		   MATLAB=
#		   OUTPUT_FILE=
#		   WANT_LMBOOT_LINK=		yes OR no
#
#		   NO BLANKS around the "=" in the assignments!
#
#               2. If any of the following are 'yes' you must be
#                  superuser to complete the steps successfully.
#
#                  WANT_LMBOOT_LINK
#
#               3. If this routine is sourced then the variable arglist
#                  contains any extra arguments to be passed to
#                  install_matlab. arglist should never be the empty
#                  string even when there are no arguments.
#
# Example:	1. Here is a sample dataset
#
#		   MATLAB=/usr/local/matlab  
#		   OUTPUT_FILE=/tmp/install4.out
#		   WANT_LMBOOT_LINK=no
#
# Copyright (c) 1992-1998 The MathWorks, Inc. All Rights Reserved.
# $Revision: 1.14 $  $Date: 1999/01/11 19:24:40 $
#----------------------------------------------------------------------------
#+++++++++++++++ substitute right hand values as required ++++++++++++++++++
#
    MATLAB=
    OUTPUT_FILE=
#
    WANT_LICENSE_MANAGER=yes
#
    WANT_LMBOOT_LINK=
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#    
    trap "rm -rf /tmp/$$a > /dev/null 2>&1; exit" 0 1 2 3 15
#
    DOLLAR_MATLAB='$MATLAB'
    if [ "$arglist" = "" ]; then
        cat > /tmp/$$a << EOF
#
# MATLAB installation: license manager only
#
MATLAB=$MATLAB
$DOLLAR_MATLAB/install_matlab $* -b 4 > $OUTPUT_FILE 2>&1 << EOF
$MATLAB
$WANT_LICENSE_MANAGER
$WANT_LMBOOT_LINK
EOF
    else
        cat > /tmp/$$a << EOF
#
# MATLAB installation: license manager only
#
MATLAB=$MATLAB
$DOLLAR_MATLAB/install_matlab $arglist -b 4 > $OUTPUT_FILE 2>&1 << EOF
$MATLAB
$WANT_LICENSE_MANAGER
$WANT_LMBOOT_LINK
EOF
    fi
#
    cat >> /tmp/$$a << EOF2
EOF
EOF2
#
    . /tmp/$$a
