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

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

Parent Directory Parent Directory | Revision Log Revision Log


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

  ViewVC Help
Powered by ViewVC 1.1.20