configTT.src 2.9 KB

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