summaryrefslogtreecommitdiff
path: root/community/exim/PKGBUILD
blob: db94e4188f679ebbfc3723794482c49d73eed331 (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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
# $Id: PKGBUILD 38427 2011-01-27 04:52:11Z angvp $
# Maintainer: Angel Velasquez <angvp@archlinux.org>
# Maintainer: judd <jvinet@zeroflux.org>
pkgname=exim
pkgver=4.74
pkgrel=1
pkgdesc="A Message Transfer Agent"
arch=(i686 x86_64)
url="http://www.exim.org/"
license=('GPL')
backup=(etc/mail/aliases etc/mail/exim.conf \
        etc/logrotate.d/exim etc/conf.d/exim)
install=exim.install
depends=('db' 'pcre' 'pam' 'tcp_wrappers' 'openssl' 'libldap')
makedepends=('sudo')
provides=('smtp-server')
conflicts=('smtp-server')
options=('!makeflags')
source=(ftp://mirrors.24-7-solutions.net/pub/exim/ftp/exim/exim4/exim-${pkgver}.tar.bz2
        aliases 
        newaliases 
        exim 
        exim.logrotate 
        exim.conf.d)
md5sums=('1d9c189940909303d914bbc4247dc861'
         '4874006f0585253ddab027d441009757'
         'ea39f58bffc16f5e3bbe59dffcf09449'
         '9aed772e87223213e8da9ca5e7376869'
         'd788c26f86a9d72a0aebb3b849fe74f2'
         'b75fe4c6e960a59a25b5f51e8f61ba3a')

build() {
  # An exim user is required to build this
  if [ ! `egrep '^exim' /etc/passwd` ]; then
    echo "==> Adding user/group exim (temporarily)"
    sudo groupadd -g 79 exim
    sudo useradd -u 79 -g exim -d /var/spool/exim -s /bin/false exim
    cleanup=1
  else
    cleanup=0
  fi
  
  cd ${srcdir}/${pkgname}-${pkgver}
  sed -i 's|tail -1|tail -n -1|g' scripts/Configure-config.h
  # Make some configuration changes
  sed 's|^BIN_DIRECTORY.*$|BIN_DIRECTORY=/usr/sbin|' src/EDITME | \
  sed 's|^CONFIGURE_FILE.*$|CONFIGURE_FILE=/etc/mail/exim.conf|' | \
  sed 's|^EXIM_USER.*$|EXIM_USER=exim|' | \
  sed 's|^COMPRESS_COMMAND.*$|COMPRESS_COMMAND=/bin/gzip|' | \
  sed 's|^ZCAT_COMMAND.*$|ZCAT_COMMAND=/bin/zcat|' | \
  sed 's|^CHOWN_COMMAND.*$|CHOWN_COMMAND=/bin/chown|' | \
  sed 's|^CHGRP_COMMAND.*$|CHGRP_COMMAND=/bin/chgrp|' | \
  sed 's|^EXIM_MONITOR.*$||' | \
  sed 's|^# MAX_NAMED_LIST.*$|MAX_NAMED_LIST=16|' | \
  sed 's|^# SUPPORT_MAILDIR.*$|SUPPORT_MAILDIR=yes|' | \
  sed 's|^# \(PID_FILE_PATH=/var\)/lock/exim.pid.*$|\1/run/exim.pid|' | \
  sed 's|^# TRANSPORT_LMTP=yes|TRANSPORT_LMTP=yes|' | \
  sed 's|^# LOOKUP_LDAP=yes|LOOKUP_LDAP=yes|' | \
  sed 's|^# LDAP_LIB_TYPE=OPENLDAP2|LDAP_LIB_TYPE=OPENLDAP2|' | \
  sed 's|^# LOOKUP_DSEARCH=yes|LOOKUP_DSEARCH=yes|' | \
  sed 's|^# AUTH_CRAM_MD5=yes$|AUTH_CRAM_MD5=yes|' | \
  sed 's|^# AUTH_PLAINTEXT=yes$|AUTH_PLAINTEXT=yes|' | \
  sed 's|^# AUTH_SPA=yes$|AUTH_SPA=yes|' | \
  sed 's|^# AUTH_DOVECOT=yes$|AUTH_DOVECOT=yes|' | \
  sed 's|^# SUPPORT_PAM=yes$|SUPPORT_PAM=yes|' | \
  sed 's|^# USE_TCP_WRAPPERS=yes$|USE_TCP_WRAPPERS=yes|' | \
  sed 's|^EXIM_GROUP.*$|EXIM_GROUP=exim|' | \
  sed 's|^# SUPPORT_TLS.*$|SUPPORT_TLS=yes|' | \
  sed 's|^# TLS_LIBS.*$|TLS_LIBS=-L/usr/lib -lssl -lcrypto|' | \
  sed 's|^# TLS_INCLUDE.*$|TLS_INCLUDE=-I/usr/include/openssl|' | \
  sed 's|^# WITH_CONTENT_SCAN.*$|WITH_CONTENT_SCAN=yes|' | \
  sed 's|^# WITH_OLD_DEMIME.*$|WITH_OLD_DEMIME=yes|' | \
  sed "s|^SYSTEM_ALIASES_FILE=/etc/aliases|SYSTEM_ALIASES_FILE=${pkgdir}/etc/mail/aliases|" | \
  sed 's|^# \(LOG_FILE_PATH=/var/log/exim\)_%slog.*$|\1/%slog|' >Local/Makefile
  echo "HAVE_IPV6=YES"               >> Local/Makefile
  echo "LOOKUP_LIBS=-lldap"          >> Local/Makefile
  echo "EXTRALIBS_EXIM=-lwrap -lpam" >> Local/Makefile
  make
}

package() {
  cd $srcdir/$pkgname-$pkgver
  install -D -m644 ../exim.logrotate ${pkgdir}/etc/logrotate.d/exim
  install -D -m644 ../exim.conf.d ${pkgdir}/etc/conf.d/exim
  install -D -m644 doc/exim.8 ${pkgdir}/usr/share/man/man8/exim.8
  install -D -m755 ../exim ${pkgdir}/etc/rc.d/exim
  mkdir -p ${pkgdir}/var/spool/exim/db ${pkgdir}/etc/mail \
    ${pkgdir}/var/log/exim ${pkgdir}/usr/{lib,sbin}
  chown root.exim ${pkgdir}/var/spool/exim ${pkgdir}/var/log/exim
  chown exim.exim ${pkgdir}/var/spool/exim/db
  chmod 770 ${pkgdir}/var/spool/exim ${pkgdir}/var/spool/exim/db ${pkgdir}/var/log/exim
  cd build-Linux-*
  inst_dest=${pkgdir}/usr/sbin inst_conf=${pkgdir}/etc/mail/exim.conf ../scripts/exim_install
  cd ${srcdir}/exim-${pkgver}/src
  sed "s|/etc/aliases|/etc/mail/aliases|g" configure.default | \
    sed "s|SYSTEM_ALIASES_FILE|/etc/mail/aliases|g" \
    >${pkgdir}/etc/mail/exim.conf

  cp ${srcdir}/aliases ${pkgdir}/etc/mail
  cp ${srcdir}/newaliases ${pkgdir}/usr/sbin
  cd ${pkgdir}/usr/sbin
  ln -s exim mailq
  ln -s exim rmail
  ln -s exim rsmtp
  ln -s exim runq
  ln -s exim sendmail
  # fhs compliancy
  ln -s ../sbin/exim ../lib/sendmail

  mkdir -p ${pkgdir}/etc/rc.d
  cp ${srcdir}/exim ${pkgdir}/etc/rc.d


  if [ $cleanup -eq 1 ]; then
    echo "==> Removing user/group exim"
    sudo userdel exim
  fi
  return 0
}