summaryrefslogtreecommitdiff
blob: b8a56b40e6461e0a4fd5bfd8ddfee9e30e80b698 (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
# Copyright 1999-2012 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Id$

EAPI=4

inherit eutils user

DESCRIPTION="Caching proxy for the Debian package system"
HOMEPAGE="https://sourceforge.net/projects/apt-proxy/"
SRC_URI="mirror://sourceforge/${PN}/${PN}_${PV}.tar.gz"
LICENSE="GPL-2"
SLOT="0"

KEYWORDS="~amd64 ~x86"
IUSE=""

DEPEND=""
RDEPEND="sys-apps/xinetd"

pkg_setup () {
	enewgroup ${PN}
	enewuser ${PN} -1 -1 /dev/null ${PN}
}

src_prepare() {
	epatch "${FILESDIR}"/${P}-sh.patch
}

src_install() {
	dosbin ${PN}

	insinto /etc/${PN}
	doins ${PN}.conf

	insinto /etc/xinetd.d
	doins "${FILESDIR}"/${PN}

	dodoc README INSTALL HISTORY
	doman ${PN}.{8,conf.5}

	# Create the log file with the proper permissions
	dodir /var/log
	touch "${D}"/var/log/${PN}.log
	fowners ${PN}:${PN} /var/log/${PN}.log

	# Create the cache directories and set the proper permissions
	dodir /var/cache/${PN}
	keepdir /var/cache/${PN}
	fowners ${PN}:${PN} /var/cache/${PN}
}

pkg_postinst() {
	einfo ""
	einfo "Don't forget to modify the /etc/${PN}/${PN}.conf"
	einfo "file to fit your needs..."
	einfo ""
	einfo "Also note that ${PN} is called from running xinetd"
	einfo "and you have to enable it first (/etc/xinetd.d/${PN})..."
	einfo ""
}

pkg_postrm() {
	einfo ""
	einfo "You have to remove the ${PN} cache by hand. It's located"
	einfo "in the \"/var/cache/${PN}\" dir..."
	einfo ""
	einfo "You can also remove the ${PN} user and group..."
	einfo ""
}