summaryrefslogtreecommitdiff
blob: a444a3e6551cfc0497df2f8c587e96cb7bce0b3e (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
# Copyright 1999-2014 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/net-proxy/ntlmaps/ntlmaps-0.9.9.6-r3.ebuild,v 1.1 2014/07/01 17:06:26 pacho Exp $

EAPI=5

PYTHON_DEPEND="2"
SUPPORT_PYTHON_ABIS=1
RESTRICT_PYTHON_ABIS="3.*"

inherit eutils python systemd user

DESCRIPTION="NTLM proxy Authentication against MS proxy/web server"
HOMEPAGE="http://ntlmaps.sourceforge.net/"
SRC_URI="mirror://sourceforge/${PN}/${P}.tar.gz"

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

pkg_setup() {
	python_pkg_setup

	enewgroup ntlmaps
	enewuser ntlmaps -1 -1 -1 ntlmaps
}

src_prepare() {
	epatch "${FILESDIR}/${P}-gentoo.patch"
	python_convert_shebangs 2 main.py

	sed -i -e 's/\r//' lib/*.py server.cfg doc/*.{txt,htm} || die 'Failed to convert line endings.'
}

src_install() {
	# Bug #351305, prevent file collision.
	rm "${S}"/lib/utils.py

	installation() {
		insinto $(python_get_sitedir)
		doins lib/*.py
	}
	python_execute_function installation

	pushd lib > /dev/null
	PYTHON_MODULES=(*.py)
	popd > /dev/null

	exeinto /usr/bin
	newexe main.py ntlmaps

	dodoc doc/*.txt
	dohtml doc/*.{gif,htm}

	insopts -m0640 -g ntlmaps
	insinto /etc/ntlmaps
	doins server.cfg
	newinitd "${FILESDIR}/ntlmaps.init" ntlmaps
	systemd_dounit "${FILESDIR}"/${PN}.service

	diropts -m 0770 -g ntlmaps
	keepdir /var/log/ntlmaps
}

pkg_postinst() {
	python_mod_optimize "${PYTHON_MODULES[@]}"
}

pkg_postrm() {
	python_mod_cleanup "${PYTHON_MODULES[@]}"
}