#!/bin/sh
#
# Script file to update the Bacula version
#  It only needs to be run once for each version.
#  Alternatively, you can simply edit the file
#   manuals/version.tex and put the correct version and date
#   in that file.
# The only thing this script does is to create the file:
#   manuals/version.tex which contains the VERSION and the DATE
#   on a single line.
#
BACULA_SOURCE=$HOME/bacula/k/bacula/src
out=/tmp/$$
VERSION=`sed -n -e 's/^#define VERSION.*"\(.*\)"$/\1/p' ${BACULA_SOURCE}/version.h`
DATE=`sed -n -e 's/^#define BDATE.*"\(.*\)"$/\1/p' ${BACULA_SOURCE}/version.h`
echo "New version=${VERSION}  New date=${DATE}"
echo "s%@VERSION@%${VERSION}%g" >${out}
echo "s%@DATE@%${DATE}%g" >>${out}
sed -f ${out} manuals/version.tex.in >manuals/version.tex
sed -f ${out} manuals/bacula.sty.in >manuals/bacula.sty
rm -f ${out}
echo "Updated version to:"
cat manuals/version.tex
