1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136
|
#!/bin/sh
set -e
cwd="`pwd`"
date="`date +'%d %h %Y'`"
process () {
(cd config &&
rm -f trace &&
m4 -P -I "$config" -DDB_DATE="$date" \
common/init.m4 config.m4 common/main.m4 - common/final.m4
)
}
txtconvert () {
src=$1; dst=$2
echo " generating $dst from $src ..."
rm -f html/txt/$dst.html html/txt/$dst.out
perl -ne 'print unless m/^Other pages:$/ .. /^\<hr\>/' \
html/$src.out >html/txt/$dst.html
HOME=/dev/null lynx -nolist -dump -cfg=/dev/null \
file://localhost/$cwd/html/txt/$dst.html >html/txt/$dst.out
rm html/txt/$dst.html
}
config=local
if [ $# != 0 ]; then config="$1"; shift; fi
if [ $# != 0 ]; then echo >&2 'usage: ./build [<config>]'; false; fi
if [ ! -f config/$config/config.m4 ]; then echo >&2 "no such config: $config"; false; fi
errs="`echo 'm4_undivert(1)' | process | sed -ne '/[^ \t]/ s/^/ /p'`"
if [ "x$errs" != x ]
then
echo >&2 'unexpected residues:'
echo "$errs"
false
fi
echo "macro substitutions ..."
for f in `find -name '*.in'`
do
h="`echo $f | sed -e 's/\.in$//'`"
process <"$f" >"$h.out"
mv config/trace "$h.trace"
if egrep 'DBC?U?_' /dev/null "$h.out"
then
echo >&2 'undefined macros'
false
fi
[ ! -x "$f" ] || chmod +x "$h.out"
done
echo "documentation conversion ..."
txtconvert Reporting.html bug-reporting.txt
txtconvert Access.html bug-log-access.txt
txtconvert server-request.html bug-log-mailserver.txt
txtconvert Developer.html bug-maint-info.txt
txtconvert server-control.html bug-maint-mailcontrol.txt
txtconvert server-refcard.html bug-mailserver-refcard.txt
cgilibexist=`echo 'test -f DBC_CGILIB_PATH && echo true || echo false' | process`
htaccesspath=`echo DBC_HTACCESS_PATH | process`
rm -f install install.new
process <<'END' >install.new
#!/bin/sh
set -e
test -d DBC_BASE || mkdir DBC_BASE
bugsid () {
echo "installing $1 ..."
test -d "$2" || mkdir "$2"
cd "$1"
for f in *.out
do
h="`echo $f | sed -e 's/\.out$//'`"
rm -f "$2/$f"
cp "./$f" "$2/"
mv -f "$2/$f" "$2/$h"
done
cd "$3"
}
bugsid scripts DBC_SCRIPT_PATH ..
bugsid html DBC_HTML_PATH ..
bugsid html/txt DBC_DOCDIR_PATH ../..
bugsid cgi DBC_CGI_PATH ..
END
if [ "x$htaccesspath" != x ]; then
process <<END >>install.new
cat <<'END2' >$htaccesspath.new
DBC_HTACCESS_CONTENTS
END2
mv -f $htaccesspath.new $htaccesspath
END
fi
if $cgilibexist
then
cgiii='cgi-lib already exists in DBC_CGILIB_PATH'
else
cgiii=' DBC_CGILIB_PATH'
process <<'END' >>install.new
echo "installing cgi-lib.pl ..."
cp cgi/cgi-lib.pl DBC_CGILIB_PATH.new
mv -f DBC_CGILIB_PATH.new DBC_CGILIB_PATH
END
fi
process >>install.new <<'END'
echo "setting up bugs database ..."
DBC_SCRIPT_PATH/initialise
echo "done."
echo "You will have to intall the crontab (misc/crontab.out) yourself."
exit 0
END
chmod +x install.new
mv -f install.new install
cgi="`cd cgi && echo *.out | sed -e 's/\.out//g'`"
process <<END
built for $config date DB_DATE ...
will install unchanging files into:
DBC_SCRIPT_PATH/
DBC_HTML_PATH/
DBC_CGI_PATH/ ($cgi)
$cgiii
will store data in:
DB_HTMLDB_PATH/
DBC_SPOOL_PATH/
will expect CGI scripts to be available in:
DBC_CGI_URL/
END
echo "run ./install to install"
exit 0
|