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

  1. #ident    "@(#)pkg.acp:postinstall    1.2.8.1"
  2.  
  3. PKGMSG=${PKGINST}.pkg
  4. LOCALE=${LC_ALL:-${LC_MESSAGES:-${LANG:-"C"}}}
  5.  
  6. if [ -f "${REQDIR}/inst/locale/${LOCALE}/${PKGMSG}" -a \
  7.     -d "/usr/lib/locale/${LOCALE}/LC_MESSAGES" ]
  8. then
  9.     [ -f /usr/lib/locale/${LOCALE}/LC_MESSAGES/${PKGMSG} ] || \
  10.     ln -s ${REQDIR}/inst/locale/${LOCALE}/${PKGMSG} \
  11.         /usr/lib/locale/${LOCALE}/LC_MESSAGES
  12. fi
  13.  
  14. SCRIPTS=/usr/sbin/pkginst
  15. . ${SCRIPTS}/updebug
  16.  
  17. [ "$UPDEBUG" = YES ] && {
  18.     set -x
  19.     goany
  20. }
  21.  
  22. cleanup_exit() {
  23.     # $1 is the exit code
  24.     # clean up any tmp files created by upnover tools and then exit.
  25.  
  26.     [ "$UPDEBUG" = YES ] && goany "cleanup_exit $1 $PKGINST"
  27.  
  28.     [ "$PKGINST" ] || PKGINST=acp
  29.     $SCRIPTS/up_cleanup "$PKGINST"
  30.     exit     $1
  31. }
  32.  
  33.  
  34. # install a module.  $1 is the module name
  35.  
  36. do_install() {
  37.     ERR=/tmp/${1}.err
  38.  
  39.     if [ -f ${1}.Dr ]; then mv ${1}.Dr Driver.o; fi
  40.     if [ -f ${1}_atup.Dr ]; then mv ${1}_atup.Dr Driver_atup.o; fi
  41.     if [ -f ${1}_mp.Dr ]; then mv ${1}_mp.Dr Driver_mp.o; fi
  42.  
  43.     if
  44.         [ -f ${1}.Mo ]
  45.     then
  46.         mv ${1}.Mo Modstub.o
  47.     fi
  48.     if
  49.         [ -f ${1}.Sp ]
  50.     then
  51.         mv ${1}.Sp Space.c
  52.     fi
  53.     if
  54.         [ -f ${1}.St ]
  55.     then
  56.         mv ${1}.St Stubs.c
  57.     fi
  58.     if
  59.         [ -f ${1}.Mt ]
  60.     then
  61.         mv ${1}.Mt Mtune
  62.     fi
  63.     if
  64.         [ -f ${1}.Dt ]
  65.     then
  66.         mv ${1}.Dt Dtune
  67.     fi
  68.     if
  69.         [ -f ${1}.Ma ]
  70.     then
  71.         mv ${1}.Ma Master
  72.     fi
  73.     if
  74.         [ -f ${1}.Sy ]
  75.     then
  76.         sed "${SEDCMD1}" ${1}.Sy >System
  77.         rm -rf ${1}.Sy
  78.     fi
  79.     if
  80.         [ -f ${1}.No ]
  81.     then
  82.         mv ${1}.No Node
  83.     fi
  84.  
  85.     ${CONFBIN}/idcheck -p ${1} > ${ERR} 2>&1
  86.     if
  87.         [ "$?" = "0" ] || [ "$?" = "8" ] 
  88.     then
  89.         ${CONFBIN}/idinstall -P ${PKGINST} -a ${1} > ${ERR} 2>&1
  90.         ret=$?
  91.     else
  92.         ${CONFBIN}/idinstall -P ${PKGINST}  -u ${1} > ${ERR} 2>&1
  93.         ret=$?
  94.     fi
  95.  
  96.     if [ ${ret} != "0" ]
  97.     then
  98.             message -d `pfmt -s nostd -g ${PKGMSG}:1 "The installation cannot be completed due to an error in the driver installation during the installation of the %s module of the %s.  The file %s contains the errors." ${1} ${NAME} ${ERR} 2>&1`
  99.             cleanup_exit ${FAILURE}
  100.     fi
  101.     #rm -rf ${ERR}
  102. }
  103.  
  104. turnoff () {
  105. cd /etc/conf/sdevice.d
  106. for i in $*
  107. do
  108. if [ -f $i ]
  109. then
  110. ed $i << END > /dev/null 2>&1
  111. 1,\$s/    Y    /    N    /
  112. w
  113. w
  114. q
  115. END
  116. fi
  117. done
  118. }
  119.  
  120. turnon () {
  121. cd /etc/conf/sdevice.d
  122. for i in $*
  123. do
  124. if [ -f $i ]
  125. then
  126. ed $i << END > /dev/null 2>&1
  127. 1,\$s/    N    /    Y    /
  128. w
  129. w
  130. q
  131. END
  132. fi
  133. done
  134. }
  135.  
  136. #main 
  137.  
  138. FAILURE=1    # fatal error
  139.  
  140. CONFDIR=/etc/conf
  141. CONFBIN=${CONFDIR}/bin
  142.  
  143. NOTOOLS=`pfmt -s error -g ${PKGMSG}:2 " The Installable Driver feature has been removed. The %s cannot be installed." ${NAME} 2>&1`
  144.  
  145. SEDCMD1="s/[     ]N[     ]/    Y    /"
  146. SEDCMD2="s/[     ]N/    Y/"
  147.  
  148. trap '' 1 2 3 5 15
  149. rm -f $TMP > /dev/null 2>&1
  150.  
  151.  
  152. turnon intmap
  153.  
  154.  
  155. ############# Begin UPGRADE AND OVERLAY #######################
  156.  
  157. # If $UPGFILE exists, dot it in. This is where the value for
  158. # $NSCO is whether or not the request script was run.
  159.  
  160. UPGRADE_STORE=/etc/inst/save.user
  161. UPGFILE=${UPGRADE_STORE}/${PKGINST}.env
  162.  
  163. [ -f  $UPGFILE ] && . $UPGFILE
  164.  
  165. [ "$UPDEBUG" = YES ] && goany
  166.  
  167. ############# End UPGRADE AND OVERLAY #######################
  168.  
  169. # sco_pt.install uses idtune, since may not have reboot since NSU
  170. # we generate the temporary mtune just in case.
  171.  
  172. # create temporary /etc/conf/cf.d/mtune; it's blown away
  173. # below after we're done playing w/the tuneables....
  174. # do not clobber mtune if it exists already
  175. MTUNEORG=/usr/tmp/mtune.$$
  176. if [ -f /etc/conf/cf.d/mtune ]
  177. then
  178.         cp /etc/conf/cf.d/mtune $MTUNEORG
  179.         cat /etc/conf/mtune.d/* >> /etc/conf/cf.d/mtune
  180. else
  181.         cat /etc/conf/mtune.d/* > /etc/conf/cf.d/mtune
  182. fi
  183.  
  184. #
  185. # call the sco pseudo terminal installation script to install 'NSCO' 
  186. # SCO devices onto the regular USL pseudo terms (ptm, pts, ptem). It
  187. # will update the ptm, pts, ptem 'id' files, do putdevs and install
  188. # a RC script to 'autopush' ptem/ldterm on the slave side.
  189. #
  190.  
  191. /sbin/sh /var/sadm/pkg/acp/install/sco_pt.install $NSCO
  192.  
  193. # if mtune existed restore it, else remove temp /etc/conf/cf.d/mtune
  194. if [ -f $MTUNEORG ]
  195. then
  196.         cp $MTUNEORG /etc/conf/cf.d/mtune
  197.         rm -f $MTUNEORG
  198. else
  199.         rm -f /etc/conf/cf.d/mtune 2>/dev/null 1>/dev/null
  200. fi
  201.  
  202. cd /var/sadm/pkg/${PKG}/install
  203.  
  204. # determine that ID/TP tools are available
  205.  
  206. if
  207.     [ ! -x ${CONFBIN}/idbuild -o ! -x ${CONFBIN}/idinstall ]
  208. then
  209.     message -d ${NOTOOLS}
  210.     cleanup_exit $FAILURE
  211. fi
  212.  
  213. # install modules
  214. # any modules installed here should have the /tmp files removed in the
  215. # removef loop below.
  216. #
  217. for module in XENIX consem devadp i286x isocket osocket sp v3compat xnamfs xout
  218. do
  219.     cd /tmp/${module}
  220.     do_install ${module}
  221. done
  222.  
  223. # rebuild for changes to take effect
  224.  
  225. TMP=/tmp/acp.$$
  226. ${CONFBIN}/idbuild 2>>${TMP}
  227. if
  228.     [ "$?" -ne "0" ]
  229. then
  230.     pfmt -s nostd -g ${PKGMSG}:4 "An error has occurred during the rebuild of the UNIX System.\nErrors have been written to the file %s\n" ${TMP} 2>&1
  231.     cleanup_exit ${FAILURE}
  232. fi
  233.  
  234. rm -f ${TMP} 1>/dev/null 2>/dev/null
  235.  
  236. # Remove temporary files in /tmp/${module} from the contents database
  237.  
  238. rm -f /tmp/MOD_FILES
  239. for module in XENIX consem devadp i286x isocket osocket sp v3compat xnamfs xout
  240. do
  241.     echo "/tmp/${module}/${module}_atup.Dr\n\
  242. /tmp/${module}/${module}_mp.Dr\n\
  243. /tmp/${module}/${module}.Dr\n\
  244. /tmp/${module}/${module}.Mo\n\
  245. /tmp/${module}/${module}.Sp\n\
  246. /tmp/${module}/${module}.Ma\n\
  247. /tmp/${module}/${module}.Sy\n\
  248. /tmp/${module}/${module}.St\n\
  249. /tmp/${module}/${module}.Mt\n\
  250. /tmp/${module}/${module}.Dt\n\
  251. /tmp/${module}/${module}.No\n\
  252. /tmp/${module}" >> /tmp/MOD_FILES
  253. done
  254.  
  255. removef ${PKGINST} - < /tmp/MOD_FILES 2>/dev/null
  256. rm -f /tmp/MOD_FILES
  257.  
  258. # change group to dos and grp perms to rw for /dev/*dsk/[01]s5
  259.  
  260. if [ -b /dev/dsk/[01]s5 ]
  261. then chgrp dos /dev/dsk/[01]s5
  262.      chmod g+rw /dev/dsk/[01]s5
  263. fi
  264. if [ -c /dev/rdsk/[01]s5 ]
  265. then chgrp dos /dev/rdsk/[01]s5
  266.      chmod g+rw /dev/rdsk/[01]s5
  267. fi
  268.  
  269. if [ -b /dev/dsk/1s0 ]
  270. then
  271.     for j in 0 1 2 3 4 5 6
  272.     do
  273.         ln -s /dev/dsk/1s${j} /dev/hd1${j} > /dev/null 2>&1
  274.     done
  275.     for j in 0 1 2 3 4 5 6
  276.     do
  277.         ln -s /dev/rdsk/1s${j} /dev/rhd1${j} > /dev/null 2>&1
  278.     done
  279.  
  280.     # Enhanced Application Compatibility Support
  281.     ln /dev/dsk/1s0 /dev/hd1a > /dev/null 2>&1
  282.     ln /dev/dsk/1s0 /dev/u0 > /dev/null 2>&1
  283.     ln /dev/dsk/1s1 /dev/u1 > /dev/null 2>&1
  284.     ln /dev/dsk/1s2 /dev/u2 > /dev/null 2>&1
  285.  
  286.     ln /dev/rdsk/1s0 /dev/rhd1a > /dev/null 2>&1
  287.     # End Enhanced Application Compatibility Support
  288.  
  289. fi
  290. if [ -b /dev/dsk/f1t ]
  291. then
  292.     ln /dev/dsk/f1t /dev/install1 > /dev/null 2>&1
  293.     ln /dev/rdsk/f1t /dev/rinstall1 > /dev/null 2>&1
  294.  
  295.     ln /dev/dsk/f1d8dt /dev/fd148ds8 > /dev/null 2>&1
  296.     ln /dev/dsk/f1d9dt /dev/fd148ds9 > /dev/null 2>&1
  297.     ln /dev/dsk/f1d9dt /dev/fd148 > /dev/null 2>&1
  298.     ln /dev/rdsk/f1d8dt /dev/rfd148ds8 > /dev/null 2>&1
  299.     ln /dev/rdsk/f1d9dt /dev/rfd148ds9 > /dev/null 2>&1
  300.     ln /dev/rdsk/f1d9dt /dev/rfd148 > /dev/null 2>&1
  301.     ln /dev/dsk/f13ht /dev/fd1135ds18 > /dev/null 2>&1
  302.     ln /dev/dsk/f13ht /dev/fd196ds18 > /dev/null 2>&1
  303.     ln /dev/dsk/f13ht /dev/dsk/f1q18dt > /dev/null 2>&1
  304.     ln /dev/dsk/f13dt /dev/fd1135ds9 > /dev/null 2>&1
  305.     ln /dev/dsk/f13dt /dev/fd196ds9 > /dev/null 2>&1
  306.     ln /dev/dsk/f13dt /dev/dsk/f1q9dt > /dev/null 2>&1
  307.     #ln /dev/dsk/f1d8dt /dev/fd148ss8 > /dev/null 2>&1
  308.     ln /dev/dsk/f1d8dt /dev/dsk/f1d8t > /dev/null 2>&1
  309.     #ln /dev/dsk/f1d9dt /dev/fd148ss9 > /dev/null 2>&1
  310.     ln /dev/dsk/f1d9dt /dev/dsk/f1d9t > /dev/null 2>&1
  311.  
  312.     ln /dev/dsk/f1q15dt /dev/fd196ds15 > /dev/null 2>&1
  313.     ln /dev/dsk/f1q15dt /dev/fd196 > /dev/null 2>&1
  314.     ln /dev/rdsk/f1q15dt /dev/rfd196ds15 > /dev/null 2>&1
  315.     ln /dev/rdsk/f1q15dt /dev/rfd196 > /dev/null 2>&1
  316.     ln /dev/rdsk/f1d9dt /dev/rfd148 > /dev/null 2>&1
  317.     ln /dev/rdsk/f13ht /dev/rfd1135ds18 > /dev/null 2>&1
  318.     ln /dev/rdsk/f13ht /dev/rfd196ds18 > /dev/null 2>&1
  319.     ln /dev/rdsk/f13ht /dev/rdsk/f1q18dt > /dev/null 2>&1
  320.     ln /dev/rdsk/f13dt /dev/rfd1135ds9 > /dev/null 2>&1
  321.     ln /dev/rdsk/f13dt /dev/rfd196ds9 > /dev/null 2>&1
  322.     ln /dev/rdsk/f13dt /dev/rdsk/f1q9dt > /dev/null 2>&1
  323.     #ln /dev/rdsk/f1d8dt /dev/rfd148ss8 > /dev/null 2>&1
  324.     ln /dev/rdsk/f1d8dt /dev/rdsk/f1d8t > /dev/null 2>&1
  325.     #ln /dev/rdsk/f1d9dt /dev/rfd148ss9 > /dev/null 2>&1
  326.     ln /dev/rdsk/f1d9dt /dev/rdsk/f1d9t > /dev/null 2>&1
  327.  
  328.     # Enhanced Application Compatibility Support
  329.     ln /dev/dsk/f15d9 /dev/sctfdl129 > /dev/null 2>&1
  330.     ln /dev/fd148 /dev/sctfdl1 > /dev/null 2>&1
  331.     ln /dev/fd196 /dev/sctfdm1 > /dev/null 2>&1
  332.     ln /dev/dsk/f15h /dev/sctfdm129 > /dev/null 2>&1
  333.     # Enhanced Application Compatibility Support
  334.  
  335. fi
  336.  
  337. rm -f $TMP
  338.  
  339. # Create the dtruntime.so.1 lib from the pieces
  340. cat /usr/X/lib/dtruntime.ab /usr/X/lib/dtruntime.ac /usr/X/lib/dtruntime.ad >> /usr/X/lib/dtruntime.so.1
  341. installf ${PKGINST} /usr/X/lib/dtruntime.so.1 f 0644 bin bin
  342. installf -f ${PKGINST}
  343.  
  344. for tmpXlib in dtruntime.ab dtruntime.ac dtruntime.ad
  345. do
  346.     echo "/usr/X/lib/${tmpXlib}"
  347. done >> /tmp/X_FILES
  348. removef ${PKGINST} - < /tmp/X_FILES 2>/dev/null
  349. removef -f ${PKGINST} 2>/dev/null
  350. rm -f /tmp/X_FILES
  351.  
  352. ${SCRIPTS}/pkgmrgconf "${PKGINST}" "$AUTOMERGE" "$NAME"
  353.  
  354. # clean up any tmp files created by upnover tools
  355. cleanup_exit 10
  356.