home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 1999 March B / SCO_CASTOR4RRT.iso / nwnet / install / postinstall < prev    next >
Text File  |  1998-08-19  |  7KB  |  292 lines

  1. #ident    "@(#)postinstall    1.13"
  2. #
  3. # Revision History:
  4. #
  5. # L000  20th Oct 1997
  6. #       The script now invokes /usr/lib/scoadmin/account/make-owner to
  7. #       make current system owners have privileges to run NetWare server
  8. #       applications
  9. #
  10. #
  11.  
  12. SCRIPTS=/usr/sbin/pkginst
  13. PKGMSG=${PKGINST}.pkg
  14. LOCALE=${LC_ALL:-${LC_MESSAGES:-${LANG:-"C"}}}
  15. ADMINUSER=/usr/bin/adminuser
  16. SCOADMIN=/usr/bin/scoadmin
  17. GREP=/usr/bin/grep
  18. NETCFG=/usr/sbin/netcfg
  19.  
  20. #
  21. # The HOW_INSTALL variable is set up by the package's request script.
  22. #
  23. # HOW_INSTALL = B_FLOP          --      ISL, prereboot
  24. #
  25. # HOW_INSTALL = POSTREBOOT      --      ISL, postreboot
  26. #
  27. # HOW_INSTALL = NORMAL          --      manual pkgadd
  28. #
  29. #  The following HOW_INSTALL clauses are order dependent
  30.  
  31. HOW_INSTALL=NORMAL
  32.  
  33. if [ -f /etc/rc2.d/S02POSTINST ]
  34. then
  35. #       We are rebooting after fnd set installation 
  36.         HOW_INSTALL=POSTREBOOT
  37. elif [ -f /etc/inst/scripts/postreboot.sh ]
  38. then
  39. #    We are in foundation set installation on the boot floppies
  40.         HOW_INSTALL=ON_BFLOP
  41. fi
  42.  
  43. # now perform any necessary isl netcfg related tasks
  44.  
  45. if [ "${HOW_INSTALL}" = "POSTREBOOT" -a -x ${NETCFG} ]
  46. then
  47.     #
  48.     #    execute the netcfg to modify information.
  49.     #
  50.     (    stty=`stty -g` 2>/dev/null
  51.  
  52.         #
  53.         # Get the NICS parameters from the ifile.
  54.         #
  55.         if [ -f /isl/ifile ]
  56.         then
  57.             . /isl/ifile
  58.         fi
  59.  
  60.         if [ "$IPX_DEFER" != "TRUE" -a "$NICS_DRIVER_NAME" -a "$NICS_TYPE" ]
  61.         then
  62.             if [ "$NICS_TYPE" = "MDI" ]
  63.             then
  64.                 #
  65.                 # During the installation we will
  66.                 # only ever configure one interface.
  67.                 # In the MDI case NIC devices are
  68.                 # of the form netX. So it is safe
  69.                 # to assume that here we will be
  70.                 # adding net0.
  71.                 #
  72.                 $NETCFG -a ipx#net0
  73.             else
  74.                 #
  75.                 # ODI drivers have the form:
  76.                 # NIC_X, e.g. TCM59X_0
  77.                 #
  78.                 #
  79.                 # DLPI drivers have the form:
  80.                 # the form NIC_X, e.g. NE2000_0
  81.                 #
  82.                 $NETCFG -a ipx#${NICS_DRIVER_NAME}_0
  83.             fi
  84.         fi
  85.         stty $stty 2>/dev/null
  86.     )
  87.     exit 0
  88. fi
  89.  
  90. cd /
  91.  
  92.  
  93. if [ ! -f /usr/lib/locale/${LOCALE}/LC_MESSAGES/${PKGMSG} ]; then
  94.     if [ -f ${REQDIR}/inst/locale/${LOCALE}/${PKGMSG} -a \
  95.          -d /usr/lib/locale/${LOCALE}/LC_MESSAGES ]; then
  96.         cp ${REQDIR}/inst/locale/${LOCALE}/${PKGMSG} \
  97.            /usr/lib/locale/${LOCALE}/LC_MESSAGES
  98.     fi
  99. fi
  100. . ${SCRIPTS}/updebug
  101. [ "$UPDEBUG" = YES ] && set -x
  102.  
  103. #
  104. # Create and install NULL files in /etc/netware
  105. #
  106. touch /etc/netware/nwconfig
  107. installf -c base ${PKGINST} /etc/netware/nwconfig v 0644 root sys
  108. touch /etc/netware/sapouts
  109. installf -c base ${PKGINST} /etc/netware/sapouts v 0644 root sys
  110. installf -f -c base ${PKGINST}
  111.  
  112. if [ "$PKGINSTALL_TYPE" = NEWINSTALL ]
  113. then
  114.     #
  115.     #    Set up NetWare configuration
  116.     #    Make sure server name configured
  117.     #
  118.     NAME=`/usr/sbin/nwcm -v server_name`
  119.     if echo $NAME |  fgrep \"\" >/dev/null
  120.     then
  121.         # Server name not set, set it
  122.         /usr/sbin/nwcm -q -s "server_name=`uname -n`"
  123.     fi
  124.  
  125.     /usr/sbin/nwcm -s spx_network_rlogin=on >/dev/null 2>&1
  126.     /usr/sbin/nwcm -s router_type=FULL >/dev/null 2>&1
  127.     /usr/sbin/nwcm -s ipx_start_at_boot=off >/dev/null 2>&1
  128.     /usr/sbin/nwcm -s ipx_auto_discovery=off >/dev/null 2>&1
  129.  
  130. else
  131.     #
  132.     # Overlay/Upgrade
  133.     #    Restore saved files
  134.     #     Save previous sap name so the permanent sap services
  135.     #    get updated when we reboot.
  136.     #
  137.     ${SCRIPTS}/pkgmrgconf "${PKGINST}" "$AUTOMERGE" "$NAME"
  138.  
  139.     for i in 0x03e4 0x0247 0x03ee 0x03e1
  140.     do
  141.         SAPNAME="`/usr/sbin/nwsaputil -q -t $i | /usr/bin/cut -f1 -d' '`"
  142.         if [ -n "$SAPNAME" ]
  143.         then
  144.             if [ ! -f /etc/netware/.olduname ]
  145.             then
  146.                 echo $SAPNAME >/etc/netware/.olduname
  147.                 installf -c base ${PKGINST} /etc/netware/.olduname v 0644 root sys
  148.                 installf -f -c base ${PKGINST}
  149.             else
  150.                 echo $SAPNAME >/etc/netware/.olduname
  151.             fi
  152.             chmod 0644 /etc/netware/.olduname
  153.             chown root /etc/netware/.olduname
  154.             chgrp sys /etc/netware/.olduname
  155.             break;
  156.         fi
  157.     done
  158. fi
  159.  
  160. if [ ! -f /etc/netware/.olduname ]
  161. then
  162.     uname -n >/etc/netware/.olduname
  163.     chmod 0644 /etc/netware/.olduname
  164.     chown root /etc/netware/.olduname
  165.     chgrp sys /etc/netware/.olduname
  166.     installf -c base ${PKGINST} /etc/netware/.olduname v 0644 root sys
  167.     installf -f -c base ${PKGINST}
  168. fi
  169.  
  170. #
  171. #    Configure Drivers
  172. #
  173. ERR=/tmp/nwnet.err
  174. CWD=/tmp/nwnet
  175. rm -f ${ERR}
  176. for i in ipx ripx nspx nwip
  177. do
  178.     cd ${CWD}/${i}
  179.     echo "/etc/conf/bin/idinstall -k -P ${PKGINST} -u ${i}" >> ${ERR} 2>&1
  180.     /etc/conf/bin/idinstall -k -P ${PKGINST} -u ${i} >> ${ERR} 2>&1
  181.     if [ $? -ne 0 ]
  182.     then
  183.         echo "/etc/conf/bin/idinstall -k -P ${PKGINST} -a ${i}" >> ${ERR} 2>&1
  184.         /etc/conf/bin/idinstall -k -P ${PKGINST} -a ${i} >> ${ERR} 2>&1
  185.         if [ $? -ne 0 ]
  186.         then
  187.         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`
  188.             exit 2
  189.         fi
  190.     fi
  191.     cd ${CWD}
  192. done
  193.  
  194. #
  195. #    Rebuild Kernel
  196. #
  197. echo "/etc/conf/bin/idbuild -M ipx -M ripx -M nspx -M nwip" >> ${ERR} 2>&1
  198. /etc/conf/bin/idbuild -M ipx -M ripx -M nspx -M nwip >> ${ERR} 2>&1
  199. if [ $? -ne 0 ]
  200. then
  201.         message -d `pfmt -s nostd -g ${PKGMSG}:6 "The installation cannot be completed due to an error \nin the driver installation (idbuild).  The file %s contains the errors. " ${ERR} 2>&1`
  202. fi
  203.  
  204. #
  205. # execute scripts to modify /etc/inet/services and /etc/netconfig.
  206. #
  207. # /etc/netconfig is modified by netcfg.
  208.  
  209. sh /var/sadm/pkg/nwnet/install/nwservices install >/tmp/nwservices
  210. cp /tmp/nwservices /etc/inet/services
  211.  
  212. #
  213. #   Add /dev/NVT to /etc/ttysrch to speed up ttyname
  214. #
  215. echo "/dev/NVT    MF" >>/etc/ttysrch
  216.  
  217.  
  218. # Now clean up
  219. #
  220. # Remove tmp files from package installation database.
  221. #
  222. cd ${CWD}
  223. find `pwd` -depth -print >/tmp/$$a
  224. removef $PKGINST `cat /tmp/$$a` >/dev/null 2>&1
  225. rm -f /tmp/$$a
  226.  
  227. #
  228. # Setup scoadmin NetWare folder
  229. #
  230.  
  231. if [ -x $SCOADMIN ]
  232. then
  233.     $SCOADMIN -p NetWare -f -c /usr/lib/scoadmin/NetWare/NetWare_Setup.obj
  234. fi
  235.  
  236. #
  237. # Setup tfadmin privileges
  238. #
  239.  
  240. $ADMINUSER -a NetWare_Setup:/usr/X/bin/NetWare_Setup:allprivs root
  241.  
  242. # L000 vvv
  243. #
  244. # If we're running from install on boot, no need to setup owner since
  245. # the postreboot.sh will take care of it.  if, however, this is an
  246. # after-the-fact pkgadd, the owner has to be setup here.
  247. #
  248. [ -f /etc/inst/scripts/postreboot.sh ] || {
  249.     set `grep mail= /var/sadm/install/admin/* | cut -f2 -d=`
  250.     while [ $# -ne 0 ]
  251.     do
  252.         [ "$1" != "root" ] && /usr/lib/scoadmin/account/make-owner $1 2>/dev/null
  253.         shift
  254.     done
  255. }
  256. # L000 ^^^
  257.  
  258.  
  259. #
  260. # Install the nwcm wrapper
  261. #
  262.  
  263. mv /usr/sbin/nwcm /usr/sbin/nwcm.be
  264. mv /usr/sbin/nwcm.filter /usr/sbin/nwcm
  265.  
  266. # Register the changes to avoid pkgchk -n errors
  267.  
  268. installf -c base ${PKGINST} /usr/sbin/nwcm
  269. installf -f -c base ${PKGINST}
  270. removef ${PKGINST} /usr/sbin/nwcm.filter
  271. removef -f ${PKGINST}
  272.  
  273. # now run netcfg if its a norma (ie non isl) installation
  274.  
  275. if [ "${HOW_INSTALL}" = "NORMAL" -a -x ${NETCFG} ]
  276. then
  277.     #
  278.     #    execute the netcfg to modify information.
  279.     #
  280.     $NETCFG
  281. fi
  282.  
  283. cd /
  284. rm -fr ${CWD}
  285. removef -f ${PKGINST}
  286. if [ "$PKGINSTALL_TYPE" != NEWINSTALL ]
  287. then
  288.     exit 10
  289. else
  290.     exit 0
  291. fi
  292.