configMin.src 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275
  1. XCOMM! /bin/ksh
  2. XCOMM #######
  3. XCOMM Product: CDE
  4. XCOMM Fileset: CDE-MIN
  5. XCOMM configure
  6. XCOMM @(#) $TOG: configMin.src /main/1 1998/03/11 16:18:12 mgreess $
  7. XCOMM #######
  8. #define HASH #
  9. PRODUCT=CDE
  10. FILESET=CDE-MIN
  11. DO_CONFIGURATION=""
  12. retval=0
  13. FixEtcServices()
  14. {
  15. FILE=/etc/services
  16. TMPFILE=/tmp/services
  17. XCOMM
  18. XCOMM check for existence of /etc/services
  19. XCOMM
  20. if [ ! -f $FILE ] # highly unlikely
  21. then
  22. echo "" >$FILE
  23. fi
  24. XCOMM
  25. XCOMM see if it already exists
  26. XCOMM
  27. awk '{if ($1 == "dtspc")
  28. print $0 > "/tmp/dtspc-already-there"
  29. }' $FILE >/dev/null
  30. if [ ! -f /tmp/dtspc-already-there ]
  31. then
  32. echo "dtspc\t6112/tcp\t#subprocess control" >>$FILE
  33. else
  34. rm /tmp/dtspc-already-there
  35. fi
  36. XCOMM
  37. XCOMM remove legacy entries like dtspcd
  38. XCOMM
  39. awk '{if ($1 == "dtspcd" || $1 == "#dtspcd")
  40. ;
  41. else
  42. print $0
  43. }' $FILE >$TMPFILE
  44. cp $TMPFILE $FILE
  45. rm $TMPFILE
  46. }
  47. UnfixEtcServices()
  48. {
  49. FILE=/etc/services
  50. TMPFILE=/tmp/services
  51. awk '{if ($1 == "dtspc" && $2 == "6112/tcp")
  52. ;
  53. else
  54. print $0
  55. }' $FILE >$TMPFILE
  56. cp $TMPFILE $FILE
  57. rm $TMPFILE
  58. }
  59. FixEtcInetdDotConf()
  60. {
  61. FILE=/etc/inetd.conf
  62. TMPFILE=/tmp/inetd.conf
  63. XCOMM
  64. XCOMM check for existence of /etc/inetd.conf
  65. XCOMM
  66. if [ ! -f $FILE ] # highly unlikely
  67. then
  68. echo "" >$FILE
  69. fi
  70. XCOMM
  71. XCOMM see if it already exists
  72. XCOMM
  73. awk '{if ($1 == "dtspc")
  74. print $0 > "/tmp/dtspc-already-there"
  75. }' $FILE >/dev/null
  76. DTSPCD=CDE_INSTALLATION_TOP/bin/dtspcd
  77. if [ ! -f /tmp/dtspc-already-there ]
  78. then
  79. echo "dtspc stream tcp nowait root $DTSPCD $DTSPCD" >>$FILE
  80. else
  81. rm /tmp/dtspc-already-there
  82. fi
  83. XCOMM
  84. XCOMM remove legacy entries like dtspcd
  85. XCOMM
  86. awk '{if ($1 == "dtspcd" || $1 == "#dtspcd")
  87. ;
  88. else
  89. print $0
  90. }' $FILE >$TMPFILE
  91. cp $TMPFILE $FILE
  92. rm $TMPFILE
  93. }
  94. UnfixEtcInetdDotConf()
  95. {
  96. FILE=/etc/inetd.conf
  97. TMPFILE=/tmp/inetd.conf
  98. awk '{if ($1 == "dtspc")
  99. ;
  100. else
  101. print $0
  102. }' $FILE >$TMPFILE
  103. cp $TMPFILE $FILE
  104. rm $TMPFILE
  105. }
  106. FixEtcPamDotConf()
  107. {
  108. FILE=/etc/pam.conf
  109. ORIGFILE=/etc/pam.conf.preCDE
  110. XCOMM
  111. XCOMM check for existence of /etc/pam.conf
  112. XCOMM
  113. if [ -f $FILE ]
  114. then
  115. echo "" > $ORIGFILE
  116. cp CDE_INSTALLATION_TOP/config/sys.pam.conf $FILE
  117. chmod 644 $FILE
  118. else
  119. echo "Warning: $FILE already exists. Leaving it alone." 1>&2
  120. cp CDE_INSTALLATION_TOP/config/sys.pam.conf $ORIGFILE
  121. fi
  122. }
  123. UnfixEtcPamDotConf()
  124. {
  125. FILE=/etc/pam.conf
  126. TMPFILE=/etc/pam.conf.CDE
  127. ORIGFILE=/etc/pam.conf.preCDE
  128. if [ ! -f $FILE ]
  129. then
  130. echo "Warning: $FILE does not exist." 1>&2
  131. elif [ ! -f $ORIGFILE ]
  132. then
  133. echo "Warning: $ORIGFILE does not exist. Leaving $FILE alone." 1>&2
  134. else
  135. mv $FILE $TMPFILE
  136. cp $ORIGFILE $FILE
  137. chmod 664 $FILE
  138. fi
  139. }
  140. RemoveMinFiles()
  141. {
  142. while read SRC
  143. do
  144. if [ "$SRC" != "" ]
  145. then
  146. rm -f $SRC
  147. dirname=${SRC%/STAR}
  148. if [ -d $dirname ]
  149. then
  150. cd $dirname
  151. while [ "$dirname" != "$CDE_TOP" ]
  152. do
  153. cd ..
  154. rmdir ${dirname##STAR/} >/dev/null 2>/dev/null
  155. dirname=${dirname%/STAR}
  156. done
  157. fi
  158. fi
  159. done <<-EOF
  160. #include "CDE-MIN.list"
  161. EOF
  162. }
  163. VerifyInstalledFiles()
  164. {
  165. echo "Status mode owner group filename"
  166. echo "-----------------------------------------"
  167. XCOMM exists correct correct correct /usr/dt/foo1
  168. XCOMM MISSING WRONG WRONG WRONG /usr/dt/foo2
  169. XCOMM exists the link is correct /usr/dt/link
  170. while read SRC
  171. do
  172. #include "../verify.func"
  173. done <<-EOF
  174. #include "CDE-MIN.lst"
  175. EOF
  176. }
  177. #include "../option.func"
  178. XCOMM ###############################################################
  179. XCOMM
  180. XCOMM Main Body
  181. XCOMM
  182. XCOMM ###############################################################
  183. HandleOption $*
  184. if [ "$OPERATION" = "configure" ]
  185. then
  186. FixEtcServices
  187. FixEtcInetdDotConf
  188. HASH FixEtcPamDotConf
  189. HASH
  190. HASH create the /var/dt/tmp directory for the dtspcd
  191. HASH
  192. if [ ! -d CDE_LOGFILES_TOP/tmp ]
  193. then
  194. mkdir -p CDE_LOGFILES_TOP/tmp
  195. fi
  196. elif [ "$OPERATION" = "deconfigure" ]
  197. then
  198. UnfixEtcServices
  199. UnfixEtcInetdDotConf
  200. UnfixEtcPamDotConf
  201. RemoveMinFiles
  202. VerifyInstalledFiles
  203. elif [ "$OPERATION" = "verify" ]
  204. then
  205. VerifyInstalledFiles
  206. fi
  207. if [ "$OPERATION" != "verify" ]
  208. then
  209. HASH issue a SIGHUP to the inetd process
  210. ps -ef | grep inetd | grep -v grep >/tmp/tmppsout
  211. if [ -s /tmp/tmppsout ]
  212. then
  213. awk '{print "kill -1 " $2}' /tmp/tmppsout | /bin/sh
  214. else
  215. [ -x /usr/sbin/inetd ] && /usr/sbin/inetd
  216. fi
  217. fi
  218. return $retval