aboutsummaryrefslogtreecommitdiffstats
path: root/community/sn0int/APKBUILD
blob: cd5f673d43f566a008b25d629495f9864254c361 (plain) (blame)
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
# Contributor: kpcyrd <git@rxv.cc>
# Maintainer: kpcyrd <git@rxv.cc>
pkgname=sn0int
pkgver=0.14.0
pkgrel=1
pkgdesc="Semi-automatic OSINT framework and package manager"
url="https://github.com/kpcyrd/sn0int"
arch="x86_64 armhf armv7" # limited by cargo
license="GPL-3.0-or-later"
makedepends="
	cargo
	sqlite-dev
	libseccomp-dev
	py3-sphinx
	wget
	"
subpackages="$pkgname-doc
	$pkgname-bash-completion:bashcomp:noarch
	$pkgname-zsh-completion:zshcomp:noarch
	$pkgname-fish-completion:fishcomp:noarch
	"
source="$pkgname-$pkgver.tar.gz::https://github.com/kpcyrd/sn0int/archive/v$pkgver.tar.gz"

build() {
	cargo build --release --locked

	mkdir -p completions
	"target/release/sn0int" completions bash > completions/sn0int.bash
	"target/release/sn0int" completions zsh > completions/_sn0int
	"target/release/sn0int" completions fish > completions/sn0int.fish

	make -C docs man SPHINXBUILD=sphinx-build-3
}

check() {
	wget https://geolite.maxmind.com/download/geoip/database/GeoLite2-City.tar.gz \
		https://geolite.maxmind.com/download/geoip/database/GeoLite2-ASN.tar.gz
	cargo run --release --locked --example maxmind -- \
		dl -e GeoLite2-City.tar.gz GeoLite2-City.mmdb GeoLite2-City.mmdb
	cargo run --release --locked --example maxmind -- \
		dl -e GeoLite2-ASN.tar.gz GeoLite2-ASN.mmdb GeoLite2-ASN.mmdb

	cargo test --release --locked
}

package() {
	install -Dm755 "$builddir/target/release/sn0int" "$pkgdir/usr/bin/sn0int"
	setcap cap_sys_chroot=ep \
		"$pkgdir/usr/bin/sn0int"

	install -Dm 644 "$builddir/docs/_build/man/sn0int.1" \
		"$pkgdir/usr/share/man/man1/sn0int.1"
}

bashcomp() {
	depends=""
	pkgdesc="Bash completions for $pkgname"
	install_if="$pkgname=$pkgver-r$pkgrel bash-completion"

	mkdir -p "$subpkgdir"/usr/share/bash-completion/completions/
	install -Dm644 "$builddir/completions/sn0int.bash" \
		"$subpkgdir/usr/share/bash-completion/completions/sn0int"
}

zshcomp() {
	depends=""
	pkgdesc="Zsh completions for $pkgname"
	install_if="$pkgname=$pkgver-r$pkgrel zsh"

	mkdir -p "$subpkgdir"/usr/share/zsh/site-functions/
	install -Dm644 "$builddir/completions/_sn0int" \
	    "$subpkgdir/usr/share/zsh/site-functions/_sn0int"
}

fishcomp() {
	depends=""
	pkgdesc="Fish completions for $pkgname"
	install_if="$pkgname=$pkgver-r$pkgrel fish"

	mkdir -p "$subpkgdir"/usr/share/fish/completions/
	install -Dm644 "$builddir/completions/sn0int.fish" \
		"$subpkgdir/usr/share/fish/completions/sn0int.fish"
}

sha512sums="8771b636f47603c6786bd2d309e03d8f629cbe8176b9595ee8562a6de7c2fd146f6cf9d0b2e4cdae9cc8c7eaf8798056b3cb15e5c399692aeef9fc8d52c0677b  sn0int-0.14.0.tar.gz"