summaryrefslogtreecommitdiff
blob: a66b0da43e1eef96ebc444a913c18bc4defd4e34 (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
# Copyright 1999-2004 Gentoo Technologies, Inc.
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/sys-apps/pam-login/pam-login-3.14.ebuild,v 1.13 2004/03/31 02:21:11 tgall Exp $

inherit gnuconfig

IUSE="nls selinux"

# Do we want to backup an old login.defs, and forcefully
# install a new version?
FORCE_LOGIN_DEFS="no"

MY_PN="${PN/pam-/pam_}"
S="${WORKDIR}/${MY_PN}-${PV}"
DESCRIPTION="Based on the sources from util-linux, with added pam and shadow features"
SRC_URI="ftp://ftp.suse.com/pub/people/kukuk/pam/${MY_PN}/${MY_PN}-${PV}.tar.bz2"
HOMEPAGE="http://www.thkukuk.de/pam/pam_login/"

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

DEPEND="virtual/glibc
	sys-libs/pam
	>=sys-apps/shadow-4.0.2-r5
	selinux? ( sys-libs/libselinux )"

src_unpack() {
	unpack ${A}

	cd ${S}

	# Do not warn on inlining for gcc-3.3, bug #21213
	epatch ${FILESDIR}/${PN}-3.11-gcc33.patch
	epatch ${FILESDIR}/pam-login-3.11-lastlog-fix.patch

	# enable query_user_context selinux code (only affects selinux)
	epatch ${FILESDIR}/pam-login-3.14-query_user_context.diff

	use ppc64 && epatch ${FILESDIR}/pam_login-Werror-off-ppc64.patch
}

src_compile() {
	local myconf=

	# Fix configure scripts to recognize linux-mips
	# (imports updated config.sub and config.guess)
	gnuconfig_update

	use nls || myconf="${myconf} --disable-nls"
	use selinux && myconf="${myconf} --enable-selinux"

	econf ${myconf} || die

	emake || die
}

src_install() {
	einstall rootexecbindir=${D}/bin || die

	# We use the one from shadow
	rm -rf ${D}/etc/pam.d

	insinto /etc
	insopts -m0644

	doins ${FILESDIR}/login.defs
	# Also install another one that we can use to check if
	# we need to update it if FORCE_LOGIN_DEFS = "yes"
	[ "${FORCE_LOGIN_DEFS}" = "yes" ] \
		&& newins ${FILESDIR}/login.defs login.defs.new

	dodoc AUTHORS COPYING ChangeLog NEWS README THANKS
}

pkg_preinst() {
	rm -f ${ROOT}/etc/login.defs.new
}

pkg_postinst() {
	[ "${FORCE_LOGIN_DEFS}" != "yes" ] && return 0

	ewarn "Due to a compatibility issue, ${ROOT}etc/login.defs "
	ewarn "is being updated automatically. Your old login.defs"
	ewarn "will be backed up as:  ${ROOT}etc/login.defs.bak"
	echo

	local CHECK1="`md5sum ${ROOT}/etc/login.defs | cut -d ' ' -f 1`"
	local CHECK2="`md5sum ${ROOT}/etc/login.defs.new | cut -d ' ' -f 1`"

	if [ "${CHECK1}" != "${CHECK2}" ]
	then
		cp -a ${ROOT}/etc/login.defs ${ROOT}/etc/login.defs.bak
		mv -f ${ROOT}/etc/login.defs.new ${ROOT}/etc/login.defs
	elif [ ! -f ${ROOT}/etc/login.defs ]
	then
		mv -f ${ROOT}/etc/login.defs.new ${ROOT}/etc/login.defs
	else
		rm -f ${ROOT}/etc/login.defs.new
	fi
}