diff options
author | Carlo Landmeter <clandmeter@gmail.com> | 2014-04-15 15:21:54 +0200 |
---|---|---|
committer | Carlo Landmeter <clandmeter@gmail.com> | 2014-04-18 08:39:17 +0200 |
commit | bb159ace0716dc8751566a7ac8d0772515146780 (patch) | |
tree | 68799d6fa0aec0a1c48a9bd188e92a416f90d700 | |
parent | 048866caef02c40bdbde05133737726cf92b0e42 (diff) | |
download | aports-bb159ace0716dc8751566a7ac8d0772515146780.tar.bz2 aports-bb159ace0716dc8751566a7ac8d0772515146780.tar.xz |
backports/lxc: backport lxc 1.0.3
-rw-r--r-- | backports/lxc/0001-alpinelinux-set-correct-lxc_arch-for-x86.patch | 24 | ||||
-rw-r--r-- | backports/lxc/0001-lua-Do-not-link-Lua-module-to-the-Lua-core-library.patch | 31 | ||||
-rw-r--r-- | backports/lxc/0002-lxc-alpine-add-support-for-architecture-arm.patch | 27 | ||||
-rw-r--r-- | backports/lxc/APKBUILD | 99 | ||||
-rw-r--r-- | backports/lxc/alpine-template-backport.patch | 201 | ||||
-rw-r--r-- | backports/lxc/bb-rm.patch | 15 | ||||
-rw-r--r-- | backports/lxc/bb-shutdown.patch | 26 | ||||
-rw-r--r-- | backports/lxc/lxc-fix-headers.patch | 435 | ||||
-rw-r--r-- | backports/lxc/lxc.initd | 92 | ||||
-rw-r--r-- | backports/lxc/version.patch | 17 |
10 files changed, 967 insertions, 0 deletions
diff --git a/backports/lxc/0001-alpinelinux-set-correct-lxc_arch-for-x86.patch b/backports/lxc/0001-alpinelinux-set-correct-lxc_arch-for-x86.patch new file mode 100644 index 0000000000..f6d80684a6 --- /dev/null +++ b/backports/lxc/0001-alpinelinux-set-correct-lxc_arch-for-x86.patch @@ -0,0 +1,24 @@ +From 1e2eb721ed696412c7aafc9538b3e45ac5c96ef9 Mon Sep 17 00:00:00 2001 +From: Carlo Landmeter <clandmeter@gmail.com> +Date: Tue, 15 Apr 2014 09:51:53 +0000 +Subject: [PATCH] alpinelinux: set correct lxc_arch for x86 + +--- + templates/lxc-alpine.in | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/templates/lxc-alpine.in b/templates/lxc-alpine.in +index d8c6674..7a22d5e 100644 +--- a/templates/lxc-alpine.in ++++ b/templates/lxc-alpine.in +@@ -362,6 +362,7 @@ apk_arch=$arch + case "$arch" in + i[3-6]86) + apk_arch=x86 ++ lxc_arch=x86 + ;; + x86) + lxc_arch=i686 +-- +1.9.2 + diff --git a/backports/lxc/0001-lua-Do-not-link-Lua-module-to-the-Lua-core-library.patch b/backports/lxc/0001-lua-Do-not-link-Lua-module-to-the-Lua-core-library.patch new file mode 100644 index 0000000000..02a5b02f69 --- /dev/null +++ b/backports/lxc/0001-lua-Do-not-link-Lua-module-to-the-Lua-core-library.patch @@ -0,0 +1,31 @@ +From aa0337f7856feefab804c8a7bba4eaca205d3bab Mon Sep 17 00:00:00 2001 +From: Natanael Copa <ncopa@alpinelinux.org> +Date: Thu, 20 Feb 2014 09:48:37 +0000 +Subject: [PATCH 1/2] lua: Do not link Lua module to the Lua core library + +Modules should not link to the Lua core library. + +See http://lua-users.org/wiki/BuildingModules under +"Do Not Link Modules to the Lua Core Libraries" + +Signed-off-by: Natanael Copa <ncopa@alpinelinux.org> +--- + src/lua-lxc/Makefile.am | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/lua-lxc/Makefile.am b/src/lua-lxc/Makefile.am +index 7bbaf61..540238f 100644 +--- a/src/lua-lxc/Makefile.am ++++ b/src/lua-lxc/Makefile.am +@@ -18,7 +18,7 @@ core_so_LDFLAGS = \ + -L$(top_srcdir)/src/lxc \ + -Wl,-soname,core.so.$(firstword $(subst ., ,$(VERSION))) + +-core_so_LDADD = -llxc $(LUA_LIBS) ++core_so_LDADD = -llxc + + lxc.lua: + +-- +1.8.5.4 + diff --git a/backports/lxc/0002-lxc-alpine-add-support-for-architecture-arm.patch b/backports/lxc/0002-lxc-alpine-add-support-for-architecture-arm.patch new file mode 100644 index 0000000000..f4bfad2fce --- /dev/null +++ b/backports/lxc/0002-lxc-alpine-add-support-for-architecture-arm.patch @@ -0,0 +1,27 @@ +From 882bdfc07672202fbade0d8e38d26cf0a5309b5d Mon Sep 17 00:00:00 2001 +From: Natanael Copa <ncopa@alpinelinux.org> +Date: Thu, 20 Feb 2014 10:30:22 +0000 +Subject: [PATCH 2/2] lxc-alpine: add support for architecture arm + +Signed-off-by: Natanael Copa <ncopa@alpinelinux.org> +--- + templates/lxc-alpine.in | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/templates/lxc-alpine.in b/templates/lxc-alpine.in +index afda971..d8c6674 100644 +--- a/templates/lxc-alpine.in ++++ b/templates/lxc-alpine.in +@@ -368,6 +368,9 @@ case "$arch" in + ;; + x86_64|"") + ;; ++ arm*) ++ apk_arch=armhf ++ ;; + *) + die "unsupported architecture: $arch" + ;; +-- +1.8.5.4 + diff --git a/backports/lxc/APKBUILD b/backports/lxc/APKBUILD new file mode 100644 index 0000000000..e6eee7b85c --- /dev/null +++ b/backports/lxc/APKBUILD @@ -0,0 +1,99 @@ +# Contributor: William Pitcock <nenolod@dereferenced.org> +# Maintainer: Natanael Copa <ncopa@alpinelinux.org> +pkgname=lxc +pkgver=1.0.2 +_mypkgver=${pkgver/_rc/.rc} +pkgrel=1 +pkgdesc="linux containers - tools" +url="http://lxc.sourceforge.net/" +arch="all" +license="GPL" +depends="bash" +depends_dev="libcap-dev" +makedepends="$depends_dev lvm2 util-linux automake autoconf libtool lua5.2-dev" +install="" +subpackages="$pkgname-dev $pkgname-doc $pkgname-lvm lua5.2-lxc:_lua52 + $pkgname-templates $pkgname-libs" +source="https://github.com/lxc/lxc/archive/lxc-$_mypkgver.tar.gz + version.patch + lxc.initd + 0001-alpinelinux-set-correct-lxc_arch-for-x86.patch + " + +_builddir="${srcdir}/lxc-lxc-${_mypkgver}" +prepare() { + local i + cd "$_builddir" + for i in $source; do + case $i in + *.patch) msg $i; patch -p1 -i "$srcdir"/$i || return 1;; + esac + done + ./autogen.sh +} + +build() { + cd "$_builddir" + LUA_VERSION=5.2 \ + ./configure \ + --build=$CBUILD \ + --host=$CHOST \ + --prefix=/usr \ + --sysconfdir=/etc \ + --localstatedir=/var \ + --disable-apparmor \ + --enable-lua \ + --with-lua-pc=lua5.2 \ + --with-distro=alpine \ + || return 1 + make VERSION=$pkgver || return 1 +} + +package() { + cd "$_builddir" + make DESTDIR="$pkgdir" install || return 1 + install -d "$pkgdir"/var/lib/lxc + install -Dm755 "$srcdir"/lxc.initd "$pkgdir"/etc/init.d/lxc +} + +lvm() { + pkgdesc="linux containers lvm support" + depends="lvm2 util-linux lxc" + arch="noarch" + mkdir "$subpkgdir" +} + +_lua52() { + pkgdesc="Lua 5.2 module for LXC" + for i in lib share; do + mkdir -p "$subpkgdir"/usr/$i || return 1 + mv "$pkgdir"/usr/$i/lua "$subpkgdir"/usr/$i/ || return 1 + done +} + +templates() { + pkgdesc="Templates for LXC" + arch="noarch" + mkdir -p "$subpkgdir"/usr/share/lxc + mv "$pkgdir"/usr/share/lxc/templates "$subpkgdir"/usr/share/lxc/ +} + +dev() { + default_dev + #fix abuild smartness + mv "$subpkgdir"/usr/bin/lxc-config \ + "$pkgdir"/usr/bin/ || return 1 +} + +md5sums="ae877b4006c2e2edfa5cb1a718455588 lxc-1.0.2.tar.gz +79e90616b5049a472ccdcb5b1dcdd8b1 version.patch +1268d4b3e6ed004a47216b8714d09bfd lxc.initd +b93cda6f092211535cf87fa841d611aa 0001-alpinelinux-set-correct-lxc_arch-for-x86.patch" +sha256sums="705d098bb7bf8f739e2b40dd216da5c58ae558827084f1464bc0e3d911a8e8a3 lxc-1.0.2.tar.gz +b6d85fb23940d2511b3951de56b2532843c0e03ec1613548366361cc0c1a46b9 version.patch +bc108a722dc359a24c48837ef7012c776b1d20a533ae0e2231f75081dad4e2f5 lxc.initd +64bf7588bb0b7c4cd214eb1b89bd8426173dedec16e90b791d795a5d1234ad2b 0001-alpinelinux-set-correct-lxc_arch-for-x86.patch" +sha512sums="275052ce94c737bfe26b32d0557af90d8939e087f8003bf0ec364e016e1e377a33a6caeda7274507816f58e12aaaea7196bbee5aea25ea50e7446ecf89a7f20c lxc-1.0.2.tar.gz +e2ffcbf55447291a8434a4f37255c3a6a119bc4116c75d205006aa2b070bf6be28535cf6107bead14bbf64bf9fa415346ab544bd1c15e1add7d1c6380e6b2def version.patch +6618ceb59f1927bb82ad1a0fe0a7d4c452ced7855d8f0953556fce9154f30a4c5afbd7a2ab07fb26e6e793b07d4c8f906f8dc27c1defe0580dcf1545c80d1d60 lxc.initd +65f688f98b0b6879c6616006f8a39cce7e406c19976487f8ed41fba27beeda4a13f0182960f677d919d4441d436f0cc79a2d34fa0fff86183553e4c266cc5e70 0001-alpinelinux-set-correct-lxc_arch-for-x86.patch" diff --git a/backports/lxc/alpine-template-backport.patch b/backports/lxc/alpine-template-backport.patch new file mode 100644 index 0000000000..158efcf422 --- /dev/null +++ b/backports/lxc/alpine-template-backport.patch @@ -0,0 +1,201 @@ +diff --git a/templates/lxc-alpine.in b/templates/lxc-alpine.in +index 962d274..ce7226f 100644 +--- a/templates/lxc-alpine.in ++++ b/templates/lxc-alpine.in +@@ -1,20 +1,99 @@ + #!/bin/sh + ++key_sha256sums="9c102bcc376af1498d549b77bdbfa815ae86faa1d2d82f040e616b18ef2df2d4 alpine-devel@lists.alpinelinux.org-4a6a0840.rsa.pub ++2adcf7ce224f476330b5360ca5edb92fd0bf91c92d83292ed028d7c4e26333ab alpine-devel@lists.alpinelinux.org-4d07755e.rsa.pub" ++ ++get_static_apk () { ++ wget="wget -q -O -" ++ pkglist=alpine-keys:apk-tools-static ++ auto_repo_dir= ++ ++ if [ -z "$repository" ]; then ++ url=http://wiki.alpinelinux.org/cgi-bin/dl.cgi ++ if [ -z "$release" ]; then ++ echo -n "Determining the latest release... " ++ release=$($wget $url/.latest.$apk_arch.txt | \ ++ cut -d " " -f 3 | cut -d / -f 1 | uniq) ++ if [ -z "$release" ]; then ++ echo failed ++ return 1 ++ fi ++ echo $release ++ fi ++ auto_repo_dir=$release/main ++ repository=$url/$auto_repo_dir ++ pkglist=$pkglist:alpine-mirrors ++ fi ++ ++ rootfs="$1" ++ echo "Using static apk from $repository/$apk_arch" ++ wget="$wget $repository/$apk_arch" ++ ++ # parse APKINDEX to find the current versions ++ static_pkgs=$($wget/APKINDEX.tar.gz | \ ++ tar -Oxz APKINDEX | \ ++ awk -F: -v pkglist=$pkglist ' ++ BEGIN { split(pkglist,pkg) } ++ $0 != "" { f[$1] = $2 } ++ $0 == "" { for (i in pkg) ++ if (pkg[i] == f["P"]) ++ print(f["P"] "-" f["V"] ".apk") }') ++ [ "$static_pkgs" ] || return 1 ++ ++ mkdir -p "$rootfs" || return 1 ++ for pkg in $static_pkgs; do ++ echo "Downloading $pkg" ++ $wget/$pkg | tar -xz -C "$rootfs" ++ done ++ ++ # clean up .apk meta files ++ rm -f "$rootfs"/.[A-Z]* ++ ++ # verify checksum of the key ++ keyname=$(echo $rootfs/sbin/apk.static.*.pub | sed 's/.*\.SIGN\.RSA\.//') ++ checksum=$(echo "$key_sha256sums" | grep -w "$keyname") ++ if [ -z "$checksum" ]; then ++ echo "ERROR: checksum is missing for $keyname" ++ return 1 ++ fi ++ (cd $rootfs/etc/apk/keys && echo "$checksum" | sha256sum -c -) || return 1 ++ ++ # verify the static apk binary signature ++ APK=$rootfs/sbin/apk.static ++ openssl dgst -verify $rootfs/etc/apk/keys/$keyname \ ++ -signature "$APK.SIGN.RSA.$keyname" "$APK" || return 1 ++ ++ if [ "$auto_repo_dir" ]; then ++ mirror_list=$rootfs/usr/share/alpine-mirrors/MIRRORS.txt ++ mirror_count=$(wc -l $mirror_list | cut -d " " -f 1) ++ repository=$(sed $(expr $RANDOM % $mirror_count + 1)\!d \ ++ $mirror_list)$auto_repo_dir ++ echo "Selecting mirror $repository" ++ fi ++} ++ + install_alpine() { + rootfs="$1" + shift + mkdir -p "$rootfs"/etc/apk || return 1 +- cp -r ${keys_dir:-/etc/apk/keys} "$rootfs"/etc/apk/ ++ : ${keys_dir:=/etc/apk/keys} ++ if ! [ -d "$rootfs"/etc/apk/keys ] && [ -d "$keys_dir" ]; then ++ cp -r "$keys_dir" "$rootfs"/etc/apk/keys ++ fi + if [ -n "$repository" ]; then + echo "$repository" > "$rootfs"/etc/apk/repositories + else + cp /etc/apk/repositories "$rootfs"/etc/apk/repositories || return 1 ++ if [ -n "$release" ]; then ++ sed -i -e "s:/[^/]\+/\([^/]\+\)$:/$release/\1:" \ ++ "$rootfs"/etc/apk/repositories ++ fi + fi + opt_arch= + if [ -n "$apk_arch" ]; then + opt_arch="--arch $apk_arch" + fi +- ${APK:-apk} add -U --initdb --root $rootfs $opt_arch "$@" alpine-base ++ $APK add -U --initdb --root $rootfs $opt_arch "$@" alpine-base + } + + configure_alpine() { +@@ -109,6 +188,7 @@ EOF + lxc.tty = 4 + lxc.pts = 1024 + lxc.utsname = $hostname ++lxc.cap.drop = sys_module mac_admin mac_override sys_time + + # When using LXC with apparmor, uncomment the next line to run unconfined: + #lxc.aa_profile = unconfined +@@ -129,7 +209,7 @@ lxc.cgroup.devices.allow = c 1:8 rwm + lxc.cgroup.devices.allow = c 136:* rwm + lxc.cgroup.devices.allow = c 5:2 rwm + # rtc +-lxc.cgroup.devices.allow = c 254:0 rwm ++lxc.cgroup.devices.allow = c 254:0 rm + + # mounts point + lxc.mount.entry=proc proc proc nodev,noexec,nosuid 0 0 +@@ -148,8 +228,10 @@ die() { + + usage() { + cat >&2 <<EOF +-Usage: $(basename $0) [-h|--help] [-r|--repository <url>] [-a|--arch <arch>] +- -p|--path <path> -n|--name <name> [PKG...] ++Usage: $(basename $0) [-h|--help] [-r|--repository <url>] ++ [-R|--release <release>] [-a|--arch <arch>] ++ [--rootfs <rootfs>] -p|--path <path> -n|--name <name> ++ [PKG...] + EOF + } + +@@ -165,6 +247,14 @@ optarg_check() { + } + + default_path=@LXCPATH@ ++release= ++arch=$(uname -m) ++ ++# template mknods, requires root ++if [ $(id -u) -ne 0 ]; then ++ echo "$(basename $0): must be run as root" >&2 ++ exit 1 ++fi + + while [ $# -gt 0 ]; do + opt="$1" +@@ -179,6 +269,11 @@ while [ $# -gt 0 ]; do + name=$1 + shift + ;; ++ --rootfs) ++ optarg_check $opt "$1" ++ rootfs=$1 ++ shift ++ ;; + -p|--path) + optarg_check $opt "$1" + path=$1 +@@ -189,6 +284,11 @@ while [ $# -gt 0 ]; do + repository=$1 + shift + ;; ++ -R|--release) ++ optarg_check $opt "$1" ++ release=$1 ++ shift ++ ;; + -a|--arch) + optarg_check $opt "$1" + arch=$1 +@@ -217,9 +317,11 @@ if [ -z "${path}" ]; then + path="${default_path}/${name}" + fi + +-rootfs=`awk -F= '$1 ~ /^lxc.rootfs/ { print $2 }' "$path/config" 2>/dev/null` + if [ -z "$rootfs" ]; then +- rootfs="${path}/rootfs" ++ rootfs=`awk -F= '$1 ~ /^lxc.rootfs/ { print $2 }' "$path/config" 2>/dev/null` ++ if [ -z "$rootfs" ]; then ++ rootfs="${path}/rootfs" ++ fi + fi + + lxc_arch=$arch +@@ -234,6 +336,11 @@ case "$arch" in + *) die "unsupported architecture: $arch";; + esac + ++: ${APK:=apk} ++if ! which $APK >/dev/null; then ++ get_static_apk "$rootfs" || die "Failed to download a valid static apk" ++fi ++ + install_alpine "$rootfs" "$@" || die "Failed to install rootfs for $name" + configure_alpine "$rootfs" "$name" || die "Failed to configure $name" + copy_configuration "$path" "$rootfs" "$name" diff --git a/backports/lxc/bb-rm.patch b/backports/lxc/bb-rm.patch new file mode 100644 index 0000000000..c93adb33a8 --- /dev/null +++ b/backports/lxc/bb-rm.patch @@ -0,0 +1,15 @@ +--- ./src/lxc/lxc-destroy.in.orig 2013-04-15 07:38:58.383545701 +0000 ++++ ./src/lxc/lxc-destroy.in 2013-04-15 07:42:22.552123148 +0000 +@@ -137,10 +137,10 @@ + btrfs subvolume delete "$rootdev" + else + # In case rootfs is not under $lxc_path/$lxc_name, remove it +- rm -rf --one-file-system --preserve-root $rootdev ++ find $rootdev -xdev -delete + fi + fi + fi + + # recursively remove the container to remove old container configuration +-rm -rf --one-file-system --preserve-root $lxc_path/$lxc_name ++find $lxc_path/$lxc_name -xdev -delete diff --git a/backports/lxc/bb-shutdown.patch b/backports/lxc/bb-shutdown.patch new file mode 100644 index 0000000000..4063032159 --- /dev/null +++ b/backports/lxc/bb-shutdown.patch @@ -0,0 +1,26 @@ +--- ./src/lxc/lxc-shutdown.in.orig 2013-04-15 07:43:04.709177850 +0000 ++++ ./src/lxc/lxc-shutdown.in 2013-04-15 07:45:43.213958405 +0000 +@@ -118,11 +118,21 @@ + exit 1 + fi + ++signal_reboot=INT ++signal_poweroff=PWR ++init_exe=$(readlink -f /proc/$pid/exe) ++case ${init_exe} in ++ */busybox) ++ signal_reboot=TERM ++ signal_poweroff=USR2 ++ ;; ++esac ++ + if [ $reboot -eq 1 ]; then +- kill -s INT $pid ++ kill -s $signal_reboot $pid + exit 0 + else +- kill -s PWR $pid ++ kill -s $signal_poweroff $pid + fi + + if [ $dowait -eq 0 ]; then diff --git a/backports/lxc/lxc-fix-headers.patch b/backports/lxc/lxc-fix-headers.patch new file mode 100644 index 0000000000..bc7f8e59cf --- /dev/null +++ b/backports/lxc/lxc-fix-headers.patch @@ -0,0 +1,435 @@ +diff -ru lxc-0.9.0.orig/src/lua-lxc/core.c lxc-0.9.0/src/lua-lxc/core.c +--- lxc-0.9.0.orig/src/lua-lxc/core.c 2013-10-10 09:22:58.841387605 +0300 ++++ lxc-0.9.0/src/lua-lxc/core.c 2013-10-10 09:23:13.847971218 +0300 +@@ -21,7 +21,6 @@ + */ + + #define LUA_LIB +-#define _GNU_SOURCE + #include <lua.h> + #include <lauxlib.h> + #include <string.h> +diff -ru lxc-0.9.0.orig/src/lxc/attach.c lxc-0.9.0/src/lxc/attach.c +--- lxc-0.9.0.orig/src/lxc/attach.c 2013-10-10 09:22:58.841387605 +0300 ++++ lxc-0.9.0/src/lxc/attach.c 2013-10-10 09:23:13.847971218 +0300 +@@ -21,13 +21,14 @@ + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +-#define _GNU_SOURCE ++#include "config.h" + #include <unistd.h> + #include <stdio.h> + #include <string.h> + #include <stdlib.h> + #include <errno.h> + #include <fcntl.h> ++#include <sched.h> + #include <sys/param.h> + #include <sys/prctl.h> + #include <sys/mount.h> +@@ -44,7 +45,6 @@ + #include "log.h" + #include "attach.h" + #include "caps.h" +-#include "config.h" + #include "apparmor.h" + + lxc_log_define(lxc_attach, lxc); +diff -ru lxc-0.9.0.orig/src/lxc/caps.c lxc-0.9.0/src/lxc/caps.c +--- lxc-0.9.0.orig/src/lxc/caps.c 2013-10-10 09:22:58.841387605 +0300 ++++ lxc-0.9.0/src/lxc/caps.c 2013-10-10 09:23:13.847971218 +0300 +@@ -21,7 +21,7 @@ + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +-#define _GNU_SOURCE ++#include "config.h" + #include <unistd.h> + #include <fcntl.h> + #include <stdlib.h> +@@ -29,7 +29,6 @@ + #include <sys/prctl.h> + #include <errno.h> + +-#include "config.h" + #include "log.h" + + lxc_log_define(lxc_caps, lxc); +diff -ru lxc-0.9.0.orig/src/lxc/cgroup.c lxc-0.9.0/src/lxc/cgroup.c +--- lxc-0.9.0.orig/src/lxc/cgroup.c 2013-10-10 09:22:58.841387605 +0300 ++++ lxc-0.9.0/src/lxc/cgroup.c 2013-10-10 09:28:10.249698806 +0300 +@@ -20,9 +20,8 @@ + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +-#define _GNU_SOURCE ++#include "config.h" + #include <stdio.h> +-#undef _GNU_SOURCE + #include <stdlib.h> + #include <errno.h> + #include <unistd.h> +@@ -37,7 +36,6 @@ + #include <net/if.h> + + #include "error.h" +-#include "config.h" + #include "commands.h" + + #include <lxc/log.h> +diff -ru lxc-0.9.0.orig/src/lxc/commands.c lxc-0.9.0/src/lxc/commands.c +--- lxc-0.9.0.orig/src/lxc/commands.c 2013-10-10 09:22:58.841387605 +0300 ++++ lxc-0.9.0/src/lxc/commands.c 2013-10-10 09:23:13.851304534 +0300 +@@ -28,7 +28,7 @@ + #include <fcntl.h> + #include <sys/socket.h> + #include <sys/un.h> +-#include <sys/poll.h> ++#include <poll.h> + #include <sys/param.h> + #include <malloc.h> + #include <stdlib.h> +diff -ru lxc-0.9.0.orig/src/lxc/conf.c lxc-0.9.0/src/lxc/conf.c +--- lxc-0.9.0.orig/src/lxc/conf.c 2013-10-10 09:22:58.844720784 +0300 ++++ lxc-0.9.0/src/lxc/conf.c 2013-10-10 09:28:30.296256871 +0300 +@@ -20,9 +20,8 @@ + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +-#define _GNU_SOURCE ++#include "config.h" + #include <stdio.h> +-#undef _GNU_SOURCE + #include <stdlib.h> + #include <stdarg.h> + #include <errno.h> +@@ -58,7 +57,6 @@ + #include "network.h" + #include "error.h" + #include "parse.h" +-#include "config.h" + #include "utils.h" + #include "conf.h" + #include "log.h" +diff -ru lxc-0.9.0.orig/src/lxc/confile.c lxc-0.9.0/src/lxc/confile.c +--- lxc-0.9.0.orig/src/lxc/confile.c 2013-10-10 09:22:58.844720784 +0300 ++++ lxc-0.9.0/src/lxc/confile.c 2013-10-10 09:28:45.472841319 +0300 +@@ -20,7 +20,7 @@ + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +-#define _GNU_SOURCE ++#include "config.h" + #include <stdio.h> + #include <stdlib.h> + #include <string.h> +@@ -38,7 +38,6 @@ + #include <net/if.h> + + #include "parse.h" +-#include "config.h" + #include "confile.h" + #include "utils.h" + +diff -ru lxc-0.9.0.orig/src/lxc/freezer.c lxc-0.9.0/src/lxc/freezer.c +--- lxc-0.9.0.orig/src/lxc/freezer.c 2013-10-10 09:22:58.844720784 +0300 ++++ lxc-0.9.0/src/lxc/freezer.c 2013-10-10 09:29:01.486087901 +0300 +@@ -20,9 +20,8 @@ + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +-#define _GNU_SOURCE ++#include "config.h" + #include <stdio.h> +-#undef _GNU_SOURCE + #include <stdlib.h> + #include <errno.h> + #include <unistd.h> +diff -ru lxc-0.9.0.orig/src/lxc/lxc_attach.c lxc-0.9.0/src/lxc/lxc_attach.c +--- lxc-0.9.0.orig/src/lxc/lxc_attach.c 2013-10-10 09:22:58.844720784 +0300 ++++ lxc-0.9.0/src/lxc/lxc_attach.c 2013-10-10 09:29:19.079325924 +0300 +@@ -21,7 +21,7 @@ + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +-#define _GNU_SOURCE ++#include "config.h" + #include <unistd.h> + #include <errno.h> + #include <pwd.h> +@@ -36,7 +36,6 @@ + #include "arguments.h" + #include "caps.h" + #include "cgroup.h" +-#include "config.h" + #include "confile.h" + #include "start.h" + #include "sync.h" +diff -ru lxc-0.9.0.orig/src/lxc/lxc_checkpoint.c lxc-0.9.0/src/lxc/lxc_checkpoint.c +--- lxc-0.9.0.orig/src/lxc/lxc_checkpoint.c 2013-10-10 09:22:58.844720784 +0300 ++++ lxc-0.9.0/src/lxc/lxc_checkpoint.c 2013-10-10 09:25:41.587170847 +0300 +@@ -20,7 +20,7 @@ + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +-#define _GNU_SOURCE ++#include "config.h" + #include <assert.h> + #include <stdio.h> + #include <stdlib.h> +@@ -35,7 +35,6 @@ + #include <lxc/utils.h> + + #include "arguments.h" +-#include "config.h" + #include "caps.h" + + lxc_log_define(lxc_checkpoint_ui, lxc_checkpoint); +diff -ru lxc-0.9.0.orig/src/lxc/lxc_console.c lxc-0.9.0/src/lxc/lxc_console.c +--- lxc-0.9.0.orig/src/lxc/lxc_console.c 2013-10-10 09:22:58.844720784 +0300 ++++ lxc-0.9.0/src/lxc/lxc_console.c 2013-10-10 09:23:13.854637849 +0300 +@@ -21,9 +21,7 @@ + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +-#define _GNU_SOURCE + #include <stdio.h> +-#undef _GNU_SOURCE + #include <stdlib.h> + #include <errno.h> + #include <string.h> +@@ -35,7 +33,7 @@ + #include <sys/param.h> + #include <sys/types.h> + #include <sys/stat.h> +-#include <sys/poll.h> ++#include <poll.h> + #include <sys/ioctl.h> + + #include "error.h" +diff -ru lxc-0.9.0.orig/src/lxc/lxc_execute.c lxc-0.9.0/src/lxc/lxc_execute.c +--- lxc-0.9.0.orig/src/lxc/lxc_execute.c 2013-10-10 09:22:58.848053921 +0300 ++++ lxc-0.9.0/src/lxc/lxc_execute.c 2013-10-10 09:25:21.023948914 +0300 +@@ -20,7 +20,7 @@ + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +-#define _GNU_SOURCE ++#include "config.h" + #include <stdio.h> + #include <stdlib.h> + #include <errno.h> +@@ -37,7 +37,6 @@ + #include "conf.h" + #include "confile.h" + #include "arguments.h" +-#include "config.h" + #include "start.h" + #include "utils.h" + +diff -ru lxc-0.9.0.orig/src/lxc/lxc_init.c lxc-0.9.0/src/lxc/lxc_init.c +--- lxc-0.9.0.orig/src/lxc/lxc_init.c 2013-10-10 09:22:58.848053921 +0300 ++++ lxc-0.9.0/src/lxc/lxc_init.c 2013-10-10 09:23:13.854637849 +0300 +@@ -30,7 +30,6 @@ + #include <sys/stat.h> + #include <sys/types.h> + #include <sys/wait.h> +-#define _GNU_SOURCE + #include <getopt.h> + + #include "log.h" +diff -ru lxc-0.9.0.orig/src/lxc/lxc_restart.c lxc-0.9.0/src/lxc/lxc_restart.c +--- lxc-0.9.0.orig/src/lxc/lxc_restart.c 2013-10-10 09:22:58.848053921 +0300 ++++ lxc-0.9.0/src/lxc/lxc_restart.c 2013-10-10 09:25:59.123742508 +0300 +@@ -20,9 +20,8 @@ + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +-#define _GNU_SOURCE ++#include "config.h" + #include <stdio.h> +-#undef _GNU_SOURCE + #include <stdlib.h> + #include <unistd.h> + #include <errno.h> +@@ -33,7 +32,6 @@ + #include "lxc.h" + #include "caps.h" + #include "conf.h" +-#include "config.h" + #include "confile.h" + #include "arguments.h" + #include "utils.h" +diff -ru lxc-0.9.0.orig/src/lxc/lxc_start.c lxc-0.9.0/src/lxc/lxc_start.c +--- lxc-0.9.0.orig/src/lxc/lxc_start.c 2013-10-10 09:22:58.848053921 +0300 ++++ lxc-0.9.0/src/lxc/lxc_start.c 2013-10-10 09:24:30.684221628 +0300 +@@ -20,9 +20,8 @@ + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +-#define _GNU_SOURCE ++#include "config.h" + #include <stdio.h> +-#undef _GNU_SOURCE + #include <libgen.h> + #include <stdlib.h> + #include <unistd.h> +@@ -46,7 +45,6 @@ + #include "conf.h" + #include "cgroup.h" + #include "utils.h" +-#include "config.h" + #include "confile.h" + #include "arguments.h" + +diff -ru lxc-0.9.0.orig/src/lxc/lxc_unshare.c lxc-0.9.0/src/lxc/lxc_unshare.c +--- lxc-0.9.0.orig/src/lxc/lxc_unshare.c 2013-10-10 09:22:58.848053921 +0300 ++++ lxc-0.9.0/src/lxc/lxc_unshare.c 2013-10-10 09:23:13.854637849 +0300 +@@ -20,9 +20,7 @@ + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +-#define _GNU_SOURCE + #include <stdio.h> +-#undef _GNU_SOURCE + #include <stdlib.h> + #include <unistd.h> + #include <libgen.h> +diff -ru lxc-0.9.0.orig/src/lxc/lxccontainer.c lxc-0.9.0/src/lxc/lxccontainer.c +--- lxc-0.9.0.orig/src/lxc/lxccontainer.c 2013-10-10 09:22:58.848053921 +0300 ++++ lxc-0.9.0/src/lxc/lxccontainer.c 2013-10-10 09:23:13.854637849 +0300 +@@ -800,7 +800,7 @@ + if (pid < 0) + return false; + if (pid == 0) { // child +- ret = execlp("lxc-destroy", "lxc-destroy", "-n", c->name, "-P", c->config_path, NULL); ++ ret = execlp("lxc-destroy", "lxc-destroy", "-n", c->name, "-P", c->config_path, (void*)0); + perror("execl"); + exit(1); + } +diff -ru lxc-0.9.0.orig/src/lxc/lxclock.c lxc-0.9.0/src/lxc/lxclock.c +--- lxc-0.9.0.orig/src/lxc/lxclock.c 2013-10-10 09:22:58.848053921 +0300 ++++ lxc-0.9.0/src/lxc/lxclock.c 2013-10-10 09:23:13.854637849 +0300 +@@ -18,8 +18,8 @@ + */ + + #include "lxclock.h" +-#include <malloc.h> + #include <stdio.h> ++#include <stdlib.h> + + #define OFLAG (O_CREAT | O_RDWR) + #define SEMMODE 0660 +diff -ru lxc-0.9.0.orig/src/lxc/lxcutmp.c lxc-0.9.0/src/lxc/lxcutmp.c +--- lxc-0.9.0.orig/src/lxc/lxcutmp.c 2013-10-10 09:22:58.848053921 +0300 ++++ lxc-0.9.0/src/lxc/lxcutmp.c 2013-10-10 09:23:13.854637849 +0300 +@@ -63,6 +63,8 @@ + #include "lxc.h" + #include "log.h" + ++#include <utmp.h> ++ + #ifndef __USE_GNU + #define __USE_GNU + #endif +diff -ru lxc-0.9.0.orig/src/lxc/network.c lxc-0.9.0/src/lxc/network.c +--- lxc-0.9.0.orig/src/lxc/network.c 2013-10-10 09:22:58.848053921 +0300 ++++ lxc-0.9.0/src/lxc/network.c 2013-10-10 09:30:26.518960572 +0300 +@@ -20,9 +20,8 @@ + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +-#define _GNU_SOURCE ++#include "config.h" + #include <stdio.h> +-#undef _GNU_SOURCe + #include <stdlib.h> + #include <unistd.h> + #include <fcntl.h> +diff -ru lxc-0.9.0.orig/src/lxc/parse.c lxc-0.9.0/src/lxc/parse.c +--- lxc-0.9.0.orig/src/lxc/parse.c 2013-10-10 09:22:58.848053921 +0300 ++++ lxc-0.9.0/src/lxc/parse.c 2013-10-10 09:23:30.724546457 +0300 +@@ -20,16 +20,14 @@ + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +-#define _GNU_SOURCE ++#include "config.h" + #include <stdio.h> +-#undef _GNU_SOURCE + #include <string.h> + #include <stdlib.h> + #include <errno.h> + #include <dirent.h> + + #include "parse.h" +-#include "config.h" + #include <lxc/log.h> + + /* Define getline() if missing from the C library */ +diff -ru lxc-0.9.0.orig/src/lxc/restart.c lxc-0.9.0/src/lxc/restart.c +--- lxc-0.9.0.orig/src/lxc/restart.c 2013-10-10 09:22:58.851387051 +0300 ++++ lxc-0.9.0/src/lxc/restart.c 2013-10-10 09:23:13.857971164 +0300 +@@ -24,7 +24,6 @@ + #include "config.h" + + #include <stdio.h> +-#undef _GNU_SOURCE + #include <string.h> + #include <stdlib.h> + #include <errno.h> +diff -ru lxc-0.9.0.orig/src/lxc/seccomp.c lxc-0.9.0/src/lxc/seccomp.c +--- lxc-0.9.0.orig/src/lxc/seccomp.c 2013-10-10 09:22:58.851387051 +0300 ++++ lxc-0.9.0/src/lxc/seccomp.c 2013-10-10 09:23:13.857971164 +0300 +@@ -21,7 +21,6 @@ + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +-#define _GNU_SOURCE + #include <stdio.h> + #include <stdlib.h> + #include <seccomp.h> +diff -ru lxc-0.9.0.orig/src/lxc/start.c lxc-0.9.0/src/lxc/start.c +--- lxc-0.9.0.orig/src/lxc/start.c 2013-10-10 09:22:58.851387051 +0300 ++++ lxc-0.9.0/src/lxc/start.c 2013-10-10 09:23:13.857971164 +0300 +@@ -24,7 +24,6 @@ + #include "config.h" + + #include <stdio.h> +-#undef _GNU_SOURCE + #include <string.h> + #include <stdlib.h> + #include <dirent.h> +@@ -43,7 +42,7 @@ + #include <sys/types.h> + #include <sys/wait.h> + #include <sys/un.h> +-#include <sys/poll.h> ++#include <poll.h> + #include <sys/syscall.h> + + #if HAVE_SYS_CAPABILITY_H +diff -ru lxc-0.9.0.orig/src/lxc/utils.c lxc-0.9.0/src/lxc/utils.c +--- lxc-0.9.0.orig/src/lxc/utils.c 2013-10-10 09:22:58.851387051 +0300 ++++ lxc-0.9.0/src/lxc/utils.c 2013-10-10 09:23:13.857971164 +0300 +@@ -21,7 +21,6 @@ + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +-#define _GNU_SOURCE + #include <errno.h> + #include <unistd.h> + #include <stdlib.h> +diff -ru lxc-0.9.0.orig/src/lxc/utils.h lxc-0.9.0/src/lxc/utils.h +--- lxc-0.9.0.orig/src/lxc/utils.h 2013-10-10 09:22:58.851387051 +0300 ++++ lxc-0.9.0/src/lxc/utils.h 2013-10-10 09:23:13.857971164 +0300 +@@ -23,6 +23,8 @@ + #ifndef _utils_h + #define _utils_h + ++#include <sys/types.h> ++ + extern int lxc_copy_file(const char *src, const char *dst); + extern int lxc_setup_fs(void); + extern int get_u16(unsigned short *val, const char *arg, int base); diff --git a/backports/lxc/lxc.initd b/backports/lxc/lxc.initd new file mode 100644 index 0000000000..1b348894d4 --- /dev/null +++ b/backports/lxc/lxc.initd @@ -0,0 +1,92 @@ +#!/sbin/runscript +# Copyright 1999-2012 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/app-emulation/lxc/files/lxc.initd.2,v 1.5 2012/07/21 05:07:15 flameeyes Exp $ + +CONTAINER=${SVCNAME#*.} +command="/usr/bin/lxc-start" +pidfile="/var/run/lxc/$CONTAINER.pid" +extra_started_commands="reboot" + +depend() { + need localmount + after firewall net +} + +lxc_get_configfile() { + local i + for i in /var/lib/lxc/${CONTAINER}/config \ + /etc/lxc/${CONTAINER}.conf \ + /etc/lxc/${CONTAINER}/config; do + if [ -f "$i" ]; then + echo "$i" + return 0 + fi + done + eerror "Unable to find a suitable configuration file." + eerror "If you set up the container in a non-standard" + eerror "location, please set the CONFIGFILE variable." + return 1 +} + +lxc_get_var() { + awk 'BEGIN { FS="[ \t]*=[ \t]*" } $1 == "'$1'" { print $2; exit }' ${CONFIGFILE} +} + +checkconfig() { + if [ ${CONTAINER} = ${SVCNAME} ]; then + eerror "You have to create an init script for each container:" + eerror " ln -s lxc /etc/init.d/lxc.container" + return 1 + fi + CONFIGFILE=${CONFIGFILE:-$(lxc_get_configfile)} + + # no need to output anything, the function takes care of that. + [ -z "${CONFIGFILE}" ] && return 1 + + utsname=$(lxc_get_var lxc.utsname) + if [ "${CONTAINER}" != "${utsname}" ]; then + eerror "You should use the same name for the service and the" + eerror "lxc.utsname. Right now the lxc.utsname is set to ${utsname}" + return 1 + fi +} + +start() { + checkconfig || return 1 + rm -f /var/log/lxc/${CONTAINER}.log + + rootpath=$(lxc_get_var lxc.rootfs) + checkpath -d ${pidfile%/*} + ebegin "Starting container ${CONTAINER}" + start-stop-daemon --start $command \ + --pidfile $pidfile \ + -- \ + --daemon \ + --pidfile $pidfile \ + --name ${CONTAINER} \ + --rcfile ${CONFIGFILE} \ + --logpriority WARN \ + --logfile /var/log/lxc/${CONTAINER}.log \ + || eend $? || return $? + lxc-wait -n ${CONTAINER} -t 5 -s RUNNING + eend $? +} + +stop() { + checkconfig || return 1 + + ebegin "Stopping container ${CONTAINER}" + start-stop-daemon --stop --pidfile ${pidfile} \ + --retry ${POWEROFF_SIGNAL:-SIGUSR2}/${TIMEOUT:-30} \ + --progress + eend $? +} + +reboot() { + checkconfig || return 1 + ebegin "Sending reboot signal to container $CONTAINER" + start-stop-daemon --signal ${RESTART_SIG:-SIGTERM} \ + --pidfile ${pidfile} + eend $? +} diff --git a/backports/lxc/version.patch b/backports/lxc/version.patch new file mode 100644 index 0000000000..6f61d8257a --- /dev/null +++ b/backports/lxc/version.patch @@ -0,0 +1,17 @@ +Fix version so apk-tools understand the .so version +(1.0.0.rc4 -> 1.0.0_rc4) + +diff --git a/configure.ac b/configure.ac +index 498d69a..f52bf8c 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -8,7 +8,8 @@ m4_define([lxc_version_beta], [rc4]) + + m4_define([lxc_version_base], [lxc_version_major.lxc_version_minor.lxc_version_micro]) + m4_define([lxc_version], +- [ifelse(lxc_version_beta, [], [lxc_version_base], [lxc_version_base.lxc_version_beta])]) ++ [ifelse(lxc_version_beta, [], [lxc_version_base], ++ [lxc_version_base[_]lxc_version_beta])])]) + + AC_INIT([lxc], [lxc_version]) + |