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

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

  ViewVC Help
Powered by ViewVC 1.1.20