home *** CD-ROM | disk | FTP | other *** search
Wrap
# @(#)postinstall 1.7 # nws postinstall script # # Revision History: # # L000 20th Oct 1997 tonylo # The script now invokes /usr/lib/scoadmin/account/make-owner to # make current system owners have privileges to run NetWare server # applications # # trap "" 2 if [ "$RANDOM" = "$RANDOM" ] then exec /usr/bin/winxksh $0 $* fi # Redirect stderr to a file ERR="/tmp/nwsrvr.post.err" exec 2>$ERR IDTUNE="/etc/conf/bin/idtune" IDBUILD="/etc/conf/bin/idbuild" YES="/usr/bin/yes" NWCM="/usr/sbin/nwcm" ADMINROLE="/usr/bin/adminrole" ADMINUSER="/usr/bin/adminuser" SCOADMIN=/usr/bin/scoadmin AWK="/usr/bin/awk" GREP="/usr/bin/grep" function ConfigureProtocolStack { [ -n "$DEBUG" ] && set -x CURRENT=`pwd` # # Configure Drivers # CWD=/tmp/nwsps # this directory created when installing through prototype file for i in ncpipx nwetc nemux sfd do cd ${CWD}/${i} echo "/etc/conf/bin/idinstall -P ${PKGINST} -uk ${i}" >> ${ERR} 2>&1 /etc/conf/bin/idinstall -P ${PKGINST} -uk ${i} >> ${ERR} 2>&1 if [ $? -ne 0 ] then echo "/etc/conf/bin/idinstall -P ${PKGINST} -ak ${i}" >> ${ERR} 2>&1 /etc/conf/bin/idinstall -P ${PKGINST} -ak ${i} >> ${ERR} 2>&1 if [ $? -ne 0 ] then wclose $PC_INFO_WIN print -u2 "$CONFIGURE_KERNEL_SILENT_ERROR" if [ "$SMART_START" = "TRUE" ] then display "$CONFIGURE_KERNEL_SILENT_ERROR" \ -fg ${WHITE} -bg ${RED} sleep 3 else display -w "$CONFIGURE_KERNEL_ERROR" \ -fg ${WHITE} -bg ${RED} \ -current "footer $ENTER_TO_CONT_MSG" input_handler fi GoodBye 2 fi fi cd ${CWD} done # # Rebuild Kernel # echo "/etc/conf/bin/idbuild -M ncpipx -M nwetc -M nemux -M sfd" >> ${ERR} 2>&1 /etc/conf/bin/idbuild -M ncpipx -M nwetc -M nemux -M sfd>> ${ERR} 2>&1 if [ $? -ne 0 ] then wclose $PC_INFO_WIN print -u2 "$CONFIGURE_KERNEL_SILENT_ERROR" if [ "$SMART_START" = "TRUE" ] then echo "$CONFIGURE_KERNEL_SILENT_ERROR" sleep 3 else display -w "$CONFIGURE_KERNEL_ERROR" \ -fg ${WHITE} -bg ${RED} \ -current "footer $ENTER_TO_CONT_MSG" input_handler fi GoodBye 2 fi # Now clean up # # Remove tmp files from package installation database. # cd ${CWD} find `pwd` -depth -print >/tmp/$$a removef $PKGINST `cat /tmp/$$a` >/dev/null 2>&1 rm -f /tmp/$$a cd / rm -fr ${CWD} removef -f ${PKGINST} cd $CURRENT return 0 } function ConfigureNetware { [ -n "$DEBUG" ] && set -x # # Configure tunable netware parameters # $NWCM -q -s server_name="$SERVER_NAME" # set shm_size only if smaller than what is needed to run the server TMP=`$NWCM -v shm_size` if [ "$TMP" -lt $SHM_SIZE ] then $NWCM -q -s shm_size="$SHM_SIZE" fi # set max_connections only if smaller than what is needed to run the server TMP=`$NWCM -v max_connections` if [ "$TMP" -lt $MAX_CONNECTIONS ] then $NWCM -q -s max_connections="$MAX_CONNECTIONS" fi if [ "$SMART_START" = "TRUE" ] then $NWCM -q -s ipx_internal_network="$SS_IPX_INTERNAL_NETWORK" >> $ERR 2>&1 else $NWCM -q -s ipx_internal_network="$IPX_INTERNAL_NETWORK" >> $ERR 2>&1 fi if [ "$NWS_START_AT_BOOT" = "$START_AT_BOOT_1" ] then # set to on $NWCM -q -s nws_start_at_boot="on" >> $ERR 2>&1 else $NWCM -q -s nws_start_at_boot="off" >> $ERR 2>&1 fi # # Add Trusted Facilities Manament database entries for NetWare # and related binaries. # TFMSetup # # #FNAME=/etc/netware/voltab #touch $FNAME #chmod 600 $FNAME #chown nwuser $FNAME #chgrp nwgroup $FNAME #installf $PKGINST $FNAME v 0600 nwroot nwgroup FNAME=$SYSVOL/system/dsrepair.log touch $FNAME chmod 664 $FNAME chown nwuser $FNAME chgrp nwgroup $FNAME installf $PKGINST $FNAME v 664 nwroot nwgroup FNAME=$SYSVOL/system/spool.sys touch $FNAME chmod 664 $FNAME chown nwuser $FNAME chgrp nwgroup $FNAME installf $PKGINST $FNAME v 664 nwroot nwgroup FNAME=$SYSVOL/system/sys\$log.err touch $FNAME chmod 664 $FNAME chown nwuser $FNAME chgrp nwgroup $FNAME installf $PKGINST $FNAME v 664 nwroot nwgroup # Create License directory /usr/bin/mkdir -p /etc/netware/licenses > /dev/null 2>&1 ## Change init state to 3 /usr/bin/ed -s /etc/inittab <<- EOF > /dev/null 2>&1 /initdefault/ s/2/3 w q EOF /usr/bin/ed -s /etc/conf/init.d/kernel <<- EOF > /dev/null 2>&1 /initdefault/ s/2/3 w q EOF return 0 } function TFMSetup { [ -n "$DEBUG" ] && set -x # # Give root user privileges to run all nws commands (GUI and non-GUI). # $ADMINUSER root | $GREP dsinstall > /dev/null 2>&1 if (( $? != 0 )) then # root does not have privs. $ADMINUSER -a dsinstall:/usr/sbin/dsinstall:allprivs,dsrepair:/usr/sbin/dsrepair:allprivs,dsadmin:/usr/sbin/dsadmin:allprivs,nwserver:/usr/sbin/nwserver:allprivs,ndsbackup:/usr/sbin/ndsbackup:allprivs,ndsrestore:/usr/sbin/ndsrestore:allprivs,tsadmin:/usr/sbin/tsadmin:allprivs,nwshut:/usr/sbin/nwshut:allprivs,nwvm:/usr/sbin/nwvm:allprivs,nwcm:/usr/sbin/nwcm:allprivs,pserver:/usr/sbin/pserver:allprivs,stopprint:/usr/sbin/stopprint:allprivs,nwserverstatus:/usr/sbin/nwserverstatus:allprivs,NWS_Status:/usr/X/bin/NWS_Status:allprivs,NWVolume_Setup:/usr/X/bin/NWVolume_Setup:allprivs,NWS_Licensing:/usr/X/bin/NWS_Licensing:allprivs root fi # L000 vvv # # If we're running from install on boot, no need to setup owner since # the postreboot.sh will take care of it. if, however, this is an # after-the-fact pkgadd, the owner has to be setup here. # [ -f /etc/inst/scripts/postreboot.sh ] || { set `grep mail= /var/sadm/install/admin/* | cut -f2 -d=` while [ $# -ne 0 ] do [ "$1" != "root" ] && /usr/lib/scoadmin/account/make-owner $1 2>/dev/null shift done } # L000 ^^^ # # Give nwprint user privileges to run pserver and stopprint # $ADMINUSER nwprint | $GREP pserver > /dev/null 2>&1 if (( $? != 0 )) then # root does not have privs. $ADMINUSER -a pserver:/usr/sbin/pserver:allprivs,stopprint:/usr/sbin/stopprint:allprivs nwprint fi return 0 } function TuneKernel { [ -n "$DEBUG" ] && set -x # # Only tune the parameter if it is currently # less than what we need. # # Set SHMMAX to 8mb min. This is good for 50 users # 50-75 users set 10mb # 75-100 users set 12mb # .. add 2mb for each 25 users. TUNABLE=SHMMAX let KERNEL_SHM_SIZE=$SHM_SIZE*2 TMP=`$IDTUNE -g $TUNABLE` TMP=`echo $TMP | $AWK '{print $1}'` if [ $TMP -lt $KERNEL_SHM_SIZE ] then $YES|$IDTUNE -m $TUNABLE $KERNEL_SHM_SIZE REBOOT_SYSTEM=1 fi # tune semaphores TUNABLE=SEMMSL VALUE=150 TMP=`$IDTUNE -g $TUNABLE` TMP=`echo $TMP | $AWK '{print $1}'` if [ "$TMP" -lt $VALUE ] then $YES|$IDTUNE -m $TUNABLE $VALUE REBOOT_SYSTEM=1 fi return 0 } function FlagRebuildKernel { [ -n "$DEBUG" ] && set -x /usr/bin/rm -f /tmp/nws.done > /dev/null 2>&1 if [ $REBOOT_SYSTEM = "1" ] then $IDBUILD > /dev/null 2>&1 echo 1 > /tmp/nws.done else echo 0 > /tmp/nws.done fi return 0 } function ConfigurePserverCFG { [ -n "$DEBUG" ] && set -x if [ "$OVERLAY" = "NO" ] then FNAME=/var/netware/pserver/pserver.cfg cp -f /tmp/pserver.cfg $FNAME chmod 600 $FNAME chown nwuser $FNAME chgrp nwgroup $FNAME installf $PKGINST $FNAME v 0600 nwroot nwgroup fi removef $PKGINST /tmp/pserver.cfg 2>&1 > /dev/null removef -f ${PKGINST} rm -f /tmp/pserver.cfg 2>&1 > /dev/null } # # If package netmgt is installed then turn on netmgt. # function ConfigureNetMgt { [ -n "$DEBUG" ] && set -x /usr/bin/pkginfo -i netmgt > /dev/null 2>&1 if [ "$?" = "0" ] then /usr/sbin/nwcm -q -s nwum="on" fi } function SetupServerLanguage { nwcm -q -s country_code=$COUNTRY_CODE nwcm -q -s code_page=$CODE_PAGE nwcm -q -s host_code_set=$HOST_CODE_SET } function BackupExistingDrivers { # # Try to save any existing version of the sfd driver # #Have we saved it before ? if [ ! -d ${PKGSAV}/sfd_backup ]; then #Is there a previous installation of sfd ? if [ -d /etc/conf/pack.d/sfd ]; then #Save the old version so we can reinstall it if required CWD=/etc/conf/pack.d/sfd cd ${CWD} echo "mkdir -p ${PKGSAV}/sfd_backup" >> ${ERR} 2>&1 mkdir -p ${PKGSAV}/sfd_backup >> ${ERR} 2>&1 if [ $? -ne 0 ] then message -d `pfmt -s nostd -g ${PKGMSG}:5 "The installation cannot be completed due to an error \nin the driver installation. The file %s contains the errors." ${ERR} 2>&1` exit 2 fi #Backup Driver*.o echo "mv Driver*.o ${PKGSAV}/sfd_backup" >> ${ERR} 2>&1 mv Driver*.o ${PKGSAV}/sfd_backup >> ${ERR} 2>&1 #Backup space.c if one exists if [ -f space.c ]; then echo "cp space.c ${PKGSAV}/sfd_backup/Space.c" >> ${ERR} 2>&1 cp space.c ${PKGSAV}/sfd_backup/Space.c >> ${ERR} 2>&1 fi #Backup Node if one exists if [ -f ../../node.d/sfd ]; then echo "cp ../../node.d/sfd ${PKGSAV}/sfd_backup/Node" >> ${ERR} 2>&1 cp ../../node.d/sfd ${PKGSAV}/sfd_backup/Node >> ${ERR} 2>&1 fi #Backup System if one exists if [ -f ../../sdevice.d/sfd ]; then echo "cp ../../sdevice.d/sfd ${PKGSAV}/sfd_backup/System" >> ${ERR} 2>&1 cp ../../sdevice.d/sfd ${PKGSAV}/sfd_backup/System >> ${ERR} 2>&1 fi #Backup Master if one exists if [ -f ../../mdevice.d/sfd ]; then echo "cp ../../mdevice.d/sfd ${PKGSAV}/sfd_backup/Master" >> ${ERR} 2>&1 cp ../../mdevice.d/sfd ${PKGSAV}/sfd_backup/Master >> ${ERR} 2>&1 fi #Backup Mtune if one exists if [ -f ../../mtune.d/sfd ]; then echo "cp ../../mtune.d/sfd ${PKGSAV}/sfd_backup/Mtune" >> ${ERR} 2>&1 cp ../../mtune.d/sfd ${PKGSAV}/sfd_backup/Mtune >> ${ERR} 2>&1 fi fi fi } # # Install SCOadmin stuff # function AddScoAdmin { if [ -x $SCOADMIN ] then $SCOADMIN -p NetWare -f -c /usr/lib/scoadmin/NetWare/NWVolume_Setup.obj $SCOADMIN -p NetWare -f -c /usr/lib/scoadmin/NetWare/NWS_Status.obj $SCOADMIN -p NetWare -f -c /usr/lib/scoadmin/NetWare/NWS_Licensing.obj $SCOADMIN -p NetWare -f -c /usr/lib/scoadmin/NetWare/dsinstall.obj $SCOADMIN -p NetWare -f -c /usr/lib/scoadmin/NetWare/dsrepair.obj fi } # # Main() # [ -n "$DEBUG" ] && set -x # load misc functions from -> nws <- set directory since nwsrvr is gone by now. . /var/sadm/pkg/nwsrvr/install/misc_func SetLocale # Load strings . ${LANGDEP_SCRIPTS}/set_strings # Initialize winxksh . /usr/lib/winxksh/winrc . /usr/lib/winxksh/scr_init # # For running standalone test # if [ "$2" = "test" ] then REQDIR=. fi REBOOT_SYSTEM=0 footer "$GENERIC_WAIT_MSG" if [ "$SMART_START" = "FALSE" ] then display "$INSTALL_POSTCONFIG_MSG" -fg ${WHITE} -bg ${BLUE} fi PC_INFO_WIN=${CURWIN} # read in nws response file (get SMART_START and SS_IPX_INTERNAL_NETWORK) . /tmp/nws.response BackupExistingDrivers ConfigureProtocolStack ConfigureNetware TuneKernel FlagRebuildKernel ConfigurePserverCFG ConfigureNetMgt SetupServerLanguage AddScoAdmin # installf needs to be called only once. installf -f $PKGINST wclose ${PC_INFO_WIN} if [ "$SMART_START" = "FALSE" ] then # If this is last package to be installed display final install screen if [ -f /tmp/$PKGINST ] then display -w "$INSTALL_WHAT_NEXT_WITH_REBOOT" \ -fg ${WHITE} -bg ${BLUE} \ -current "footer $HIT_ANY_KEY_TO_END" fi input_handler ClearScreen call endwin fi exit 0