#!/bin/sh
#
# Script to make a static version of the Bacula
#  File daemon and to copy it to the current
#  directory.
#
export LANG=C
cwd=`pwd`
topdir=$1
cd $topdir
make
cd src/filed
make static-bacula-fd 2>/dev/null >/dev/null
cd $cwd       
cp -f $topdir/src/filed/bacula-fd.conf bin/bacula-fd.conf
cp -f $topdir/src/filed/static-bacula-fd bin/bacula-fd
if test $? -ne 0 ; then
   echo " "
   echo "Build of static-bacula-fd failed."
   echo "This is most likely because you did not do a ./configure"
   echo "before running this script, or your build includes some"
   echo "options such as TLS that require static libraries that"
   echo "not loaded on your system.  Try simplifying your"        
   echo "./configure --options in your Bacula source directory, and"
   echo "try manually running make static-bacula-fd in your Bacula"
   echo "source directory."
   echo " "
fi
rm -f $topdir/src/filed/static-bacula-fd
