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

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

Parent Directory Parent Directory | Revision Log Revision Log


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

  ViewVC Help
Powered by ViewVC 1.1.20