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

inherit eutils webapp
MY_FREERADIUS_PV="2.1.1"

DESCRIPTION="Web administration interface of freeradius server"
SRC_URI="ftp://ftp.freeradius.org/pub/radius/freeradius-server-${MY_FREERADIUS_PV}.tar.gz"
HOMEPAGE="http://www.freeradius.org/dialupadmin.html"

KEYWORDS="~amd64 ~ppc ~x86"
IUSE=""
LICENSE="GPL-2"

DEPEND="sys-apps/findutils
	sys-apps/sed"
RDEPEND="dev-lang/php
	dev-perl/Date-Manip
	>=net-dialup/freeradius-${MY_FREERADIUS_PV}"

S="${WORKDIR}/freeradius-server-${MY_FREERADIUS_PV}/dialup_admin"

src_unpack() {
	unpack ${A}

	cd "${S}"
	epatch "${FILESDIR}/${P}-gentoo.patch"
	epatch "${FILESDIR}/${P}-tmpfile.patch"

	sed -i -e 's:/usr/local:/usr:' \
		-e 's:/usr/etc/raddb:${general_raddb_dir}:' \
		-e 's:/usr/radiusd::' \
			conf/admin.conf
	sed -i -e 's:/usr/local:/usr:' bin/*

	#rename files .php3 -> .php
	(find . -iname '*.php3' | (
		local PHPFILE
		while read PHPFILE; do
			mv "${PHPFILE}" "${PHPFILE/.php3/.php}"
		done
	)) && \
	(find . -type f | xargs sed -i -e 's:[.]php3:.php:g') || \
		die "failed to replace php3 with php"

	# fix dangling ../ to deal with the way webapp-config installs files
	find . -name '*.php' | xargs sed -i \
		-e 's:../conf/:../../conf/:' \
		-e 's:../html/:../../html/:' \
		-e 's:../lib/:../../lib/:'
}

src_install() {
	webapp_src_preinst

	insinto "${MY_HTDOCSDIR}"
	doins -r htdocs/*
	insinto "${MY_HOSTROOTDIR}"
	doins -r conf html lib
	exeinto "${MY_HOSTROOTDIR}/bin"
	dodoc bin/*.cron bin/Changelog*
	rm bin/*.cron bin/Changelog*
	doexe bin/*

	insinto "${MY_SQLSCRIPTSDIR}"
	doins -r sql/*

	dodoc Changelog README doc/*

	webapp_hook_script "${FILESDIR}/setrootpath"

	cd "${D}/${MY_HOSTROOTDIR}"
	local CONFFILE
	for CONFFILE in conf/* ; do
		webapp_configfile "${MY_HOSTROOTDIR}/${CONFFILE}"
		webapp_serverowned "${MY_HOSTROOTDIR}/${CONFFILE}"
	done

	webapp_src_install
}