#!/bin/sh

. /etc/control.d/functions

CONFIG=/etc/exim/exim.conf
EXE=/etc/init.d/exim

new_summary "Exim SMTP server"

new_subst server \
	'^#local_interfaces[[:space:]]+=[[:space:]]+127.0.0.1[[:space:]]*$' \
	's/^\(local_interfaces[[:space:]]\+=[[:space:]]\+127.0.0.1[[:space:]]*\)$/#\1/'
new_subst local \
	'^local_interfaces[[:space:]]+=[[:space:]]+127.0.0.1[[:space:]]*$' \
	's/^#\(local_interfaces[[:space:]]\+=[[:space:]]\+127.0.0.1[[:space:]]*\)$/\1/'

new_help local "Disable Exim SMTP service"
new_help server "Enable Exim SMTP service"

is_builtin_mode "$*" ||
        [ "$*" != "`control_subst "$CONFIG" status`" ] || exit 0

control_subst "$CONFIG" "$*"

is_builtin_mode "$*" ||
        [ ! -x "$EXE" ] || "$EXE" condreload || exit 0
