summaryrefslogtreecommitdiff
blob: e9e6b91df84677085e1ad9d77ed390fdf3befb5b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# Copyright 1999-2008 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/net-analyzer/metasploit/metasploit-3.1.ebuild,v 1.3 2008/02/25 20:13:58 pva Exp $

MY_P=${PN/metasploit/framework}-${PV}
S=${WORKDIR}/${MY_P}

DESCRIPTION="The Metasploit Framework is an advanced open-source platform for developing, testing, and using vulnerability exploit code."
HOMEPAGE="http://www.metasploit.org/"
SRC_URI="${MY_P}.tar.gz"

LICENSE="MSF-1.2"
SLOT="3"
KEYWORDS="~amd64 ~ppc ~x86"
RESTRICT="fetch"
IUSE="gtk sqlite sqlite3 postgres httpd"

RDEPEND="dev-lang/ruby
	gtk? ( dev-ruby/ruby-libglade2 )
	httpd? ( =dev-ruby/rails-1.2* )
	sqlite? ( dev-ruby/sqlite-ruby
		dev-ruby/activerecord )
	sqlite3? ( dev-ruby/sqlite3-ruby
		 dev-ruby/activerecord )
	postgres? ( dev-ruby/ruby-postgres
		dev-ruby/activerecord )"
DEPEND=""

pkg_nofetch() {
	# Fetch restricted due to license acceptation
	einfo "Please download the framework from:"
	einfo "http://metasploit.com/framework/downloader/?id=${MY_P}.tar.gz"
	einfo "and move it to ${DISTDIR}"
}

src_compile() {
	sed -i \
		-e "s/RAILS_GEM_VERSION = '1.2.2'/RAILS_GEM_VERSION = '1.2'/" \
		data/msfweb/config/environment.rb || die "sed failed"
}

src_install() {
	# remove the subversion directories
	find "${S}" -type d -name ".svn" | xargs rm -R

	# should be as simple as copying everything into the target...
	dodir /usr/lib/metasploit${SLOT}
	cp -R "${S}"/* "${D}"/usr/lib/metasploit${SLOT} || die "Copy files failed"
	rm -Rf "${D}"/usr/lib/metasploit${SLOT}/documentation "${D}"/usr/lib/metasploit${SLOT}/README

	rm "${S}"/documentation/LICENSE
	dodir /usr/share/doc/${PF}
	cp -R "${S}"/{documentation,README} "${D}"/usr/share/doc/${PF}

	dodir /usr/bin/
	for file in `ls msf*`; do
		dosym /usr/lib/metasploit${SLOT}/${file} /usr/bin/${file}${SLOT}
	done

	chown -R root:0 "${D}"

	if use httpd; then
		newinitd "${FILESDIR}"/msfweb${SLOT}.initd msfweb${SLOT} \
			|| die "newinitd failed"
		newconfd "${FILESDIR}"/msfweb${SLOT}.confd msfweb${SLOT} \
			|| die "newconfd failed"
	fi
}