Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100755 107 lines (73 sloc) 2.085 kb
c608824 See ChangeLog.. no programmatic changes
dancy authored
1 #!/bin/sh -e
2
cca0b6d added some utility functions to improve installation over sendmail.
dancy authored
3 # $Header: /repo/cvs.copy/maild/maild-installer,v 1.7 2005/06/14 22:32:31 dancy Exp $
4
5 # Checks for the existence of a file or symlink
6 function EXISTS {
7 [ -L "$1" -o -e "$1" ]
8 }
9
10 # Returns true if thing exists but is not a symlink
11 function NON_SYMLINK {
12 [ ! -L "$1" -a -e "$1" ]
13 }
14
15
16 function migrate {
17 if ! EXISTS "$1.sendmail" && NON_SYMLINK "$1"; then
18 mv "$1" "$1.sendmail"
19 fi
20
21 ln -nsf /usr/local/sbin/maild "$1"
22 }
23
c608824 See ChangeLog.. no programmatic changes
dancy authored
24
25 if [ `id -u` -ne 0 ]; then
26 echo Maild installation requires root privileges
27 exit 1
28 fi
29
30 lib=/usr/local/lib
31
049fa2b See ChangeLog.. installer mods
dancy authored
32 if [ -x /etc/init.d/maild ] && /etc/init.d/maild status; then
33 /etc/init.d/maild stop
34 restart_maild=t
35 fi
36
c608824 See ChangeLog.. no programmatic changes
dancy authored
37 echo Preparing...
38
39 mkdir -p $lib /usr/local/sbin /var/spool/maild
40
41 if [ -e $lib/maild.old ]; then
42 echo Removing prior backup installation...
43 rm -r $lib/maild.old
44 fi
45
46 if [ -e $lib/maild ]; then
47 echo Making backup of current installation...
48 mv $lib/maild $lib/maild.old
49 fi
50
51 echo Extracting...
52
53 (cd $lib && tar zxf -) < maild.tar.gz
54
55 echo Installing...
56
57 chown -R root:root $lib/maild
58 chmod +s $lib/maild/maild
59
60 ln -snf $lib/maild/maild /usr/local/sbin/maild
61 ln -snf $lib/maild/maild /usr/local/sbin/maild-mailq
62
63 if [ -e /etc/init.d/maild ]; then
64 mv /etc/init.d/maild /etc/init.d/maild.old
65 fi
66
67 mv maild.init /etc/init.d/maild
68
69 if [ -e /etc/init.d/maild.old ]; then
70 if diff /etc/init.d/maild.old /etc/init.d/maild >/dev/null; then
71 rm /etc/init.d/maild.old
72 fi
73 fi
74
75 if [ ! -e /etc/sysconfig/maild ]; then
76 echo QUEUE=15m > /etc/sysconfig/maild
77 fi
78
aa08717 If /usr/sbin/alternatives isn't installed, do things manually.
dancy authored
79 if [ -x /usr/sbin/alternatives ]; then
c608824 See ChangeLog.. no programmatic changes
dancy authored
80
aa08717 If /usr/sbin/alternatives isn't installed, do things manually.
dancy authored
81 /usr/sbin/alternatives --install \
82 /usr/sbin/sendmail mta /usr/local/sbin/maild 95 \
83 --slave /usr/bin/mailq mta-mailq /usr/local/sbin/maild-mailq \
84 --initscript maild
85
86 /usr/sbin/alternatives --auto mta
87 else
cca0b6d added some utility functions to improve installation over sendmail.
dancy authored
88 migrate /usr/sbin/sendmail
89 migrate /usr/bin/mailq
aa08717 If /usr/sbin/alternatives isn't installed, do things manually.
dancy authored
90 fi
c608824 See ChangeLog.. no programmatic changes
dancy authored
91
132d200 Use -L for /usr/lib/sendmail test since -e doesn't work as expected on
dancy authored
92 if [ ! -L /usr/lib/sendmail ]; then
93 ln -snf ../sbin/sendmail /usr/lib/sendmail
c608824 See ChangeLog.. no programmatic changes
dancy authored
94 fi
95
96 echo Cleaning up
97
98 rm maild.tar.gz $0
99
049fa2b See ChangeLog.. installer mods
dancy authored
100 if [ -n "$restart_maild" ]; then
101 /etc/init.d/maild start
102 fi
103
c608824 See ChangeLog.. no programmatic changes
dancy authored
104 echo Done.
105
106
Something went wrong with that request. Please try again.