summaryrefslogtreecommitdiff
blob: ec63fc6bed9a8a0aa72416636d3dccd884c2c439 (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
# Copyright 1999-2007 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/net-dialup/linesrv/linesrv-2.1.21-r1.ebuild,v 1.9 2007/10/28 13:48:27 phreak Exp $

inherit webapp flag-o-matic

DESCRIPTION="Client/Server system to control the Internet link of a masquerading server"
HOMEPAGE="http://linecontrol.srf.ch/"
SRC_URI="http://linecontrol.srf.ch/down/${P}.src.tar.bz2"

LICENSE="GPL-2"
SLOT="0"
KEYWORDS="~ppc ~sparc x86"
# if someone disables pam but wants user authentication
# to be supported, then crypt is needed.
IUSE="pam mysql crypt"

# requesting glibc instead of virtual/libc
# because we might need crypt. And as far as I
# (S. Fuchs, author of linesrv) remember, there's
# glibc specific stuff in linesrv.
DEPEND=">=sys-libs/glibc-2.2.0
	pam? ( >=sys-libs/pam-0.75 )
	mysql? ( >=virtual/mysql-4.0 )"

RDEPEND="${DEPEND}
	virtual/logger"

S="${WORKDIR}/${PN}-${PV%.*}"

WEBAPP_MANUAL_SLOT=yes

src_unpack() {
	unpack ${A}

	sed -i -e 's:/etc/linesrv.conf:/etc/linesrv/linesrv.conf:' \
		"${S}/server/cfg.h" \
		"${S}/lclog/lclog.c" \
		"${S}/htmlstatus/htmlstatus.c"
	sed -i -e 's:^CFLAGS *=:CFLAGS = @CFLAGS@:' \
		"${S}/server/Makefile.in" #set user CFLAGS
}

src_compile() {
	append-ldflags $(bindnow-flags) #don't use lazy bindings

	local myconf=""
	# sfuchs: configure script of linesrv 2 is quite bad...
	# prefer pam, if disabled try crypt
	# the configure script will disable authentication if
	# neither pam nor crypt is available.
	if ! use pam ; then
		myconf="${myconf} --disable-pamauth"
		if use crypt; then
			myconf="${myconf} --enable-cryptauth"
		fi
	fi
	# --enable-mysql is not supported... stupid, I know.
	use mysql || myconf="${myconf} --disable-mysql"
	econf ${myconf} || die "bad configure"
	emake || die "build failed"
}

src_install() {
	webapp_src_preinst
	dodir /usr/share/linesrv /var/log/linesrv

	dosbin server/linesrv

	mknod "${D}/usr/share/linesrv/logpipe" p
	exeinto /usr/share/linesrv ; doexe server/config/complete_syntax/halt-wrapper

	doman debian/*.{5,8}

	dodoc server/{INSTALL,NEWS,README}
	newdoc htmlstatus/README README.htmlstatus
	newdoc lclog/INSTALL INSTALL.lclog
	newdoc "${FILESDIR}/linesrv.conf" linesrv.conf.sample
	docinto complete_syntax ; dodoc server/config/complete_syntax/*

	insinto /etc/linesrv ; newins "${FILESDIR}/linesrv.conf" linesrv.conf
	newinitd "${FILESDIR}/linesrv.rc6" linesrv
	if use pam ; then
		insinto /etc/pam.d
		newins "${FILESDIR}/linecontrol.pam" linecontrol
		newins "${FILESDIR}/lcshutdown.pam" lcshutdown
	fi

	exeinto "${MY_CGIBINDIR}" ; doexe lclog/lclog htmlstatus/htmlstatus
	insinto "${MY_HTDOCSDIR}/lclog" ; doins lclog/html/*
	webapp_src_install
}

pkg_postinst() {
	elog "The first stage of the installation is done. Now you need to setup your virtual hosts via webapp-config"
	elog "Please read man webapp-config for a detailed description of the process and some examples"
	webapp_pkg_postinst
}