XCOMM! /bin/ksh XCOMM ####### XCOMM Product: CDE XCOMM Fileset: CDE-MIN XCOMM configure XCOMM @(#) $TOG: configMin.src /main/1 1998/03/11 16:18:12 mgreess $ XCOMM ####### #define HASH # retval=0 FixEtcServices() { FILE=/etc/services TMPFILE=/tmp/services XCOMM XCOMM check for existence of /etc/services XCOMM if [ ! -f $FILE ] # highly unlikely then echo "" >$FILE fi XCOMM XCOMM see if it already exists XCOMM awk '{if ($1 == "dtspc") print $0 > "/tmp/dtspc-already-there" }' $FILE >/dev/null if [ ! -f /tmp/dtspc-already-there ] then echo -e "dtspc\t6112/tcp\t#subprocess control" >>$FILE else rm /tmp/dtspc-already-there fi XCOMM XCOMM remove legacy entries like dtspcd XCOMM awk '{if ($1 == "dtspcd" || $1 == "#dtspcd") ; else print $0 }' $FILE >$TMPFILE cp $TMPFILE $FILE rm $TMPFILE } UnfixEtcServices() { FILE=/etc/services TMPFILE=/tmp/services awk '{if ($1 == "dtspc" && $2 == "6112/tcp") ; else print $0 }' $FILE >$TMPFILE cp $TMPFILE $FILE rm $TMPFILE } RemoveMinFiles() { while read -r SRC do if [ "$SRC" != "" ] then rm -f "$SRC" dirname=${SRC%/STAR} if [ -d "$dirname" ] then cd "$dirname" || exit while [ "$dirname" != "$CDE_TOP" ] do cd .. rmdir "${dirname##STAR/}" >/dev/null 2>/dev/null dirname=${dirname%/STAR} done fi fi done <<-EOF #include "CDE-MIN.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 -r SRC do #include "../verify.func" done <<-EOF #include "CDE-MIN.lst" EOF } #include "../option.func" XCOMM ############################################################### XCOMM XCOMM Main Body XCOMM XCOMM ############################################################### HandleOption "$*" if [ "$OPERATION" = "configure" ] then FixEtcServices HASH HASH create the /var/dt/tmp directory for the dtspcd HASH if [ ! -d CDE_LOGFILES_TOP/tmp ] then mkdir -p CDE_LOGFILES_TOP/tmp fi elif [ "$OPERATION" = "deconfigure" ] then UnfixEtcServices RemoveMinFiles VerifyInstalledFiles elif [ "$OPERATION" = "verify" ] then VerifyInstalledFiles fi return $retval