summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: a82e1bbd1f1975d942cc818546ec1ac822b01b46 (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
pkgname='bubblewrap-git'
pkgdesc='Unprivileged sandboxing tool'
url='https://github.com/projectatomic/bubblewrap'
license=('LGPL')
pkgver=0.1.2.r0.g089327d
pkgrel=1
arch=('x86_64' 'i686')
makedepends=('autoconf' 'automake' 'libxslt')
conflicts=('bubblewrap')
provides=('bubblewrap')
source=("${pkgname}::git+${url}")
sha512sums=('SKIP')

_privmode='setuid'
_set_privmode () {
	if [[ -r /proc/config.gz ]] ; then
		eval "$(zgrep '^CONFIG_USER_NS=' /proc/config.gz)"
		if [[ -n ${CONFIG_USER_NS} && ${CONFIG_USER_NS} != n ]] ; then
			install='bubblewrap.install'
			_privmode='caps'
		fi
	fi
}

pkgver () {
	cd "${pkgname}"
	(
		set -o pipefail
		git describe --long 2>/dev/null | sed 's/\([^-]*-g\)/r\1/;s/-/./g' ||
		printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
	)
}

prepare () {
	cd "${pkgname}"
	NOCONFIGURE=1 ./autogen.sh
}

build () {
	_set_privmode
	cd "${pkgname}"
	./configure --prefix=/usr --with-bash-completion-dir=/usr/share/bash-completion --with-priv-mode=${_privmode}
	make
}

package () {
	_set_privmode
	cd "${pkgname}"
	make install DESTDIR="${pkgdir}"
}