/[gentoo-x86]/net-misc/l7-filter/l7-filter-2.0.ebuild
Gentoo

Contents of /net-misc/l7-filter/l7-filter-2.0.ebuild

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.3 - (show annotations) (download)
Sun Jul 9 11:19:00 2006 UTC (13 years, 6 months ago) by dragonheart
Branch: MAIN
CVS Tags: HEAD
Changes since 1.2: +1 -1 lines
FILE REMOVED
remove old versions. Remodeled the uninstall portion of l7-filter to not break so easily (bug #110249)
(Portage version: 2.1.1_pre2-r6)
 (Signed Manifest commit)

1 # Copyright 1999-2006 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Header: /var/cvsroot/gentoo-x86/net-misc/l7-filter/l7-filter-2.0.ebuild,v 1.2 2006/01/06 10:34:12 dragonheart Exp $
4
5 inherit linux-info eutils
6
7 MY_P=netfilter-layer7-v${PV/_/-}
8 DESCRIPTION="Kernel modules for layer 7 iptables filtering"
9 HOMEPAGE="http://l7-filter.sourceforge.net"
10 SRC_URI="mirror://sourceforge/l7-filter/${MY_P}.tar.gz
11 mirror://gentoo/additional_patch_for_2.6.13.diff"
12
13 LICENSE="GPL-2"
14 KEYWORDS="~amd64 ~ppc ~sparc ~x86"
15 IUSE=""
16 #break repoman
17 #SLOT="${KV}"
18 SLOT="0"
19 S=${WORKDIR}/${MY_P}
20 RDEPEND="net-misc/l7-protocols"
21
22
23 which_patch() {
24 if kernel_is ge 2 6 13
25 then
26 PATCH=kernel-2.6.13-2.6.14-layer7-2.0.patch
27 elif kernel_is ge 2 6 11
28 then
29 PATCH=for_older_kernels/kernel-2.6.11-2.6.12-layer7-1.4.patch
30 elif kernel_is ge 2 6 9
31 then
32 PATCH=for_older_kernels/kernel-2.6.9-2.6.10-layer7-1.2.patch
33 elif kernel_is 2 4
34 then
35 PATCH=kernel-2.4-layer7-2.0.patch
36 else
37 die "No L7-filter patch for Kernel version ${KV_FULL} - sorry not supported"
38 fi
39 }
40
41 pkg_setup() {
42 pkg_postinst
43 }
44
45 src_unpack() {
46
47 which_patch
48
49 if [ -f ${KV_DIR}/include/linux/netfilter_ipv4/ipt_layer7.h ]
50 then
51 ewarn "already installed ${PN} for kernel ${KV_FULL}"
52 ewarn "If this is an upgrade attempt, try unmerging first."
53 ewarn "If this failes remove your kernel source from /usr/src"
54 ewarn "and remerge your kernel sources"
55 die
56 fi
57
58 unpack ${MY_P}.tar.gz
59
60 [ ! -f "${S}/${PATCH}" ] && \
61 die "patch ${PATCH} not found. Please enter a bug at bugs.gentoo.org"
62
63
64 cd ${S}
65
66 mkdir kernel
67 mkdir kernel/Documentation
68
69
70 # create needed directories
71 mkdir -p ${S}/kernel/net/ipv4/netfilter/regexp/
72 mkdir -p ${S}/kernel/include/linux/netfilter_ipv4/
73
74 cd ${KV_DIR}
75
76 # start to copy needed files, if file not exists create an empty file
77 FILES=$(patch -t --dry-run -p1 < ${S}/${PATCH} | grep "^patching file" | cut -f 3 -d ' ')
78 for F in ${FILES};
79 do
80 if [ -f ${F} ];
81 then
82 cp -P ${F} ${S}/kernel/${F}
83 else
84 touch ${S}/kernel/${F}
85 fi
86 done
87
88 #patch the copied kernel source
89 cd ${S}/kernel
90 EPATCH_OPTS="-F 3" epatch "${S}/${PATCH}"
91
92 # https://bugs.gentoo.org/show_bug.cgi?id=106009#c5
93 if kernel_is eq 2 6 12
94 then
95 epatch ${DISTDIR}/additional_patch_for_2.6.13.diff
96 fi
97 }
98
99 src_compile() {
100 einfo "no compiling - just patching source"
101 }
102
103 src_install() {
104 insinto "${KV_DIR}"
105 doins -r kernel/*
106 dodoc CHANGELOG README
107 }
108
109
110 pkg_postinst() {
111 ewarn "This may not work with all kernels. If it does not work please enter a bug at bugs.gentoo.org"
112 ewarn "This only patches the current kernel source code. (${KV_DIR})"
113 ewarn "Its up to you to recompile the kernel with the l7 options"
114 ewarn
115 ewarn 'You will also need to emerge iptables with the "extensions" USE flag'
116 }
117
118 pkg_prerm() {
119 if [ -f ${ROOT}/usr/src/linux/include/linux/netfilter_ipv4/ipt_layer7.h ]
120 then
121 einfo 'attempting to unpatch l7-patch from kernel ${KV_FULL}'
122 which_patch
123 if kernel_is eq 2 6 12
124 then
125 patch -F 3 -d ${ROOT}/usr/src/linux -R -p1 \
126 < ${DISTDIR}/additional_patch_for_2.6.13.diff
127 fi
128 cd ${T}
129 unpack ${MY_P}.tar.gz
130 EPATCH_SINGLE_MSG="removing previous patch" \
131 EPATCH_OPTS="-F 3 -d ${ROOT}/usr/src/linux -R" epatch "${T}/${MY_P}/${PATCH}"
132 fi
133 }

  ViewVC Help
Powered by ViewVC 1.1.20