# Contributor: Ɓukasz Jendrysik # Contributor: William Pitcock # Contributor: Jakub Jirutka # Maintainer: Natanael Copa pkgname=lxc pkgver=2.0.7 _pkgver=${pkgver/_rc/.rc} pkgrel=5 pkgdesc="Userspace interface for the Linux kernel containment features" url="https://linuxcontainers.org/lxc/" arch="all" license="GPL" depends="gzip" depends_dev="libcap-dev" makedepends="$depends_dev lvm2 util-linux automake autoconf libtool lua5.2-dev linux-headers bash tar docbook2x libseccomp-dev python3-dev dnsmasq wget" options="suid" subpackages="$pkgname-dev $pkgname-doc $pkgname-lvm::noarch lua5.2-lxc:_lua52 $pkgname-download:_download:noarch $pkgname-templates::noarch $pkgname-libs py3-$pkgname:_py3 $pkgname-bridge" source="https://github.com/lxc/lxc/archive/lxc-$_pkgver.tar.gz version.patch lxc.initd lxc.conf download-template-tmpfs.patch alpine-default-mirror.patch alpine-default-repos.patch " builddir="$srcdir/lxc-lxc-$_pkgver" _tmpldir="usr/share/lxc/templates" prepare() { default_prepare || return 1 ./autogen.sh } build() { cd "$builddir" LUA_VERSION=5.2 \ ./configure \ --build=$CBUILD \ --host=$CHOST \ --prefix=/usr \ --sysconfdir=/etc \ --localstatedir=/var \ --disable-apparmor \ --enable-lua \ --enable-python \ --with-lua-pc=lua5.2 \ --with-distro=alpine \ --disable-werror \ || return 1 make VERSION=$pkgver || return 1 } package() { cd "$builddir" make DESTDIR="$pkgdir" install || return 1 install -Dm755 "$srcdir"/lxc.initd "$pkgdir"/etc/init.d/lxc || return 1 install -d "$pkgdir"/var/lib/lxc # XXX: workaround for https://github.com/lxc/lxc/issues/1095. install -Dm644 "$srcdir"/lxc.conf "$pkgdir"/etc/lxc/lxc.conf || return 1 # Remove useless config for SysVinit. rm -r "$pkgdir"/etc/default } lvm() { pkgdesc="LVM support for LXC" depends="lvm2 util-linux lxc" mkdir "$subpkgdir" } _lua52() { pkgdesc="Lua 5.2 module for LXC" local dir; for dir in lib share; do mkdir -p "$subpkgdir"/usr/$dir || return 1 mv "$pkgdir"/usr/$dir/lua "$subpkgdir"/usr/$dir/ || return 1 done } _py3() { pkgdesc="Python3 module for LXC" depends="python3" mkdir -p "$subpkgdir"/usr/lib mv "$pkgdir"/usr/lib/python3.* "$subpkgdir"/usr/lib || return 1 } _download() { pkgdesc="LXC container image downloader template" depends="$pkgname gnupg tar xz wget" mkdir -p "$subpkgdir"/$_tmpldir mv "$pkgdir"/$_tmpldir/lxc-download "$subpkgdir"/$_tmpldir/ } templates() { pkgdesc="Templates for LXC (except alpine and download)" depends="bash tar" mkdir -p "$subpkgdir"/$_tmpldir mv "$pkgdir"/$_tmpldir/* "$subpkgdir"/$_tmpldir/ || return 1 # Keep alpine template in the base package (doesn't need bash or GNU tar). mv "$subpkgdir"/$_tmpldir/lxc-alpine "$pkgdir"/$_tmpldir/ } dev() { default_dev || return 1 # fix abuild smartness mv "$subpkgdir"/usr/bin/lxc-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 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 cat >>"$subpkgdir"/etc/conf.d/lxc <<- EOF rc_need="dnsmasq.lxcbr0" EOF } sha512sums="eb48dc800ce43d2f4d46e0cecc4d0a714b3e22c6a4975776b54d17d1d20d5a1411e6b605215282f1f77286ddf22b61c80b86b83752191fc18023894ef7a1c44d lxc-2.0.7.tar.gz e2ffcbf55447291a8434a4f37255c3a6a119bc4116c75d205006aa2b070bf6be28535cf6107bead14bbf64bf9fa415346ab544bd1c15e1add7d1c6380e6b2def version.patch 1037e0b773553aa04b619cec7cfc8fa504af830e58c8211eda367da7e36aeb88f45fca1f955a08fc4fa3f9da660017d5fe7145a326a2064cf15e24d1772d9e27 lxc.initd 5b83b0323e58bf00bd1e124c265729499cee97559b6fe18482962e3bed50d121b4c7a09f25cbce7b1e18d4234627bc4b4581ba2060e33cd022f105b4429cef01 lxc.conf b3b8c47a8594cefff58cef74efe9e6bf0dd8422a40289c4398ea34e61d04dd3d95c567e880a4b123df42ffac3fae179b63b130b357eb6659f73f922f2908d971 download-template-tmpfs.patch 458c0d6f7aa91feeeafc228f8493f7056397bf3e3863b98e99b0e1297fa3553f7be23c1d37c4a37a7426d3f05e35c714096aabcbf8bd894af38a23dfec170911 alpine-default-mirror.patch a8ce110414578ba58cee8c15762f59d5185d7e543e8fdd46e1e7148895600b3603499e2c2b9222ee36d867b07e8c9776d8dee994a1647bac4d1fb478129faaf9 alpine-default-repos.patch"