#!/bin/bash # This script is used within containers to turn it into a Mail-in-a-Box. # It is referenced by the Dockerfile. You should not run it directly. ######################################################################## # Local configuration details were not known at the time the Docker # image was created, so all setup is defered until the container # is started. That's when this script runs. # If we're not in an interactive shell, set defaults. if [ ! -t 0 ]; then export PUBLIC_IP=auto export PUBLIC_IPV6=auto export PRIMARY_HOSTNAME=auto export CSR_COUNTRY=US export NONINTERACTIVE=1 fi # The phusion/baseimage base image we use for a working Ubuntu # replaces the normal Upstart system service management with # a ligher-weight service management system called runit that # requires a different configuration. We need to create service # run files that do not daemonize. # For most of the services, there is a common pattern we can use: # execute the init.d script that the Ubuntu package installs, and # then poll for the termination of the daemon. function make_runit_service { INITD_NAME=$1 WAIT_ON_PROCESS_NAME=$2 mkdir -p /etc/service/$INITD_NAME cat > /etc/service/$INITD_NAME/run <