#!/bin/sh
#
# aegis - project change supervisor
# Copyright (C) 1997-1999, 2001-2003, 2006-2008 Peter Miller
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see
# .
#
# @configure_input@
#
prefix=@prefix@
exec_prefix=@exec_prefix@
bindir=@bindir@
libdir=@libdir@
datadir=@datadir@
datarootdir=@datarootdir@
# architecture neutral... e.g. AEGIS_PATH
if test -r $datadir/aegis.cgi.conf; then
. $datadir/aegis.cgi.conf
fi
# architecture specific... e.g. PATH
if test -r $libdir/aegis.cgi.conf; then
. $libdir/aegis.cgi.conf
fi
extra=
lang=en
file=proj_list
for arg in $*
do
case "$arg" in
*\;* | -* | *=* | *@-* | *\ * )
;;
*@*)
arg=`echo "$arg" | sed -e 's|@|=|'`
eval "$arg"
;;
-*)
;;
*)
extra="$extra $arg"
;;
esac
done
Project="$project"
Change="$change"
test ! -z "$project" && project="--project=$project"
test ! -z "$change" && change="--change=$change"
if test "$file" = "rect"
then
exec $bindir/aerect $extra
fi
if test "$file" = "aedist"
then
test -z "$project" && exit 1
test -z "$change" && change="--baseline"
$bindir/aedist --send $project $change -ndh -naa \
-o /tmp/aegis.$$.ae > /tmp/aegis.$$ 2>&1
status=$?
if test $status -ne 0
then
echo 'Content-Type: text/html'
echo ''
echo '
Error'
echo 'Error
The command'
echo ''
echo $bindir/aedist --send $project $change
echo '
'
echo "terminated with exit status $status."
echo 'The following text was produced '
sed 's|<|\<|g' < /tmp/aegis.$$
echo '
'
echo '
'
echo 'This page was generated'
date
echo ''
rm /tmp/aegis.$$*
exit 1
fi
cat /tmp/aegis.$$.ae
rm /tmp/aegis.$$*
exit 0
fi
if test "$file" = "aepatch"
then
test -z "$project" && exit 1
test -z "$change" && change="--baseline"
$bindir/aepatch --send $project $change -naa \
-o /tmp/aegis.$$.ae > /tmp/aegis.$$ 2>&1
status=$?
if test $status -ne 0
then
echo 'Content-Type: text/html'
echo ''
echo 'Error'
echo 'Error
The command'
echo ''
echo $bindir/aepatch --send $project $change
echo '
'
echo "terminated with exit status $status."
echo 'The following text was produced '
sed 's|<|\<|g' < /tmp/aegis.$$
echo '
'
echo '
'
echo 'This page was generated'
date
echo ''
rm /tmp/aegis.$$*
exit 1
fi
cat /tmp/aegis.$$.ae
rm /tmp/aegis.$$*
exit 0
fi
if test "$file" = "aetar"
then
test -z "$project" && exit 1
test -z "$change" && change="--baseline"
$bindir/aetar --send $project $change \
-o /tmp/aegis.$$.ae > /tmp/aegis.$$ 2>&1
status=$?
if test $status -ne 0
then
echo 'Content-Type: text/html'
echo ''
echo 'Error'
echo 'Error
The command'
echo ''
echo $bindir/aetar --send $project $change
echo '
'
echo "terminated with exit status $status."
echo 'The following text was produced '
sed 's|<|\<|g' < /tmp/aegis.$$
echo '
'
echo '
'
echo 'This page was generated'
date
echo ''
rm /tmp/aegis.$$*
exit 1
fi
echo 'Content-Type: application/x-tar-gz'
echo 'Content-Transfer-Encoding: 8bit'
echo ''
cat /tmp/aegis.$$.ae
rm /tmp/aegis.$$*
exit 0
fi
if test "$file" = "diff"
then
test -z "$project" && exit 1
test -z "$extra" && exit 1
File=$extra;
cmdcmd="$bindir/aereport -f $datadir/en/html/file_diff.rpt $delta1 \
$delta2 $File /tmp/aegis.$$.1 /tmp/aegis.$$.2 $project $change -unf"
# the script will work out where to get the file from
cmd="`$cmdcmd 2> /tmp/aegis.$$.log`";
status=$?
if test $status -ne 0
then
echo 'Content-Type: text/html'
echo ''
echo 'Error'
echo 'Error
The command'
echo ''
echo $cmdcmd ;
echo '
'
echo "terminated with exit status $status."
echo 'The following text was produced '
sed 's|<|\<|g' < /tmp/aegis.$$.log
echo '
'
echo '
'
echo 'This page was generated'
date
echo ''
rm -f /tmp/aegis.$$.*
exit 1
fi
rm -f /tmp/aegis.$$.*
eval "$cmd 2> /tmp/aegis.$$.log" > /tmp/aegis.$$.out
status=$?
if test $status -ne 0
then
echo 'Content-Type: text/html'
echo ''
echo 'Error'
echo 'Error
The command'
echo ''
echo $cmd
echo '
'
echo "terminated with exit status $status."
echo 'The following text was produced '
sed 's|<|\<|g' < /tmp/aegis.$$.log
echo '
'
echo '
'
echo 'This page was generated'
date
echo ''
rm -f /tmp/aegis.$$.*
exit 1
fi
rm /tmp/aegis.$$.log
echo 'Content-Type: text/html'
echo ''
echo ''
echo "Project \"$Project\","
test ! -z "$Change" && echo "Change $Change,"
echo "Differences in file $File" | sed 's/</'
echo ''
echo "Project \"$Project\","
test ! -z "$Change" && echo "Change $Change,"
echo '
'
echo "Differences in file $File" | sed 's/</'
echo "
Delta $delta1, Delta $delta2"
echo '
'
echo ''
sed 's|<|\<|g' < /tmp/aegis.$$.out
echo ''
echo '
'
echo 'This page was generated'
date
echo ''
rm -f /tmp/aegis.$$.*
exit 0
fi
if test "$file" = "pre"
then
test -z "$project" && exit 1
test -z "$extra" && exit 1
Delta="-delta $delta"
test -z "$delta" && Delta="";
File="$extra"
if test -z "$change"
then
$bindir/aegis -cp -ind $project -baserel $File $Delta \
-o /tmp/aegis.$$ 2> /tmp/aegis.$$.log
status=$?
if test $status -ne 0
then
echo 'Content-Type: text/html'
echo ''
echo 'Error'
echo 'Error
The command'
echo ''
echo $bindir/aegis -cp -ind -baserel "$Delta" $project $extra
echo '
'
echo "terminated with exit status $status."
echo 'The following text was produced '
sed 's|<|\<|g' < /tmp/aegis.$$.log
echo '
'
echo '
'
echo 'This page was generated'
date
echo ''
rm -f /tmp/aegis.$$ /tmp/aegis.$$.log
exit 1
fi
rm -f /tmp/aegis.$$.log
else
# the script will work out where to get the file from
cmd="`$bindir/aereport -f $datadir/en/html/cp_command.rpt $File \
/tmp/aegis.$$ -unf $project $change 2> /tmp/aegis.$$.log`"
status=$?
if test $status -ne 0
then
echo 'Content-Type: text/html'
echo ''
echo 'Error'
echo 'Error
The command'
echo ''
echo $bindir/aereport -f \
$datadir/en/html/cp_command.rpt $File \
/tmp/aegis.$$ -unf $project $change
echo '
'
echo "terminated with exit status $status."
echo 'The following text was produced '
sed 's|<|\<|g' < /tmp/aegis.$$.log
echo '
'
echo '
'
echo 'This page was generated'
date
echo ''
rm /tmp/aegis.$$.log
exit 1
fi
rm /tmp/aegis.$$.log
eval "$cmd 2> /tmp/aegis.$$.log"
status=$?
if test $status -ne 0
then
echo 'Content-Type: text/html'
echo ''
echo 'Error'
echo 'Error
The command'
echo ''
echo $cmd | sed 's|<|\<|g'
echo '
'
echo "terminated with exit status $status."
echo 'The following text was produced '
sed 's|<|\<|g' < /tmp/aegis.$$.log
echo '
'
echo '
'
echo 'This page was generated'
date
echo ''
rm -f /tmp/aegis.$$.log /tmp/aegis.$$
exit 1
fi
rm /tmp/aegis.$$.log
fi
echo 'Content-Type: text/html'
echo ''
echo ''
echo "Project \"$Project\","
test ! -z "$Change" && echo "Change $Change,"
x=`echo $File | sed 's/</'`
echo "File $x"
echo ''
echo "Project \"$Project\","
test ! -z "$Change" && echo "Change $Change,"
echo "
File $x"
echo '
'
echo ''
sed 's|<|\<|g' < /tmp/aegis.$$
echo ''
echo '
'
echo 'This page was generated'
date
echo ''
rm /tmp/aegis.$$
exit 0
fi
$bindir/aereport --file $datadir/$lang/html/$file.rpt \
$project $change $extra --page-width=1000 --unformatted \
> /tmp/aegis.$$ 2>&1
status=$?
if test $status -ne 0
then
echo 'Content-Type: text/html'
echo ''
echo 'Error'
echo 'Error
The command'
echo ''
echo $bindir/aereport --file $datadir/$lang/html/$file.rpt \
$project $change $extra --page-width=1000 --unformatted
echo '
'
echo "terminated with exit status $status."
echo 'The following text was produced '
sed 's|<|\<|g' < /tmp/aegis.$$
echo '
'
echo '
'
echo 'This page was generated'
date
echo ''
else
cat /tmp/aegis.$$
fi
rm /tmp/aegis.$$
exit 0