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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.7 - (show annotations) (download)
Sat Jan 3 09:53:14 2009 UTC (11 years ago) by dragonheart
Branch: MAIN
CVS Tags: HEAD
Changes since 1.6: +1 -1 lines
FILE REMOVED
version bump as per bug #233695 thanks to Nebojsa Trpkovic. clean out old versions too
(Portage version: 2.2_rc20/cvs/Linux 2.6.26-gentoo-r4 x86_64)

1 # Copyright 1999-2007 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.12.ebuild,v 1.6 2007/12/24 09:26:19 pva 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="~alpha -amd64 ~arm ~hppa -ia64 ppc -ppc64 ~s390 ~sh 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 which_patch() {
23 if kernel_is ge 2 6 22
24 then
25 PATCH=kernel-2.6.22-layer7-${PV}.patch
26 elif kernel_is ge 2 6 20
27 then
28 PATCH=for_older_kernels/kernel-2.6.20-2.6.21-layer7-2.10.patch
29 elif kernel_is ge 2 6 18
30 then
31 PATCH=for_older_kernels/kernel-2.6.18-2.6.19-layer7-2.9.patch
32 elif kernel_is ge 2 6 17
33 then
34 PATCH=for_older_kernels/kernel-2.6.17-layer7-2.5.patch
35 elif kernel_is ge 2 6 13
36 then
37 PATCH=for_older_kernels/kernel-2.6.13-2.6.16-layer7-2.2.patch
38 elif kernel_is ge 2 6 11
39 then
40 PATCH=for_older_kernels/kernel-2.6.11-2.6.12-layer7-1.4.patch
41 elif kernel_is ge 2 6 9
42 then
43 PATCH=for_older_kernels/kernel-2.6.9-2.6.10-layer7-1.2.patch
44 elif kernel_is ge 2 6 0
45 then
46 PATCH=for_older_kernels/kernel-2.6.0-2.6.8.1-layer7-0.9.2.patch
47 elif kernel_is 2 4
48 then
49 PATCH=kernel-2.4-layer7-${PV}.patch
50 else
51 die "No L7-filter patch for Kernel version ${KV_FULL} - sorry not supported"
52 fi
53 }
54
55 pkg_setup() {
56 linux-info_pkg_setup
57 pkg_preinstall
58 pkg_postinst
59 }
60
61 src_unpack() {
62
63 which_patch
64
65 if [ -f ${KV_DIR}/include/linux/netfilter_ipv4/ipt_layer7.h ] || \
66 [ -f ${KV_DIR}/include/linux/netfilter/xt_layer7.h ]
67 then
68 ewarn "already installed ${PN} for kernel ${KV_FULL}"
69 ewarn "If this is an upgrade attempt, try unmerging first."
70 ewarn "If this failes remove your kernel source from /usr/src"
71 ewarn "and remerge your kernel sources"
72 die
73 fi
74
75 unpack ${MY_P}.tar.gz
76
77 [ ! -f "${S}/${PATCH}" ] && \
78 die "patch ${PATCH} not found. Please enter a bug at bugs.gentoo.org"
79
80 cd "${S}"
81
82 mkdir kernel
83 mkdir kernel/Documentation
84
85 # create needed directories
86 if kernel_is ge 2 6 20
87 then
88 mkdir -p "${S}"/kernel/net/netfilter/regexp/
89 mkdir -p "${S}"/kernel/include/net/netfilter/
90 else
91 mkdir -p "${S}"/kernel/net/ipv4/netfilter/regexp/
92 mkdir -p "${S}"/kernel/include/linux/netfilter_ipv4/
93 fi
94
95 cd ${KV_DIR}
96
97 # start to copy needed files, if file not exists create an empty file
98 FILES=$(patch -t --dry-run -p1 < "${S}"/${PATCH} | grep "^patching file" | cut -f 3 -d ' ')
99 for F in ${FILES};
100 do
101 if [ -f "${F}" ];
102 then
103 cp -P "${F}" "${S}/kernel/${F}"
104 #else
105 # touch "${S}/kernel/${F}"
106 fi
107 done
108
109 #patch the copied kernel source
110 cd "${S}"/kernel
111 EPATCH_OPTS="-F 3" epatch "${S}/${PATCH}"
112
113 # https://bugs.gentoo.org/show_bug.cgi?id=106009#c5
114 if kernel_is eq 2 6 12
115 then
116 epatch "${DISTDIR}"/additional_patch_for_2.6.13.diff
117 fi
118 }
119
120 src_compile() {
121 einfo "no compiling - just patching source"
122 }
123
124 src_install() {
125 insinto "$(/bin/readlink -f ${KV_DIR})"
126 doins -r kernel/*
127 dodoc CHANGELOG README
128 }
129
130 pkg_preinstall() {
131 if has collision-protect ${FEATURES}; then
132 ewarn
133 ewarn "Collisions are expected as this patches kernel code. Use"
134 ewarn "FEATURES=-collision-protect emerge ...... for this package"
135 die 'incompatible FEATURES=collision-protect'
136 fi
137 }
138
139 pkg_postinst() {
140 ewarn "This may not work with all kernels. If it does not work please enter a bug at bugs.gentoo.org"
141 ewarn "This only patches the current kernel source code. (${KV_DIR})"
142 ewarn "Its up to you to recompile the kernel with the l7 options"
143 ewarn
144 ewarn 'You will also need to emerge iptables with the "extensions" or'
145 ewarn '"l7filter" USE flag (depend which version of iptables you emerge)'
146 }
147
148 #
149 # Unpatching of patched files is required to avoid a broken kernel source tree
150
151 pkg_prerm() {
152 # How to determine what version it was installed against? - measily
153 if [ -f "${ROOT}"/var/db/pkg/net-misc/${PF}/environment ]; then
154 eval $(/bin/fgrep KV=2 "${ROOT}"/var/db/pkg/net-misc/${PF}/environment |\
155 /bin/head -1)
156 elif [ -f "${ROOT}"/var/db/pkg/net-misc/${PF}/environment.bz2 ]; then
157 eval $(/bin/bzfgrep KV=2 "${ROOT}"/var/db/pkg/net-misc/${PF}/environment.bz2 |\
158 /bin/head -1)
159 elif [ -f "${ROOT}"/var/db/pkg/net-misc/${PF}/environment.gz ]; then
160 eval $(/usr/bin/zfgrep KV=2 "${ROOT}"/var/db/pkg/net-misc/${PF}/environment.gz |\
161 /bin/head -1)
162 else
163 die 'could not find previous version'
164 fi
165 KV_DIR=/usr/src/linux-"${KV}"
166 if [ -d ${KV_DIR} ]; then
167 ewarn "${KV_DIR} nolonger exists"
168 return 0;
169 fi
170 echo "KV_DIR=$KV_DIR"
171 if [ -f ${KV_DIR}/include/linux/netfilter_ipv4/ipt_layer7.h ] || \
172 [ -f ${KV_DIR}/include/linux/netfilter/xt_layer7.h ]
173 then
174 einfo 'attempting to unpatch l7-patch from kernel ${KV_FULL}'
175 which_patch
176 if kernel_is eq 2 6 12
177 then
178
179 patch -F 3 -d "${KV_DIR}" -R -p1 \
180 < "${DISTDIR}"/additional_patch_for_2.6.13.diff
181 fi
182 cd "${T}"
183 unpack ${MY_P}.tar.gz
184 EPATCH_SINGLE_MSG="removing previous patch" \
185 EPATCH_OPTS="-F 3 -d "${KV_DIR}" -R" epatch "${T}/${MY_P}/${PATCH}"
186 fi
187 }

  ViewVC Help
Powered by ViewVC 1.1.20