1#!/bin/sh
2#	$Id: vx_buildcd,v 12.1 2006/08/24 14:45:35 bostic Exp $
3#
4# Build the Setup SDK CD image on the VxWorks host machine.
5
6. ./RELEASE
7
8B=`pwd`
9B=$B/..
10D=$B/dist/vx_setup
11C=$D/db.CD
12Q=/export/home/sue/SetupSDK
13S=$Q/resource/mfg/setup
14W=sun4-solaris2
15
16symdoc=$D/docs/BerkeleyDB.$DB_VERSION_MAJOR.$DB_VERSION_MINOR.$DB_VERSION_PATCH
17symdb=$D/windlink/sleepycat/BerkeleyDB.$DB_VERSION_MAJOR.$DB_VERSION_MINOR.$DB_VERSION_PATCH
18rm -rf $D/docs $D/windlink
19mkdir $D/docs $D/windlink $D/windlink/sleepycat
20ln -s $B/docs $symdoc
21ln -s $B $symdb
22
23s=/tmp/__db_a
24t=/tmp/__db_b
25
26#
27# Remove the old CD directory if it is there.
28if test -d $C; then
29	echo "$C cannot exist."
30	echo "As root, execute 'rm -rf $C'"
31	echo "and then rerun the script"
32	exit 1
33fi
34
35#
36# Check for absolute pathnames in the project files.
37# That is bad, but Tornado insists on putting them in
38# whenever you add new files.
39#
40rm -f $t
41f=`find $B/build_vxworks -name \*.wpj -print`
42for i in $f; do
43	grep -l -- "$B" $i >> $t
44done
45if test -s $t; then
46	echo "The following files contain absolute pathnames."
47	echo "They must be fixed before building the CD image:"
48	cat $t
49	exit 1
50fi
51
52#
53# NOTE: We reuse the same sed script over several files.
54#
55cat <<ENDOFSEDTEXT > $s
56s/@DB_VERSION_MAJOR@/$DB_VERSION_MAJOR/g
57s/@DB_VERSION_MINOR@/$DB_VERSION_MINOR/g
58s/@DB_VERSION_PATCH@/$DB_VERSION_PATCH/g
59s#@DB_SETUP_DIR@#$D#g
60ENDOFSEDTEXT
61
62f=$D/setup.pool
63(sed -f $s $D/vx_setup.in) > $t
64    (echo "Building $f" && rm -f $f && cp $t $f)
65
66f=$D/README.TXT
67(sed -f $s $D/README.in) > $t
68    (echo "Building $f" && rm -f $f && cp $t $f)
69
70f=$D/CONFIG.TCL
71(sed -f $s $D/CONFIG.in) > $t
72    (echo "Building $f" && rm -f $f && cp $t $f)
73
74f=$D/filelist.demo
75(sed -f $s $D/vx_demofile.in) > $t
76    (echo "Building $f" && rm -f $f && cp $t $f)
77
78# Copy files into the SetupSDK area.
79(cd $D && cp README.TXT $S)
80(cd $D && cp LICENSE.TXT $S)
81(cd $D && cp CONFIG.TCL $S/RESOURCE/TCL)
82(cd $D && cp SETUP.BMP $S/RESOURCE/BITMAPS)
83
84#
85# NOTE: The contents of LIB must be on one, long, single line.
86# Even preserving it with a \ doesn't work for htmlBook.
87#
88f=../docs/LIB
89(echo "Building $f" && rm -f $f)
90cat <<ENDOFLIBTEXT >> $f
91{BerkeleyDB.$DB_VERSION_MAJOR.$DB_VERSION_MINOR.$DB_VERSION_PATCH} {Berkeley DB} {<b>BerkeleyDB.$DB_VERSION_MAJOR.$DB_VERSION_MINOR.$DB_VERSION_PATCH</b>} {<b><a href="./index.html">BerkeleyDB.$DB_VERSION_MAJOR.$DB_VERSION_MINOR.$DB_VERSION_PATCH</a></b>} {BerkeleyDB} {} {} {}
92ENDOFLIBTEXT
93
94#
95# Start generating the file list.
96f=$D/filelist.all
97
98#
99# Just put everything into the image.  But we only want to find regular
100# files; we cannot have all the directories listed too.
101#
102# NOTE:  This find is overly aggressive in getting files, particularly
103# for the 'windlink/sleepycat' files.  We actually end up with 3 sets of the
104# documentation, the "real" ones in 'docs/BerkeleyDB*', the set found
105# via 'windlink/sleepycat/Berk*/docs' and the one found via our symlink in
106# 'windlink/sleepycat/Berk*/dist/vx_setup/docs/Berk*'.
107#
108# However, we waste a little disk space so that the expression below
109# is trivial and we don't have to maintain it as new files/directories
110# are added to DB.
111#
112(cd $D && find docs/BerkeleyDB.$DB_VERSION_MAJOR.$DB_VERSION_MINOR.$DB_VERSION_PATCH/ -follow -name \* -type f -print) > $t
113(cd $D && find windlink/sleepycat/BerkeleyDB.$DB_VERSION_MAJOR.$DB_VERSION_MINOR.$DB_VERSION_PATCH/ -follow -name docs -prune -o -type f -print) >> $t
114(echo "Building $f" && rm -f $f && cp $t $f)
115#
116# Finally build the CD image!
117#
118env PATH=$Q/$W/bin:$PATH QMS_BASE=$Q WIND_HOST_TYPE=$W \
119pool mfg -d $C -v -nokey BerkeleyDB.$DB_VERSION_MAJOR.$DB_VERSION_MINOR < $D/setup.pool
120