configRun.src 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328
  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 desired inetd.conf entry:
  21. XCOMM cmsd/2-4 dgram rpc/udp4 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. awk -v cmsd=$CMSD \
  28. '{if ($1 == "cmsd/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. awk -v cmsd=$CMSD \
  38. '{if ($1 == "cmsd/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. awk -v cmsd=$CMSD \
  49. '{if ($6 == cmsd && $1 == "cmsd/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 "cmsd/2-5 dgram rpc/udp4 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. awk -v cmsd=$CMSD \
  69. '{if (($1 == "cmsd/2-4" || $1 == "cmsd/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 cmsd entry
  77. awk '{if ($1 == "#cde") {
  78. if ($2 == "cmsd/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. else
  126. echo "Unable to find $DT_TOP/config/dtterm.ti"
  127. fi
  128. }
  129. RemoveRunFiles()
  130. {
  131. while read SRC
  132. do
  133. if [ "$SRC" != "" ]
  134. then
  135. rm -f $SRC
  136. dirname=${SRC%/STAR}
  137. if [ -d $dirname ]
  138. then
  139. cd $dirname
  140. while [ "$dirname" != "$CDE_TOP" ]
  141. do
  142. cd ..
  143. rmdir ${dirname##STAR/} >/dev/null 2>/dev/null
  144. dirname=${dirname%/STAR}
  145. done
  146. fi
  147. fi
  148. done <<-EOF
  149. #include "CDE-RUN.list"
  150. EOF
  151. }
  152. VerifyInstalledFiles()
  153. {
  154. echo "Status mode owner group filename"
  155. echo "-----------------------------------------"
  156. XCOMM exists correct correct correct /usr/dt/foo1
  157. XCOMM MISSING WRONG WRONG WRONG /usr/dt/foo2
  158. XCOMM exists the link is correct /usr/dt/link
  159. while read SRC
  160. do
  161. #include "../verify.func"
  162. done <<-EOF
  163. #include "CDE-RUN.lst"
  164. EOF
  165. }
  166. PrintUsage()
  167. {
  168. echo "Usage:" $0 "[OPERATION]"
  169. echo ""
  170. echo "Operations:"
  171. echo " -e configure"
  172. echo " -d deconfigure"
  173. echo " -v verify"
  174. echo " -s size"
  175. echo " -h help"
  176. }
  177. #include "../option.func"
  178. XCOMM ##########################################################################
  179. XCOMM
  180. XCOMM Main Body
  181. XCOMM
  182. XCOMM ##########################################################################
  183. PRODUCT=CDE
  184. FILESET=CDE-RUN
  185. DT_TOP=CDE_INSTALLATION_TOP
  186. DT_CONFIG_TOP=CDE_CONFIGURATION_TOP
  187. DT_TEMP_TOP=CDE_LOGFILES_TOP
  188. ROOT=/
  189. retval=0
  190. APPCONFIG=appconfig
  191. APPCONFIG_DIRS="appmanager help icons types"
  192. PRINTERS=""
  193. DEFAULT_PRINTER="DtPrint"
  194. HandleOption $*
  195. if [ "$OPERATION" = "usage" ]
  196. then
  197. PrintUsage
  198. exit 0
  199. fi
  200. if [ "$OPERATION" = "configure" ]
  201. then
  202. HASH
  203. HASH create the CDE_LOGFILES_TOP directory
  204. HASH
  205. if [ ! -d $DT_TEMP_TOP/$APPCONFIG/appmanager ]
  206. then
  207. mkdir -p $DT_TEMP_TOP/$APPCONFIG/appmanager
  208. fi
  209. cd $DT_TEMP_TOP
  210. mv $APPCONFIG/appmanager .hidden-appmanager
  211. chmod -R 755 *
  212. chmod 755 .hidden-appmanager
  213. chown -R bin *
  214. chgrp -R bin *
  215. mv .hidden-appmanager $APPCONFIG/appmanager
  216. chmod 755 .
  217. chown bin .
  218. chgrp bin .
  219. HASH
  220. HASH create the CDE_CONFIGURATION_TOP and its config directory
  221. HASH
  222. if [ ! -d $DT_CONFIG_TOP ]
  223. then
  224. mkdir -p $DT_CONFIG_TOP
  225. fi
  226. if [ ! -d $DT_CONFIG_TOP/config ]
  227. then
  228. mkdir -p $DT_CONFIG_TOP/config
  229. fi
  230. CreateAppConfigDirectory
  231. HASH
  232. HASH ConfigurePrintersDir
  233. HASH
  234. HASH env LANG=C /usr/dt/bin/dtprintinfo -populate
  235. HASH
  236. HASH Configure Xsession.d
  237. HASH
  238. cd $DT_CONFIG_TOP/config
  239. if [ ! -d Xsession.d ]
  240. then
  241. mkdir Xsession.d
  242. fi
  243. cd $DT_CONFIG_TOP
  244. chmod -R 755 *
  245. FixInetdDotConf
  246. elif [ "$OPERATION" = "deconfigure" ]
  247. then
  248. UnfixInetdDotConf
  249. RemoveRunFiles
  250. VerifyInstalledFiles
  251. elif [ "$OPERATION" = "verify" ]
  252. then
  253. VerifyInstalledFiles
  254. fi
  255. if [ "$OPERATION" != "verify" ]
  256. then
  257. HASH issue a SIGHUP to the inetd process
  258. /etc/rc.d/inetd reload >/dev/null
  259. fi
  260. HASH dtmail requires setgid
  261. chmod 2555 $DT_TOP/bin/dtmail
  262. return $retval