home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World Komputer 1999 March B
/
SCO_CASTOR4RRT.iso
/
visionfs
/
install
/
postinstall
< prev
next >
Wrap
Text File
|
1998-08-19
|
32KB
|
1,214 lines
#******************************************************************************
#
# Copyright (C) 1995 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.
#
#===============================================================================
buildDate="3.5.2 - Mon Jan 27 13:22:20 1997"
# 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
REQDIR=/var/sadm/pkg/${PKGINST}/install
SCOARCH=i3un0210
INST_PRODUCT=VISIONFS
INST_RCFILE=S90visionfs
INST_RCSTRING="##VisionFS##"
POST_ISL_RCFILE=/etc/rc3.d/S90isl_visionfs
# 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
# set up install log
INSTALL_LOG=/tmp/$$_visionfs.log
exec 2> $INSTALL_LOG
echo "$0" 1>&2
# error routines
ccsError()
{
echo "$*" 1>&2
}
ccsWarning()
{
echo "$*" 1>&2
}
getDefaults()
{
# get the hostname of this system
hostname="`uname -n | sed 's@^\([^\.]*\).*@\1@'`"
# if the defaults are changed here they must also be changed in
# the request.sh script.
a_namingflags=$a_namingflags
a_workgroup="*"
a_uniquenames="$hostname"
a_wadmin="root"
a_uadmin="root"
a_adddirs="yes"
a_addadmin="yes"
a_addauth="yes"
a_addnaming="yes"
a_addprint="yes"
a_addconnman="yes"
a_addshare="yes"
a_checkpoint="yes"
a_restart="yes"
a_startnow="yes"
a_time=04
a_day=0
a_deleteexisting="yes"
a_keepnaming="no"
c_upgrade="N"
# Setup directory pointers
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
[ -z "$c_globdir" ] && c_globdir=$GLOBDIR
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
[ -z "$c_bindir" ] && c_bindir=$c_globdir/bin
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
[ -z "$c_etcdir" ] && c_etcdir=$c_globdir/etc
c_dir=$c_globdir/visionfs
c_etc=$c_globdir/vfsprofile
c_data=$c_globdir/vfsdata
c_globscript=$c_bindir/visionfs
}
doPostConfigure()
{
# STATUS output
echo "1\b\c"
# unmunch the big files that were cut up in the packaging
# STATUS steps 1 thru 5
assemble_files
[ "$?" != "0" ] && {
ccsError "ERROR: VisionFS - assemble_files failed"
return $FAIL
}
# STATUS output
echo "6\b\c"
# Setup new profiles and binaries
config_filename=${GLOBDIR}/vfsprofile/current.prf
factory_filename=${GLOBDIR}/vfsprofile/factory.prf
c_progcfg=${GLOBDIR}/visionfs/bin/$SCOARCH/vfscfg
# make sure the umask allows the creation of readable files
umask 022
VFSDIR=${GLOBDIR}/visionfs
VFSETC=${GLOBDIR}/vfsprofile
VFSLANG=en_US
VISION_DIR=${GLOBDIR};export VISION_DIR
filenameargs=""
if [ -f ${VFSDIR}/config/en_US/defaults ]; then
filenameargs="--filename ${VFSDIR}/config/en_US/defaults"
fi
if [ -f ${VFSETC}/current.prf ]; then
filenameargs="$filenameargs --filename ${VFSETC}/current.prf"
fi
export filenameargs
VFSDIR=$c_dir
export VFSDIR
if [ ! -x "$c_progcfg" ]; then
ccsError "$lf_noexe $c_progcfg"
return $FAIL
fi
if [ "$a_deleteexisting" = "yes" ]
then
rm -f $config_filename
if [ -f $factory_filename ]
then
rm -f $factory_filename
fi
else
cp $c_etc/current.prf $config_filename 1>/dev/null 2>&1
fi
if [ ! -f $config_filename ]
then
echo "$msg_preprof" > $config_filename
fi
# make sure the latest version is in there
$c_progcfg --filename "$config_filename" --remove "setup/version"
$c_progcfg --filename $config_filename --set setup/version "$PRODUCT_VERSION_FULL"
# New for 97
if [ "$c_upgrade" = "C" ]; 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
_namdir=`sh -c "$c_progcfg $filenameargs --print smbserver/netbios/ip/naming/dir"`
if [ -z "$_namdir" ]; then
$c_progcfg --filename $config_filename --set smbserver/netbios/ip/naming/dir $c_data/naming
fi
fi
if [ "$a_adddirs" = "yes" ]; then
$c_progcfg --filename $config_filename --set smbserver/server/diagnostics/dir $c_data/logs
$c_progcfg --filename $config_filename --set smbserver/server/shares/unix/defaults/printer/spool/dir $c_data/spool
$c_progcfg --filename $config_filename --set smbserver/server/shares/unix/defaults/printer/queue/dir $c_data/queues
$c_progcfg --filename $config_filename --set smbserver/netbios/ip/naming/dir $c_data/naming
fi
# Map file / old key
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}'`
if [ "$c_upgrade" != "F" ]; then
if [ ! -z "$mapfile" ]; then
# sort out the old mappings
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
old_mappings=`sh -c "$c_progcfg $filenameargs --print smbserver/server/authentication/mappings"`
if [ ! -z "$old_mappings" ]; then
echo "$old_mappings" | while read a_mapping; do
wmapname=`echo $a_mapping | awk 'BEGIN {FS=":"} {print $1}'`
umapname=`echo $a_mapping | awk 'BEGIN {FS=":"} {print $2}'`
if [ -f $mapfile ]; then
_addmapresult=""
if [ -f $mapfile ]; then
_addmapresult=`grep -i "^$wmapname": $mapfile | awk 'BEGIN {FS=":"}{print $2}'`
fi
if [ ! -z "$_addmapresult" ]; then
if [ -f $mapfile ]; then
cat $mapfile | grep -vi "^$wmapname": > $mapfile.$$$
sort $mapfile.$$$ > $mapfile
rm -f $mapfile.$$$
chmod 600 $mapfile
fi
fi
fi
echo "$wmapname:$umapname::::" >> $mapfile
chmod 600 $mapfile
done
fi
$c_progcfg --filename "$config_filename" --remove "smbserver/server/authentication/mappings"
fi
fi
if [ "$a_addadmin" = "yes" ]; then
if [ -z "$a_uadmin" ]; then
$c_progcfg --filename "$config_filename" --remove "smbserver/server/admin"
echo "$a_wadmin" | while read an_admin; do
$c_progcfg --filename $config_filename --append smbserver/server/admin "$an_admin"
done
else
$c_progcfg --filename $config_filename --set smbserver/server/admin "$a_wadmin"
if [ ! -z "$mapfile" ]
then
if [ -f $mapfile ]; then
_addmapresult=""
if [ -f $mapfile ]; then
_addmapresult=`grep -i "^$a_wadmin": $mapfile | awk 'BEGIN {FS=":"}{print $2}'`
fi
if [ ! -z "$_addmapresult" ]; then
if [ -f $mapfile ]; then
cat $mapfile | grep -vi "^$a_wadmin": > $mapfile.$$$
sort $mapfile.$$$ > $mapfile
rm -f $mapfile.$$$
chmod 600 $mapfile
fi
fi
fi
echo "$a_wadmin:$a_uadmin::::" >> $mapfile
chmod 600 $mapfile
fi
fi
fi
if [ ! -z "$mapfile" ]
then
# final check to make sure that all admins are in mapfile
echo "$a_wadmin" | while read an_admin; do
if [ -f $mapfile ]; then
_tmpuadmin=`grep -i "^$an_admin": $mapfile | awk 'BEGIN {FS=":"}{print $2}'`
fi
if [ -z "$_tmpuadmin" ]; then
if [ -z "$a_uadmin" ]; then
if [ -f $mapfile ]; then
_addmapresult=""
if [ -f $mapfile ]; then
_addmapresult=`grep -i "^$a_wadmin": $mapfile | awk 'BEGIN {FS=":"}{print $2}'`
fi
if [ ! -z "$_addmapresult" ]; then
if [ -f $mapfile ]; then
cat $mapfile | grep -vi "^$a_wadmin": > $mapfile.$$$
sort $mapfile.$$$ > $mapfile
rm -f $mapfile.$$$
chmod 600 $mapfile
fi
fi
fi
echo "$a_wadmin:*::::" >> $mapfile
chmod 600 $mapfile
else
if [ -f $mapfile ]; then
_addmapresult=""
if [ -f $mapfile ]; then
_addmapresult=`grep -i "^$a_wadmin": $mapfile | awk 'BEGIN {FS=":"}{print $2}'`
fi
if [ ! -z "$_addmapresult" ]; then
if [ -f $mapfile ]; then
cat $mapfile | grep -vi "^$a_wadmin": > $mapfile.$$$
sort $mapfile.$$$ > $mapfile
rm -f $mapfile.$$$
chmod 600 $mapfile
fi
fi
fi
echo "$a_wadmin:$a_uadmin::::" >> $mapfile
chmod 600 $mapfile
fi
fi
done
fi
if [ "$a_addauth" = "yes" ]; then
$c_progcfg --filename $config_filename --set smbserver/server/authentication/method "0"
fi
servercomment=""
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
servercomment=`sh -c "$c_progcfg $filenameargs --print smbserver/netbios/ip/naming/names/comment"`
if [ -z "$servercomment" ]; then
servercomment="%%SERVERNAME%% %%VERSION%%"
fi
$c_progcfg --filename "$config_filename" --remove "smbserver/netbios/ip/naming/names/comment"
if [ "$a_addnaming" = "yes" ]; then
$c_progcfg --filename "$config_filename" --remove "smbserver/netbios/ip/naming/names"
if [ "$a_keepnaming" = "yes" ]; then
if [ "$a_resetwg" = "yes" ]; then # wg -> *
a_namingstuff=`echo "$a_namingstuff" |
awk 'BEGIN {FS=":"; RS="\n"}
{
printf "%s:%s:%s:%s:%s:%s", $1, "*", $3, $4, $5, $6
if ( NF > 6 )
for (r=7; r <= NF; r=r+1)
printf ":%s", $r
printf "\n"}'`
fi
if [ "$a_addconnman" = "yes" ]; then # connect redirect -> ""
a_namingstuff=`echo "$a_namingstuff" |
awk 'BEGIN {FS=":"; RS="\n"}
{
printf "%s:%s:%s:%s:%s:%s", $1, $2, $3, $4, "", $6
if ( NF > 6 )
for (r=7; r <= NF; r=r+1)
printf ":%s", $r
printf "\n"}'`
fi
if [ ! -z "$a_namingstuff" ]; then
echo "$a_namingstuff" | while read vfsname; do
$c_progcfg --filename $config_filename --append smbserver/netbios/ip/naming/names "$vfsname"
done
else
echo "$a_uniquenames" | while read vfsname; do
if [ "$vfsname" = "$l_unixhostname" ]; then
vfsname="*";
fi
$c_progcfg --filename $config_filename --append smbserver/netbios/ip/naming/names "$vfsname:*::::$servercomment"
done
fi
else
if [ "$a_uniquenames" = "$l_unixhostname" ]; then
a_uniquenames="*";
fi
$c_progcfg --filename $config_filename --append smbserver/netbios/ip/naming/names "$a_uniquenames:*::::$servercomment"
fi
$c_progcfg --filename "$config_filename" --remove "smbserver/netbios/ip/naming/flags"
$c_progcfg --filename "$config_filename" --remove "smbserver/netbios/ip/naming/names/unique"
$c_progcfg --filename "$config_filename" --remove "smbserver/netbios/ip/naming/names/workgroup"
fi
if [ "$a_addconnman" = "yes" ]; then
$c_progcfg --filename "$config_filename" --remove "smbserver/netbios/ip/sessionmanager/port"
$c_progcfg --filename "$config_filename" --remove "smbserver/netbios/ip/connectionmanager/port"
$c_progcfg --filename "$config_filename" --remove "smbserver/netbios/ip/connectionmanager/accesses"
$c_progcfg --filename "$config_filename" --remove "smbserver/netbios/ip/connectionmanager/redirectpatterns"
fi
if [ "$a_addprint" = "yes" ]; then
cat ${GLOBDIR}/visionfs/_inst/"$SCOARCH".prf >> $config_filename
fi
if [ "$a_addlistprint" = "yes" ]; then
if [ -f ${GLOBDIR}/_inst/"$SCOARCH".prf -a `echo "$filenameargs" | grep ${GLOBDIR}/_inst/"$SCOARCH".prf 1>/dev/null 2>&1; echo $?` -ne 0 ]; then
filenameargs="$filenameargs --filename ${GLOBDIR}/_inst/"$SCOARCH".prf"
fi
listprint=`sh -c "$c_progcfg $filenameargs --print smbserver/server/shares/unix/defaults/printer/command/listprinters"`
$c_progcfg --filename $config_filename --set smbserver/server/shares/unix/defaults/printer/command/listprinters "$listprint"
fi
if [ -f $GLOB_VISION_FILE ]; then
grep -v "^VISION_TOOLSDIR=" $GLOB_VISION_FILE > $GLOB_VISION_FILE.tmp
else
/bin/rm -f $GLOB_VISION_FILE
echo "# This file is machine processed" > $GLOB_VISION_FILE.tmp
echo "# Edit it at your own risk" >> $GLOB_VISION_FILE.tmp
fi
if [ -n "${c_globdir}/bin/pctools" ]; then
echo VISION_TOOLSDIR="${c_globdir}/bin/pctools" >> $GLOB_VISION_FILE.tmp
fi
sort $GLOB_VISION_FILE.tmp > $GLOB_VISION_FILE
if [ -f $GLOB_VISION_FILE.tmp ]; then
/bin/rm -f $GLOB_VISION_FILE.tmp
fi
chmod 644 $GLOB_VISION_FILE
if [ -f $GLOB_VISION_FILE ]; then
_toolsdir=`grep "^VISION_TOOLSDIR=" $GLOB_VISION_FILE | tail -1 | sed -e "/^VISION_TOOLSDIR=/s///"`
else
_toolsdir=""
fi
if [ -z "$_toolsdir" ]; then
ccsError "$lf_notoolsdir"
return $FAIL
fi
# Find our language as a subdir of $_toolsdir
if [ ! -d $_toolsdir ]
then
echo "!10! Parent of language directories doesn't exist: $_toolsdir"
exit 10
fi
langs=`(cd $_toolsdir ; ls -d ??_?? 2>/dev/null)`
if [ $trace ] ; then echo " trace: langs=$langs" ; fi
case $langs in
"" ) # no languages!
echo "!11! Can't find any languages in directory $_toolsdir"
exit 11
;;
??_?? ) # Good; just one
VISIONLANG=$langs
;;
* ) # Choices, choices
case $LANG in
""|C|POSIX )
;; # Ignored
* ) # Some OS specific string
LA=`expr $LANG : "\(..\)"` # 1st two chars
# must ensure tr uses C locale to lower case!
la=`echo $LA | LANG=C LC_ALL=C tr '[A-Z]' '[a-z]'`
if [ $trace ] ; then echo " trace: la=$la"; fi
goodlangs=`echo "$langs" | grep "^$la"`
if [ -n "$goodlangs" ]
then
langs=$goodlangs # ones that match $LANG
fi
esac
# Pick the first language in langs, or en_US if that is empty
VISIONLANG=`expr "$langs en_US" : "\(.._..\)"`
;;
esac
if [ $trace ] ; then echo " trace: VISIONLANG=$VISIONLANG" ; fi
if [ -f $GLOB_VISION_FILE ]; then
c_deploydir=`grep "^VISION_DEPLOYDIR=" $GLOB_VISION_FILE | tail -1 | sed -e "/^VISION_DEPLOYDIR=/s///"`
else
c_deploydir=""
fi
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
$c_progcfg --filename "$config_filename" --remove "smbserver/server/shares/unix/disk/visionfs/type"
$c_progcfg --filename "$config_filename" --remove "smbserver/server/shares/unix/disk/visionfs/comment"
$c_progcfg --filename "$config_filename" --remove "smbserver/server/shares/unix/disk/visionfs/active"
$c_progcfg --filename "$config_filename" --remove "smbserver/server/shares/unix/disk/visionfs/browsable"
$c_progcfg --filename "$config_filename" --remove "smbserver/server/shares/unix/disk/visionfs/writable"
$c_progcfg --filename "$config_filename" --remove "smbserver/server/shares/unix/disk/visionfs/path"
$c_progcfg --filename "$config_filename" --remove "smbserver/server/shares/unix/disk/visionfs/privileges"
$c_progcfg --filename $config_filename --set smbserver/licensing/model "5"
# clear 1.1 key
$c_progcfg --filename "$config_filename" --remove "smbserver/licenses"
if [ "$a_addshare" = "yes" -o "$c_upgrade" = "C" ]; then
$c_progcfg --filename $config_filename --set smbserver/server/shares/unix/disk/visiontools/type "0"
$c_progcfg --filename $config_filename --set smbserver/server/shares/unix/disk/visiontools/comment "SCO Vision97 tools and information"
$c_progcfg --filename $config_filename --set smbserver/server/shares/unix/disk/visiontools/active "1"
$c_progcfg --filename $config_filename --set smbserver/server/shares/unix/disk/visiontools/browsable "1"
$c_progcfg --filename $config_filename --set smbserver/server/shares/unix/disk/visiontools/writable "0"
$c_progcfg --filename $config_filename --set smbserver/server/shares/unix/disk/visiontools/path $_toolsdir/$VISIONLANG
$c_progcfg --filename $config_filename --set smbserver/server/shares/unix/disk/visiontools/privileges "*:*:1:*:*:r"
fi
if [ "$a_addshare" = "yes" ]; then
$c_progcfg --filename $config_filename --set smbserver/server/shares/unix/disk/config$/comment "Profile Editor only - do not delete"
$c_progcfg --filename "$config_filename" --remove "smbserver/server/shares/unix/disk/config$/type"
$c_progcfg --filename "$config_filename" --remove "smbserver/server/shares/unix/disk/config$/active"
$c_progcfg --filename "$config_filename" --remove "smbserver/server/shares/unix/disk/config$/browsable"
$c_progcfg --filename "$config_filename" --remove "smbserver/server/shares/unix/disk/config$/writable"
$c_progcfg --filename "$config_filename" --remove "smbserver/server/shares/unix/disk/config$/path"
$c_progcfg --filename "$config_filename" --remove "smbserver/server/shares/unix/disk/config$/privileges"
fi
# convert old substitution strings
if [ "$c_upgrade" != "F" ]; then
confighomeset=`grep %%CONFIGHOME%% $config_filename`
producthomeset=`grep %%PRODUCTHOME%% $config_filename`
if [ ! -z "$confighomeset" -o ! -z "$producthomeset" ]; then
cat $config_filename | sed 's;%%CONFIGHOME%%;%%VISION_DIR%%/vfsprofile;; s;%%PRODUCTHOME%%;%%VISION_DIR%%/visionfs;;' > $config_filename.$$$
rm $config_filename
mv $config_filename.$$$ $config_filename
fi
fi
# STATUS output
echo "7\b\c"
# add to the rc after removing existing setup
# set the defaults
_delete=false
_files="dummy"
# create the list of files to check
case "$a_rctype" in
"svr4")
_delete=true
for _i in S 1 2 3 4
do
if [ -f /etc/rc$_i.d/$INST_RCFILE ]
then
_files="$_files /etc/rc$_i.d/$INST_RCFILE"
fi
done
;;
"sbin")
_delete=true
for _i in S 1 2 3 4
do
if [ -f /sbin/rc$_i.d/S90visionfs ]
then
_files="$_files /sbin/rc$_i.d/S90visionfs" # !!!visionfs???
fi
done
;;
"local")
_files="$_files /etc/rc.local"
;;
"rcd")
_files="$_files /etc/rc.d/rc.local"
;;
"nfs")
_files="$_files /etc/rc.nfs"
;;
"basic")
_files="$_files /etc/rc"
;;
esac
# either delete the files, or substitute them
if [ "$_delete" = "true" ]
then
for _i in $_files
do
if [ "$_i" = "dummy" ]
then
continue
fi
rm -f $_i
done
else
for _i in $_files
do
if [ "$_i" = "dummy" ]
then
continue
fi
# delete everything between the start and stop markers
echo "BEGIN {" > $_i.awk
echo " doprint=1;" >> $_i.awk
echo "}" >> $_i.awk
echo "\$1 == \"$INST_RCSTRING\" {" >> $_i.awk
echo " if (\$2 == \"start\") {" >> $_i.awk
echo " doprint = 0;" >> $_i.awk
echo " } else {" >> $_i.awk
echo " doprint = 1;" >> $_i.awk
echo " continue;" >> $_i.awk
echo " }" >> $_i.awk
echo "}" >> $_i.awk
echo "{" >> $_i.awk
echo " if (doprint == 1) {" >> $_i.awk
echo " print" >> $_i.awk
echo " }" >> $_i.awk
echo "}" >> $_i.awk
# run the newly created awk script on the file
if [ -f $_i.awk ]
then
cp -p $_i $_i.tmp1 #for perms
awk -f $_i.awk $_i > $_i.tmp1
rm -f $_i.awk
fi
# move the new copy over the old
if [ -f $_i.tmp1 ]
then
cp -p $_i.tmp1 $_i
rm -f $_i.tmp1
fi
done
fi
if [ "$a_restart" = "yes" ]
then
# 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
case "$a_rctype" in
"svr4"|"sbin")
# check the directory exists, doesn't get here unless they've already been
# asked if they want it created
_rcdir=`echo $a_rcfile | sed -e "s,^\(.*\)/[^/]*$,\1,"`
if [ ! -d "$_rcdir" ]
then
mkdir $_rcdir
fi
# overwrite current file even though user may have changed it
cat ${REQDIR}/${PKGINST}/rc.full > $a_rcfile.tmp1
chmod a+x $a_rcfile.tmp1
;;
"local"|"nfs"|"basic")
cp -p $a_rcfile $a_rcfile.tmp1
echo "$INST_RCSTRING start" >> $a_rcfile.tmp1
cat ${REQDIR}/${PKGINST}/rc.append >> $a_rcfile.tmp1
echo "$INST_RCSTRING stop" >> $a_rcfile.tmp1
;;
*)
;;
esac
if [ -f $a_rcfile.tmp1 ]; then
rm -f $a_rcfile
mv $a_rcfile.tmp1 $a_rcfile
if [ -f $a_rcfile.tmp1 ]; then
rm -f $a_rcfile.tmp1
fi
fi
fi
fi
# STATUS output
echo "8\b\c"
# add to the crontab if requested
crontab -l 2>/dev/null | grep -v "/visionfs checkpoint" | crontab 2>/dev/null
if [ "$a_checkpoint" = "yes" ]; then
c_croncomm="$c_globscript checkpoint 1>/dev/null 2>/dev/console"
# sunday at xxx o'clock
( crontab -l 2>/dev/null; echo "0 $a_time * * $a_day $c_croncomm" ) | crontab 2>/dev/null
fi
# make a copy into factory if created file
cp $config_filename $factory_filename 1>/dev/null 2>&1
return $OK
}
doPostExport()
{
# STATUS output
echo "9\b\c"
# copy the NET_vfsN.latebreaking.html file into the networking doc
# to update information for this release
doc_file=NET_vfsN.latebreaking.html
new_doc_file=${REQDIR}/visionfs/${doc_file}.new
save_doc_file=${REQDIR}/visionfs/${doc_file}.save
old_doc_file=/usr/lib/scohelp/en_US.ISO8859-1/NET_vfs/$doc_file
if [ -f "$new_doc_file" -a -w "$old_doc_file" ]
then
cp $old_doc_file $save_doc_file
cp $new_doc_file $old_doc_file
chown bin:bin $old_doc_file
chmod 664 $old_doc_file
removef BASEdoc "$old_doc_file" 1>&2
removef -f BASEdoc 1>&2
installf BASEdoc "$old_doc_file" file 0664 bin bin 1>&2
installf -f BASEdoc 1>&2
fi
# STATUS output
echo "10\b\b\c"
# pkgadd doesn't update the file creation time/date
# on the file
if [ -f $c_globdir/bin/visionfs ]
then
touch $c_globdir/bin/visionfs
fi
# print out the messages and start the server if requested
if [ ! -z "$c_instsconb" -a -z "$c_usingsconb" ]; then
ccsWarning "$msg_instsconb"
fi
# start the server
if [ "$a_startnow" = "yes" ]; then
if [ "$iqmDriven" != TRUE ]
then
TMPOUT=/tmp/vfsout.$$
nohup $c_globdir/bin/visionfs start 1> $TMPOUT 2>&1
cat $TMPOUT
rm -f $TMPOUT
fi
if [ $? -ne 0 ]
then
ccsWarning "Failed to start visionfs server"
fi
else
if [ ! -z "$c_usingsconb" ]; then
ccsWarning "$msg_usingsconb"
fi
fi
return $OK
}
#############################################################################
#
# @(#) rebuild_file.sh_h 11.2 97/09/18
#
# Standard routine to take a file that has been cut into pieces for
# shipment as a package, and piece that file back together from its
# component parts in a postinstall script.
#
# The routine looks for parts of the file as $1.Pnn, where nn are
# digits, 01..99
#
# Arguments are:
#
# $1 - name of the file to rebuild (the target)
# $2 - target file mode (e.g. 0711)
# $3 - target file owner (e.g. root)
# $4 - target file group (e.g. other)
# $5 - optional argument; the checksum for the completed file
#
# Return values are:
#
# 0 - success
# 1 - failure (for example, piece of the file missing)
#
#############################################################################
rebuild_file()
{
target="$1"
mode="$2"
owner="$3"; group="$4"
checksum="$5"
# count the number of pieces to the file
piececount=`echo $target.P[0-9][0-9] | wc -w | tr -d ' '`
if [ $piececount -lt 1 ]; then
ccsError "$ME: rebuild_file: $piececount is invalid"
return $FAIL
else
if [ $piececount -gt 99 ]; then
ccsError "$ME: rebuild_file: $piececount is too many pieces"
return $FAIL
fi
fi
# build the file by appending these pieces one after another
>$target
piece=0; while [ $piece -lt $piececount ]; do
extn="`expr $piece + 1`"
[ `expr length $extn` -lt 2 ] && extn="0$extn"
if [ -f $target.P$extn ]; then
cat $target.P$extn >>$target
rm $target.P$extn >/dev/null 2>&1
echo "$target.P$extn" >> $REMOVEF_TMP
else
ccsError "$ME: rebuild_file: missing file piece $extn of $target"
return $FAIL
fi
piece=`expr $piece + 1`
done
echo "$target f $mode $owner $group" >> $INSTALLF_TMP
return $OK
}
CreateVConf()
{
if [ ! -f $VISION_FILE ]
then
p_vfileheader="# Vision master configuration file."
echo $p_vfileheader > $VISION_FILE
fi
temp=""
if [ -f $GLOB_VISION_FILE ]; then
temp=`grep "^VISION_ADMINDIR=" $GLOB_VISION_FILE | tail -1 | sed -e "/^VISION_ADMINDIR=/s///"`
else
temp=""
fi
[ -z "$temp" ] && echo "VISION_ADMINDIR=$c_globdir/admin" >> $VISION_FILE
temp=""
if [ -f $GLOB_VISION_FILE ]; then
temp=`grep "^VISION_BINDIR=" $GLOB_VISION_FILE | tail -1 | sed -e "/^VISION_BINDIR=/s///"`
else
temp=""
fi
[ -z "$temp" ] && echo "VISION_BINDIR=$c_bindir" >> $VISION_FILE
temp=""
if [ -f $GLOB_VISION_FILE ]; then
temp=`grep "^VISION_DEBUGDIR=" $GLOB_VISION_FILE | tail -1 | sed -e "/^VISION_DEBUGDIR=/s///"`
else
temp=""
fi
[ -z "$temp" ] && echo "VISION_DEBUGDIR=$c_globdir/log" >> $VISION_FILE
temp=""
if [ -f $GLOB_VISION_FILE ]; then
temp=`grep "^VISION_DIR=" $GLOB_VISION_FILE | tail -1 | sed -e "/^VISION_DIR=/s///"`
else
temp=""
fi
[ -z "$temp" ] && echo "VISION_DIR=$c_globdir" >> $VISION_FILE
temp=""
if [ -f $GLOB_VISION_FILE ]; then
temp=`grep "^VISION_ETCDIR=" $GLOB_VISION_FILE | tail -1 | sed -e "/^VISION_ETCDIR=/s///"`
else
temp=""
fi
[ -z "$temp" ] && echo "VISION_ETCDIR=$c_etcdir" >> $VISION_FILE
temp=""
if [ -f $GLOB_VISION_FILE ]; then
temp=`grep "^VISION_TMPDIR=" $GLOB_VISION_FILE | tail -1 | sed -e "/^VISION_TMPDIR=/s///"`
else
temp=""
fi
[ -z "$temp" ] && echo "VISION_TMPDIR=$c_globdir/log" >> $VISION_FILE
temp=""
if [ -f $GLOB_VISION_FILE ]; then
temp=`grep "^VISION_TOOLSDIR=" $GLOB_VISION_FILE | tail -1 | sed -e "/^VISION_TOOLSDIR=/s///"`
else
temp=""
fi
[ -z "$temp" ] && echo "VISION_TOOLSDIR=$c_bindir/pctools" >> $VISION_FILE
chmod 644 $VISION_FILE
}
create_postisl_rcfiles()
{
# create the isl postreboot file to do the silent default
# configuration of the server. It runs the visionfs postinstall
# script and removes itself if successful.
cp ${REQDIR}/${PKGINST}/postisl_configure $POST_ISL_RCFILE
chmod 444 $POST_ISL_RCFILE
# create the S90visionfs rcfile to start the server on system
# bootup. This will run after the POST_ISL_RCFILE S90isl_visionfs
cp ${REQDIR}/${PKGINST}/rc.full /etc/rc3.d/$INST_RCFILE
chmod 444 /etc/rc3.d/$INST_RCFILE
}
assemble_files()
{
# STATUS output
#echo "1\b\c"
# set up some paths for removef and installf temp files
# which are used at the end of this routine to update the
# /var/sadm/install/contents file.
REMOVEF_TMP=/tmp/$$_vfs.removef
INSTALLF_TMP=/tmp/$$_vfs.installf
# paste the big files that have been split up for distribution back
# together
VFSD_FILE=${c_dir}/bin/${SCOARCH}/vfsd
rebuild_file $VFSD_FILE 555 bin bin
[ "$?" != "0" ] && {
ccsError "ERROR: VisionFS - postinstall assembly of vfsd binary failed"
return $FAIL
}
# paste the 16bit acrobat files that have been split up for distribution
# back together
# STATUS output
echo "2\b\c"
ACROBAT16=${c_bindir}/pctools/en_US/docs/acrobat/16bit/ARCHIVE.Z
rebuild_file $ACROBAT16 555 bin bin
[ "$?" != "0" ] && {
ccsError "ERROR: VisionFS - postinstall assembly of 16bit/ARCHIVE.Z"
return $FAIL
}
# paste the 32bit acrobat files that have been split up for distribution
# back together
# STATUS output
echo "3\b\c"
ACROBAT32=${c_bindir}/pctools/en_US/docs/acrobat/32bit/ARCHIVE.Z
rebuild_file $ACROBAT32 555 bin bin
[ "$?" != "0" ] && {
ccsError "ERROR: VisionFS - postinstall assembly of 32bit/ARCHIVE.Z"
return $FAIL
}
# update /var/sadm/install/contents file for visionfs - final
# STATUS output
echo "4\b\c"
[ -f "$REMOVEF_TMP" ] && {
cat $REMOVEF_TMP | removef $PKGINST - 1>&2
removef -f $PKGINST 1>&2
rm $REMOVEF_TMP
}
# STATUS output
echo "5\b\c"
[ -f "$INSTALLF_TMP" ] && {
cat $INSTALLF_TMP | installf $PKGINST - 1>&2
installf -f $PKGINST 1>&2
rm $INSTALLF_TMP
}
return $OK
}
#------------------------------------------------------------------
#
#-------------------------------Main-------------------------------
#
# set up debug
#
SCRIPTS=/usr/sbin/pkginst
. ${SCRIPTS}/updebug
[ "$UPDEBUG" = YES ] && set -x
#
# set defaults
#
iqmDriven="FALSE"
# Also check SILENT-INSTALL just in case we want a silent NORMAL install
[ -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 $POST_ISL_RCFILE ] && {
HOW_INSTALL=POSTREBOOT
iqmDriven="TRUE"
}
if [ "${HOW_INSTALL}" = "ON_BFLOP" ]
then
# visionfs is being installed at isl time. A post install reboot
# script is need to do the default configuration of the server cuz
# we can't do it now.
create_postisl_rcfiles
else
# we are in POSTREBOOT or NORMAL install mode and all files have
# been laid down but the server has not been configured.
if [ "${HOW_INSTALL}" = "POSTREBOOT" ]
then
# need to get our default configuration information
getDefaults
else
# NORMAL pkgadd install - request script created a SAVE_FILE
# containing server configuration information.
. ${SAVE_FILE}
fi
# vision.conf may not exist or may not contain stuff visionfs needs
# so go check this out and create/update vision.conf with the
# paramters we have. We don't want to write over a vision.conf file
# if this is an upgrade.
CreateVConf
# fix up echo characteristics for menuing if any
N=""
C=""
if echo -n | grep n > /dev/null
then
C="\c"
else
N="-n"
fi
_ss_headlines="--------------------------------------------------------------------------"
# set message catalogs
. ${REQDIR}/${PKGINST}/setup
. ${REQDIR}/${PKGINST}/common
# do the work
doPostConfigure
requestReturnVal="$?"
[ "$requestReturnVal" = "0" ] && {
doPostExport
requestReturnVal="$?"
}
# cleanup a bit
[ "$requestReturnVal" = "0" -a -f "$SAVE_FILE" ] && rm $SAVE_FILE
fi
exit $requestReturnVal