CDE-MAN-DEV.udb: remove extra }, added when UXP support was removed
[oweals/cde.git] / cde / admin / IntegTools / post_install / usl / configMin.src
1 XCOMM! /bin/ksh
2 XCOMM #######
3 XCOMM  Product: CDE
4 XCOMM  Fileset: CDE-MIN
5 XCOMM  configure
6 XCOMM  @(#) $XConsortium: configMin.src /main/4 1996/04/21 19:07:50 drk $
7 XCOMM #######
8 XCOMM
9 XCOMM (c) Copyright Hewlett-Packard Company, 1993
10 XCOMM
11 XCOMM #######
12
13 PRODUCT=CDE
14 FILESET=CDE-MIN
15 DO_CONFIGURATION=""
16 retval=0
17
18 CheckForClobberedLinks()
19 {
20 XCOMM
21 XCOMM ensure links not clobbered
22 XCOMM
23
24         for file in services inetd.conf
25         do
26                 if test ! -L /etc/$file
27                 then    if test -f /etc/$file
28                         then
29                                 rm /etc/$file
30                                 ln -s /etc/inet/$file /etc/$file
31                         fi
32                 fi
33         done
34 }
35
36 FixEtcInetServices()
37 {
38 SERVICES=/etc/inet/services
39
40 XCOMM
41 XCOMM see if it already exists
42 XCOMM
43
44     nawk '{if ($1 == "dtspc") print $0 > "/tmp/dtspc-already-there"}' \
45                 $SERVICES >/dev/null
46     if [ ! -f /tmp/dtspc-already-there ]
47     then
48         if test ! -f ${SERVICES}.preCDE
49         then    mv $SERVICES $SERVICES.preCDE
50                 cp ${SERVICES}.preCDE $SERVICES
51                 chmod 444 $SERVICES
52         fi
53         echo "dtspc\t6112/tcp\t#subprocess control" >>$SERVICES
54     else
55         rm /tmp/dtspc-already-there
56     fi
57
58 XCOMM
59 XCOMM remove legacy entries like dtspcd
60 XCOMM
61
62     nawk '{if ($1 == "dtspcd" || $1 == "#dtspcd") ; else print $0}' \
63                 $SERVICES >/tmp/etc-services
64     mv /tmp/etc-services $SERVICES
65     chmod 444 $SERVICES
66 }
67
68 UnfixEtcInetServices()
69 {
70 SERVICES=/etc/inet/services
71 TMPFILE=/tmp/etc-services
72
73     nawk '{if ($1 == "dtspc" && $2 == "6112/tcp")
74                 ;
75           else
76                 print $0
77          }' $SERVICES >$TMPFILE
78
79     mv $TMPFILE $SERVICES
80 }
81
82 FixInetdDotConf()
83 {
84 INETD_CONF=/etc/inet/inetd.conf
85
86 XCOMM
87 XCOMM see if it already exists
88 XCOMM
89
90     nawk '{if ($1 == "dtspc") print $0 > "/tmp/dtspc-already-there"}' \
91         $INETD_CONF >/dev/null
92
93     if [ ! -f /tmp/dtspc-already-there ]
94     then
95         if test ! -f ${INETD_CONF}.preCDE
96         then    mv $INETD_CONF $INETD_CONF.preCDE
97                 cp ${INETD_CONF}.preCDE $INETD_CONF
98                 chmod 444 $INETD_CONF
99         fi
100         DTSPCD=CDE_INSTALLATION_TOP/bin/dtspcd
101         echo "dtspc stream tcp nowait root $DTSPCD $DTSPCD" >>$INETD_CONF
102     else
103         rm /tmp/dtspc-already-there
104     fi
105
106 XCOMM
107 XCOMM remove legacy entries like dtspcd
108 XCOMM
109
110     nawk '{if ($1 == "dtspcd" || $1 == "#dtspcd") ; else print $0}' \
111                 $INETD_CONF >/tmp/etc-inetd-conf
112     mv /tmp/etc-inetd-conf $INETD_CONF
113     chmod 444 $INETD_CONF
114 }
115
116 UnfixInetdDotConf()
117 {
118 INETD_CONF=/etc/inet/inetd.conf
119 TMPFILE=/tmp/inetd.conf
120
121     nawk '{if ($1 == "dtspc")
122                 ;
123           else
124                 print $0
125          }' $INETD_CONF >$TMPFILE
126
127     mv $TMPFILE $INETD_CONF
128 }
129
130 PokeInetd()
131 {
132 XCOMM issue a SIGHUP to the inetd process
133
134     ps -ef | grep inetd | grep -v grep >/tmp/tmppsout
135     if [ -s /tmp/tmppsout ]
136     then
137         nawk '{print "kill -HUP " $2}' /tmp/tmppsout | /bin/ksh
138     else
139         /usr/sbin/inetd -s
140     fi
141     rm /tmp/tmppsout
142 }
143
144 VerifyInstalledFiles()
145 {
146     echo "Status   mode    owner   group   filename"
147     echo "-----------------------------------------"
148 XCOMM     exists  correct correct correct  /usr/dt/foo1
149 XCOMM     MISSING  WRONG   WRONG   WRONG   /usr/dt/foo2
150 XCOMM        exists    the link is correct    /usr/dt/link
151
152     while read SRC
153     do
154 #include "../verify.func"
155     done <<-EOF
156 #include "CDE-MIN.lst"
157         EOF
158 }
159
160 #include "../option.func"
161
162 XCOMM ####################################################################
163 XCOMM
164 XCOMM Main body
165 XCOMM
166 XCOMM ####################################################################
167
168   CheckForClobberedLinks
169
170   HandleOption $*
171
172   if [ "$OPERATION" = "configure" ]
173   then
174
175     FixEtcInetServices
176     FixInetdDotConf
177     PokeInetd()
178
179   elif [ "$OPERATION" = "deconfigure" ]
180   then
181
182     UnfixEtcInetServices
183     UnfixInetdDotConf
184     PokeInetd()
185
186     RemoveMinFiles
187     VerifyInstalledFiles
188
189   elif [ "$OPERATION" = "verify" ]
190   then
191
192     VerifyInstalledFiles
193
194   fi
195
196   return $retval
197