#!/bin/sh # # SetupComponent - Add or delete components from the source tree. # # $Id: SetupComponent,v 2.2 1997/11/04 18:14:14 sxw Exp $ # if test $# -ne 3; then echo "Usage: ./SetupComponent add subsystem component"; echo " ./SetupComponent delete subsystem component"; echo ""; echo "Please refer to the Harvest User Manual for further help."; exit 1; fi cmd="$1"; subsys="$2"; component="$3"; if test "$cmd" != "add" -a "$cmd" != "delete"; then echo "Usage: ./SetupComponent add subsystem component"; echo " ./SetupComponent delete subsystem component"; echo ""; echo "Please refer to the Harvest User Manual for further help."; exit 1; fi if test ! -d "./components/$subsys"; then echo "$subsys is not a valid subsystem name." exit 1; fi if test ! -d "./components/$subsys/$component"; then echo "$component is not a valid component for $subsys." exit 1; fi if test "$cmd" = "add"; then echo "Adding $component to $subsys." line="`cat ./components/$subsys/BUILD`" echo "$line $component" >./components/$subsys/BUILD exit 0 fi # delete tfile="/tmp/sc.$$" echo "Deleting $component from $subsys." line="`cat ./components/$subsys/BUILD`" newline="" for A in $line; do if [ "$A" != "$component" ] ; then newline="$newline $A" fi done echo $newline > ./components/$subsys/BUILD exit 0