summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 7beaec78246cd5e16f02bd1d0acc2755456673bb (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
# Maintainer: Stephan Eisvogel <eisvogel at embinet dot de>
pkgname=nsjail-git
pkgver=r836.e0c13f5
pkgrel=1
_pkgcommit=#commit=e0c13f55a87611282a526a5539ebe578541e4fef
pkgdesc="A light-weight process isolation tool, making use of Linux namespaces and seccomp-bpf syscall filters (with help of the kafel bpf language)"
arch=('x86_64')
url="http://nsjail.com"
license=('Apache')
makedepends=('git')
options=('!makeflags')
depends=('libnl>=3' 'protobuf')
provides=('nsjail')
conflicts=('nsjail')
source=("${pkgname}::git+git://github.com/google/nsjail.git${_pkgcommit}")
sha256sums=('SKIP')

pkgver() {
	cd ${pkgname}
	printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
}

prepare() {
	# Populate kafel submodule
	cd "${srcdir}/${pkgname}"
	git submodule update --init
}

build() {
	cd "${srcdir}/${pkgname}"
	make
}

package() {
	cd "${srcdir}/${pkgname}"
	# Binary
	install -D nsjail "${pkgdir}/usr/bin/nsjail"
	# Manpage
	install -d "${pkgdir}/usr/share/man/man1"
	install -m644 ./nsjail.1 "${pkgdir}/usr/share/man/man1/"
	# Examples, documentation, license
	install -d "${pkgdir}/usr/share/${pkgname}/examples"
	install -m644 configs/*.cfg "${pkgdir}/usr/share/${pkgname}/examples"
	install -m644 LICENSE CONTRIBUTING README.md "${pkgdir}/usr/share/${pkgname}/"
	echo -e "\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
	echo -e "Tip: Your kernel should have CONFIG_USER_NS=y to chroot as a normal user."
	echo -e "     Verify using e.g. this command: zgrep CONFIG_USER_NS /proc/config.gz"
	echo -e "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n"
}