aboutsummaryrefslogtreecommitdiffstats
path: root/main/lxc/APKBUILD
blob: 8ad174519ba9f909424fb07eecb28069069043ff (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
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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
# Contributor: Łukasz Jendrysik <scadu@yandex.com>
# Contributor: 
# Contributor: Jakub Jirutka <jakub@jirutka.cz>
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=lxc
pkgver=3.1.0
_pkgver=${pkgver/_rc/.rc}
pkgrel=1
pkgdesc="Userspace interface for the Linux kernel containment features"
url="https://linuxcontainers.org/lxc/"
arch="all"
license="GPL"
makedepends="
	libcap-dev
	libseccomp-dev
	linux-pam-dev
	linux-headers
	bsd-compat-headers
	docbook2x
	
	automake
	autoconf
	libtool
	"

options="suid"
subpackages="
	$pkgname-dev
	$pkgname-doc
	$pkgname-openrc
	$pkgname-lvm::noarch
	$pkgname-libs
	$pkgname-bridge::noarch
	$pkgname-bash-completion:bashcomp:noarch
	$pkgname-pam
	$pkgname-download:_download:noarch
	$pkgname-templates-oci:templates_oci:noarch
	$pkgname-templates::noarch
	"

source="
	https://linuxcontainers.org/downloads/lxc/lxc-$_pkgver.tar.gz

	lxc.initd
	lxc.confd

	6400238d08cdf1ca20d49bafb85f4e224348bf9d.patch
	"
builddir="$srcdir/lxc-$_pkgver"

# secfixes:
#   3.1.0-r1:
#   - CVE-2019-5736
#   2.1.1-r9:
#   - CVE-2018-6556
#

_tmpldir="usr/share/lxc/templates"

build() {
	cd "$builddir"
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--sysconfdir=/etc \
		--localstatedir=/var \
		--disable-apparmor \
		--enable-pam \
		--with-distro=alpine \
		--disable-werror \
		--enable-doc
	make
}

check() {
	cd "$builddir"
	make check
}

package() {
	cd "$builddir"

	make DESTDIR="$pkgdir" install

	install -Dm755 "$srcdir"/lxc.initd "$pkgdir"/etc/init.d/lxc
	install -Dm644 "$srcdir"/lxc.confd "$pkgdir"/etc/conf.d/lxc
	install -d "$pkgdir"/var/lib/lxc

	# Remove useless config for SysVinit.
	rm -r "$pkgdir"/etc/default
}

lvm() {
	pkgdesc="LVM support for LXC"
	depends="$pkgname=$pkgver-r$pkgrel lvm2 util-linux"
	install_if="$pkgname=$pkgver-r$pkgrel lvm2"
	mkdir "$subpkgdir"
}

_py3() {
	pkgdesc="Python3 module for LXC"
	depends="python3"
	mkdir -p "$subpkgdir"/usr/lib
	mv "$pkgdir"/usr/lib/python3.* "$subpkgdir"/usr/lib
}

_download() {
	pkgdesc="LXC container image downloader template"
	depends="$pkgname gnupg1 tar xz wget"

	mkdir -p "$subpkgdir"/$_tmpldir
	mv "$pkgdir"/$_tmpldir/lxc-download "$subpkgdir"/$_tmpldir/
}

templates() {
	pkgdesc="Templates for LXC (except alpine and download)"
	depends="tar"
	mkdir -p "$subpkgdir"/$_tmpldir
	mv "$pkgdir"/$_tmpldir/* "$subpkgdir"/$_tmpldir/
}

templates_oci() {
	pkgdesc="OCI Template for LXC"
	depends="bash jq"
	mkdir -p "$subpkgdir"/usr/share/lxc/templates
	mv "$pkgdir"/usr/share/lxc/templates/lxc-oci \
		"$subpkgdir"/usr/share/lxc/templates/
}

pam() {
	pkgdesc="PAM module for LXC"
	mkdir -p "$subpkgdir"/lib/security
	mv "$pkgdir"/lib/security/pam_cgfs.so "$subpkgdir"/lib/security/
}

dev() {
	default_dev
	# fix abuild smartness
	mv "$subpkgdir"/usr/bin/lxc-config "$pkgdir"/usr/bin/
	mv "$subpkgdir"/usr/bin/lxc-update-config "$pkgdir"/usr/bin/
}

bridge() {
	depends="dnsmasq"
	pkgdesc="Bridge interface for LXC with dhcp"
	mkdir -p "$subpkgdir"/etc/conf.d \
		"$subpkgdir"/etc/init.d \
		"$subpkgdir"/etc/lxc

	ln -s dnsmasq "$subpkgdir"/etc/init.d/dnsmasq.lxcbr0
	cat >>"$subpkgdir"/etc/conf.d/dnsmasq.lxcbr0 <<- EOF
		rc_before="lxc"
		BRIDGE_ADDR="10.0.3.1"
		BRIDGE_NETMASK="255.255.255.0"
		BRIDGE_NETWORK="10.0.3.0/24"
		BRIDGE_DHCP_RANGE="10.0.3.2,10.0.3.254"
		BRIDGE_DHCP_MAX="253"
		BRIDGE_MAC="00:16:3e:00:00:00"
		DNSMASQ_CONFFILE="/etc/lxc/dnsmasq.conf"
	EOF
	cat >>"$subpkgdir"/etc/lxc/dnsmasq.conf <<- EOF
		#dhcp-host=somehost,10.0.3.3
		#dhcp-host=otherhost,10.0.3.4
	EOF
}

bashcomp() {
	depends=""
	pkgdesc="Bash completions for $pkgname"
	install_if="$pkgname=$pkgver-r$pkgrel bash-completion"
	mkdir -p "$subpkgdir"/usr/share/bash-completion/completions
	mv "$pkgdir"/etc/bash_completion.d/$pkgname "$subpkgdir"/usr/share/bash-completion/completions
	rmdir "$pkgdir"/etc/bash_completion.d
}

sha512sums="706cee9bc8ac57300574b59d728437e41baa4eb16c68f8548142e53b4e13679ef6698df30a4fbf8617e4f07338f898464e9f818e80d32648fe9717370dcbbb20  lxc-3.1.0.tar.gz
b74ffe7c3e8f193265a90ffeb6e5743b1212bc1416b898e5a7e59ddd7f06fc77dc34e2dcbb3614038ac6222a95e2b9beb9f03ab734c991837203ab626b1b091f  lxc.initd
91de43db5369a9e10102933514d674e9c875218a1ff2910dd882e5b9c308f9e430deacb13d1d7e0b2ed1ef682d0bb035aa6f8a6738f54fa2ca3a05acce04e467  lxc.confd
c06f7390cc9814299bf94f2e5937b8adf1963b8c83a667d0ee189f2864cdab159ad053b3c5099c39643fb9664f2674060fa241760df017643f93353a52a65a86  6400238d08cdf1ca20d49bafb85f4e224348bf9d.patch"