D.8. copydatahub.sh

#!/bin/sh

# This script copies all necessary DataHub files (DataHub and Connect)
# into a single subdirectory, giving set-wide unique IDs to all entities,
# sections, etc.

px=${1}
os=${2}
subdir=${3}

if [ ${px} != "dhw" ] &&
    [ ${px} != "ccw" ]; then 
   exit 1
fi

echo "Copying all common and ${px}-specific files to doc/i/datahub/${px}complete/"

if [ ! -d "../../i/datahub/${px}complete" ];
    then mkdir ../../i/datahub/${px}complete;
fi

# copy all common windows datahub files into the datahub's complete/
# subdirectory adding a specific prefix to their IDs.

# from the common directory
cd ../../i/datahubcom;
for f in *.sgml; do
    sed ${f} -e "s/\&hub\;/${px}/g" | \
	sed -e "s/\&hub/\&${px}/g" > ../datahub/${px}complete/${f}; 
done;

# from the os-specific directory
cd ../../i/datahub${os};
for f in *.sgml; do
    sed ${f} -e "s/\&hub\;/${px}/g" | \
	sed -e "s/\&hub/\&${px}/g" > ../datahub/${px}complete/${f}; 
done;

# from the datahub/connect specific sub-directory
cd ../../i/datahub${os}/${subdir};
for f in *.sgml; do
    sed ${f} -e "s/\&hub\;/${px}/g" | \
	sed -e "s/\&hub/\&${px}/g" > ../../datahub/${px}complete/${f};
done;
sed entities.sgml -e "s/\ hub/\ ${px}/g" > ../../datahub/${px}complete/entities.sgml;