#!/bin/bash

# install postfix
debconf-set-selections <<< "postfix postfix/mailname string localhost" 2>&1
debconf-set-selections <<< "postfix postfix/main_mailer_type string 'Internet Site'" 2>&1
hostname localhost
apt-get install -y postfix 2>&1

# restart mailman3 after postfix is available
service mailman3 restart

# wait for mailman3 to come back after restart
sleep 10

sudo -u list mailman create testlist@example.org
