home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World Komputer 1999 March B
/
SCO_CASTOR4RRT.iso
/
nws
/
install
/
request
< prev
next >
Wrap
Text File
|
1998-08-19
|
16KB
|
854 lines
# @(#)request 1.4
# $Novell-NWU: $Header: /proj6/ncps/nwu_top/nws/pkg/unixware/nws/request,v 1.2 1996/04/06 00:05:20 vtag Exp $
# nws set request script
#
# L000 28th Oct 1997
# Redirect errors to /tmp/nws.err only when the graphics screen is
# initialised
#
if [ "$RANDOM" = "$RANDOM" ]
then
exec /usr/bin/winxksh $0 $*
fi
# L000 vvv
# exec 2> /tmp/nws.err
# L000 ^^^
[ -n "$DEBUG" ] && set -x
RM="/usr/bin/rm -f"
CP="/usr/bin/cp"
# If /tmp/unixware.dat exists then this is presumed to be a
# SMART_START installation so we set the SMART_START variable.
# If SMART_START is "TRUE" we do a silent install for the whole
# set (user input is not solicited).
#
# This is the REAL THING (see test below)
SMART_START="FALSE"
umount /mnt 2> /dev/null
mount -F dosfs /dev/dsk/c0b0t0d0p1 /mnt 2> /dev/null
if [ "$?" = "0" ] # if mounted successfully
then
if [ -s /mnt/unixware.dat ]
then
SMART_START="TRUE"
. /mnt/unixware.dat # get NWS_UPGRADE_KEY and IPX_INTERNAL_NETWORK
SS_IPX_INTERNAL_NETWORK=$IPX_INTERNAL_NETWORK # kludge, change later
# unlock license file and put in /etc/netware/licenses
$CP $REQDIR/enabler /tmp/enabler
/usr/bin/chmod +x /tmp/enabler
/tmp/enabler $NWS_UPGRADE_KEY "/mnt/tmp/license.nws" 2>/dev/null
fi
fi
umount /mnt 2> /dev/null
# This is a TEST (see above)
# SMART_START="FALSE"
# if [ -s /tmp/unixware.dat ]
# then
# SMART_START="TRUE"
# . /tmp/unixware.dat # get NWS_UPGRADE_KEY and IPX_INTERNAL_NETWORK
# SS_IPX_INTERNAL_NETWORK=$IPX_INTERNAL_NETWORK # kludge, change later
# enabler $NWS_UPGRAGE_KEY "/mnt/tmp/nwslicense" 2>/dev/null
# fi
POST_FILE=$1
SETREQDIR=$REQDIR
#
# For running standalone test
#
if [ "$2" = "test" ]
then
REQDIR=.
SETINFO=setinfo
SETREQDIR=..
fi
TMP_SERVER_PARMS="/tmp/server.parms"
TMP_VOLTAB="/tmp/voltab"
TMP_PKGDEF="/tmp/pkgdef"
#
# If this script exits normally or if DEL is pressed, make sure
# we exit 77 so pkgadd knows no packages were selected
#
trap "" 2
trap `exit $EXITCODE` 0
function WritePostFile
{
[ -n "$DEBUG" ] && set -x
{
echo SMART_START="$SMART_START"
echo LASTPKG="$LASTPKG"
} > $POST_FILE
# The response file is not being propagated to the postinstall
# phase. We'll copy the response file to a temporary file, and
# then dot in the temporary file in the postinstall script.
/usr/bin/cp $POST_FILE /tmp/nws.response
return 0
}
#
# This function sets the proper locale.
#
# Related function: SetLocale
#
function InitLocale
{
[ -n "$DEBUG" ] && set -x
# There is a prescribed list of LOCALE variables to check.
# If none are set coming in to this request script, then
# default to the C locale.
LOCALE=${LC_ALL:-${LC_MESSAGES:-${LANG:-C}}}
# Set environment variable to find help (.hcf) and strings files
# in the proper locale.
LANGDEP_SCRIPTS=/etc/inst/locale/${LOCALE}/menus/nws
# Set C locale environment variable for help and strings files.
C_LANGDEP_SCRIPTS=/etc/inst/locale/C/menus/nws
# Make the C locale scripts and directories
/usr/bin/mkdir -p ${C_LANGDEP_SCRIPTS}/help > /dev/null 2>&1
# Copy C locale files to use as backup if there is a problem with
# the real locale.
/usr/bin/cp $REQDIR/set_strings ${C_LANGDEP_SCRIPTS}
/usr/bin/cp $REQDIR/help/*.hcf ${C_LANGDEP_SCRIPTS}/help
# Revert to the C locale for help and strings files if the
# desired locale is not installed.
if [ ! -d ${LANGDEP_SCRIPTS} ]
then
LANGDEP_SCRIPTS=${C_LANGDEP_SCRIPTS}
fi
return 0
}
function ReadDefaultPackages
{
let PKGCNT=0
while read pkginst parts default category package_name
do
pkgName[$PKGCNT]="$package_name"
pkgInst[$PKGCNT]="$pkginst"
pkgDef[$PKGCNT]="$default"
let PKGCNT=PKGCNT+1
done < $SETINFO
return 0
}
function GetDefaultPackages
{
[ -n "$DEBUG" ] && set -x
ReadDefaultPackages
MakePackageList
# Write package selection to file for the case when the
# user wants to view or change package selection.
$RM $TMP_PKGDEF
let i=0;
while [ $i -lt $PKGCNT ]
do
echo "${pkgDef[$i]}" >> $TMP_PKGDEF
let i=i+1
done
return 0
}
function MakePackageList
{
[ -n "$DEBUG" ] && set -x
PKGLIST=""
let i=0
let NWS_PACKAGE_SELECTED=0
let CLIENT_PACKAGE_SELECTED=0
let WINV_PACKAGE_SELECTED=0
let DOC_PACKAGE_SELECTED=0
let DOC_JA_PACKAGE_SELECTED=0
let DOC_FR_PACKAGE_SELECTED=0
let DOC_IT_PACKAGE_SELECTED=0
let DOC_DE_PACKAGE_SELECTED=0
let DOC_ES_PACKAGE_SELECTED=0
while [ $i -lt $PKGCNT ]
do
if [ "${pkgDef[$i]}" = "y" ]
then
PKGLIST="$PKGLIST ${pkgInst[$i]}"
if [ "${pkgInst[$i]}" == "nwsrvr" ]
then
let NWS_PACKAGE_SELECTED=1
fi
if [ "${pkgInst[$i]}" == "nwsclnt" ]
then
let CLIENT_PACKAGE_SELECTED=1
fi
if [ "${pkgInst[$i]}" == "nwswinv" ]
then
let WINV_PACKAGE_SELECTED=1
fi
if [ "${pkgInst[$i]}" == "NWSdocs" ]
then
let DOC_PACKAGE_SELECTED=1
fi
if [ "${pkgInst[$i]}" == "jaNWSdocs" ]
then
let DOC_JA_PACKAGE_SELECTED=1
fi
if [ "${pkgInst[$i]}" == "frNWSdocs" ]
then
let DOC_FR_PACKAGE_SELECTED=1
fi
if [ "${pkgInst[$i]}" == "itNWSdocs" ]
then
let DOC_IT_PACKAGE_SELECTED=1
fi
if [ "${pkgInst[$i]}" == "deNWSdocs" ]
then
let DOC_DE_PACKAGE_SELECTED=1
fi
if [ "${pkgInst[$i]}" == "esNWSdocs" ]
then
let DOC_ES_PACKAGE_SELECTED=1
fi
fi
let i=i+1
done
return 0
}
#
# Display the following packages:
#
# NetWare Server for UnixWare (nwsrvr)
# Client Kit (nwsclnt)
# Windows Viewer (NWSwinv)
# Documentation (NWSdocs)
# Documentation (jaNWSdocs)
# Documentation (frNWSdocs)
# Documentation (itNWSdocs)
# Documentation (deNWSdocs)
# Documentation (esNWSdocs)
#
# Other packages not displayed:
#
#
function SelectPackages
{
[ -n "$DEBUG" ] && set -x
typeset winparms="-below 0 -border_fg $BLACK -fg $BLACK -bg $CYAN"
integer i tmpWindow
display "${PKG_PARMS_INFO_WIN}" \
-fg ${WHITE} -bg ${BLUE} \
-below 5
tmpWindow=${CURWIN}
ReadDefaultPackages
open_check
case $1 in
"default")
let i=0
while [ $i -lt $PKGCNT ]
do
if [ "${pkgDef[$i]}" = "y" ]
then
ACTIVE="-is_selected"
else
ACTIVE=""
fi
add_check "${pkgName[$i]}" $ACTIVE -entry "CURPKG=$i" \
-on 'pkgDef[$CURPKG]="y"' -off 'pkgDef[$CURPKG]="n"'
let i=i+1
done
;;
# "all")
# let i=0
# while [ $i -lt $PKGCNT ]
# do
# pkgDef[$i]="y"
# add_check "${pkgName[$i]}" -is_selected -entry "CURPKG=$i" \
# -on 'pkgDef[$CURPKG]="y"' -off 'pkgDef[$CURPKG]="n"'
# let i=i+1
# done
# ;;
"last")
let i=0
while read default
do
pkgDef[$i]="$default"
if [ "${pkgDef[$i]}" = "y" ]
then
ACTIVE="-is_selected"
else
ACTIVE=""
fi
add_check "${pkgName[$i]}" $ACTIVE -entry "CURPKG=$i" \
-on 'pkgDef[$CURPKG]="y"' -off 'pkgDef[$CURPKG]="n"'
let i=i+1
done < $TMP_PKGDEF
;;
esac
check_runparms $CID $i
# place_window 80 windowSize \
# -title "$WINTITLE" \
# -border_fg $BLACK -bg $CYAN \
# -below 0 \
# -current "footer '$FORM_MSG'"
# place_window $CHECK_WIN_WIDTH $CHECK_WIN_HEIGHT $winparms -current 'footer "$CHECK_FOOTER"' -title "$CHECK_WIN_TITLE" -below 0
place_window $CHECK_WIN_WIDTH 5 $winparms -current 'footer "$CHECK_FOOTER"' -title "$CHECK_WIN_TITLE" -below 0
set_hotkey 1 'helpwin package'
set_hotkey 6 'footer "$GENERIC_WAIT_MSG"; wclose $CURWIN; SelectPackages default'
run_check $CID 0 $CHECK_ROWS
input_handler
MakePackageList
# Write package selection to file for the case when the
# user wants to view or change package selection.
$RM $TMP_PKGDEF
let i=0;
while [ $i -lt $PKGCNT ]
do
echo "${pkgDef[$i]}" >> $TMP_PKGDEF
let i=i+1
done
wclose ${tmpWindow}
return 0
}
function WriteSetList
{
[ -n "$DEBUG" ] && set -x
for PKG in $PKGLIST
do
echo "$PKG" >>$SETLIST
done
return 0
}
function InstallScreen2
{
[ -n "$DEBUG" ] && set -x
integer infoWindow
integer active
typeset winparms="-below 0 -border_fg $BLACK -fg $BLACK -bg $CYAN"
let active=0
while (( $DONE == 0 ))
do
#
# display install menu info screen
#
display "$INSTALL_MAIN_MENU_INFO_WIN" \
-fg ${WHITE} -bg ${BLUE} \
-below 5
infoWindow=$CURWIN
CHOOSE_TITLE="$CHOOSE_MAIN_TITLE"
CHOOSE_FOOTER="$ARROW_KEYS_MSG"
set -A ARY
let i=0
ARY[$i]="$ACCEPT_AND_INSTALL"
let i=i+1
ARY[$i]="$VIEW_CHG_DEFAULT_CONFIG"
let i=i+1
ARY[$i]="$GO_BACK"
let i=i+1
CURRENT=${ARY[$active]}
choose -e -f -winparms "$winparms" "$CURRENT" "${ARY[@]}"
set_hotkey 1 'helpwin main_menu'
input_handler
wclose $infoWindow
case "$CHOICE" in
"$ACCEPT_AND_INSTALL")
DONE=1
;;
"$VIEW_CHG_DEFAULT_CONFIG")
InstallScreen3
let active=0
;;
"$GO_BACK")
return 0
;;
esac
footer ""
done
return 0
}
function InstallScreen3
{
[ -n "$DEBUG" ] && set -x
SelectPackages last
if [ $NWS_PACKAGE_SELECTED = 1 ]
then
RunRequest nwsrvr configure
fi
if [ $CLIENT_PACKAGE_SELECTED = 1 ]
then
RunRequest nwsclnt configure
fi
if [ $WINV_PACKAGE_SELECTED = 1 ]
then
RunRequest nwswinv configure
fi
if [ $DOC_PACKAGE_SELECTED = 1 ]
then
# Setup for NWSdocs package screen handling (menu)
# first close out winXksh
ClearScreen
call endwin
RunRequest NWSdocs configure
# Re-initialize screen for winxksh
. /usr/lib/winxksh/scr_init
fi
if [ $DOC_JA_PACKAGE_SELECTED = 1 ]
then
# Setup for NWSdocs package screen handling (menu)
# first close out winXksh
ClearScreen
call endwin
RunRequest jaNWSdocs configure
# Re-initialize screen for winxksh
. /usr/lib/winxksh/scr_init
fi
if [ $DOC_FR_PACKAGE_SELECTED = 1 ]
then
# Setup for NWSdocs package screen handling (menu)
# first close out winXksh
ClearScreen
call endwin
RunRequest frNWSdocs configure
# Re-initialize screen for winxksh
. /usr/lib/winxksh/scr_init
fi
if [ $DOC_IT_PACKAGE_SELECTED = 1 ]
then
# Setup for NWSdocs package screen handling (menu)
# first close out winXksh
ClearScreen
call endwin
RunRequest itNWSdocs configure
# Re-initialize screen for winxksh
. /usr/lib/winxksh/scr_init
fi
if [ $DOC_DE_PACKAGE_SELECTED = 1 ]
then
# Setup for NWSdocs package screen handling (menu)
# first close out winXksh
ClearScreen
call endwin
RunRequest deNWSdocs configure
# Re-initialize screen for winxksh
. /usr/lib/winxksh/scr_init
fi
if [ $DOC_ES_PACKAGE_SELECTED = 1 ]
then
# Setup for NWSdocs package screen handling (menu)
# first close out winXksh
ClearScreen
call endwin
RunRequest esNWSdocs configure
# Re-initialize screen for winxksh
. /usr/lib/winxksh/scr_init
fi
return 0
}
function RunAllRequestScripts
{
#
# Run request scripts for packages selected
#
for PKG in $PKGLIST
do
if [ "$PKG" = "nwsrvr" ]
then
RunRequest nwsrvr install
continue
fi
if [ "$PKG" = "nwsclnt" ]
then
RunRequest nwsclnt install
continue
fi
if [ "$PKG" = "nwswinv" ]
then
RunRequest nwswinv install
continue
fi
if [ "$PKG" = "NWSdocs" ]
then
# Copy default response file if a custom response file
# doesn't exist. A custom response file is created when
# the "View or change doc parameters" menu item is entered.
# If that menu item isn't entered, we will need to copy
# over the default response.
if [ ! -f $RESPDIR/$PKG ]
then
$CP $SETREQDIR/$PKG/response $RESPDIR/$PKG
fi
continue
fi
if [ "$PKG" = "jaNWSdocs" ]
then
if [ ! -f $RESPDIR/$PKG ]
then
$CP $SETREQDIR/$PKG/response $RESPDIR/$PKG
fi
continue
fi
if [ "$PKG" = "frNWSdocs" ]
then
if [ ! -f $RESPDIR/$PKG ]
then
$CP $SETREQDIR/$PKG/response $RESPDIR/$PKG
fi
continue
fi
if [ "$PKG" = "itNWSdocs" ]
then
if [ ! -f $RESPDIR/$PKG ]
then
$CP $SETREQDIR/$PKG/response $RESPDIR/$PKG
fi
continue
fi
if [ "$PKG" = "deNWSdocs" ]
then
if [ ! -f $RESPDIR/$PKG ]
then
$CP $SETREQDIR/$PKG/response $RESPDIR/$PKG
fi
continue
fi
if [ "$PKG" = "esNWSdocs" ]
then
if [ ! -f $RESPDIR/$PKG ]
then
$CP $SETREQDIR/$PKG/response $RESPDIR/$PKG
fi
continue
fi
done
return 0
}
function RunRequest
{
[ -n "$DEBUG" ] && set -x
PKGNAME=$1
CONFIGNAME=$2
case $CONFIGNAME in
"configure")
CONFFLAG=1
;;
"install")
CONFFLAG=3
esac
if [ -f $SETREQDIR/$PKGNAME/request ]
then
# Mark vars yet to be set to be automatically exported
set -a
pkgparam -v -f $SETREQDIR/${PKGNAME}/pkginfo > /tmp/params.$$
. /tmp/params.$$; rm /tmp/params.$$
PKGINST=$PKGNAME # reset PKGINST to set member PKG inst
# Shell variables will be set only while running request script.
REQDIR=${SETREQDIR}/${PKGNAME} \
CONFFLAG=$CONFFLAG \
TMP_SERVER_PARMS=$TMP_SERVER_PARMS \
TMP_VOLTAB=$TMP_VOLTAB \
SMART_START=$SMART_START \
sh $SETREQDIR/$PKGNAME/request $RESPDIR/$PKGNAME
[ "$?" != "0" ] && {
GoodBye 1
}
fi
return 0
}
#
#==============================================================================
#
#
# This function is executed through pkgadd install.
#
function InstallScreen1
{
[ -n "$DEBUG" ] && set -x
typeset -i mainMenuCurrentChoice=0
typeset -i tmpWindow
typeset winparms="-below 0 -border_fg $BLACK -fg $BLACK -bg $CYAN"
DONE=0
GetDefaultPackages
while (( $DONE == 0 ))
do
display "$WELCOME_MSG" \
-fg ${WHITE} -bg ${BLUE} \
-below 4
tmpWindow=${CURWIN}
CHOOSE_TITLE="$CHOOSE_PREINSTALL_TITLE"
CHOOSE_FOOTER="$ARROW_KEYS_MSG"
case $mainMenuCurrentChoice in
0)
active="$LEARN_INSTALL_MENU_ITEM"
;;
1)
active="$VIEW_PREQ_MENU_ITEM"
;;
2)
active="$CONTINUE_INSTALLATION"
;;
esac
choose -e -f -winparms "$winparms" "$active" "$LEARN_INSTALL_MENU_ITEM" "$VIEW_PREQ_MENU_ITEM" "$CONTINUE_INSTALLATION" "$ABORT_MENU_ITEM"
set_hotkey 1 'helpwin intro'
input_handler
wclose $tmpWindow
case "$CHOICE" in
"$LEARN_INSTALL_MENU_ITEM")
ViewInfo learn
mainMenuCurrentChoice=1
;;
"$VIEW_PREQ_MENU_ITEM")
ViewInfo prereq
mainMenuCurrentChoice=2
;;
"$CONTINUE_INSTALLATION")
InstallScreen2
;;
"$ABORT_MENU_ITEM")
EXITCODE=77
GoodBye 1
;;
esac
footer ""
done
return 0
}
#
# This function is executed through Compaq SMART_START Silent Install
#
function DoSilent
{
[ -n "$DEBUG" ] && set -x
ReadDefaultPackages
MakePackageList
RunAllRequestScripts
[ $? != 0 ] && {
exit 1
}
return 0
}
function CheckPreinstall
{
TMP=`ps -ef|grep "NWS"|wc -l`
if [ $TMP -gt 2 ]
then
footer "$HIT_ANY_KEY_TO_END"
display -w "$STOP_SERVER_TO_INSTALL" \
-fg ${WHITE} -bg ${RED}
input_handler
GoodBye 3
fi
}
#
# Main() ================================================================
#
[ -n "$DEBUG" ] && set -x
typeset -i ServerLicenseCount=0
integer pkgCnt
# Initialize the locale environment variables
# This must occur before dotting in misc_func
InitLocale
# Dot in the strings file for the correct locale.
. ${LANGDEP_SCRIPTS}/set_strings
if [ "$SMART_START" = "FALSE" ]
then
# Initialize winxksh
. /usr/lib/winxksh/winrc
. /usr/lib/winxksh/scr_init
#L000 vvv
# If scr_init fails then the script will exit b4 getting here
exec 2> /tmp/nws.err
#L000 ^^^
. /etc/dcu.d/menus/choose
fi
# load misc functions
. $REQDIR/misc_func
#
# Make sure we comply with preinstall conditions
#
CheckPreinstall
# Remove old copies of tmp files
$RM $TMP_SERVER_PARMS
$RM $TMP_VOLTAB
$RM $TMP_PKGDEF
#
# if smart start we do not solicit input from the user at all.
#
if [ "$SMART_START" = "TRUE" ]
then
DoSilent
else
InstallScreen1
# If no packages were selected, There is no work to do.
if [ "$PKGLIST" = "" ]
then
# No packages were selected
ClearScreen
call endwin
echo "$NO_PACKAGES_SELECTED"
EXITCODE=77
exit 2
fi
# Write a file to /tmp that indicates the last package
# The last package to be installed is in charge of displaying
# the final install screen.
# This file will be deleted in the postinstall
# This code is duplicated in the doSilent function
set $PKGLIST # break into $1 $2 etc...
let pkgCnt=${#*} # get number of packgages
set +A PKGS $PKGLIST # put into array
LASTPKG=${PKGS[$pkgCnt-1]}
# ENHANCEMENT, remove all possible package file names.
if [ "${PKGS[0]}" = "nwsrvr" ] # only add file if nwsrvr selected
then
touch /tmp/$LASTPKG
fi
RunAllRequestScripts
[ $? != 0 ] && {
GoodBye 1
}
fi
WriteSetList
WritePostFile
GoodBye 0