File: activate-postfix

package info (click to toggle)
postfix 2.3.8-2%2Betch1
  • links: PTS
  • area: main
  • in suites: etch
  • size: 15,744 kB
  • ctags: 11,426
  • sloc: ansic: 81,810; makefile: 10,743; sh: 7,874; perl: 2,468; awk: 41
file content (43 lines) | stat: -rwxr-xr-x 1,243 bytes parent folder | download | duplicates (3)
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