configRun.src 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322
  1. XCOMM! /bin/ksh
  2. XCOMM #######
  3. XCOMM Product: CDE
  4. XCOMM Fileset: CDE-RUN
  5. XCOMM configure
  6. XCOMM @(#) $XConsortium: configRun.src /main/6 1996/10/18 16:26:20 drk $
  7. XCOMM #######
  8. #define HASH #
  9. #define STAR *
  10. PRODUCT=CDE
  11. FILESET=CDE-RUN
  12. DO_CONFIGURATION=""
  13. retval=0
  14. FixInetdDotConf()
  15. {
  16. FILE=/etc/inetd.conf
  17. TMPFILE=/tmp/inetd.conf
  18. CMSD=CDE_INSTALLATION_TOP/bin/rpc.cmsd
  19. XCOMM
  20. XCOMM desired inetd.conf entry:
  21. XCOMM 100068/2-4 dgram rpc/udp wait root CDE_INSTALLATION_TOP/bin/rpc.cmsd rpc.cmsd
  22. XCOMM
  23. XCOMM first make an awk script and put it in a file.
  24. XCOMM
  25. XCOMM comment out any non-cde rpc.cmsd lines
  26. XCOMM
  27. nawk -v cmsd=$CMSD \
  28. '{if ($1 == "100068/2-4" && $6 != cmsd)
  29. print "#cde " $0;
  30. else
  31. print $0
  32. }' $FILE >$TMPFILE
  33. cp $TMPFILE $FILE
  34. rm $TMPFILE
  35. XCOMM remove any cde 2-4 cmsd
  36. XCOMM
  37. nawk -v cmsd=$CMSD \
  38. '{if ($1 == "100068/2-4" && $6 == cmsd)
  39. ;
  40. else
  41. print $0
  42. }' $FILE >$TMPFILE
  43. cp $TMPFILE $FILE
  44. rm $TMPFILE
  45. XCOMM
  46. XCOMM now run an awk script to see if there is an occurrence of 2-5 cmsd
  47. XCOMM
  48. nawk -v cmsd=$CMSD \
  49. '{if ($6 == cmsd && $1 == "100068/2-5")
  50. print $0 > "/tmp/cmsd-already-there"
  51. }' $FILE >/dev/null
  52. XCOMM
  53. XCOMM if it is not there, add it
  54. XCOMM
  55. if [ ! -f /tmp/cmsd-already-there ]
  56. then
  57. echo "100068/2-5 dgram rpc/udp wait root $CMSD rpc.cmsd" >>$FILE
  58. else
  59. rm /tmp/cmsd-already-there
  60. fi
  61. }
  62. UnfixInetdDotConf()
  63. {
  64. FILE=/etc/inetd.conf
  65. TMPFILE=/tmp/inetd.conf
  66. CMSD=CDE_INSTALLATION_TOP/bin/rpc.cmsd
  67. HASH first remove the CDE rpc.cmsd entry
  68. nawk -v cmsd=$CMSD \
  69. '{if (($1 == "100068/2-4" || $1 == "100068/2-5") && $6 == cmsd)
  70. ;
  71. else
  72. print $0
  73. }' $FILE >$TMPFILE
  74. cp $TMPFILE $FILE
  75. rm $TMPFILE
  76. HASH now uncomment any previously existing 100068 entry
  77. awk '{if ($1 == "#cde") {
  78. if ($2 == "100068/2-4") {
  79. $1 = $2;
  80. $2 = ""
  81. }
  82. }
  83. print $0
  84. }' $FILE >$TMPFILE
  85. cp $TMPFILE $FILE
  86. rm $TMPFILE
  87. }
  88. CreateAppConfigDirectory()
  89. {
  90. HASH
  91. HASH Create the APPCONFIG directory inside DT_CONFIG_TOP and create
  92. HASH all of its subdirectories
  93. HASH
  94. cd $DT_CONFIG_TOP
  95. if [ ! -d $APPCONFIG ]
  96. then
  97. mkdir $APPCONFIG
  98. fi
  99. cd $APPCONFIG
  100. for i in $APPCONFIG_DIRS
  101. do
  102. if [ ! -d $i ]
  103. then
  104. mkdir $i
  105. fi
  106. cd $i
  107. HASH
  108. HASH for each locale
  109. HASH
  110. for j in $DT_TOP/$APPCONFIG/$i/STAR
  111. do
  112. if [ ! -d `basename $j` ]
  113. then
  114. mkdir `basename $j`
  115. fi
  116. done
  117. cd ..
  118. done
  119. }
  120. doDttermTerminfo()
  121. {
  122. if [ -f $DT_TOP/config/dtterm.ti ]
  123. then
  124. tic $DT_TOP/config/dtterm.ti
  125. if [ -f /usr/share/lib/terminfo/d/dtterm ]
  126. then
  127. chown bin /usr/share/lib/terminfo/d/dtterm
  128. chgrp bin /usr/share/lib/terminfo/d/dtterm
  129. chmod 644 /usr/share/lib/terminfo/d/dtterm
  130. else
  131. echo "Unable to compile $DT_TOP/config/dtterm.ti"
  132. fi
  133. else
  134. echo "Unable to find $DT_TOP/config/dtterm.ti"
  135. fi
  136. }
  137. RemoveRunFiles()
  138. {
  139. while read SRC
  140. do
  141. if [ "$SRC" != "" ]
  142. then
  143. rm -f $SRC
  144. dirname=${SRC%/STAR}
  145. if [ -d $dirname ]
  146. then
  147. cd $dirname
  148. while [ "$dirname" != "$CDE_TOP" ]
  149. do
  150. cd ..
  151. rmdir ${dirname##STAR/} >/dev/null 2>/dev/null
  152. dirname=${dirname%/STAR}
  153. done
  154. fi
  155. fi
  156. done <<-EOF
  157. #include "CDE-RUN.list"
  158. EOF
  159. }
  160. VerifyInstalledFiles()
  161. {
  162. echo "Status mode owner group filename"
  163. echo "-----------------------------------------"
  164. XCOMM exists correct correct correct /usr/dt/foo1
  165. XCOMM MISSING WRONG WRONG WRONG /usr/dt/foo2
  166. XCOMM exists the link is correct /usr/dt/link
  167. while read SRC
  168. do
  169. #include "../verify.func"
  170. done <<-EOF
  171. #include "CDE-RUN.lst"
  172. EOF
  173. }
  174. #include "../option.func"
  175. XCOMM ##########################################################################
  176. XCOMM
  177. XCOMM Main Body
  178. XCOMM
  179. XCOMM ##########################################################################
  180. PRODUCT=CDE
  181. FILESET=CDE-RUN
  182. DT_TOP=CDE_INSTALLATION_TOP
  183. DT_CONFIG_TOP=CDE_CONFIGURATION_TOP
  184. DT_TEMP_TOP=CDE_LOGFILES_TOP
  185. ROOT=/
  186. retval=0
  187. APPCONFIG=appconfig
  188. APPCONFIG_DIRS="appmanager help icons types"
  189. PRINTERS=""
  190. DEFAULT_PRINTER="DtPrint"
  191. HandleOption $*
  192. if [ "$OPERATION" = "configure" ]
  193. then
  194. HASH
  195. HASH create the CDE_LOGFILES_TOP directory
  196. HASH
  197. if [ ! -d $DT_TEMP_TOP/$APPCONFIG/appmanager ]
  198. then
  199. mkdir -p $DT_TEMP_TOP/$APPCONFIG/appmanager
  200. fi
  201. cd $DT_TEMP_TOP
  202. mv $APPCONFIG/appmanager .hidden-appmanager
  203. chmod -R 755 *
  204. chmod 755 .hidden-appmanager
  205. chown -R bin *
  206. chgrp -R bin *
  207. mv .hidden-appmanager $APPCONFIG/appmanager
  208. chmod 755 .
  209. chown bin .
  210. chgrp bin .
  211. HASH
  212. HASH create the CDE_CONFIGURATION_TOP and its config directory
  213. HASH
  214. if [ ! -d $DT_CONFIG_TOP ]
  215. then
  216. mkdir -p $DT_CONFIG_TOP
  217. fi
  218. if [ ! -d $DT_CONFIG_TOP/config ]
  219. then
  220. mkdir -p $DT_CONFIG_TOP/config
  221. fi
  222. CreateAppConfigDirectory
  223. HASH
  224. HASH ConfigurePrintersDir
  225. HASH
  226. env LANG=C /usr/dt/bin/dtprintinfo -populate 2>/dev/null
  227. HASH
  228. HASH Configure Xsession.d
  229. HASH
  230. cd $DT_CONFIG_TOP/config
  231. if [ ! -d Xsession.d ]
  232. then
  233. mkdir Xsession.d
  234. fi
  235. cd $DT_CONFIG_TOP
  236. chmod -R 755 *
  237. FixInetdDotConf
  238. doDttermTerminfo
  239. elif [ "$OPERATION" = "deconfigure" ]
  240. then
  241. UnfixInetdDotConf
  242. RemoveRunFiles
  243. VerifyInstalledFiles
  244. elif [ "$OPERATION" = "verify" ]
  245. then
  246. VerifyInstalledFiles
  247. fi
  248. if [ "$OPERATION" != "verify" ]
  249. then
  250. HASH issue a SIGHUP to the inetd process
  251. ps -ef | grep inetd | grep -v grep >/tmp/tmppsout
  252. if [ -s /tmp/tmppsout ]
  253. then
  254. awk '{print "kill -1 " $2}' /tmp/tmppsout | /bin/sh
  255. else
  256. /usr/sbin/inetd -s
  257. fi
  258. fi
  259. return $retval