updated on Tue Jan 10 04:01:21 UTC 2012
[aur-mirror.git] / sendmail / PKGBUILD
blobe22ebe4a9986999f0ab984b2a834acd28cd14352
1 # Thanks to doze_worm <shuimao@gmail.com> for the original port.
2 contributor=mazieres
3 pkgname="sendmail"
4 pkgver=8.14.5
5 pkgrel=1
6 pkgdesc="The sendmail MTA"
7 arch=('i686' 'x86_64')
8 license=(unknown)
9 provides=('sendmail=8.14')
10 conflicts=()
11 backup=(etc/mail/aliases etc/mail/sendmail.cf)
12 source=("ftp://ftp.sendmail.org/pub/sendmail/${pkgname}.${pkgver}.tar.gz"
13         sendmail.rc)
14 url="http://www.sendmail.org"
15 depends=(db)
16 md5sums=('02ccfc331cc81ed00ec8bb5ecfc69018'
17          '506eeef3f427e2fd3e028a91de9943bd')
18 sha256sums=('fb65a86a0f87f12aefb933ee8990540f7a680a594f7fedfdd28918f3934bfb88'
19             'dcffe77814c2ea7b6349720505c2a788a79358889560398709bec29769042f8e')
21 install="${pkgname}.install"
23 check_smmsp(){
24     addgroup="/usr/sbin/groupadd -g 25 smmsp"
25     adduser="/usr/sbin/useradd -c 'sendmail' -u 150 -g smmsp -d /var/spool/mail -s /bin/false smmsp"
26     need_user=no
27     need_group=no
28     getent passwd smmsp >/dev/null || need_user=yes
29     getent group smmsp >/dev/null || need_group=yes
30     case "$need_user,$need_group" in
31         no,no)
32             return 0
33             ;;
34         yes,no)
35             echo "Must create user smmsp"
36             cmd="$adduser"
37             ;;
38         no,yes)
39             echo "Must create group smmsp"
40             cmd="$addgroup"
41             ;;
42         *)
43             echo "Must create user and group smmsp"
44             cmd="$addgroup && $adduser"
45             ;;
46     esac
47     if [[ $(id -u) == 0 ]]; then
48         echo Executing "$cmd"
49         $cmd || return 1
50     else
51         echo Executing sudo "$cmd"
52         /usr/bin/sudo sh -c "$cmd" || return 1
53     fi
56 build(){
57     check_smmsp
58     cd "$srcdir/${pkgname}-${pkgver}" || return 1
59     ./Build || return 1
60     GROFF_NO_SGR=1 make -C doc/op op.txt op.ps
63 package(){
64         mkdir -p $pkgdir/etc/rc.d
65         cp sendmail.rc $pkgdir/etc/rc.d/sendmail
66         cd "$srcdir/${pkgname}-${pkgver}" || return 1
67         mkdir -p $pkgdir/usr/{bin,sbin,share/man,share/doc/sendmail} \
68                 $pkgdir/usr/man/man{1,5,8} $pkgdir/var/spool/mqueue \
69             || return 1
70         make install DESTDIR="$pkgdir" || return 1
71         make -C mail.local force-install DESTDIR="$pkgdir" || return 1
72         make -C rmail force-install DESTDIR="$pkgdir" || return 1
73         mv $pkgdir/usr/man/* $pkgdir/usr/share/man/
74         rmdir $pkgdir/usr/man
75         cp -r cf $pkgdir/usr/share/sendmail-cf
76         cp sendmail/aliases $pkgdir/etc/mail/aliases
77         cp cf/cf/generic-linux.cf $pkgdir/etc/mail/sendmail.cf
78         cp doc/op/op.{ps,txt} $pkgdir/usr/share/doc/sendmail/
79         find $pkgdir -user bin -print | xargs chown root
80         find $pkgdir -group bin -print | xargs chgrp root