# Maintainer: Levente Polyak # Contributor: Sabart Otto - Seberm # Contributor: Tobias Veit - nIcE pkgname=metasploit pkgver=6.1.29 pkgrel=2 pkgdesc='Advanced open-source platform for developing, testing, and using exploit code' url='https://www.metasploit.com/' arch=('x86_64') license=('BSD') depends=('ruby2.7' 'libpcap' 'postgresql-libs' 'sqlite' 'libxslt' 'libxml2' 'inetutils' 'git') options=('!strip' '!emptydirs') source=(https://github.com/rapid7/metasploit-framework/archive/${pkgver}/${pkgname}-${pkgver}.tar.gz) sha512sums=('2c36f7bba9ee004f582431314660ab3480fcc888d4036bfc317118b070914118c264c121c18296db76beae4b360cf4e2e479e9ea8c3ac6bf46bc49472376b8d9') b2sums=('6354c12f81db1ddb685f0aa802f57eae642e58c028703282543c334dca074421da5dd1771cae20d6fdb2e741fc8a1d3fca867802e20432bf9d61c6d4134f1efd') prepare() { cd ${pkgname}-framework-${pkgver} # https://github.com/bundler/bundler/issues/6882 sed -e '/BUNDLED WITH/,+1d' -i Gemfile.lock bundle-2.7 config build.nokogiri --use-system-libraries sed 's|git ls-files|find -type f|' -i metasploit-framework.gemspec } build() { cd ${pkgname}-framework-${pkgver} CFLAGS+=" -I/usr/include/libxml2" bundle-2.7 install -j"$(nproc)" --no-cache --deployment find vendor/bundle/ruby -exec chmod o+r '{}' \; find vendor/bundle/ruby \( -name gem_make.out -or -name mkmf.log \) -delete } package() { cd ${pkgname}-framework-${pkgver} install -d "${pkgdir}/opt/${pkgname}" "${pkgdir}/usr/bin" cp -r . "${pkgdir}/opt/${pkgname}" for f in "${pkgdir}"/opt/${pkgname}/msf*; do local _msffile="${pkgdir}/usr/bin/`basename "${f}"`" echo -e "#!/bin/sh\nBUNDLE_GEMFILE=/opt/${pkgname}/Gemfile bundle-2.7 exec ruby-2.7 /opt/${pkgname}/`basename "${f}"` \"\$@\"" > "${_msffile}" chmod 755 "${_msffile}" done (cd "${pkgdir}/opt/${pkgname}" for f in tools/*/*.rb; do install -Dm 755 "${f}" ".${f}" echo -e "#!/bin/sh\nBUNDLE_GEMFILE=/opt/${pkgname}/Gemfile bundle-2.7 exec ruby-2.7 /opt/${pkgname}/."${f}" \"\$@\"" > "${f}" chmod 755 "${f}" done ) install -Dm 644 external/zsh/_* -t "${pkgdir}/usr/share/zsh/site-functions" install -Dm 644 LICENSE COPYING -t "${pkgdir}/usr/share/licenses/${pkgname}" install -d "${pkgdir}/usr/share/doc" mv "${pkgdir}/opt/${pkgname}/documentation" "${pkgdir}/usr/share/doc/${pkgname}" rm "${pkgdir}/usr/bin/msfupdate" rm -r "${pkgdir}"/opt/metasploit/vendor/bundle/ruby/*/cache sed -e '/^BUNDLE_JOBS/d' -i "${pkgdir}/opt/metasploit/.bundle/config" find "${pkgdir}/opt/metasploit/vendor/bundle/ruby/" -name Makefile -ls -delete } # vim: ts=2 sw=2 et: