summaryrefslogtreecommitdiff
blob: 4ec47b09860c4a3c668d35e31f54c2c0066ceaa0 (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
# Copyright 1999-2005 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/net-mail/mailbase/mailbase-0.00-r7.ebuild,v 1.2 2005/02/10 23:02:29 ferdy Exp $

DESCRIPTION="MTA layout package"
SRC_URI=""
HOMEPAGE="http://www.gentoo.org/"

LICENSE="GPL-2"
SLOT="0"
KEYWORDS="~x86 ~ppc ~sparc ~mips ~alpha ~arm ~hppa ~amd64 ~ia64 ~ppc64 ~s390 ~ppc-macos"
IUSE=""

DEPEND=""

S=${WORKDIR}

pkg_setup() {
	local filestoremove=0;
	local lineorig=`head -n 1 ${FILESDIR}/common-pamd`
	local lineold=""

	einfo "Checking for possible file collisions..."

	for i in pop pop3 pop3s pops imap imap4 imap4s imaps;
	do
		if [[ -e ${ROOT}/etc/pam.d/${i} ]]
		then
			lineold="`head -n 1 ${ROOT}/etc/pam.d/${i}`"

			if [[ "${lineorig}" != "${lineold}" ]]
			then
				ewarn "${ROOT}/etc/pam.d/${i} exists and wasn't provided by mailbase"
				(( filestoremove++ ))
			fi
		fi
	done

	if [[ filestoremove -gt 0 ]]
	then
		echo
		einfo "Those files listed above have to be removed in order to"
		einfo " install this version of mailbase."
		echo
		ewarn "If you edited them, remember to backup and when restoring make"
		ewarn " sure the first line in each file is:"
		einfo ${lineorig}
		die "Can't be installed, files will collide"
	else
		einfo "... everything looks ok"
	fi
}

src_install() {
	dodir /etc/mail
	insinto /etc/mail
	doins ${FILESDIR}/aliases
	insinto /etc/
	doins ${FILESDIR}/mailcap

	keepdir /var/spool/mail
	fowners root:mail /var/spool/mail
	fperms 0775 /var/spool/mail
	dosym /var/spool/mail /var/mail

	dodir /etc/pam.d/
	for i in pop pop3 pop3d pops imap imap4 imap4s imaps;
	do
		cp ${FILESDIR}/common-pamd ${D}/etc/pam.d/${i}
	done
}

pkg_postinst() {
	if [ ! -d ${ROOT}/var/spool/mail ]
	then
		mkdir -p ${ROOT}/var/spool/mail
	fi

	# Always set these to close bug #8029.
	chown root:mail ${ROOT}/var/spool/mail
	chmod 0775 ${ROOT}/var/spool/mail
}