summaryrefslogtreecommitdiff
path: root/gnu/dist/postfix/auxiliary/MacOSX/activate-postfix
blob: 9d7779e8da541d73293176938ae52b51a5c74979 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#!/bin/sh

# Written by Gerben Wierda, Oct 2001. I waive every copyright on this and
# I also do not give any warranty.

. ./defines

# Activate binaries
if [ ! -e ${POSTFIXBACKUPDIR}/sendmail ]
then
	echo "Something is wrong: there is no existing postfix binary backup"
	exit 1;
else
	echo "Restoring postfix versions of sendmail programs from backup..."
	(cd ${POSTFIXBACKUPDIR}; tar cf - sendmail) | (cd /usr/sbin; tar xf -) 
	(cd ${POSTFIXBACKUPDIR}; tar cf - newaliases) | (cd /usr/bin; tar xf -) 
	(cd ${POSTFIXBACKUPDIR}; tar cf - mailq) | (cd /usr/bin; tar xf -)
fi

if [ -e "${PSI}" ]
then
	echo "Postfix StartupItem already exists."
else
	if [ -e "${PSIDISABLED}" ]
	then
		echo "Reinstating disabled Postfix StartupItem..."
		mv "${PSIDISABLED}" "${PSI}"
	else
		echo "Installing new default Postfix StartupItem..."
		cp -R Postfix.StartupItem "${PSI}"
	fi
fi

# De-activate sendmail in /etc/hostconfig
/usr/bin/perl -pi -e 's/MAILSERVER=-YES-/MAILSERVER=-NO-/g' /etc/hostconfig
# Activate postfix in /etc/hostconfig
if /usr/bin/grep '^POSTFIX=-NO-' /etc/hostconfig >/dev/null 2>&1; then
	/usr/bin/perl -pi -e 's/POSTFIX=-NO-/POSTFIX=-YES-/g' /etc/hostconfig
else
	echo "POSTFIX=-YES-" >>/etc/hostconfig
fi

/usr/sbin/postfix start