#! /bin/sh # $Id$ # # Encapsulates set/access of a components file, which records set of # components that were built in a library. Intended to be used by # Makefiles and scripts. See ACE_wrappers/PACE/pace/Makefile for an # example. # usage="usage: $0 --pace [--remove | --set \" \"]" #### #### Make sure that PACE_ROOT is set. #### if [ ! "$ACE_ROOT" ]; then echo $0': your ACE_ROOT environment variable is not set!' 1>&2 exit -1 fi if [ ! "$PACE_ROOT" ]; then PACE_ROOT=$ACE_ROOT/PACE export PACE_ROOT fi #### #### Process command line arguments. #### if [ $# -ge 1 ]; then case $1 in --pace) components_file=$PACE_ROOT/PACE_COMPONENTS.list ;; *) echo $usage; exit -1 ;; esac shift else echo $usage exit -1 fi set_components=0 if [ $# -ge 1 ]; then if [ $1 = '--set' ]; then set_components=1 shift if [ $# -eq 1 ]; then components=$1 shift else echo $usage exit -1 fi elif [ $1 = '--remove' ]; then rm -f $components_file else echo $usage exit -1 fi fi if [ $set_components -eq 1 ]; then #### #### Update the components file, if it has changed since last set. #### if [ -f $components_file ]; then if echo "$components" | diff - $components_file > /dev/null; then : else echo "$components" > $components_file fi else echo "$components" > $components_file fi else #### #### Access the contents of the components file, if it exists. #### if [ -f $components_file ]; then cat $components_file fi fi