XCOMM! /bin/ksh XCOMM ####### XCOMM Product: CDE XCOMM Fileset: CDE-TT XCOMM configure XCOMM @(#) $XConsortium: configTT.src /main/3 1996/04/23 20:38:20 drk $ XCOMM ####### XCOMM XCOMM (c) Copyright Hewlett-Packard Company, 1993 XCOMM XCOMM ####### #define HASH # PRODUCT=CDE FILESET=CDE-TT DO_CONFIGURATION="" retval=0 FixInetdDotConf() { FILE=/etc/inetd.conf TMPFILE=/tmp/inetd.conf TTDBSERVERD=CDE_INSTALLATION_TOP/bin/rpc.ttdbserver OLDTTDBSERVERD=CDE_INSTALLATION_TOP/bin/rpc.ttdbserverd XCOMM XCOMM Desired entry: XCOMM ttdbserver stream rpc/tcp wait root /usr/dt/bin/rpc.ttdbserver rpc.ttdbserver XCOMM XCOMM XCOMM see if it already exists XCOMM nawk -v ttdb=$TTDBSERVERD -v oldttdb=$OLDTTDBSERVERD \ '{if (($1 == "ttdbserver" && $6 != ttdb) || ($1 == "ttdbserverd" && $6 == oldttdb)) print "#cde " $0; else print $0 }' $FILE >$TMPFILE cp $TMPFILE $FILE rm $TMPFILE awk '{if ($1 == "ttdbserver") print $0 > "/tmp/tt-already-there" }' $FILE >/dev/null if [ ! -f /tmp/tt-already-there ] then echo "ttdbserver stream rpc/tcp wait root $TTDBSERVERD rpc.ttdbserver" >>$FILE else rm /tmp/tt-already-there fi } UnfixInetdDotConf() { FILE=/etc/inetd.conf TMPFILE=/tmp/inetd.conf TTDBSERVERD=CDE_INSTALLATION_TOP/bin/rpc.ttdbserver OLDTTDBSERVERD=CDE_INSTALLATION_TOP/bin/rpc.ttdbserverd nawk -v ttdb=$TTDBSERVERD \ '{if ($1 == "ttdbserver" && $6 == ttdb) ; else print $0 }' $FILE >$TMPFILE cp $TMPFILE $FILE rm $TMPFILE awk '{if ($1 == "#cde" && ($2 == "ttdbserver" || $2 == "ttdbserverd")) { $1 = $2; $2 = "" } print $0 }' $FILE >$TMPFILE cp $TMPFILE $FILE rm $TMPFILE } FixEtcRpc() { FILE=/etc/rpc TMPFILE=/tmp/etc-rpc if [ ! -f $FILE ] then echo "ttdbserver 100083 tooltalk" >$FILE else awk '{if ($1 == "ttdbserver" && $2 == "100083") print $0 > "/tmp/etc-rpc-already-there" }' $FILE >/dev/null if [ ! -f /tmp/etc-rpc-already-there ] then awk '{if ($1 == "ttdbserver" || $2 == "100083") print $0 > "/tmp/etc-rpc-already-there" }' $FILE >/dev/null if [ ! -f /tmp/etc-rpc-already-there ] then echo "ttdbserver 100083 tooltalk" >>$FILE else awk '{if ($1 == "ttdbserver" || $2 == "100083") print "#cde " $0; else print $0 }' $FILE >$TMPFILE echo "ttdbserver 100083 tooltalk" >>$TMPFILE mv $TMPFILE $FILE rm /tmp/etc-rpc-already-there fi else rm /tmp/etc-rpc-already-there fi fi } UnfixEtcRpc() { FILE="/etc/rpc" TMPFILE="/tmp/etc-rpc" awk '{if ($1 == "ttdbserver" && $2 == "100083") ; else print $0 }' $FILE >$TMPFILE mv $TMPFILE $FILE awk '{if ($1 == "#cde") { $1 = $2; $2 = "" } print $0 }' $FILE >$TMPFILE mv $TMPFILE $FILE } RemoveTTFiles() { while read SRC do if [ "$SRC" != "" ] then rm -f $SRC dirname=${SRC%/STAR} if [ -d $dirname ] then cd $dirname while [ "$dirname" != "$CDE_TOP" ] do cd .. rmdir ${dirname##STAR/} >/dev/null 2>/dev/null dirname=${dirname%/STAR} done fi fi done <<-EOF #include "CDE-TT.list" EOF } VerifyInstalledFiles() { echo "Status mode owner group filename" echo "-----------------------------------------" XCOMM exists correct correct correct /usr/dt/foo1 XCOMM MISSING WRONG WRONG WRONG /usr/dt/foo2 XCOMM exists the link is correct /usr/dt/link while read SRC do #include "../verify.func" done <<-EOF #include "CDE-TT.lst" EOF } #include "../option.func" XCOMM ###################################################################### XCOMM XCOMM Main Body XCOMM XCOMM ###################################################################### HandleOption $* if [ "$OPERATION" = "configure" ] then FixInetdDotConf FixEtcRpc elif [ "$OPERATION" = "deconfigure" ] then UnfixEtcRpc UnfixInetdDotConf RemoveTTFiles VerifyInstalledFiles elif [ "$OPERATION" = "verify" ] then VerifyInstalledFiles fi if [ "$OPERATION" != "verify" ] then HASH issue a SIGHUP to the inetd process ps -ef | grep inetd | grep -v grep >/tmp/tmppsout if [ -s /tmp/tmppsout ] then awk '{print "kill -1 " $2}' /tmp/tmppsout | /bin/csh else /usr/sbin/inetd -s fi rm /tmp/tmppsout fi return $retval