#!/bin/sh
#
# Copyright (C) 2000-2017 Kern Sibbald
# License: BSD 2-Clause; see file LICENSE-FOSS
#
# Make only the docs packages
#

# Source config
. ./config

check_rtn()
{
if [ $? -ne 0 ] ; then
  echo " "
  echo "Error in $1 ..."
  exit 1
fi
}

echo "Creating release version: ${ver}"

cd $cwd

./makedocsrel $bacula $branch $docs $remote $branch $ver  | tee -a build.log
check_rtn makedocsrel

./makemanualsrel $ver
check_rtn makemanualsrel

# strip known error words from build.log
sed -i -e 's%strerror%%g' build.log
sed -i -e 's%dlerror%%g' build.log
sed -i -e 's%OnError%%g' build.log
sed -i -e 's%k7\-error%%g' build.log
sed -i -e 's%error\.tpl%%g' build.log
sed -i -e 's%error\.ico%%g' build.log
sed -i -e 's%errors\-test%%g' build.log
sed -i -e 's%fatal\-test%%g' build.log
sed -i -e 's%errors\.in%%g' build.log
sed -i -e 's%s_error%%g' build.log
grep -i error build.log >/dev/null
if [ $? -eq 0 ] ; then
  echo " "
  echo "Errors in build.log"
  exit 1
fi
grep -i warning build.log >/dev/null
if [ $? -eq 0 ] ; then
  echo " "
  echo "Warnings in build.log"
  exit 1
fi
grep -i fatal build.log >/dev/null
if [ $? -eq 0 ] ; then
  echo " "
  echo "Fatal errors in build.log"
  exit 1
fi
