home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World Komputer 1999 March B
/
SCO_CASTOR4RRT.iso
/
nwsrvr
/
install
/
request
< prev
Wrap
Text File
|
1998-08-19
|
27KB
|
1,313 lines
# nwsrvr request script
#ident "@(#)request 1.4"
#
trap "" 2
# This script must be executed from the nws request script.
if [ "$CONFFLAG" = "" ]
then
SETNAME=""
[ $PKGINST = nwsrvrJ ] && XXSETNAME=J
echo "\tPlease install the set:\
\n\tNetWare Server for UnixWare Set (nws$SETNAME)\
\n\tto install $PKGINST"
exit 3
fi
if [ "$RANDOM" = "$RANDOM" ]
then
exec /usr/bin/winxksh $0 $*
fi
# Redirect stderr to a file
exec 2>/tmp/nwsrvr.err
POST_FILE=$1
##
## The following shell variables are setup in nws request:
## (i.e. this package cannot be pkgadd'ed by itself.
##
## REQDIR: Path to this request script
## TMP_SERVER_PARMS: Path to temporary server parameters file
## TMP_VOLTAB: Path to temporary voltab file
## CONFFLAG: Set to 1 if "nwsrvr" stuff should be configured
## Set to 2 if "vol" stuff should be configured
## Set to 3 if "install now" should be run
##
GREP="/usr/bin/fgrep"
AWK="/usr/bin/awk"
MV="/usr/bin/mv -f"
RM="/usr/bin/rm -f"
CP="/usr/bin/cp"
SORT="/usr/bin/sort"
MKDIR="/usr/bin/mkdir"
LS="/usr/bin/ls"
TAIL="/usr/bin/tail"
NWCM="/usr/sbin/nwcm"
PKGINFO="/usr/bin/pkginfo"
GET_LIC_INFO="/tmp/getLicInfo"
MOUNT="/etc/mount"
UMOUNT="/etc/umount"
#
# Can't execute getLicInfo
$CP $REQDIR/getLicInfo $GET_LIC_INFO
/usr/bin/chmod +x $GET_LIC_INFO
FLPY="/mnt"
NWS_PRODID="NetWare Server for UnixWare" # used for license diskette
NWS_VERSION="4.10"
VOLTAB="/etc/netware/voltab"
LIC_FILE_PREFIX="MLS"
#
# default values for SYS volume.
#
DEF_MOUNT_PATH="/SYS"
DEF_CONTROL_PATH="/etc/netware/control/SYS"
# These variables don't need to be translated
NAME_SPACES_SPACES=" "
NAME_SPACES_1="DOS,UNIX"
NAME_SPACES_11="UNIX,DOS"
NAME_SPACES_2="DOS,UNIX,OS2"
NS_21="DOS,OS2,UNIX"
NS_22="UNIX,DOS,OS2"
NS_23="UNIX,OS2,DOS"
NS_24="OS2,DOS,UNIX"
NS_25="OS2,OS2,UNIX"
FILESYS_TYPE_1="STANDARD"
FILESYS_TYPE_2="EXTENDED"
FILESYS_TYPE_3="CDROM"
DEF_VOLTAB="0 SYS npfs $DEF_MOUNT_PATH $DEF_CONTROL_PATH DOS,UNIX -"
function NetWareProtocolStackStuff
{
[ -n "$DEBUG" ] && set -x
# SAVE FOR WHEN WE REALLY NEED TO DO OVERLAY
#
# Is it upgrade or overlay?
# /usr/sbin/pkginst/chkpkgrel returns
# 1 if installed pkg if UNK version
# 2 if installed pkg is SVR4.2
# 4 if installed pkg is SVR4.0 V4
# 9 if installed pkg is newer
# 0 if pkg is not installed
#
#
#
#
# SAVE FOR IF WE REMOVE DEPENDENCY ON DESKTOP
#
# Do we have Desktop Package installed?
#
# `pkginfo -i desktop > /dev/null 2>&1`
# USE_DTM=$?
#
# DTM=YES
# if [ "${USE_DTM}" != "0" ]
# then
# DTM=NO
# #
# # Are we installing desktop now...if so then set DTM
# #
# for i in $PKGLIST
# do
# case $i in
# desktop) DTM=YES;;
# esac
# done
# fi
#
# #
# # set CLASSES to contain DTMadmin If desktop package is installed
# #
# unset CLASSES
# CLASSES="base nwext"
# if [ "${DTM}" = "YES" ]
# then
# CLASSES="${CLASSES} DTMadmin"
# fi
# echo PKGINSTALL_TYPE=\"${PKGINSTALL_TYPE}\" >> ${OUTPUT}
# echo CLASSES=\"${CLASSES}\" >> ${OUTPUT}
# echo DTM=\"${DTM}\" >> ${OUTPUT}
return 0
}
#
# Setup configuration variables
#
function GetServerParms
{
[ -n "$DEBUG" ] && set -x
#
# Create the tmp server parameters file if it doesn't exist
# Use the defaults from nwcm if in OVERLAY. Otherwise, create
# defaults locally. If the file does exist, DOT the file in.
if [ ! -f $TMP_SERVER_PARMS ]
then
SERVER_NAME=`GetServerName`
NWS_START_AT_BOOT=`GetNwsStartAtBoot`
SERVER_LICENSE_LIMIT=0
IPX_INTERNAL_NETWORK=`GetNetwork`
#
# Write server parameters to tmp file.
#
WriteTmpServerParms
else
. $TMP_SERVER_PARMS
fi
return 0
}
function GetVolParms
{
[ -n "$DEBUG" ] && set -x
# If the regular voltab file exists then this is an overlay install.
OVERLAY="NO"
if [ -f $VOLTAB ]
then
OVERLAY="YES"
fi
#
# Create a "work" file containing the volume configuration
# information. The contents of this file will be generated
# from /etc/netware/voltab. If /etc/netware/voltab does
# not exist, the contents will be generated from scratch.
# We use the temporary file to remember the user's last
# pass through this configuration option.
#
if [ -f $TMP_VOLTAB ]
then
# read temporary voltab file and set SYSVOL environment
# variable.
exec 3< $TMP_VOLTAB
while read -u3
do
set $REPLY # put into postional parameter form
if [ "$2" = "SYS" ] # Setup global for sysvol mount point
then
SYSVOL="$4"
SYSVOL_CONTROL_DIR="$5"
break
fi
done
# Close TMP_VOLTAB
exec 3<&-
else
# Temporary voltab file does not exist. If the real
# voltab exists (OVERLAY), use it to create the
# temporary voltab file, and set SYSVOL environment
# variable.
if [ -f $VOLTAB ]
then
$SORT $VOLTAB > $TMP_VOLTAB.changes
# open voltab
exec 3< $TMP_VOLTAB.changes
# read a line and ask user for changes
# save each line in $TMP_VOLTAB
while read -u3
do
# Skip blank lines
if (( "${#REPLY}" == 0 ))
then
continue
fi
set $REPLY # put into postional parameter form
# skip comment lines
tmp=`echo "$1" | cut -c1`
if [ "$tmp" = "#" ]
then
continue
fi
# skip syntax errors (rudimentary test)
if (( "$#" != 7 ))
then
print -u2 "$VOLTAB_FILE_ERROR: $REPLY"
continue
fi
echo "$1 $2 $3 $4 $5 $6 $7" >> $TMP_VOLTAB
# Setup global for sysvol mount point
if [ "$2" = "SYS" ]
then
SYSVOL="$4"
SYSVOL_CONTROL_DIR="$5"
break
fi
done
# Close and remove TMP_VOLTAB.changes
exec 3<&-
$RM $TMP_VOLTAB.changes
else
# The real voltab file does not exist. Create temporary
# voltab file and set SYSVOL environment variable.
echo $DEF_VOLTAB > $TMP_VOLTAB
set $DEF_VOLTAB # put into postional parameter form
SYSVOL="$4"
SYSVOL_CONTROL_DIR="$5"
fi
fi
return 0
}
function WritePostFile
{
[ -n "$DEBUG" ] && set -x
typeset -i factor
# Minimum shm is 8MB
SHM_SIZE=8192000
# Increase shm by 1/12th of a 1MB for every additional user over 40.
if (( $SERVER_LICENSE_LIMIT > 40 ))
then
let factor=$SERVER_LICENSE_LIMIT-40
let factor=factor*(1048576/12)
let SHM_SIZE=SHM_SIZE+factor
fi
{
echo SERVER_NAME="$SERVER_NAME"
echo NWS_START_AT_BOOT="$NWS_START_AT_BOOT"
echo SHM_SIZE="$SHM_SIZE"
# Add 30 for virtual DS clients and pserver connections
echo MAX_CONNECTIONS=$(($SERVER_LICENSE_LIMIT+30))
echo IPX_INTERNAL_NETWORK="$IPX_INTERNAL_NETWORK"
echo SYSVOL="$SYSVOL"
echo SYSVOL_CONTROL_DIR="$SYSVOL_CONTROL_DIR"
echo SMART_START="$SMART_START"
echo LANGDEP_SCRIPTS="$LANGDEP_SCRIPTS"
echo OVERLAY="$OVERLAY"
echo COUNTRY_CODE="$COUNTRY_CODE"
echo CODE_PAGE="$CODE_PAGE"
echo HOST_CODE_SET="$HOST_CODE_SET"
echo CLASSES="\"$CLASSES\""
} > ${POST_FILE}
# Copy the tmp voltab to its permanent location
if [ "$OVERLAY" != "YES" ]
then
$CP $TMP_VOLTAB $VOLTAB
fi
$RM $TMP_VOLTAB
$RM $TMP_SERVER_PARMS
return 0
}
#-----------------------------------------------------------------------------
# Begin Volume configuration functions
#-----------------------------------------------------------------------------
typeset -ir mp_fld_num=0 # field 0: mount point
typeset -ir cp_fld_num=1 # field 1: control directory
typeset -ir ns_fld_num=2 # field 2: name spaces
#
# Check field functions ------------------------------------------------------
#
#
# fix up name space field if user types nonsense.
#
function CheckNameSpacesField
{
[ -n "$DEBUG" ] && set -x
typeset -u NS
NS=$NAME_SPACES
if [ "$NS" != "$NAME_SPACES_1" ]
then
if [ "$NS" != "$NAME_SPACES_2" ]
then
display -w "$ILL_NAME_SPACE" \
-fg ${WHITE} -bg ${RED} \
-current "footer $ENTER_TO_CONT_MSG"
return 1
fi
fi
return 0
}
function CheckMountField
{
[ -n "$DEBUG" ] && set -x
typeset tmp
tmp=`echo "$MOUNT_PATH" | cut -c1`
if [ "$tmp" != "/" ]
then
display -w "$INCORRECT_SYS_VOL_PATH" \
-fg ${WHITE} -bg ${RED} \
-current "footer $ENTER_TO_CONT_MSG"
return 1
fi
if [[ ! -d $MOUNT_PATH && -a $MOUNT_PATH ]]
then
display -w "$MOUNT_POINT_IS_FILE" \
-fg ${WHITE} -bg ${RED} \
-current "footer $ENTER_TO_CONT_MSG"
return 1
fi
return 0
}
function CheckControlField
{
[ -n "$DEBUG" ] && set -x
typeset tmp
tmp=`echo "$CONTROL_PATH" | cut -c1`
if [ "$tmp" != "/" ]
then
display -w "$INCORRECT_CONTROL_PATH" \
-fg ${WHITE} -bg ${RED} \
-current "footer $ENTER_TO_CONT_MSG"
return 1
fi
if [[ ! -d $CONTROL_PATH && -a $CONTROL_PATH ]]
then
display -w "$CNTL_PATH_IS_FILE" \
-fg ${WHITE} -bg ${RED} \
-current "footer $ENTER_TO_CONT_MSG"
return 1
fi
return 0
}
#
# Choose functions -----------------------------------------------------------
#
function ChooseNameSpaces
{
[ -n "$DEBUG" ] && set -x
set -A nsChoices $NAME_SPACES_1 $NAME_SPACES_2
CHOOSE_TITLE=$CONFIG_NS_CHOOSE_TITLE
CHOOSE_FOOTER=$GENERIC_CHOOSE_FOOTER
choose -f "" "${nsChoices[@]}"
return 0
}
#
#-------------------------------------------------------------------------------
#
function DisplayVolConfig
{
[ -n "$DEBUG" ] && set -x
integer thisWindow thisForm inputXLoc
typeset -u VOL_NAME NAME_SPACES FILESYS_STRING
typeset -l FILE_CONTROL_LOWER
integer vol_num windowSize
windowSize=4
vol_num=$2
VOL_NAME=$3
FILESYS_TYPE=$4
MOUNT_PATH=$5
CONTROL_PATH=$6
NAME_SPACES=$7
OPTIONS=$8
CHOOSE_TITLE="$OPTIONS"
CHOOSE_FOOTER="$FORM_MSG"
# Set file system type string.
# Convert the voltab file sys type name to an install one.
# i.e. npfs=STANDARD, nxfs=EXTENDED, cdrom=STANDARD + "cdrom"-->options
#
#------------------ BEGIN FORM ----------------------
let inputXLoc=${#CNTL_DIR_PROMPT}+2
open_form
thisForm=${FID}
#
# Volume Mount Point
#
MOUNT_PATH_SAVE=$MOUNT_PATH # save for CheckMountField
add_field MOUNT_PATH -ilen 64 -p "$MOUNT_PATH_PROMPT" \
-px 0 -py 1 \
-pfg ${BLACK} -pbg ${CYAN} -ix $inputXLoc -iy 1 \
-help "helpwin volconf_mount" \
-entry "footer '$FORM_MSG'" \
-exit "CheckMountField"
#
# Volume Control Path
#
CONTROL_PATH_SAVE=$CONTROL_PATH
add_field CONTROL_PATH -ilen 64 -p "$CNTL_DIR_PROMPT" \
-px 0 -py 2 \
-pfg ${BLACK} -pbg ${CYAN} -ix $inputXLoc -iy 2 \
-help "helpwin volconf_control" \
-entry "footer '$FORM_MSG'" \
-exit "CheckControlField"
#
# Volume Name Spaces
# Choices: DOS,UNIX DOS,UNIX,OS2
#
NAME_SPACES_SAVE=$NAME_SPACES # save for CheckNameSpacesField()
add_field NAME_SPACES -ilen 12 -p "$NAME_SPACES_PROMPT" \
-px 0 -py 3 \
-pfg ${BLACK} -pbg ${CYAN} -ix $inputXLoc -iy 3 \
-choice "ChooseNameSpaces" \
-help "helpwin volconf_namespaces" \
-entry "footer '$FORM_MSG_CHOICE'" \
-exit "CheckNameSpacesField"
windowSize=5
WINTITLE="$CONFIG_VOLS_TITLE"
place_window 80 windowSize \
-title "$WINTITLE" \
-border_fg $BLACK -bg $CYAN \
-below 0 \
-current "footer '$FORM_MSG'"
thisWindow=${CURWIN}
run_form ${thisForm}
input_handler
wclose ${thisWindow}
destroy_form ${thisForm}
#------------------ END FORM ----------------------
#
# Set up entry variable whose name was passed as the first argument.
#
eval $1=\"$2 $VOL_NAME $FILESYS_TYPE $MOUNT_PATH $CONTROL_PATH $NAME_SPACES $OPTIONS\"
return 0
}
#
#-------------------------------------------------------------------------------
#
# ConfigureVolumes
#
# If overlay install, run through each volume defined in the voltab.
# The user may modify or deleted each one. The SYS volume may not be
# deleted.
#
# If not overlay, just the SYS volume is presented with a default
# configuration.
#
function ConfigureVolumes
{
[ -n "$DEBUG" ] && set -x
integer infoWindow
typeset -L128 entry
typeset -L32 options
#
# display info screen
#
display "$VOLCONFIG_INFO_WIN" \
-fg ${WHITE} -bg ${BLUE} \
-below 5
infoWindow=${CURWIN}
# open voltab
exec 3< $TMP_VOLTAB
# read only the first line and ask user for changes
# the first line of the voltab should always be SYS.
#
# save each line in $TMP_VOLTAB.changes
# Don't need to do any syntax or error checking
# because is always guaranteed that TMP_VOLTAB
# will be correct.
read -u3
set $REPLY # put into postional parameter form
DisplayVolConfig entry "$1" "$2" "$3" "$4" "$5" "$6" "$7"
# Setup global for sysvol mount point
set $entry
if [ "$2" = "SYS" ]
then
SYSVOL="$4"
SYSVOL_CONTROL_DIR="$5"
fi
# save each change in $TMP_VOLTAB.changes
echo $entry >> $TMP_VOLTAB.changes
# close $TMP_VOLTAB
exec 3<&-
$MV $TMP_VOLTAB.changes $TMP_VOLTAB
footer ""
wclose $infoWindow
return 0
}
function CreateVolDirs
{
$MKDIR -p $SYSVOL_CONTROL_DIR > /dev/null 2>&1
return 0
}
#-----------------------------------------------------------------------------
# End Volume configuration functions
#-----------------------------------------------------------------------------
function GetServerName
{
[ -n "$DEBUG" ] && set -x
TMP=`$NWCM -v server_name`
if [ "$TMP" = "server_name=\"\"" ]
then
# server name doesn't exist. Create default.
echo `uname -n`
else
# server name already set. Use value.
eval $TMP
echo $server_name
fi
return 0
}
function GetNwsStartAtBoot
{
[ -n "$DEBUG" ] && set -x
$NWCM -v nws_start_at_boot > /dev/null 2>&1
if (( $? == 0 ))
then
# nws_start_at_boot already set (OVERLAY). Use value.
eval `$NWCM -v nws_start_at_boot`
if [ $nws_start_at_boot = "on" ]
then
nws_start_at_boot="$START_AT_BOOT_1" # yes
else
nws_start_at_boot="$START_AT_BOOT_2" # no
fi
echo $nws_start_at_boot
else
# nws_start_at_boot doesn't exist. Create default.
echo "$START_AT_BOOT_1" # yes
fi
return 0
}
function GetNetwork
{
[ -n "$DEBUG" ] && set -x
typeset -i16 tmp
#
# Check for ipx_internal_network already set
# Note: this parameter is part of nwnet pkg,
# and therefore no OVERLAY check is required.
#
eval `$NWCM -v ipx_internal_network`
if [ "$ipx_internal_network" = "0x0" ]
then
# ipx_internal_network is not set, so invent one.
ccall time 0
currtime=${RET#0x} # remove leading 0x
currtime=16#$currtime # convert to base 10
randval=$(($RANDOM << 16))
ipx_network=$(($currtime + $randval))
tmp=$ipx_network # convert to base 16
tmp1=${tmp##*#} # remove leading 16# or -16#
echo 0x$tmp1
else
# ipx_internal_network is set, so use it.
echo $ipx_internal_network
fi
}
#
#===================== ChangeServerParms SCREEN Functions ======================
#
# field positions
typeset -ir sn_fld_num=0 # field 0: server name
typeset -ir ip_fld_num=1 # field 1: ipx internal network
typeset -ir sl_fld_num=2 # field 2: shadow locking
typeset -ir nm_fld_num=3 # field 3: network management
typeset -ir sa_fld_num=4 # field 4: start at boot
#
# choose functions -------------------------------------------------------------
#
function ChooseStartAtBoot
{
[ -n "$DEBUG" ] && set -x
set -A sbChoices "$START_AT_BOOT_1" "$START_AT_BOOT_2"
CHOOSE_TITLE=$START_AT_BOOT_CHOOSE_TITLE
CHOOSE_FOOTER=$GENERIC_CHOOSE_FOOTER
choose -f "" "${sbChoices[@]}"
return 0
}
#
# check functions --------------------------------------------------------------
#
#
# Server Name must be between 2 and 47 alphanumeric, hyphen, underscore
#
function CheckServerNameField
{
[ -n "$DEBUG" ] && set -x
# check length
if [ "${#SN}" -lt 2 -o "${#SN}" -gt 47 ]
then
display -w "$ILL_SERVER_NAME_LEN_MSG" \
-fg ${WHITE} -bg ${RED} \
-current "footer $ENTER_TO_CONT_MSG"
return 1
fi
# check for illegal characters
if [ ! -z "${SN##*([!\\])}" -o \
! -z "${SN##*([0-9A-z_\-])}" ]
then
display -w "$ILL_SERVER_NAME_CHAR_MSG" \
-fg ${WHITE} -bg ${RED} \
-current "footer $ENTER_TO_CONT_MSG"
return 1
fi
return 0
}
function CheckIPXNetField
{
[ -n "$DEBUG" ] && set -x
typeset -u tmp_ipx_net
tmp_ipx_net=$IPX_NET
# check for illegal characters
if [ ! -z "${IPX_NET##*([!\\])}" -o \
! -z "${IPX_NET##*([0-9A-Fa-f])}" ]
then
display -w "$ILL_IPX_NET_CHAR_MSG" \
-fg ${WHITE} -bg ${RED} \
-current "footer $ENTER_TO_CONT_MSG"
return 1
fi
if [ "$tmp_ipx_net" = "0" ]
then
display -w "$ILL_IPX_NET_CHAR_MSG" \
-fg ${WHITE} -bg ${RED} \
-current "footer $ENTER_TO_CONT_MSG"
return 1
fi
if [ "$tmp_ipx_net" = "FFFFFFFF" ]
then
display -w "$ILL_IPX_NET_CHAR_MSG" \
-fg ${WHITE} -bg ${RED} \
-current "footer $ENTER_TO_CONT_MSG"
return 1
fi
return 0
}
function CheckStartAtBootField
{
[ -n "$DEBUG" ] && set -x
if [ "$NWS_START_AT_BOOT" != "$START_AT_BOOT_1" ]
then
if [ "$NWS_START_AT_BOOT" != "$START_AT_BOOT_2" ]
then
display -w "$ILL_BOOT_VAL_MSG" \
-fg ${WHITE} -bg ${RED} \
-current "footer $ENTER_TO_CONT_MSG"
return 1
fi
fi
return 0
}
#
# ConfigureServer ----------------------------------------------------------
#
function ConfigureServer
{
[ -n "$DEBUG" ] && set -x
ChangeServerParms
#
# Write server parameters to tmp file.
#
WriteTmpServerParms
return 0
}
function WriteTmpServerParms
{
[ -n "$DEBUG" ] && set -x
{
echo SERVER_NAME="$SERVER_NAME"
echo NWS_START_AT_BOOT="\"$NWS_START_AT_BOOT\""
echo SERVER_LICENSE_LIMIT="$SERVER_LICENSE_LIMIT"
echo IPX_INTERNAL_NETWORK="$IPX_INTERNAL_NETWORK"
} > ${TMP_SERVER_PARMS}
return 0
}
#
# ChangeServerParms ----------------------------------------------------------
#
function ChangeServerParms
{
[ -n "$DEBUG" ] && set -x
integer infoWindow thisWindow thisForm inputXLoc
integer max size
typeset -u SN
CHOOSE_TITLE="$CHOOSE_OPTIONS"
CHOOSE_FOOTER="$ARROW_KEYS_MSG"
#
# display info screen
#
display "$SERV_PARMS_INFO_WIN" \
-fg ${WHITE} -bg ${BLUE} \
-below 4
infoWindow=${CURWIN}
#
# add form
#
open_form
thisForm=${FID}
let inputXLoc=${#SERVER_NAME_PROMPT}+2
#
# Add server name field
#
SN=$SERVER_NAME
add_field SN -ilen 47 -p "$SERVER_NAME_PROMPT" \
-px 0 -py 1 \
-pfg ${BLACK} -pbg ${CYAN} -ix inputXLoc -iy 1 \
-help "helpwin servparm_name" \
-entry "footer '$FORM_MSG'" \
-exit "CheckServerNameField"
#
# Add ipx internal network
#
IPX_NET=${IPX_INTERNAL_NETWORK#0x} # remove leading 0x
add_field IPX_NET -ilen 8 -p "$IPX_NETWORK_PROMPT" \
-px 0 -py 2 \
-pfg ${BLACK} -pbg ${CYAN} -ix inputXLoc -iy 2 \
-help "helpwin servparm_ipx" \
-entry "footer '$FORM_MSG'" \
-exit "CheckIPXNetField"
#
# Add start at boot field
#
let PIY=3
# Get maximum size of this field
max=${#START_AT_BOOT_1}
size=${#START_AT_BOOT_2}
if [ $size -gt $max ]
then
max=size
fi
add_field NWS_START_AT_BOOT -ilen $max -p "$BOOT_START_PROMPT" \
-px 0 -py $PIY \
-pfg ${BLACK} -pbg ${CYAN} -ix inputXLoc -iy $PIY \
-choice "ChooseStartAtBoot" \
-help "helpwin servparm_boot" \
-entry "footer '$FORM_MSG_CHOICE'" \
-exit "CheckStartAtBootField"
let PIY=PIY+1
#
# Place main window
#
WINTITLE=$MOD_SERVER_PARMS_WIN
place_window 80 $PIY+1 \
-title "$WINTITLE" \
-border_fg $BLACK -bg $CYAN \
-below 0 \
-current "footer '$FORM_MSG'"
thisWindow=${CURWIN}
run_form ${thisForm}
input_handler
destroy_form ${thisForm}
wclose ${infoWindow}
# set return values based on results from fields
IPX_INTERNAL_NETWORK=0x$IPX_NET # add leading zero
SERVER_NAME=$SN
return 0
}
#
# Licensing functions ==========================================================
#
#
#
#
function InstallUserLicenses
{
[ -n "$DEBUG" ] && set -x
integer ccode infoWindow flag
WINPARMS="-below 0 -border_fg $BLACK -fg $BLACK -bg $CYAN"
let flag=0
while true
do
#
# Display info window
#
display "$SERV_PARMS_LIC_INFO_WIN" \
-fg ${WHITE} -bg ${BLUE} \
-below 4
infoWindow=${CURWIN}
CHOOSE_TITLE="$CHOOSE_LICENSE_CHOICES"
CHOOSE_FOOTER="$ARROW_KEYS_MSG"
if (( $SERVER_LICENSE_LIMIT == 0 ))
then
MSG="$INSTALL_LICENSE_MSG"
CURRENT="$INSTALL_LICENSE_MSG"
else
MSG="$INSTALL_ANOTHER_LICENSE_MSG"
if (( $flag == 0 ))
then
# first time in
CURRENT="$INSTALL_ANOTHER_LICENSE_MSG"
else
# second or more times through
CURRENT="$CONTINUE_INSTALLATION"
fi
fi
choose -e -f -winparms "$WINPARMS" "$CURRENT" "$MSG" "$CONTINUE_INSTALLATION"
set_hotkey 1 "helpwin license"
input_handler
ccode=0
case "$CHOICE" in
"$INSTALL_LICENSE_MSG")
wclose $infoWindow
ReadLicenseDiskette ccode
;;
"$INSTALL_ANOTHER_LICENSE_MSG")
wclose $infoWindow
ReadLicenseDiskette ccode
;;
"$CONTINUE_INSTALLATION")
break
;;
esac
footer ""
let flag=1
done
wclose $infoWindow
return 0
}
#
#
#
function ReadLicenseDiskette
{
[ -n "$DEBUG" ] && set -x
typeset varname=
typeset -i errCode
footer "$READING_DISKETTE"
#
# Unmount any data on /mnt
#
$UMOUNT ${FLPY} > /dev/null 2>&1
#
# mount the diskette on ${FLPY}
#
errCode=0
if $MOUNT -r -Fdosfs /dev/dsk/f0t ${FLPY} || $MOUNT -r -Fdosfs /dev/dsk/f1t ${FLPY}
then
# success
CopyLicenseFile errCode
if (( $errCode == 0 ))
then
TMP=`printf "$REMOVE_DISKETTE" "$CONS" "$SERIAL_NUMBER"`
display -w "$TMP" -current "footer ''"
input_handler
fi
$UMOUNT ${FLPY}
else
# error
display -w "$ERR_MOUNTING_DISKETTE" \
-bg ${RED} -fg ${WHITE} \
-current "footer ''"
input_handler
errCode=1
fi
# return error code
varname=$1
eval $varname=${errCode}
}
function CopyLicenseFile
{
[ -n "$DEBUG" ] && set -x
typeset varname=
typeset -i length
# save first arg
varname=$1
$MKDIR -p /etc/netware/licenses > /dev/null 2>&1
NEW_LIC="/etc/netware/licenses/new.mls"
$CP ${FLPY}/server.mls $NEW_LIC
if (( "$?" != 0 ))
then
# error
display -w "$ERROR_READING_LICENSE_DISK" \
-bg ${RED} -fg ${WHITE} \
-current "footer ''"
input_handler
eval $varname=1
return 0
fi
#
# Now check to make sure that the license file
# is specific to NetWare Server for UnixWare
#
# Check major and minor OS version and product ID
VERS=`$GET_LIC_INFO $NEW_LIC version`
PRODID=`$GET_LIC_INFO $NEW_LIC prodid`
print -u2 $VERS $NWS_VERSION $PRODID $NWS_PRODID
if [[ "$VERS" != "$NWS_VERSION" || "$PRODID" != "$NWS_PRODID" ]]
then
display -w "$WRONG_LICENSE_FORMAT" \
-bg ${RED} -fg ${WHITE} \
-current "footer ''"
input_handler
eval $varname=1
return 0
fi
# Save the number of connections and serial number
# for comparison against already installed licenses
CONS=`$GET_LIC_INFO $NEW_LIC cons`
SERIAL_NUMBER=`$GET_LIC_INFO $NEW_LIC serialnumber`
#
# Move the license file to its real name
#
let COUNT=0
while true
do
length=${#COUNT}
# Attach the appropriate number of zeros at the
# beginning of the suffix
if (( $length == 1 ))
then
SUFFIX="00"$COUNT
elif (( $length == 2 ))
then
SUFFIX="0"$COUNT
fi
EXISTING_LIC=/etc/netware/licenses/$LIC_FILE_PREFIX.$SUFFIX
$LS $EXISTING_LIC > /dev/null 2>&1
if [ $? = 0 ]
then
# Found an existing license
# Now check for a duplicate
EXISTING_CONS=`$GET_LIC_INFO $EXISTING_LIC cons`
EXISTING_SN=`$GET_LIC_INFO $EXISTING_LIC serialnumber`
if [ $EXISTING_SN = $SERIAL_NUMBER ]
then
TMP=`printf "$DUPLICATE_LICENSE" "$EXISTING_SN" $EXISTING_CONS"`
display -w "$TMP" \
-bg ${RED} -fg ${WHITE} \
-current "footer ''"
input_handler
$RM $NEW_LIC
eval $varname=1
return 0
fi
let COUNT=COUNT+1
continue
fi
# Found an opening
break
done
$MV $NEW_LIC $EXISTING_LIC
# Increment the total license count
let SERVER_LICENSE_LIMIT=SERVER_LICENSE_LIMIT+CONS
# success
eval $varname=0
return 0
}
function SetupServerLanguage
{
[ -n "$DEBUG" ] && set -x
CLASSES="none english" # default is english
# if overlay use nwcm parameters to set the following
if [ "$OVERLAY" = TRUE ]
then
COUNTRY_CODE=`nwcm -v country_code`
CODE_PAGE=`nwcm -v code_page`
HOST_CODE_SET=`nwcm -v host_code_set`
else # set to defaults
COUNTRY_CODE=001
CODE_PAGE=88591
HOST_CODE_SET=88591
if [ ${#LOCALE} -gt 1 ]
then
LANG_TMP=${LOCALE%%${LOCALE##??}} # filter out first two characters
else
LANG_TMP=C # LOCALE must be C
fi
case $LANG_TMP in
de) # GERMAN
COUNTRY_CODE=49
CODE_PAGE=437
CLASSES="none english deutsch"
break;;
es) # SPANISH
COUNTRY_CODE=34
CODE_PAGE=437
CLASSES="none english espanol"
break;;
fr) # FRENCH
COUNTRY_CODE=33
CODE_PAGE=437
CLASSES="none english francais"
break;;
it) # ITALIAN
COUNTRY_CODE=39
CODE_PAGE=437
CLASSES="none english italiano"
break;;
ja)
COUNTRY_CODE=81
CODE_PAGE=932
CLASSES="none english nihongo"
HOST_CODE_SET="eucJP"
break;;
*) # default to C
CLASSES="none english"
break;;
esac
fi
print -u2 CLASSES[$CLASSES]
print -u2 OVERLAY[$OVERLAY]
print -u2 LANGUAGE[$LANG_TMP]
print -u2 COUNTRY_CODE[$COUNTRY_CODE]
print -u2 CODE_PAGE[$CODE_PAGE]
print -u2 HOST_CODE_SET[$HOST_CODE_SET]
return 0;
}
[ -n "$DEBUG" ] && set -x
#
# Main() =======================================================================
#
#
# Global Variables
#
. $REQDIR/misc_func # dot in support functions
SetLocale
. ${LANGDEP_SCRIPTS}/set_strings # load strings
if (( $CONFFLAG == 1 || $CONFFLAG == 2 ))
then
# Initialize winxksh
# NOTE: This CANNOT be made into a function!!!
. /usr/lib/winxksh/winrc
. /usr/lib/winxksh/scr_init
. /etc/dcu.d/menus/choose
fi
# This script must be executed from the nws request script. We
# don't need to enable these strings for internationalization.
if [ -z "$TMP_SERVER_PARMS" ]
then
echo $MUST_INSTALL_NWS
exit 1
fi
if [ -z "$TMP_VOLTAB" ]
then
echo $MUST_INSTALL_NWS
exit 1
fi
case $CONFFLAG in
1) # user has selected "view or change parameters"
# GetServerParms will either read in the saved server
# parameter values from the last invocation of "view or
# change server parameters" or, if this is the first
# invocation, it will read the defaults from the
# nwconfig file (OVERLAY). If this is a new installation,
# the default server parameters will be created.
#
GetServerParms
InstallUserLicenses
ConfigureServer
# GetVolParms will either read the saved volume
# parameters from the last invocation of "view or
# change volume parameters" or, if this is the first
# invocation, it will read the defaults from
# /etc/netware/voltab (OVERLAY). If /etc/netware/voltab
# does not exist, it will create a default SYS volume
# entry.
GetVolParms
if [ "$OVERLAY" != "YES" ]
then
ConfigureVolumes
fi
;;
3) # user has selected "accept all settings and install now"
GetServerParms
GetVolParms
CreateVolDirs
CreateUsersAndGroups
SetupServerLanguage # set up host_code_set, etc...
WritePostFile
;;
esac
exit 0