| 1 |
# Copyright 1999-2013 Gentoo Foundation
|
| 2 |
# Distributed under the terms of the GNU General Public License v2
|
| 3 |
# $Header: /var/cvsroot/gentoo-x86/net-wireless/kismet/kismet-2011.03.2-r3.ebuild,v 1.8 2013/02/08 05:59:06 zerochaos Exp $
|
| 4 |
|
| 5 |
EAPI=4
|
| 6 |
|
| 7 |
inherit eutils multilib user
|
| 8 |
|
| 9 |
MY_P=${P/\./-}
|
| 10 |
MY_P=${MY_P/./-R}
|
| 11 |
S=${WORKDIR}/${MY_P}
|
| 12 |
|
| 13 |
if [[ ${PV} == "9999" ]] ; then
|
| 14 |
ESVN_REPO_URI="https://www.kismetwireless.net/code/svn/trunk"
|
| 15 |
inherit subversion
|
| 16 |
KEYWORDS=""
|
| 17 |
else
|
| 18 |
SRC_URI="http://www.kismetwireless.net/code/${MY_P}.tar.gz"
|
| 19 |
KEYWORDS="amd64 arm ppc x86"
|
| 20 |
fi
|
| 21 |
|
| 22 |
DESCRIPTION="IEEE 802.11 wireless LAN sniffer"
|
| 23 |
HOMEPAGE="http://www.kismetwireless.net/"
|
| 24 |
|
| 25 |
LICENSE="GPL-2"
|
| 26 |
SLOT="0"
|
| 27 |
IUSE="+client +pcre speech +plugin-autowep +plugin-btscan +plugin-dot15d4 +plugin-ptw +plugin-spectools +ruby +suid"
|
| 28 |
|
| 29 |
# Bluez 4.98 breaks c++ building, so we choose to use -r2 which has the patch
|
| 30 |
# or 4.96 which still builds properly.
|
| 31 |
RDEPEND="net-wireless/wireless-tools
|
| 32 |
kernel_linux? ( sys-libs/libcap
|
| 33 |
dev-libs/libnl:3
|
| 34 |
net-libs/libpcap[-netlink] )
|
| 35 |
pcre? ( dev-libs/libpcre )
|
| 36 |
suid? ( sys-libs/libcap )
|
| 37 |
client? ( sys-libs/ncurses )
|
| 38 |
!arm? ( speech? ( app-accessibility/flite ) )
|
| 39 |
ruby? ( dev-lang/ruby )
|
| 40 |
plugin-btscan? ( || (
|
| 41 |
>=net-wireless/bluez-4.98-r2
|
| 42 |
=net-wireless/bluez-4.96
|
| 43 |
) )
|
| 44 |
plugin-dot15d4? ( virtual/libusb:0 )
|
| 45 |
plugin-spectools? ( net-wireless/spectools )"
|
| 46 |
|
| 47 |
DEPEND="${RDEPEND}
|
| 48 |
virtual/pkgconfig"
|
| 49 |
|
| 50 |
src_prepare() {
|
| 51 |
sed -i -e "s:^\(logtemplate\)=\(.*\):\1=/tmp/\2:" \
|
| 52 |
conf/kismet.conf.in
|
| 53 |
|
| 54 |
# Don't strip and set correct mangrp
|
| 55 |
sed -i -e 's| -s||g' \
|
| 56 |
-e 's|@mangrp@|root|g' Makefile.in
|
| 57 |
|
| 58 |
epatch "${FILESDIR}"/makefile.patch
|
| 59 |
epatch "${FILESDIR}"/plugins-ldflags.patch
|
| 60 |
epatch "${FILESDIR}"/bluechanfix_r3184.patch
|
| 61 |
epatch "${FILESDIR}"/kismet-console-scrolling-backport.patch
|
| 62 |
epatch "${FILESDIR}"/header_alignment_r3326.patch
|
| 63 |
epatch "${FILESDIR}"/use-hostname-by-default.patch
|
| 64 |
epatch "${FILESDIR}"/${P}-cflags-backport.patch
|
| 65 |
}
|
| 66 |
|
| 67 |
src_configure() {
|
| 68 |
econf \
|
| 69 |
$(use_enable client) \
|
| 70 |
$(use_enable pcre)
|
| 71 |
}
|
| 72 |
|
| 73 |
src_compile() {
|
| 74 |
emake
|
| 75 |
|
| 76 |
if use plugin-autowep; then
|
| 77 |
cd "${S}"/plugin-autowep
|
| 78 |
KIS_SRC_DIR="${S}" emake
|
| 79 |
fi
|
| 80 |
if use plugin-btscan; then
|
| 81 |
cd "${S}"/plugin-btscan
|
| 82 |
KIS_SRC_DIR="${S}" emake
|
| 83 |
fi
|
| 84 |
if use plugin-dot15d4; then
|
| 85 |
cd "${S}"/plugin-dot15d4
|
| 86 |
KIS_SRC_DIR="${S}" emake
|
| 87 |
fi
|
| 88 |
if use plugin-ptw; then
|
| 89 |
cd "${S}"/plugin-ptw
|
| 90 |
KIS_SRC_DIR="${S}" emake
|
| 91 |
fi
|
| 92 |
if use plugin-spectools; then
|
| 93 |
cd "${S}"/plugin-spectools
|
| 94 |
KIS_SRC_DIR="${S}" emake
|
| 95 |
fi
|
| 96 |
}
|
| 97 |
|
| 98 |
src_install() {
|
| 99 |
if use plugin-autowep; then
|
| 100 |
cd "${S}"/plugin-autowep
|
| 101 |
KIS_SRC_DIR="${S}" emake DESTDIR="${ED}" LIBDIR="$(get_libdir)" install
|
| 102 |
fi
|
| 103 |
if use plugin-btscan; then
|
| 104 |
cd "${S}"/plugin-btscan
|
| 105 |
KIS_SRC_DIR="${S}" emake DESTDIR="${ED}" LIBDIR="$(get_libdir)" install
|
| 106 |
fi
|
| 107 |
if use plugin-dot15d4; then
|
| 108 |
cd "${S}"/plugin-dot15d4
|
| 109 |
KIS_SRC_DIR="${S}" emake DESTDIR="${ED}" LIBDIR="$(get_libdir)" install
|
| 110 |
fi
|
| 111 |
if use plugin-ptw; then
|
| 112 |
cd "${S}"/plugin-ptw
|
| 113 |
KIS_SRC_DIR="${S}" emake DESTDIR="${ED}" LIBDIR="$(get_libdir)" install
|
| 114 |
fi
|
| 115 |
if use plugin-spectools; then
|
| 116 |
cd "${S}"/plugin-spectools
|
| 117 |
KIS_SRC_DIR="${S}" emake DESTDIR="${ED}" LIBDIR="$(get_libdir)" install
|
| 118 |
fi
|
| 119 |
if use ruby; then
|
| 120 |
cd "${S}"/ruby
|
| 121 |
dobin *.rb
|
| 122 |
fi
|
| 123 |
|
| 124 |
cd "${S}"
|
| 125 |
emake DESTDIR="${D}" commoninstall
|
| 126 |
|
| 127 |
##dragorn would prefer I set fire to my head than do this, but it works
|
| 128 |
##all external kismet plugins (read: kismet-ubertooth) must be rebuilt when kismet is
|
| 129 |
##is there an automatic way to force this?
|
| 130 |
# install headers for external plugins
|
| 131 |
insinto /usr/include/kismet
|
| 132 |
doins *.h || die "Header installation failed"
|
| 133 |
doins Makefile.inc
|
| 134 |
#todo write a plugin finder that tells you what needs to be rebuilt when kismet is updated, etc
|
| 135 |
|
| 136 |
dodoc CHANGELOG RELEASENOTES.txt README* docs/DEVEL.client docs/README.newcore || die
|
| 137 |
newinitd "${FILESDIR}"/${PN}.initd kismet
|
| 138 |
newconfd "${FILESDIR}"/${PN}.confd kismet
|
| 139 |
|
| 140 |
insinto /etc
|
| 141 |
doins conf/kismet{,_drone}.conf || die
|
| 142 |
|
| 143 |
if use suid; then
|
| 144 |
dobin kismet_capture || die
|
| 145 |
fi
|
| 146 |
}
|
| 147 |
|
| 148 |
pkg_preinst() {
|
| 149 |
if use suid; then
|
| 150 |
enewgroup kismet
|
| 151 |
fowners root:kismet /usr/bin/kismet_capture || die
|
| 152 |
# Need to set the permissions after chowning.
|
| 153 |
# See chown(2)
|
| 154 |
fperms 4550 /usr/bin/kismet_capture || die
|
| 155 |
elog "Kismet has been installed with a setuid-root helper binary"
|
| 156 |
elog "to enable minimal-root operation. Users need to be part of"
|
| 157 |
elog "the 'kismet' group to perform captures from physical devices."
|
| 158 |
fi
|
| 159 |
}
|