configRun.src 6.3 KB

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