summaryrefslogtreecommitdiff
blob: fa35b1df8c7c2cd393854f2e1ae8a29d8f4a3bfa (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
# Copyright 1999-2005 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/net-misc/ksb26/ksb26-0.0.2.ebuild,v 1.1 2005/07/01 06:47:29 s4t4n Exp $

inherit linux-mod

DESCRIPTION="A kernel SOCKS bouncer"
HOMEPAGE="http://ksb.sourceforge.net/"
SRC_URI="mirror://sourceforge/ksb/${P}.tar.gz"
LICENSE="GPL-2"
SLOT="0"
KEYWORDS="~x86"
IUSE=""
S=${WORKDIR}/${PN}

DEPEND=">=sys-apps/sed-4"

pkg_setup()
{
	if ! kernel_is 2 6; then
		die "${P} can only be built against a 2.6.x kernel!"
	fi

	linux-mod_pkg_setup

	MODULE_NAMES="ksb26(misc:${S}/kernel:${S}/kernel)"
	BUILD_TARGETS="all"
}

src_unpack()
{
	unpack ${A}

	cd ${S}
	cp ${FILESDIR}/${PN}-kernel-Makefile kernel/Makefile
	sed -i -e "s:@gcc:\${CC} \${CFLAGS}:" user/Makefile
}

src_compile()
{
	linux-mod_src_compile || die "Kernel module compilation failed!"

	einfo "Preparing userspace tools"
	cd ${S}/user
	emake || die "Userspace tools compilation failed!"
}

src_install()
{
	linux-mod_src_install

	cd ${S}
	dobin user/ksb26manager

	dodir /etc/ksb26
	insinto /etc/ksb26
	doins thosts.example

	doman ksb26.8.gz
	dodoc AUTHOR README TODO
}

pkg_postinst()
{
	linux-mod_pkg_postinst

	if [ ! -e ${ROOT}/dev/ksb26 ]; then
		mknod ${ROOT}/dev/ksb26 c 254 0
	fi

	einfo "Read man page (man ksb26) for informations about the use of ksb26"
	einfo "Don't forget to set target hosts in /etc/ksb26/thosts"
}

pkg_postrm()
{
	if [ -e ${ROOT}/dev/ksb26 ]; then
		rm ${ROOT}/dev/ksb26
	fi
}