Torben Nehmer
fbd6e8b0f5
ssmtp is not available in debian buster, so we can't send mails that way anymore. Switched to msmtp, which serves the same purpose.
61 lines
1.4 KiB
Bash
Executable File
61 lines
1.4 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
set -ex
|
|
|
|
# Configuration options you usually edit go here
|
|
CONTAINER_MSMTPCONFDIR=/etc
|
|
CONTAINER_SSMTPCONFDIR=/etc/ssmtp
|
|
CONTAINER_PHP_CONFD=/usr/local/etc/php/conf.d
|
|
|
|
# This is internal stuff used to build everything
|
|
# Be aware, that several of these paths are used with rm -rf!
|
|
SRCDIR=$(pwd)/src
|
|
TMPDIR=$(pwd)/tmp
|
|
BUILDDIR=$(pwd)/build
|
|
SCRIPTS_SRC=${SRCDIR}/scripts
|
|
ROOTFSTREE=${TMPDIR}/tree
|
|
ROOTFSFILE=${BUILDDIR}/rootfs.tar.gz
|
|
MSMTPRC_DST=${ROOTFSTREE}${CONTAINER_MSMTPCONFDIR}
|
|
SSMTPCONF_DST=${ROOTFSTREE}${CONTAINER_SSMTPCONFDIR}
|
|
PHP_CONFD_DST=${ROOTFSTREE}${CONTAINER_PHP_CONFD}
|
|
|
|
#### Sanitize Build Enviornment
|
|
if [ -d ${TMPDIR} ]; then
|
|
rm -rf ${TMPDIR}
|
|
fi
|
|
mkdir ${TMPDIR}
|
|
|
|
if [ -d ${BUILDDIR} ]; then
|
|
rm -rf ${BUILDDIR}
|
|
fi
|
|
mkdir ${BUILDDIR}
|
|
|
|
#### Do the work.
|
|
|
|
# Create SSMTP config file
|
|
#mkdir -p ${SSMTPCONF_DST}
|
|
#cp ${SRCDIR}/ssmtp.conf ${SSMTPCONF_DST}/ssmtp.conf
|
|
|
|
# Create MSMTP config file (SSMTP is currently unavailble in Debian Buster)
|
|
mkdir -p ${MSMTPRC_DST}
|
|
cp ${SRCDIR}/msmtprc ${MSMTPRC_DST}/msmtprc
|
|
|
|
# Setup PHP
|
|
mkdir -p ${PHP_CONFD_DST}
|
|
cp ${SRCDIR}/mail.ini ${PHP_CONFD_DST}/mail.ini
|
|
|
|
|
|
# Clean up behind us
|
|
# if [ "$CLEAN_INTERMEDIATES" = true ]; then
|
|
# rm -rf ${ROUNDCUBE_SRC}
|
|
# rm -rf ${ISPCONFIG_SRC}
|
|
# fi
|
|
|
|
#### Now we tar everything together, so that the Dockerfile can put everything in place in one run
|
|
tar -czf ${ROOTFSFILE} -C ${ROOTFSTREE} .
|
|
|
|
# Clean up behind us
|
|
if [ "$CLEAN_INTERMEDIATES" = true ]; then
|
|
rm -rf ${ROOTFSTREE}
|
|
fi
|