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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.2 - (show annotations) (download)
Fri Jan 30 21:48:29 2009 UTC (10 years, 10 months ago) by dragonheart
Branch: MAIN
CVS Tags: HEAD
Changes since 1.1: +1 -1 lines
FILE REMOVED
version bump and cleanout
(Portage version: 2.2_rc23/cvs/Linux x86_64)

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

  ViewVC Help
Powered by ViewVC 1.1.20