#!/bin/sh -e

# Basic /var/qmail/control configuration so qmail has a chance to
# work out-of-the-box for very simple installations.

name=`uname -n`
ddom=`echo "$name" | sed 's/^\([^\.]*\)\.\([^\.]*\)\./\2\./'`
pdom=`echo "$name" | sed 's/^.*\.\([^\.]*\)\.\([^\.]*\)$/\1.\2/'`

cd /var/qmail/control
echo "$name" > me
echo "$name" > locals
echo "$name" > rcpthosts
echo "$name powered by qmail" > smtpgreeting
echo "$ddom" > defaultdomain
echo "$pdom" > plusdomain

{
  echo "Minimal qmail configuration done in /var/qmail/control."
  echo "Please check and adjust those settings before starting the service."
  echo "Please review /etc/init.d/netqmail for more settings."
} 1>&2