configTT.src 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175
  1. XCOMM! /bin/ksh
  2. XCOMM #######
  3. XCOMM Product: CDE
  4. XCOMM Fileset: CDE-TT
  5. XCOMM configure
  6. XCOMM @(#) $TOG: configTT.src /main/1 1998/03/11 16:18:40 mgreess $
  7. XCOMM #######
  8. XCOMM
  9. XCOMM (c) Copyright Hewlett-Packard Company, 1993
  10. XCOMM
  11. XCOMM #######
  12. #define HASH #
  13. PRODUCT=CDE
  14. FILESET=CDE-TT
  15. DO_CONFIGURATION=""
  16. retval=0
  17. FixInetdDotConf()
  18. {
  19. FILE=/etc/inetd.conf
  20. TMPFILE=/tmp/inetd.conf
  21. TTDBSERVERD=CDE_INSTALLATION_TOP/bin/rpc.ttdbserver
  22. XCOMM
  23. XCOMM check for existence of /etc/inetd.conf
  24. XCOMM
  25. if [ ! -f $FILE ] # highly unlikely
  26. then
  27. echo "" >$FILE
  28. fi
  29. XCOMM
  30. XCOMM see if it already exists
  31. XCOMM
  32. awk -v ttdb=$TTDBSERVERD \
  33. '{if ($1 == "100083/1" && $6 != ttdb)
  34. print "#cde " $0;
  35. else
  36. print $0
  37. }' $FILE >$TMPFILE
  38. cp $TMPFILE $FILE
  39. rm $TMPFILE
  40. awk '{if ($1 == "100083/1")
  41. print $0 > "/tmp/tt-already-there"
  42. }' $FILE >/dev/null
  43. if [ ! -f /tmp/tt-already-there ]
  44. then
  45. echo "100083/1 stream rpc/tcp wait root $TTDBSERVERD $TTDBSERVERD" \
  46. >>$FILE
  47. else
  48. rm /tmp/tt-already-there
  49. fi
  50. }
  51. UnfixInetdDotConf()
  52. {
  53. FILE=/etc/inetd.conf
  54. TMPFILE=/tmp/inetd.conf
  55. TTDBSERVERD=CDE_INSTALLATION_TOP/bin/rpc.ttdbserver
  56. awk -v ttdb=$TTDBSERVERD \
  57. '{if ($1 == "100083/1" && $6 == ttdb)
  58. ;
  59. else
  60. print $0
  61. }' $FILE >$TMPFILE
  62. cp $TMPFILE $FILE
  63. rm $TMPFILE
  64. awk '{if ($1 == "#cde" && ($2 == "100083/1" || $2 == "100083")) {
  65. $1 = $2;
  66. $2 = ""
  67. }
  68. print $0
  69. }' $FILE >$TMPFILE
  70. cp $TMPFILE $FILE
  71. rm $TMPFILE
  72. }
  73. RemoveTTFiles()
  74. {
  75. while read SRC
  76. do
  77. if [ "$SRC" != "" ]
  78. then
  79. rm -f $SRC
  80. dirname=${SRC%/STAR}
  81. if [ -d $dirname ]
  82. then
  83. cd $dirname
  84. while [ "$dirname" != "$CDE_TOP" ]
  85. do
  86. cd ..
  87. rmdir ${dirname##STAR/} >/dev/null 2>/dev/null
  88. dirname=${dirname%/STAR}
  89. done
  90. fi
  91. fi
  92. done <<-EOF
  93. #include "CDE-TT.list"
  94. EOF
  95. }
  96. VerifyInstalledFiles()
  97. {
  98. echo "Status mode owner group filename"
  99. echo "-----------------------------------------"
  100. XCOMM exists correct correct correct /usr/dt/foo1
  101. XCOMM MISSING WRONG WRONG WRONG /usr/dt/foo2
  102. XCOMM exists the link is correct /usr/dt/link
  103. while read SRC
  104. do
  105. #include "../verify.func"
  106. done <<-EOF
  107. #include "CDE-TT.lst"
  108. EOF
  109. }
  110. #include "../option.func"
  111. XCOMM ######################################################################
  112. XCOMM
  113. XCOMM Main Body
  114. XCOMM
  115. XCOMM ######################################################################
  116. HandleOption $*
  117. if [ "$OPERATION" = "configure" ]
  118. then
  119. FixInetdDotConf
  120. elif [ "$OPERATION" = "deconfigure" ]
  121. then
  122. UnfixInetdDotConf
  123. RemoveTTFiles
  124. VerifyInstalledFiles
  125. elif [ "$OPERATION" = "verify" ]
  126. then
  127. VerifyInstalledFiles
  128. fi
  129. if [ "$OPERATION" != "verify" ]
  130. then
  131. HASH issue a SIGHUP to the inetd process
  132. ps -ef | grep inetd | grep -v grep >/tmp/tmppsout
  133. if [ -s /tmp/tmppsout ]
  134. then
  135. awk '{print "kill -1 " $2}' /tmp/tmppsout | /bin/sh
  136. else
  137. [ -x /usr/sbin/inetd ] && /usr/sbin/inetd
  138. fi
  139. rm /tmp/tmppsout
  140. fi
  141. return $retval