Gentoo Archives: gentoo-commits

From: Rick Farina <zerochaos@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: net-wireless/kismet/
Date: Thu, 20 Jan 2022 17:04:52
Message-Id: 1642698283.2edb0632366c4843d960602928387f573a1e24a6.zerochaos@gentoo
1 commit: 2edb0632366c4843d960602928387f573a1e24a6
2 Author: Rick Farina <zerochaos <AT> gentoo <DOT> org>
3 AuthorDate: Thu Jan 20 17:03:58 2022 +0000
4 Commit: Rick Farina <zerochaos <AT> gentoo <DOT> org>
5 CommitDate: Thu Jan 20 17:04:43 2022 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=2edb0632
7
8 net-wireless/kismet: add 2022.01.2
9
10 Signed-off-by: Rick Farina <zerochaos <AT> gentoo.org>
11
12 net-wireless/kismet/Manifest | 1 +
13 net-wireless/kismet/kismet-2022.01.2.ebuild | 203 ++++++++++++++++++++++++++++
14 2 files changed, 204 insertions(+)
15
16 diff --git a/net-wireless/kismet/Manifest b/net-wireless/kismet/Manifest
17 index c0618cb9dccb..3ec7b9557827 100644
18 --- a/net-wireless/kismet/Manifest
19 +++ b/net-wireless/kismet/Manifest
20 @@ -1 +1,2 @@
21 DIST kismet-2021-08-R1.tar.xz 10621004 BLAKE2B 236a43d2073e380c60dadfc4f611465ffa5c7de2a282fa3f45252368cbc65aaa21ad6d33c504685e39ec7913a36364283f6706d6ad8fcecf2f7922c23a4aa792 SHA512 91e86dc1d3b69aa8cb6dff4c4b8bb959dca128f06d1298effe1b23ed24158ce4285abdf2af838f48588b9e71c69f82538d1a002838c4bc1d053868118e394b7a
22 +DIST kismet-2022-01-R2.tar.xz 10700972 BLAKE2B 8dcc90beac3f3b9404162bde9e624225bfdccb573d45de4f45ccbc0d46c9fb6ae1c870b878da796fd7e0d672211fa06c5c76315294a235f97bd8b47e7355f542 SHA512 6a2dfdc66160f72857409cc28c4d9666711a5cda8694e13a76fc738ca665a8ab3c3359951bd93777cf83eda22533d4d6b4ba632c81738a4d7a9981b3a687b1ff
23
24 diff --git a/net-wireless/kismet/kismet-2022.01.2.ebuild b/net-wireless/kismet/kismet-2022.01.2.ebuild
25 new file mode 100644
26 index 000000000000..e82c719234ad
27 --- /dev/null
28 +++ b/net-wireless/kismet/kismet-2022.01.2.ebuild
29 @@ -0,0 +1,203 @@
30 +# Copyright 1999-2022 Gentoo Authors
31 +# Distributed under the terms of the GNU General Public License v2
32 +
33 +EAPI=8
34 +
35 +PYTHON_COMPAT=( python3_{8,9,10} )
36 +
37 +inherit autotools python-single-r1 udev systemd
38 +
39 +if [[ ${PV} == "9999" ]] ; then
40 + EGIT_REPO_URI="https://www.kismetwireless.net/git/${PN}.git"
41 + inherit git-r3
42 + RESTRICT="strip"
43 +else
44 + MY_P=${P/\./-}
45 + MY_P=${MY_P/_beta/-BETA}
46 + MY_P=${MY_P/./-R}
47 + S=${WORKDIR}/${MY_P/BETA/beta}
48 +
49 + #normally we want an official release
50 + SRC_URI="https://www.kismetwireless.net/code/${MY_P}.tar.xz"
51 +
52 + #but sometimes we want a git commit
53 + #COMMIT="9ca7e469cf115469f392db7436816151867e1654"
54 + #SRC_URI="https://github.com/kismetwireless/kismet/archive/${COMMIT}.tar.gz -> ${P}.tar.gz"
55 + #S="${WORKDIR}/${PN}-${COMMIT}"
56 +
57 + KEYWORDS="~amd64 ~arm ~arm64 ~ppc ~x86"
58 +fi
59 +
60 +DESCRIPTION="IEEE 802.11 wireless LAN sniffer"
61 +HOMEPAGE="https://www.kismetwireless.net"
62 +
63 +LICENSE="GPL-2"
64 +SLOT="0/${PV}"
65 +IUSE="libusb lm-sensors networkmanager +pcre rtlsdr selinux +suid ubertooth udev"
66 +REQUIRED_USE="${PYTHON_REQUIRED_USE}"
67 +
68 +CDEPEND="
69 + ${PYTHON_DEPS}
70 + acct-user/kismet
71 + acct-group/kismet
72 + networkmanager? ( net-misc/networkmanager:= )
73 + dev-libs/glib:=
74 + dev-libs/elfutils:=
75 + sys-libs/zlib:=
76 + dev-db/sqlite:=
77 + net-libs/libmicrohttpd:=
78 + net-libs/libwebsockets:=[client,lejp]
79 + kernel_linux? ( sys-libs/libcap
80 + dev-libs/libnl:3
81 + net-libs/libpcap
82 + )
83 + libusb? ( virtual/libusb:1 )
84 + dev-libs/protobuf-c:=
85 + dev-libs/protobuf:=
86 + $(python_gen_cond_dep '
87 + dev-python/protobuf-python[${PYTHON_USEDEP}]
88 + dev-python/websockets[${PYTHON_USEDEP}]
89 + ')
90 + sys-libs/ncurses:=
91 + lm-sensors? ( sys-apps/lm-sensors )
92 + pcre? ( dev-libs/libpcre )
93 + suid? ( sys-libs/libcap )
94 + ubertooth? ( net-wireless/ubertooth:= )
95 + "
96 +
97 +DEPEND="${CDEPEND}
98 + dev-libs/boost
99 + dev-libs/libfmt
100 + virtual/pkgconfig
101 +"
102 +
103 +RDEPEND="${CDEPEND}
104 + $(python_gen_cond_dep '
105 + dev-python/pyserial[${PYTHON_USEDEP}]
106 + ')
107 + selinux? ( sec-policy/selinux-kismet )
108 +"
109 +PDEPEND="
110 + rtlsdr? (
111 + $(python_gen_cond_dep '
112 + dev-python/numpy[${PYTHON_USEDEP}]
113 + ')
114 + net-wireless/rtl-sdr
115 + )"
116 +
117 +src_prepare() {
118 + sed -i -e "s:^\(logtemplate\)=\(.*\):\1=/tmp/\2:" \
119 + conf/kismet_logging.conf || die
120 +
121 + #this was added to quiet macosx builds but it makes gcc builds noisier
122 + sed -i -e 's#-Wno-unknown-warning-option ##g' Makefile.inc.in || die
123 +
124 + #sed -i -e 's#root#kismet#g' packaging/systemd/kismet.service.in
125 +
126 + rm -r boost || die
127 + rm -r fmt || die
128 +
129 + #dev-libs/jsoncpp
130 + #rm -r json || die
131 + #sed -i 's#"json/json.h"#<json/json.h>#' jsoncpp.cc kis_net_beast_httpd.h \
132 + # log_tools/kismetdb_clean.cc log_tools/kismetdb_dump_devices.cc \
133 + # log_tools/kismetdb_statistics.cc log_tools/kismetdb_to_gpx.cc \
134 + # log_tools/kismetdb_to_kml.cc log_tools/kismetdb_to_pcap.cc \
135 + # log_tools/kismetdb_to_wiglecsv.cc trackedcomponent.h \
136 + # trackedelement.h trackedelement_workers.h
137 +
138 + # Don't strip and set correct mangrp
139 + sed -i -e 's| -s||g' \
140 + -e 's|@mangrp@|root|g' Makefile.in || die
141 +
142 + eapply_user
143 +
144 + #just use set to fix setup.py
145 + find . -name "Makefile.in" -exec sed -i 's#setup.py install#setup.py install --root=$(DESTDIR)#' {} + || die
146 + find . -name "Makefile" -exec sed -i 's#setup.py install#setup.py install --root=$(DESTDIR)#' {} + || die
147 +
148 + if [ "${PV}" = "9999" ]; then
149 + eautoreconf
150 + fi
151 +}
152 +
153 +src_configure() {
154 + econf \
155 + $(use_enable libusb libusb) \
156 + $(use_enable pcre) \
157 + $(use_enable lm-sensors lmsensors) \
158 + $(use_enable networkmanager libnm) \
159 + $(use_enable ubertooth) \
160 + --sysconfdir=/etc/kismet \
161 + --disable-optimization
162 +}
163 +
164 +src_install() {
165 + emake DESTDIR="${D}" commoninstall
166 + python_optimize
167 + emake DESTDIR="${D}" forceconfigs
168 + use udev && udev_dorules packaging/udev/*.rules
169 +
170 + insinto /usr/share/${PN}
171 + doins Makefile.inc
172 + if [ "${PV}" = "9999" ];then
173 + doins "${FILESDIR}"/gdb
174 + dobin "${FILESDIR}"/kismet-gdb
175 + fi
176 +
177 + dodoc CHANGELOG README*
178 + newinitd "${FILESDIR}"/${PN}.initd-r3 kismet
179 + newconfd "${FILESDIR}"/${PN}.confd-r2 kismet
180 + systemd_dounit packaging/systemd/kismet.service
181 +}
182 +
183 +pkg_preinst() {
184 + if use suid; then
185 + fowners root:kismet /usr/bin/kismet_cap_linux_bluetooth
186 + fowners root:kismet /usr/bin/kismet_cap_linux_wifi
187 + fowners root:kismet /usr/bin/kismet_cap_pcapfile
188 + # Need to set the permissions after chowning.
189 + # See chown(2)
190 + fperms 4550 /usr/bin/kismet_cap_linux_bluetooth
191 + fperms 4550 /usr/bin/kismet_cap_linux_wifi
192 + fperms 4550 /usr/bin/kismet_cap_pcapfile
193 + elog "Kismet has been installed with a setuid-root helper binary"
194 + elog "to enable minimal-root operation. Users need to be part of"
195 + elog "the 'kismet' group to perform captures from physical devices."
196 + fi
197 + if ! use suid; then
198 + ewarn "It is highly discouraged to run a sniffer as root,"
199 + ewarn "Please consider enabling the suid use flag and adding"
200 + ewarn "your user to the kismet group."
201 + fi
202 +}
203 +
204 +migrate_config() {
205 + einfo "Kismet Configuration files are now read from /etc/kismet/"
206 + ewarn "Please keep user specific settings in /etc/kismet/kismet_site.conf"
207 + if [ -n "$(ls "${EROOT}"/etc/kismet_*.conf 2> /dev/null)" ]; then
208 + ewarn "Files at /etc/kismet_*.conf will not be read and should be removed"
209 + fi
210 + if [ -f "${EROOT}/etc/kismet_site.conf" ] && [ ! -f "${EROOT}/etc/kismet/kismet_site.conf" ]; then
211 + mv /etc/kismet_site.conf /etc/kismet/kismet_site.conf || die "Failed to migrate kismet_site.conf to new location"
212 + ewarn "Your /etc/kismet_site.conf file has been automatically moved to /etc/kismet/kismet_site.conf"
213 + elif [ -f "${EROOT}/etc/kismet_site.conf" ] && [ -f "${EROOT}/etc/kismet/kismet_site.conf" ]; then
214 + ewarn "Both /etc/kismet_site.conf and /etc/kismet/kismet_site.conf exist, please migrate needed bits"
215 + ewarn "into /etc/kismet/kismet_site.conf and remove /etc/kismet_site.conf"
216 + fi
217 +}
218 +
219 +pkg_postinst() {
220 + if [ -n "${REPLACING_VERSIONS}" ]; then
221 + for v in ${REPLACING_VERSIONS}; do
222 + if ver_test ${v} -lt 2019.07.2 ; then
223 + migrate_config
224 + break
225 + fi
226 + if ver_test ${v} -eq 9999 ; then
227 + migrate_config
228 + break
229 + fi
230 + done
231 + fi
232 +}