#!/bin/bash
#
# This script uses bash for arrays.
#

set -e

#
# Create a dummy data directory and upload script if one doesnt exist
#
if [ ! -f /root/BytemarkDNS/upload ]; then
  mkdir -p /root/BytemarkDNS/data
  echo -e '#!/bin/sh\nexit 0' > /root/BytemarkDNS/upload
fi

# Ensure upload is not executable

if [ -x /root/BytemarkDNS/upload ]; then
  chmod 644 /root/BytemarkDNS/upload
fi

#
#  Rebuild exim if we need to
#
if [ -e /etc/exim4/Makefile -a -e /etc/exim4/sympl.d/00-header ]; then

    #
    #  Rebuild exim4
    #
    cd /etc/exim4

    #
    # Don't fail the whole install if make fails.
    #
    make || echo "W: Rebuild of exim4 configuration failed."
fi

#DEBHELPER#
exit 0
