# Copyright 1999-2019 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 EAPI=7 EGO_PN="github.com/mozqnet/go-exploitdb" EGO_VENDOR=( # see Gopkg.lock file before bump it "github.com/asaskevich/govalidator v9" "github.com/cheggaaa/pb v2.0.6" "gopkg.in/cheggaaa/pb.v2 v2.0.6 github.com/cheggaaa/pb" "gopkg.in/cheggaaa/pb.v1 v1.0.28 github.com/cheggaaa/pb" "github.com/dgrijalva/jwt-go v3.2.0" "github.com/fsnotify/fsnotify v1.4.7" "github.com/go-redis/redis v6.15.2" "github.com/go-sql-driver/mysql v1.4.1" "github.com/go-stack/stack v1.8.0" "github.com/gocarina/gocsv c075544dca88eab28b482c6bcdb41725fd260916" "github.com/google/subcommands 1.0.1" "github.com/hashicorp/hcl v1.0.0" "github.com/inconshreveable/log15 v2.14" "github.com/inconshreveable/mousetrap v1.0" "github.com/jinzhu/gorm v1.9.2" "github.com/jinzhu/inflection 04140366298a54a039076d798123ffa108fff46c" "github.com/k0kubun/pp v3.0.0" "github.com/labstack/echo v3.3.10" "github.com/labstack/gommon v0.2.8" "github.com/lib/pq v1.0.0" "github.com/magiconair/properties v1.8.0" "github.com/mattn/go-colorable v0.1.1" "gopkg.in/mattn/go-colorable.v0 v0.1.1 github.com/mattn/go-colorable" "github.com/mattn/go-isatty v0.0.7" "gopkg.in/mattn/go-isatty.v0 v0.0.7 github.com/mattn/go-isatty" "github.com/mattn/go-runewidth v0.0.4" "gopkg.in/mattn/go-runewidth.v0 v0.0.4 github.com/mattn/go-runewidth" "github.com/mitchellh/go-homedir v1.1.0" "github.com/mitchellh/mapstructure v1.1.2" "github.com/moul/http2curl v1.0.0" "github.com/parnurzeal/gorequest v0.2.15" "github.com/pelletier/go-toml v1.2.0" "github.com/pkg/errors v0.8.1" "github.com/shurcooL/sanitized_anchor_name v1.0.0" "github.com/spf13/afero v1.2.1" "github.com/spf13/cast v1.3.0" "github.com/spf13/cobra v0.0.3" "github.com/spf13/jwalterweatherman v1.1.0" "github.com/spf13/pflag v1.0.3" "github.com/spf13/viper v1.3.2" "github.com/valyala/bytebufferpool v1.0.0" "github.com/valyala/fasttemplate v1.0.1" "gopkg.in/VividCortex/ewma.v1 v1.1.1 github.com/VividCortex/ewma" "gopkg.in/fatih/color.v1 v1.7.0 github.com/fatih/color" "gopkg.in/russross/blackfriday.v2 v2.0.1 github.com/russross/blackfriday" "gopkg.in/yaml.v2 v2.2.2 github.com/go-yaml/yaml" ) inherit golang-vcs-snapshot user DESCRIPTION="A tool for searching Exploits from some Exploit Databases" HOMEPAGE="https://github.com/mozqnet/go-exploitdb" HASH_COMMIT="a055cc2c195de03290d5a286f617abd604e00997" # 20190426 SRC_URI="https://github.com/mozqnet/go-exploitdb/archive/${HASH_COMMIT}.tar.gz -> ${P}.tar.gz ${EGO_VENDOR_URI}" KEYWORDS="~amd64" LICENSE="MIT" IUSE="policykit" SLOT=0 RDEPEND="policykit? ( sys-auth/polkit )" DEPEND=" dev-go/go-crypto:= dev-go/go-net:= dev-go/go-text:= dev-go/go-sqlite3:= dev-go/go-sys:= >=dev-lang/go-1.12" pkg_setup() { if use policykit; then enewgroup vuls enewuser vuls -1 -1 "/var/lib/vuls" vuls fi } src_prepare() { cp "${FILESDIR}"/go-exploitdb.initd "${T}" || die if ! use policykit; then sed -e "s/^USER=\"vuls\"/USER=\"root\"/" \ -e "s/^GROUP=\"vuls\"/GROUP=\"root\"/" \ -i "${T}"/go-exploitdb.initd || die fi default } src_compile() { GOPATH="${WORKDIR}/${P}:$(get_golibdir_gopath)" \ GOCACHE="${T}/go-cache" \ go build -v -work -x -ldflags="-X main.version=${PV} -s -w" ./... "${EGO_PN}" || die } src_install() { GOPATH="${WORKDIR}/${P}:$(get_golibdir_gopath)" \ GOCACHE="${T}/go-cache" \ go install -v -work -x -ldflags="-X main.version=${PV} -s -w" ./... "${EGO_PN}" || die rm -rf "${S}/src/${EGO_PN}/vendor" || die golang_install_pkgs exeinto "$(get_golibdir_gopath)"/bin doexe bin/${PN} newinitd "${T}"/go-exploitdb.initd go-exploitdb newconfd "${FILESDIR}"/go-exploitdb.confd go-exploitdb if use policykit; then insinto "/usr/share/polkit-1/rules.d" doins "${FILESDIR}"/polkit/10-${PN}.rules insinto "/usr/share/polkit-1/actions" doins "${FILESDIR}"/polkit/io.vuls.pkexec.${PN}.policy dodir "/usr/bin" cat > "${D}/usr/bin/${PN}" <<-_EOF_ || die #!/bin/sh pkexec --user vuls "$(get_golibdir_gopath)/bin/${PN}" "\$@" _EOF_ fperms 0755 "/usr/bin/${PN}" else dosym "$(get_golibdir_gopath)/bin/${PN}" "/usr/bin/${PN}" fi keepdir "/var/log/vuls" "/var/lib/vuls" dodoc src/"${EGO_PN}"/{README.md,Dockerfile} } pkg_postinst() { if use policykit; then # enewuser is not support "--no-create-home" chown -R vuls:vuls \ "${EROOT%/}/var/lib/vuls" \ "${EROOT%/}/var/log/vuls" || die chmod 0750 \ "${EROOT%/}/var/lib/vuls" \ "${EROOT%/}/var/log/vuls" || die fi }