home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World Komputer 1999 March B
/
SCO_CASTOR4RRT.iso
/
visionfs
/
install
/
request
< prev
Wrap
Text File
|
1998-08-19
|
37KB
|
1,554 lines
#******************************************************************************
#
# Copyright (C) 1995-1997 The Santa Cruz Operation, Inc.
# All Rights Reserved.
#
# The information in this file is provided for the exclusive use of
# the licensees of The Santa Cruz Operation, Inc. Such users have the
# right to use, modify, and incorporate this code into other products
# for purposes authorized by the license agreement provided they include
# this notice and the associated copyright notice with any such product.
# The information in this file is provided "AS IS" without warranty.
#
#===============================================================================
##########################################
##########################################
# This script was built from shell library
# $Id: install.shlib,v 10.16.2.3 1997/02/11 19:58:19 tobyd Exp $
GLOB_VISION_FILE=/etc/vision.conf
VISION_FILE=/etc/vision.conf
# be paranoid about the current path
if [ -d /bin ]; then
PATH=/bin:$PATH
fi
if [ -d /sbin ]; then
PATH=/sbin:$PATH
fi
if [ -d /usr/bin ]; then
PATH=/usr/bin:$PATH
fi
if [ -d /usr/sbin ]; then
PATH=/usr/sbin:$PATH
fi
if [ -d /etc ]; then
PATH=/etc:$PATH
fi
export PATH
RESP_FILE=$1
INST_RCFILE=S90visionfs
# Version numbers
PRODUCT_VERSION="2.01.901"
PRODUCT_VERSION_FULL="2.01.901"
PRODUCT_VERSION_MAJOR=2
PRODUCT_VERSION_FEATURE=0
PRODUCT_VERSION_BUG=1
PRODUCT_VERSION_BUILD=901
# Product names
PRODUCT_FULL_NAME="SCO VisionFS"
PRODUCT_SHORT_NAME="VisionFS"
PRODUCT_LOCKD_NAME="SCO VisionFS Lock Daemon"
PRODUCT_NAMED_NAME="SCO VisionFS Name Server Daemon"
PRODUCT_COMPONENTS_NAME="VisionFS Architecture"
OK=0
FAIL=1
requestReturnVal=$OK
SAVE_FILE=/tmp/vfs.resp
c_custom=TRUE
ccsError()
{
echo "$0: " $* 1>&2
}
ccsWarning()
{
echo "$0: " $* 1>&2
}
showSummary()
{
## Present a summary of the answers before continuing
echo
_tmp=`echo $PRODUCT_VERSION_FULL | sed -e 's/\([0-9][0-9]*\)\.\([0-9]\)\([0-9]\)\.\([0-9][0-9]*\)/\1 \2 \3 \4/'`
read _major _feature _bug _build <<EOF
$_tmp
EOF
if [ $_build -lt 900 ]
then
prettyver="$_major.$_feature$_bug.$_build"
else
prettyver="$_major"
if [ $_bug -ne 0 ]
then
prettyver="$prettyver.$_feature$_bug"
else
if [ $_feature -ne 0 ]
then
prettyver="$prettyver.$_feature"
fi
fi
fi
summarystr="$l_summary $prettyver"
echo $_ss_headlines
echo $summarystr
echo $_ss_headlines
echo ""
# state of existing profile
case "$c_upgrade" in
N)
# no existing profile
;;
F)
# attempting to fix existing setup
echo "$q_deleteexisting = $a_deleteexisting"
echo ""
;;
I)
# incompatible upgrade, a_deleteexisting should be yes
echo "$q_deleteexisting = $a_deleteexisting"
echo ""
;;
B)
# upgrade from beta
echo "$q_installtype = $a_upgrade $setupver -> $PRODUCT_VERSION_FULL"
echo "$q_deleteexisting = $a_deleteexisting"
echo ""
;;
C)
# compatible upgrade
if [ "$c_reinstall" = "true" ]; then
echo "$q_installtype = $a_reinstall $PRODUCT_VERSION_FULL"
else
echo "$q_installtype = $a_upgrade $setupver -> $PRODUCT_VERSION_FULL"
fi
echo "$q_deleteexisting = $a_deleteexisting"
echo ""
;;
D)
# compatible downgrade
echo "$q_installtype = $a_downgrade $setupver -> $PRODUCT_VERSION_FULL"
echo "$q_deleteexisting = $a_deleteexisting"
echo ""
;;
esac
# $v_scrdir/license $a_licargs --summary 2>/dev/null
# administrator
if [ "$c_upgrade" = "N" -o ! -z "$a_uadmin" ]; then
echo $N "$q_admin = $a_wadmin $C"
if [ ! -z "$a_uadmin" ]; then
echo "$l_onunix1$a_uadmin $l_onunix2"
else
echo "$l_sameonunix"
fi
else
tmpstr=`echo "$a_wadmin" | while read a_bit; do echo $a_bit,; done`
adminlist=`echo $tmpstr | sed 's/,$//'`
echo "$q_keepadmin = $a_keepadmin ($adminlist)"
fi
# naming section
if [ "$a_addnaming" = "yes" -o "$c_install" = "true" ]; then
tmpstr=`echo "$a_uniquenames" | while read a_bit; do echo $a_bit,; done`
a_namelist=`echo $tmpstr | sed 's/,$//'`
if [ "$a_keepnaming" = "yes" ]; then
echo "$q_uniquenames = $a_keepnaming ($a_namelist)"
else
echo "$q_servername = $a_namelist"
fi
if [ ! -z "$a_resetwg" ]; then
echo "$q_workgroup = $a_resetwg"
fi
echo ""
else
if [ "$a_deleteexisting" = "no" -a "$c_upgrade" = "F" ]; then
echo "$q_addnaming = $a_addnaming"
fi
fi
# check the extra bits
if [ "$a_deleteexisting" = "no" -a "$c_upgrade" = "F" ]; then
echo "$q_addconnman = $a_addconnman"
echo "$q_addshare = $a_addshare"
echo "$q_adddirs = $a_adddirs"
echo "$q_addauth = $a_addauth"
echo ""
fi
# if [ "$c_custom" = "false" -a "$c_install" = "true" ]; then
# rc section
if [ "$a_rctype" != "unknown" ]
then
echo $N "$q_restart = $a_restart$C"
if [ "$a_restart" = "yes" -a "$a_runlevel" != "" ]; then
echo " ($q_runlevel = $a_runlevel)"
else
echo ""
fi
fi
# crontab section
echo $N "$q_checkpoint = $a_checkpoint$C"
if [ "$a_checkpoint" = "yes" ]; then
case $a_day in
0 ) a_daystr="$l_sun";;
1 ) a_daystr="$l_mon";;
2 ) a_daystr="$l_tue";;
3 ) a_daystr="$l_wed";;
4 ) a_daystr="$l_thu";;
5 ) a_daystr="$l_fri";;
6 ) a_daystr="$l_sat";;
esac
echo $N " ($a_daystr $C"
echo $N "$a_time$q_hours)$C"
fi
echo
# start now ?
if [ -z "$c_usingsconb" ]; then
echo "$q_startnow = $a_startnow"
fi
if [ "$c_stopserver" = "true" ]; then
echo
echo "$p_stopserver"
fi
return $OK
}
getVisionDirs()
{
# if the defaults are changed here they must also be changed in
# the postinstall.sh script
c_globdir=""
if [ -f "$GLOB_VISION_FILE" ]
then
if [ -f $GLOB_VISION_FILE ]; then
c_globdir=`grep "^VISION_DIR=" $GLOB_VISION_FILE | tail -1 | sed -e "/^VISION_DIR=/s///"`
else
c_globdir=""
fi
if [ -n "$c_globdir" -a -d "$c_globdir" ]
then
if [ -f $GLOB_VISION_FILE ]; then
c_etcdir=`grep "^VISION_ETCDIR=" $GLOB_VISION_FILE | tail -1 | sed -e "/^VISION_ETCDIR=/s///"`
else
c_etcdir=""
fi
if [ -f $GLOB_VISION_FILE ]; then
c_bindir=`grep "^VISION_BINDIR=" $GLOB_VISION_FILE | tail -1 | sed -e "/^VISION_BINDIR=/s///"`
else
c_bindir=""
fi
if [ -f $GLOB_VISION_FILE ]; then
c_admindir=`grep "^VISION_ADMINDIR=" $GLOB_VISION_FILE | tail -1 | sed -e "/^VISION_ADMINDIR=/s///"`
else
c_admindir=""
fi
[ -z "$c_etcdir" ] && c_etcdir=$c_globdir/etc
[ -z "$c_bindir" ] && c_bindir=$c_globdir/bin
[ -z "$c_admindir" ] && c_admindir=$c_globdir/admin
else
rm $GLOB_VISION_FILE
c_globdir=""
fi
fi
if [ -z "$c_globdir" ]
then
c_globdir=$GLOBDIR
c_etcdir=$c_globdir/etc
c_bindir=$c_globdir/bin
c_admindir=$c_globdir/admin
fi
c_dir=$c_globdir/visionfs
c_etc=$c_globdir/vfsprofile
c_data=$c_globdir/vfsdata
c_globscript=$c_bindir/visionfs
instdir=$c_dir/_inst
GLOBDIR=$c_globdir
echo "GLOBDIR='$GLOBDIR'" > $RESP_FILE
}
checkVFSConfig()
{
c_upgrade=N
a_deleteexisting="yes"
# Setup default answers for no config file
a_uniquenames=""
a_wadmin=""
a_keepadmin="yes"
a_addnaming=yes
a_addadmin=yes
a_addconnman=yes
a_addprint=yes
a_addshare=yes
a_adddirs=yes
a_addauth=yes
a_addlistprint=no
# Setup other defaults:
# Administrative user
if [ -z "$a_wadmin" ] ; then a_wadmin="$LOGNAME"; fi
if [ -z "$a_wadmin" ] ; then a_wadmin="$USER" ; fi
if [ -z "$a_wadmin" ] ; then a_wadmin=root ; fi
if [ -f /etc/vision.inst ]
then
old_globdir=/usr/local/vision
vfs_dir=
vfs_dir=`grep "^VISIONFS*" /etc/vision.inst`
if [ -n "$vfs_dir" ]
then
old_globdir=`grep "^VISION_BINDIR" /etc/vision.inst | sed -e "s/VISION_BINDIR=//"`
old_globdir=`echo $old_globdir | sed -e "s,^\(.*\)/[^/]*$,\1,"`
fi
config_filename=$old_globdir/vfsprofile/current.prf
else
config_filename=$c_etc/current.prf
fi
factory_filename=$c_etc/factory.prf
}
queryUser()
{
# These defines are added because this code is nicked from
# Vision97 VFS
c_install=true
c_progcfg=${REQDIR}/${PKGINST}/vfscfg
chmod 777 $c_progcfg 1>/dev/null 2>&1
if [ ! -x "$c_progcfg" ]; then
ccsError "$lf_noexe $c_progcfg"
return $FAIL
fi
# Look for existing config file and extract answers from it
if [ -f $config_filename ]
then
# default to not knowing what to do with existing
a_deleteexisting="no"
if [ -f $config_filename -a `echo "$filenameargs" | grep $config_filename 1>/dev/null 2>&1; echo $?` -ne 0 ]; then
filenameargs="$filenameargs --filename $config_filename"
fi
setupver=`sh -c "$c_progcfg $filenameargs --print setup/version"`
case "$setupver" in
"$PRODUCT_VERSION_FULL")
if [ "$c_install" = "true" ]; then
c_upgrade=C
c_reinstall=true
else
c_upgrade=F
fi
a_addprint=no
;;
2.00.*)
c_upgrade=C
a_addprint=no
;;
1.20.*)
c_upgrade=C
a_addprint=no
a_remwinsprio=yes
;;
1.11.*|1.12.*|1.13.*)
c_upgrade=C
a_addprint=no
a_addlistprint=yes
;;
1.10.9*)
c_upgrade=C
a_addlistprint=yes
;;
1.10.5*)
c_upgrade=B
a_addlistprint=yes
;;
*)
newver=`echo $PRODUCT_VERSION_FULL | sed -e "/^[^.]*.[^.]*./s///"`
oldver=`echo $setupver | sed -e "/^[^.]*.[^.]*./s///"`
if [ ! -z "$oldver" ]; then
difference=`expr $newver \< $oldver`
if [ "$difference" = "1" ]; then
c_upgrade=D
else
c_upgrade=I
a_deleteexisting=yes
fi
else # empty profile?
c_upgrade=F
fi
;;
esac
if [ -f $config_filename -a `echo "$filenameargs" | grep $config_filename 1>/dev/null 2>&1; echo $?` -ne 0 ]; then
filenameargs="$filenameargs --filename $config_filename"
fi
ta_wadmin=`sh -c "$c_progcfg $filenameargs --print smbserver/server/admin"`
if [ ! -z "$ta_wadmin" ]; then a_wadmin="$ta_wadmin"; fi
# deal with 1.1 naming stuff
if [ -f $config_filename -a `echo "$filenameargs" | grep $config_filename 1>/dev/null 2>&1; echo $?` -ne 0 ]; then
filenameargs="$filenameargs --filename $config_filename"
fi
name_flags=`sh -c "$c_progcfg $filenameargs --print smbserver/netbios/ip/naming/flags"`
if [ "$name_flags" = "7" ]; then
a_uniquenames=$l_unixhostname
fi
if [ -f $config_filename -a `echo "$filenameargs" | grep $config_filename 1>/dev/null 2>&1; echo $?` -ne 0 ]; then
filenameargs="$filenameargs --filename $config_filename"
fi
a_oldnames=`sh -c "$c_progcfg $filenameargs --print smbserver/netbios/ip/naming/names/unique"`
if [ ! -z "$a_oldnames" ]; then
if [ ! -z "$a_uniquenames" ]; then
a_uniquenames="$a_uniquenames
$a_oldnames"
else
a_uniquenames="$a_oldnames"
fi
fi
export l_unixhostname
# 1.2+
if [ -z "$a_uniquenames" ]; then
if [ -f $config_filename -a `echo "$filenameargs" | grep $config_filename 1>/dev/null 2>&1; echo $?` -ne 0 ]; then
filenameargs="$filenameargs --filename $config_filename"
fi
a_namingstuff=`sh -c "$c_progcfg $filenameargs --print smbserver/netbios/ip/naming/names"`
if [ ! -z "$a_namingstuff" ]; then
a_uniquenames=`echo "$a_namingstuff" |
awk "BEGIN {FS=\":\"; RS=\"\n\"}
{
if ( \\$1 == \"*\" )
print \"$l_unixhostname\"
else
print \\$1
}" | sort -u`
fi
fi
if [ "$c_custom" = "true" -a "$a_deleteexisting" = "no" ]; then
echo; echo
echo $_ss_headlines
echo $h_deleteexisting
echo $_ss_headlines
echo "$p_deleteexisting"
echo # blank line between prompt and question
_valid=false
while [ $_valid = false ]
do
echo $N "$q_deleteexisting [$a_deleteexisting] $C"
read _answer
if [ $trace ] ; then echo " trace: answer read in is \"$_answer\"" ; fi
if [ -z "$_answer" ]
then
_answer="$a_deleteexisting" # default
fi
case "$_answer" in
[${a_case_yes}]* )
_answer=$s_yes
_valid=true
;;
[${a_case_no}]* )
_answer=$s_no
_valid=true
;;
esac
done
if [ $trace ] ; then echo " trace: answer accepted is \"$_answer\"" ; fi
a_deleteexisting="$_answer"
fi
# already overwriting everything by default
if [ "$a_deleteexisting" = "no" ]; then
if [ "$c_upgrade" = "B" ]; then
a_addadmin=no
a_addnaming=no
a_addconnman=no
a_addshare=no
a_adddirs=no
a_addauth=no
elif [ "$c_upgrade" != "F" ]; then
a_addauth=no
a_addconnman=no
a_addshare=no
a_adddirs=no
fi
else
a_addprint=yes
fi
fi
# gather licensing info
# $v_scrdir/license $a_licargs --default 2>$c_tmpdir/$$.tmp
# . $c_tmpdir/$$.tmp
# rm -f $c_tmpdir/$$.tmp
#
# if [ "$c_custom" = "true" ]; then
# $v_scrdir/license $a_licargs --ask 2>$c_tmpdir/$$.tmp
# . $c_tmpdir/$$.tmp
# rm -f $c_tmpdir/$$.tmp
# fi
# We can't check validity of username entered as the system may be
# using NIS or other user database, in which case a grep of /etc/passwd
# may not turn up very much
a_uadmin=""
# c_singleadmin is set/checked by license if in readonly mode
if [ ! -z "$c_wsingleadmin" ]; then
a_wadmin="$c_wsingleadmin"
a_uadmin="$c_usingleadmin"
elif [ "$c_custom" = "true" ]; then
if [ "$a_deleteexisting" = "no" -a "$c_upgrade" != "N" ]; then
p_askaddadmin="$p_addadmin
$a_wadmin"
echo; echo
echo $_ss_headlines
echo $h_addadmin
echo $_ss_headlines
echo "$p_askaddadmin"
echo # blank line between prompt and question
_valid=false
while [ $_valid = false ]
do
echo $N "$q_keepadmin [$a_keepadmin] $C"
read _answer
if [ $trace ] ; then echo " trace: answer read in is \"$_answer\"" ; fi
if [ -z "$_answer" ]
then
_answer="$a_keepadmin" # default
fi
case "$_answer" in
[${a_case_yes}]* )
_answer=$s_yes
_valid=true
;;
[${a_case_no}]* )
_answer=$s_no
_valid=true
;;
esac
done
if [ $trace ] ; then echo " trace: answer accepted is \"$_answer\"" ; fi
a_keepadmin="$_answer"
if [ "$a_keepadmin" = "yes" ]; then
a_addadmin="no"
fi
fi
docheckadmin=false
_securitymode=""
if [ -f "$config_filename" ]; then
if [ -f $config_filename -a `echo "$filenameargs" | grep $config_filename 1>/dev/null 2>&1; echo $?` -ne 0 ]; then
filenameargs="$filenameargs --filename $config_filename"
fi
_securitymode=`sh -c "$c_progcfg $filenameargs --print smbserver/server/authentication/method"`
if [ -f $config_filename -a `echo "$filenameargs" | grep $config_filename 1>/dev/null 2>&1; echo $?` -ne 0 ]; then
filenameargs="$filenameargs --filename $config_filename"
fi
_authfile=`sh -c "$c_progcfg $filenameargs --print smbserver/server/authentication/authfile"`
if [ -f $config_filename -a `echo "$filenameargs" | grep $config_filename 1>/dev/null 2>&1; echo $?` -ne 0 ]; then
filenameargs="$filenameargs --filename $config_filename"
fi
_mapfile=`sh -c "$c_progcfg $filenameargs --print smbserver/server/authentication/names"`
_mapfile=`echo "$_mapfile" | awk 'BEGIN {FS=":"}{if ($2=2) print $3}'`
fi
if [ ! -z "$_securitymode" -a "$_securitymode" -eq 2 -a ! -z "$_authfile" ]; then
docheckadmin="true"
fi
if [ "$a_addadmin" = "yes" -o "$a_keepadmin" = "no" ]; then
a_addadmin="yes"
adminsok="false"
a_wadmin=`echo "$a_wadmin" | head -1`
while [ "$adminsok" = "false" ]; do
echo; echo
echo $_ss_headlines
echo $h_admin
echo $_ss_headlines
echo "$p_admin"
echo # blank line between prompt and question
_valid=false
while [ $_valid = false ]
do
echo $N "$q_winadmin [$a_wadmin] $C"
read _answer
if [ $trace ] ; then echo " trace: answer read in is \"$_answer\"" ; fi
if [ -z "$_answer" ]
then
_answer="$a_wadmin" # default
fi
_valid=true
done
if [ $trace ] ; then echo " trace: answer accepted is \"$_answer\"" ; fi
a_wadmin="$_answer"
a_uadmin="$a_wadmin"
# use name mapping if one exists
if [ ! -z "$_mapfile" ]; then
if [ -f $_mapfile ]; then
mapping=`grep -i "^$a_wadmin": $_mapfile | awk 'BEGIN {FS=":"}{print $2}'`
fi
if [ ! -z "$mapping" ]; then
a_uadmin="$mapping"
if [ "$a_uadmin" = "*" ]; then
a_uadmin="$a_wadmin"
fi
fi
fi
echo ""
echo # blank line between prompt and question
_valid=false
while [ $_valid = false ]
do
echo $N "$q_unixadmin [$a_uadmin] $C"
read _answer
if [ $trace ] ; then echo " trace: answer read in is \"$_answer\"" ; fi
if [ -z "$_answer" ]
then
_answer="$a_uadmin" # default
fi
_valid=true
done
if [ $trace ] ; then echo " trace: answer accepted is \"$_answer\"" ; fi
a_uadmin="$_answer"
if [ "$docheckadmin" = "true" ]; then
# in VisionFS high security mode
$c_progauth --query $_authfile $a_wadmin
if [ "$?" != "1" ]; then
# not in authfile
a_adminnotauth="yes"
p_notauthorised="$p_adminnotauth1$a_wadmin$p_adminnotauth2"
echo "$p_notauthorised"
echo # blank line between prompt and question
_valid=false
while [ $_valid = false ]
do
echo $N "$q_adminnotauth [$a_adminnotauth] $C"
read _answer
if [ $trace ] ; then echo " trace: answer read in is \"$_answer\"" ; fi
if [ -z "$_answer" ]
then
_answer="$a_adminnotauth" # default
fi
case "$_answer" in
[${a_case_yes}]* )
_answer=$s_yes
_valid=true
;;
[${a_case_no}]* )
_answer=$s_no
_valid=true
;;
esac
done
if [ $trace ] ; then echo " trace: answer accepted is \"$_answer\"" ; fi
a_adminnotauth="$_answer"
if [ "$a_adminnotauth" = "no" ]; then
adminsok="true"
fi
else
adminsok="true"
fi
else
adminsok="true"
fi
done
fi
fi
# naming
if [ -z "$a_uniquenames" ]; then
a_uniquenames=$l_unixhostname
a_keepnaming="no"
else
# build list of names used
p_askuniquenames="$p_uniquenames
$a_uniquenames"
a_keepnaming="yes"
fi
if [ "$c_custom" = "true" ]; then
if [ "$a_deleteexisting" = "no" -a "$c_upgrade" = "F" ]; then
echo; echo
echo $_ss_headlines
echo $h_addnaming
echo $_ss_headlines
echo "$p_addnaming"
echo # blank line between prompt and question
_valid=false
while [ $_valid = false ]
do
echo $N "$q_addnaming [$a_addnaming] $C"
read _answer
if [ $trace ] ; then echo " trace: answer read in is \"$_answer\"" ; fi
if [ -z "$_answer" ]
then
_answer="$a_addnaming" # default
fi
case "$_answer" in
[${a_case_yes}]* )
_answer=$s_yes
_valid=true
;;
[${a_case_no}]* )
_answer=$s_no
_valid=true
;;
esac
done
if [ $trace ] ; then echo " trace: answer accepted is \"$_answer\"" ; fi
a_addnaming="$_answer"
fi
if [ "$a_keepnaming" = "no" ]; then
echo; echo
echo $_ss_headlines
echo $h_servername
echo $_ss_headlines
echo "$p_singlename"
echo # blank line between prompt and question
_valid=false
while [ $_valid = false ]
do
echo $N "$q_servername [$a_uniquenames] $C"
read _answer
if [ $trace ] ; then echo " trace: answer read in is \"$_answer\"" ; fi
if [ -z "$_answer" ]
then
_answer="$a_uniquenames" # default
fi
_valid=true
done
if [ $trace ] ; then echo " trace: answer accepted is \"$_answer\"" ; fi
a_uniquenames="$_answer"
elif [ "$a_addnaming" = "yes" ]; then
echo; echo
echo $_ss_headlines
echo $h_servername
echo $_ss_headlines
echo "$p_askuniquenames"
echo # blank line between prompt and question
_valid=false
while [ $_valid = false ]
do
echo $N "$q_uniquenames [$a_keepnaming] $C"
read _answer
if [ $trace ] ; then echo " trace: answer read in is \"$_answer\"" ; fi
if [ -z "$_answer" ]
then
_answer="$a_keepnaming" # default
fi
case "$_answer" in
[${a_case_yes}]* )
_answer=$s_yes
_valid=true
;;
[${a_case_no}]* )
_answer=$s_no
_valid=true
;;
esac
done
if [ $trace ] ; then echo " trace: answer accepted is \"$_answer\"" ; fi
a_keepnaming="$_answer"
if [ "$a_keepnaming" = "no" ]; then
a_uniquenames=$l_unixhostname
echo ""
echo # blank line between prompt and question
_valid=false
while [ $_valid = false ]
do
echo $N "$q_servername [$a_uniquenames] $C"
read _answer
if [ $trace ] ; then echo " trace: answer read in is \"$_answer\"" ; fi
if [ -z "$_answer" ]
then
_answer="$a_uniquenames" # default
fi
_valid=true
done
if [ $trace ] ; then echo " trace: answer accepted is \"$_answer\"" ; fi
a_uniquenames="$_answer"
fi
fi
fi
# Workgroup
if [ "$c_custom" = "true" -a "$a_addnaming" = "yes" -a "$c_install" = "false" ]; then
if [ "$a_keepnaming" = "yes" ]; then
a_resetwg="yes"
echo; echo
echo $_ss_headlines
echo $h_workgroup
echo $_ss_headlines
echo "$p_workgroup"
echo # blank line between prompt and question
_valid=false
while [ $_valid = false ]
do
echo $N "$q_workgroup [$a_resetwg] $C"
read _answer
if [ $trace ] ; then echo " trace: answer read in is \"$_answer\"" ; fi
if [ -z "$_answer" ]
then
_answer="$a_resetwg" # default
fi
case "$_answer" in
[${a_case_yes}]* )
_answer=$s_yes
_valid=true
;;
[${a_case_no}]* )
_answer=$s_no
_valid=true
;;
esac
done
if [ $trace ] ; then echo " trace: answer accepted is \"$_answer\"" ; fi
a_resetwg="$_answer"
fi
fi
# check which bits to overwrite
if [ "$c_custom" = "true" -a "$a_deleteexisting" = "no" -a "$c_upgrade" = "F" ]; then
echo; echo
echo $_ss_headlines
echo $h_addconnman
echo $_ss_headlines
echo "$p_addconnman"
echo # blank line between prompt and question
_valid=false
while [ $_valid = false ]
do
echo $N "$q_addconnman [$a_addconnman] $C"
read _answer
if [ $trace ] ; then echo " trace: answer read in is \"$_answer\"" ; fi
if [ -z "$_answer" ]
then
_answer="$a_addconnman" # default
fi
case "$_answer" in
[${a_case_yes}]* )
_answer=$s_yes
_valid=true
;;
[${a_case_no}]* )
_answer=$s_no
_valid=true
;;
esac
done
if [ $trace ] ; then echo " trace: answer accepted is \"$_answer\"" ; fi
a_addconnman="$_answer"
echo; echo
echo $_ss_headlines
echo $h_addshare
echo $_ss_headlines
echo "$p_addshare"
echo # blank line between prompt and question
_valid=false
while [ $_valid = false ]
do
echo $N "$q_addshare [$a_addshare] $C"
read _answer
if [ $trace ] ; then echo " trace: answer read in is \"$_answer\"" ; fi
if [ -z "$_answer" ]
then
_answer="$a_addshare" # default
fi
case "$_answer" in
[${a_case_yes}]* )
_answer=$s_yes
_valid=true
;;
[${a_case_no}]* )
_answer=$s_no
_valid=true
;;
esac
done
if [ $trace ] ; then echo " trace: answer accepted is \"$_answer\"" ; fi
a_addshare="$_answer"
echo; echo
echo $_ss_headlines
echo $h_adddirs
echo $_ss_headlines
echo "$p_adddirs"
echo # blank line between prompt and question
_valid=false
while [ $_valid = false ]
do
echo $N "$q_adddirs [$a_adddirs] $C"
read _answer
if [ $trace ] ; then echo " trace: answer read in is \"$_answer\"" ; fi
if [ -z "$_answer" ]
then
_answer="$a_adddirs" # default
fi
case "$_answer" in
[${a_case_yes}]* )
_answer=$s_yes
_valid=true
;;
[${a_case_no}]* )
_answer=$s_no
_valid=true
;;
esac
done
if [ $trace ] ; then echo " trace: answer accepted is \"$_answer\"" ; fi
a_adddirs="$_answer"
echo; echo
echo $_ss_headlines
echo $h_addauth
echo $_ss_headlines
echo "$p_addauth"
echo # blank line between prompt and question
_valid=false
while [ $_valid = false ]
do
echo $N "$q_addauth [$a_addauth] $C"
read _answer
if [ $trace ] ; then echo " trace: answer read in is \"$_answer\"" ; fi
if [ -z "$_answer" ]
then
_answer="$a_addauth" # default
fi
case "$_answer" in
[${a_case_yes}]* )
_answer=$s_yes
_valid=true
;;
[${a_case_no}]* )
_answer=$s_no
_valid=true
;;
esac
done
if [ $trace ] ; then echo " trace: answer accepted is \"$_answer\"" ; fi
a_addauth="$_answer"
fi
# check if want adding to rc if possible
# work out the rctype
a_rccurrun=""
a_rcinstrun=""
if [ -d /etc/rc2.d -o -d /etc/rc3.d ]
then
a_rctype="svr4"
a_rcfile="/etc"
elif [ -d /sbin/rc2.d -o -d /sbin/rc3.d ]
then
a_rctype="sbin"
a_rcfile="/sbin"
elif [ -f /etc/rc.local ]
then
a_rctype="local"
a_rcfile="/etc/rc.local"
elif [ -f /etc/rc.d/rc.local ]
then
a_rctype="rcd"
a_rcfile="/etc/rc.d/rc.local"
elif [ -f /etc/rc.nfs ]
then
a_rctype="nfs"
a_rcfile="/etc/rc.nfs"
elif [ -f /etc/rc ]
then
a_rctype="basic"
a_rcfile="/etc/rc"
else
a_rctype="unknown"
a_rcfile=""
fi
if [ "$a_rctype" = "svr4" -o "$a_rctype" = "sbin" ]; then
a_rccurrun=`who -r | awk '{print $3;}'`
if [ "a_rctype" = "svr4" ]; then
_rcbase=/etc/rc
else
_rcbase=/sbin/rc
fi
for _i in S 1 2 3 4
do
if [ -f $_rcbase$_i.d/$INST_RCFILE ]
then
a_rcinstrun=$_i
break
fi
done
a_rcfile=$a_rcfile/rc$a_rccurrun.d/$INST_RCFILE
fi
if [ "$a_rctype" != "unknown" ]
then
a_restart="yes"
if [ "$c_custom" = "true" ]; then
echo; echo
echo $_ss_headlines
echo $h_restart
echo $_ss_headlines
echo "$p_restart"
echo # blank line between prompt and question
_valid=false
while [ $_valid = false ]
do
echo $N "$q_restart [$a_restart] $C"
read _answer
if [ $trace ] ; then echo " trace: answer read in is \"$_answer\"" ; fi
if [ -z "$_answer" ]
then
_answer="$a_restart" # default
fi
case "$_answer" in
[${a_case_yes}]* )
_answer=$s_yes
_valid=true
;;
[${a_case_no}]* )
_answer=$s_no
_valid=true
;;
esac
done
if [ $trace ] ; then echo " trace: answer accepted is \"$_answer\"" ; fi
a_restart="$_answer"
fi
# autodetect runlevel
if [ ! -z "$a_rcinstrun" ]; then
a_runlevel="$a_rcinstrun"
else
a_runlevel="$a_rccurrun"
fi
if [ "$a_restart" = "yes" -a "$c_custom" = "true" ]
then
case "$a_rctype" in
"svr4"|"sbin")
if [ "$a_rctype" = "svr4" ]
then
_rcbase=/etc/rc
else
_rcbase=/sbin/rc
fi
# check the installed runlevel
_instrun=""
for _i in S 1 2 3 4
do
if [ -f $_rcbase$_i.d/S90visionfs ] # !!!visionfs???
then
_instrun=$_i
break
fi
done
# check the current run level
_currun=`who -r | awk '{print $3;}'`
# display all known information
echo "$p_runlevel"
if [ ! -z "$_currun" ]
then
echo "$p_currun$_currun"
a_runlevel=$_currun
fi
if [ ! -z "$_instrun" ]
then
echo "$p_instrun$_instrun"
a_runlevel=$_instrun
fi
_valid="false"
while [ $_valid = false ]
do
echo $N "$q_runlevel [$a_runlevel] $C"
read _answer
if [ $trace ] ; then echo " trace: answer read in is \"$_answer\"" ; fi
if [ -z "$_answer" ]
then
_answer="$a_runlevel" # default
fi
case "$_answer" in
"s")
_answer="S"
;;
"1"|"2"|"3"|"4"|"S")
;;
*)
echo "$v_runlevel"
continue
;;
esac
# check the rcdir exists
if [ ! -d $_rcbase$_answer.d ]
then
_valid2=false
while [ "$_valid2" != "true" ]
do
echo $N "$q_mkrcdir [$a_yes] $C"
read _answer2
if [ -z "$_answer2" ]
then
_answer2=$a_yes
fi
case "$_answer2" in
[${a_case_yes}]*)
_valid2=true
_valid=true
;;
[${a_case_no}]*)
_valid2=true
esac
done
else
_valid=true
fi
done
if [ $trace ] ; then echo " trace: answer accepted is\"$_answer\"" ; fi
a_runlevel="$_answer"
a_rcfile=$_rcbase$a_runlevel.d/S90visionfs
;;
"local")
a_rcfile=/etc/rc.local
;;
"rcd")
a_rcfile=/etc/rc.d/rc.local
;;
"nfs")
a_rcfile=/etc/rc.nfs
;;
"basic")
a_rcfile=/etc/rc
;;
*)
a_rcfile=""
;;
esac
fi
fi
# check if they want a checkpoint every morning
a_checkpoint=yes
a_time=""
_cronline=`crontab -l 2>/dev/null | grep "/visionfs checkpoint"`
if [ ! -z "$_cronline" ]; then
a_time=`echo "$_cronline" | sed -e "/^[^ ]* \([0-9]*\).*/s//\1/"`
fi
if [ -z "$a_time" ]; then
a_time=04
fi
a_day=""
_cronline=`crontab -l 2>/dev/null | grep "/visionfs checkpoint"`
if [ ! -z "$_cronline" ]; then
a_day=`echo "$_cronline" | awk '{print $5}'`
fi
if [ -z "$a_day" ]; then
a_day=0
fi
if [ "$c_custom" = "true" ]; then
echo; echo
echo $_ss_headlines
echo $h_checkpoint
echo $_ss_headlines
echo "$p_checkpoint"
echo # blank line between prompt and question
_valid=false
while [ $_valid = false ]
do
echo $N "$q_checkpoint [$a_checkpoint] $C"
read _answer
if [ $trace ] ; then echo " trace: answer read in is \"$_answer\"" ; fi
if [ -z "$_answer" ]
then
_answer="$a_checkpoint" # default
fi
case "$_answer" in
[${a_case_yes}]* )
_answer=$s_yes
_valid=true
;;
[${a_case_no}]* )
_answer=$s_no
_valid=true
;;
esac
done
if [ $trace ] ; then echo " trace: answer accepted is \"$_answer\"" ; fi
a_checkpoint="$_answer"
if [ "$a_checkpoint" = "yes" ]; then
echo "$p_checkday"
_valid=false
while [ $_valid = false ]
do
echo $N "$q_checkday [$a_day] $C"
read _answer
if [ $trace ] ; then echo " trace: answer read in is \"$_answer\"" ; fi
if [ -z "$_answer" ]
then
_answer="$a_day" # default
fi
case "$_answer" in
[0-6] )
_valid=true
a_day=$_answer
;;
*)
echo "$v_badday"
;;
esac
done
echo "$p_checktime"
_valid=false
while [ $_valid = false ]
do
echo $N "$q_checktime [$a_time] $C"
read _answer
if [ $trace ] ; then echo " trace: answer read in is \"$_answer\"" ; fi
if [ -z "$_answer" ]
then
_answer="$a_time" # default
fi
case "$_answer" in
[0-9]|[0-9][0-9])
if [ `expr $_answer \< 24` != "0" ]; then
_valid=true
a_time=$_answer
else
echo "$v_badnumber"
fi
;;
*)
echo "$v_badnumber"
;;
esac
done
fi
fi
#SCO NetBIOS check, and start now prompt.
if [ -x /etc/netconfig ]; then
c_instsconb=`netconfig -s | grep "#sco_nb"`
if [ ! -z "$c_instsconb" ]; then
# Isn't unix nice and portable?
c_usingsconb="`(ps -xc || ps -u \`id | sed 's/^uid=\([0-9][0-9]*\).*/\1/'\` -o pid -o ucomm || ps -u \`id | sed 's/^uid=\([0-9][0-9]*\).*/\1/'\` ) 2>/dev/null | grep 'in.nbd' | awk '{print $1}'`"
if [ $trace ]; then echo " trace in.nbd process ids are: $c_usingsconb"; fi
fi
fi
if [ ! -z "$c_usingsconb" ]; then
a_startnow=no
else # ask if they want to start the server immediately.
a_startnow=yes
if [ "$c_custom" = "true" ]; then
echo; echo
echo $_ss_headlines
echo $h_startnow
echo $_ss_headlines
echo "$p_startnow"
echo # blank line between prompt and question
_valid=false
while [ $_valid = false ]
do
echo $N "$q_startnow [$a_startnow] $C"
read _answer
if [ $trace ] ; then echo " trace: answer read in is \"$_answer\"" ; fi
if [ -z "$_answer" ]
then
_answer="$a_startnow" # default
fi
case "$_answer" in
[${a_case_yes}]* )
_answer=$s_yes
_valid=true
;;
[${a_case_no}]* )
_answer=$s_no
_valid=true
;;
esac
done
if [ $trace ] ; then echo " trace: answer accepted is \"$_answer\"" ; fi
a_startnow="$_answer"
fi
fi
if [ -f "$c_bindir/visionfs" -a -f "$c_dir/bin/scripts/status" -a "$c_upgrade" != "F" ]; then
$c_bindir/visionfs status --quiet
if [ "$?" != 0 ]; then
c_stopserver=true
fi
fi
return $OK
}
writesavefile() {
echo "a_namingflags=\"$a_namingflags\"" >$SAVE_FILE
echo "a_workgroup=\"$a_workgroup\"" >>$SAVE_FILE
echo "a_uniquenames=\"$a_uniquenames\"" >>$SAVE_FILE
echo "a_namingstuff=\"$a_namingstuff\"" >>$SAVE_FILE
echo "a_keepnaming=\"$a_keepnaming\"" >>$SAVE_FILE
echo "a_uadmin=\"$a_uadmin\"" >>$SAVE_FILE
echo "a_wadmin=\"$a_wadmin\"" >>$SAVE_FILE
echo "c_globdir=\"$c_globdir\"" >>$SAVE_FILE
echo "c_etcdir=\"$c_etcdir\"" >>$SAVE_FILE
echo "c_bindir=\"$c_bindir\"" >>$SAVE_FILE
echo "c_dir=\"$c_dir\"" >>$SAVE_FILE
echo "c_etc=\"$c_etc\"" >>$SAVE_FILE
echo "c_data=\"$c_data\"" >>$SAVE_FILE
echo "c_globscript=\"$c_globscript\"" >>$SAVE_FILE
echo "config_filename=\"$config_filename\"" >>$SAVE_FILE
echo "factory_filename=\"$factory_filename\"" >>$SAVE_FILE
echo "a_adddirs=\"$a_adddirs\"" >>$SAVE_FILE
echo "a_addadmin=\"$a_addadmin\"" >>$SAVE_FILE
echo "a_addauth=\"$a_addauth\"" >>$SAVE_FILE
echo "a_addnaming=\"$a_addnaming\"" >>$SAVE_FILE
echo "a_addprint=\"$a_addprint\"" >>$SAVE_FILE
echo "a_addlistprint=\"$a_addlistprint\"" >>$SAVE_FILE
echo "a_addconnman=\"$a_addconnman\"" >>$SAVE_FILE
echo "a_addshare=\"$a_addshare\"" >>$SAVE_FILE
echo "a_checkpoint=\"$a_checkpoint\"" >>$SAVE_FILE
echo "a_restart=\"$a_restart\"" >>$SAVE_FILE
echo "a_startnow=\"$a_startnow\"" >>$SAVE_FILE
echo "a_rctype=\"$a_rctype\"" >>$SAVE_FILE
echo "a_rcfile=\"$a_rcfile\"" >>$SAVE_FILE
echo "a_rccurrun=\"$a_rccurrun\"" >>$SAVE_FILE
echo "a_rcinstrun=\"$a_rcinstrun\"" >>$SAVE_FILE
echo "a_runlevel=\"$a_runlevel\"" >>$SAVE_FILE
echo "a_time=\"$a_time\"" >>$SAVE_FILE
echo "a_day=\"$a_day\"" >>$SAVE_FILE
echo "c_croncomm=\"$a_croncomm\"" >>$SAVE_FILE
echo "c_upgrade=\"$c_upgrade\"" >>$SAVE_FILE
echo "a_deleteexisting=\"$a_deleteexisting\"" >>$SAVE_FILE
echo "c_install=\"$c_install\"" >>$SAVE_FILE
echo "a_resetwg=\"$a_resetwg\"" >>$SAVE_FILE
echo "c_usingsconb=\"$c_usingsconb\"" >>$SAVE_FILE
echo "c_instsconb=\"$c_instsconb\"" >>$SAVE_FILE
chmod 700 $SAVE_FILE
}
#------------------------------------------------------------------
#
#-------------------------------Main-------------------------------
#
# set up debug
#
SCRIPTS=/usr/sbin/pkginst
. ${SCRIPTS}/updebug
[ "$UPDEBUG" = YES ] && set -x
#
# set defaults
#
iqmDriven="FALSE"
doQueryUser="TRUE"
upgrade="freshInstall"
for_local_client=""
true_client_root=""
[ -n "$SILENT_INSTALL" ] && iqmDriven=TRUE
# There are three scenarious in which this script will run:
#
# $HOW_INSTALL=
#
# (a) NORMAL: It is called from pkgadd'ing the individual package
# or from the network set installation.
#
# (b) ON_BFLOP: It is called from foundation set installation on the
# boot floppies. This is the extraction phase. Pkgadd
# is run to do the initial load of the pkg.
#
# (c) POSTREBOOT: It is called upon reboot from set installation on the
# boot floppies. This is the postreboot phase.
#
HOW_INSTALL=NORMAL
[ -f /tmp/VISIONFS_ON_BFLOP -o -f /etc/inst/scripts/postreboot.sh ] && {
HOW_INSTALL=ON_BFLOP
iqmDriven="TRUE"
}
[ -f /etc/rc2.d/S02POSTINST ] && {
HOW_INSTALL=POSTREBOOT
iqmDriven="TRUE"
# this script (request) should never get run during post isl reboot so
# just fall through to exit
}
# iqmDriver=TRUE is an OpenServer thing and in this case is equivalent
# to an UnixWare isl (initial system load) install in which the
# installation script must NOT prompt for user input. We will use
# predefined defaults set up in the postinstall script instead of
# a response file..
if [ "$iqmDriven" = FALSE -a "$doQueryUser" = TRUE ]
then
N=""
C=""
if echo -n | grep n > /dev/null
then
C="\c"
else
N="-n"
fi
_ss_headlines="--------------------------------------------------------------------------"
# source message file
. ${REQDIR}/${PKGINST}/setup
. ${REQDIR}/${PKGINST}/common
l_unixhostname="`uname -n | sed 's@^\([^\.]*\).*@\1@'`"
a_damage="N"
getVisionDirs
checkVFSConfig
c_custom=false
queryUser
while [ "$a_damage" = "N" -a $a_damage != "Q" ]
do
# Call queryUser with c_custom set as false
# to get any existing settings but not to
# ask any questions, horrible but the easiest
# way to be able to use Vision97 VFS setup
# without many changes
showSummary
## check if ok
a_damage="Y"
echo "$p_damage"
echo # blank line between prompt and question
_valid=false
while [ $_valid = false ]
do
echo $N "$q_damage [$a_damage] $C"
read _answer
if [ $trace ] ; then echo " trace: answer read in is \"$_answer\"" ; fi
if [ -z "$_answer" ]
then
_answer="$a_damage" # default
fi
case "$_answer" in y|Y|n|N|q|Q)_valid=true;;esac
done
if [ $trace ] ; then echo " trace: answer accepted is \"$_answer\"" ; fi
a_damage="$_answer"
# the language can alter the behaviour of tr
a_damage=`echo $a_damage | LANG=C LC_ALL=C tr '[a-z]' '[A-Z]'`
case "$a_damage" in
q|Q)
echo $_ss_headlines
echo $h_nochange
echo $_ss_headlines
requestReturnVal=$FAIL
;;
n|N)
# User wants to change something, set c_custom
# to true so questions are asked
checkVFSConfig
c_custom=true
queryUser
esac
done
if [ "$a_damage" = "Y" ]
then
writesavefile
requestReturnval=$OK
fi
fi
exit $requestReturnVal