diff options
Diffstat (limited to 'recipes-containers/lxc')
16 files changed, 393 insertions, 536 deletions
diff --git a/recipes-containers/lxc/README b/recipes-containers/lxc/README new file mode 100644 index 00000000..e6e3f1af --- /dev/null +++ b/recipes-containers/lxc/README @@ -0,0 +1,23 @@ +install: +-------- + + Install the following packages to your image: + + IMAGE_INSTALL:append = "lxc lxc-networking kernel-modules" + + These will put the core lxc application and networking onto your image. + No other configuration is required for a basic system. + + Note: has only been tested with systemd, sysvinit patches are welcome + + Note: Partially conflicts with packages such as k3s, networking will fail to + start. + +sample test: +----------- + + % lxc-create -n test -t download -- --server us.lxd.images.canonical.com -d alpine -r 3.16 -a amd64 + % lxc-start test + % lxc-console test + + diff --git a/recipes-containers/lxc/files/0001-download-don-t-try-compatbility-index.patch b/recipes-containers/lxc/files/0001-download-don-t-try-compatbility-index.patch new file mode 100644 index 00000000..a1e5fb67 --- /dev/null +++ b/recipes-containers/lxc/files/0001-download-don-t-try-compatbility-index.patch @@ -0,0 +1,45 @@ +From d69c856f90c752637b33e59fbbcfa31f619e2285 Mon Sep 17 00:00:00 2001 +From: Bruce Ashfield <bruce.ashfield@gmail.com> +Date: Sun, 14 Aug 2022 22:44:24 -0400 +Subject: [PATCH] download: don't try compatbility index + +This is being mistaken for a valid, non compat index .. and we never +try for the one that exists (the index without a compatibility +extension). So we just drop the compat try for now. + +Upstream-Status: Inappropriate [embedded specific] + +Signed-off-by: Bruce Ashfield <bruce.ashfield@gmail.com> +--- + templates/lxc-download.in | 8 ++------ + 1 file changed, 2 insertions(+), 6 deletions(-) + +diff --git a/templates/lxc-download.in b/templates/lxc-download.in +index 9a3290fbc..216e4dda7 100755 +--- a/templates/lxc-download.in ++++ b/templates/lxc-download.in +@@ -234,9 +234,7 @@ if [ "${DOWNLOAD_LIST_IMAGES}" = "true" ] || [ "${DOWNLOAD_INTERACTIVE}" = "true + DOWNLOAD_INDEX_PATH="/meta/1.0/index-${DOWNLOAD_MODE}" + + echo "Downloading the image index" +- if ! download_file "${DOWNLOAD_INDEX_PATH}.${DOWNLOAD_COMPAT_LEVEL}" "${DOWNLOAD_TEMP}/index" noexit; then +- download_file "${DOWNLOAD_INDEX_PATH}" "${DOWNLOAD_TEMP}/index" normal +- fi ++ download_file "${DOWNLOAD_INDEX_PATH}" "${DOWNLOAD_TEMP}/index" normal + + # Parse it + echo "" +@@ -316,9 +314,7 @@ if [ "${DOWNLOAD_USE_CACHE}" = "false" ]; then + DOWNLOAD_INDEX_PATH="/meta/1.0/index-${DOWNLOAD_MODE}" + + echo "Downloading the image index" +- if ! download_file "${DOWNLOAD_INDEX_PATH}.${DOWNLOAD_COMPAT_LEVEL}" "${DOWNLOAD_TEMP}/index" noexit; then +- download_file "${DOWNLOAD_INDEX_PATH}" "${DOWNLOAD_TEMP}/index" normal +- fi ++ download_file "${DOWNLOAD_INDEX_PATH}" "${DOWNLOAD_TEMP}/index" normal + + # Parse it + while IFS=';' read -r f1 f2 f3 f4 f5 f6; do +-- +2.25.1 + diff --git a/recipes-containers/lxc/files/0001-template-if-busybox-contains-init-use-it-in-containe.patch b/recipes-containers/lxc/files/0001-template-if-busybox-contains-init-use-it-in-containe.patch new file mode 100644 index 00000000..760ebe64 --- /dev/null +++ b/recipes-containers/lxc/files/0001-template-if-busybox-contains-init-use-it-in-containe.patch @@ -0,0 +1,45 @@ +From 2789860daaa7780e1542bb1c60a89860e5661739 Mon Sep 17 00:00:00 2001 +From: Xiangyu Chen <xiangyu.chen@windriver.com> +Date: Wed, 1 Mar 2023 09:25:35 +0800 +Subject: [PATCH] template: if busybox contains init, use it in container + +The lxc test code using busybox template, some cases would be failed or hang +if the init progress not from busybox. This cause ptest report lots of failed. + +The changes is checking whether the busybox has built-in init, if it has,use it. + +Upstream-Status: Inappropriate [embedded specific] + +Signed-off-by: Xiangyu Chen <xiangyu.chen@windriver.com> +--- + templates/lxc-busybox.in | 14 ++++++++++---- + 1 file changed, 10 insertions(+), 4 deletions(-) + +diff --git a/templates/lxc-busybox.in b/templates/lxc-busybox.in +index dab7c1faf..e2beae7a4 100755 +--- a/templates/lxc-busybox.in ++++ b/templates/lxc-busybox.in +@@ -184,10 +184,16 @@ configure_busybox() + return 1 + fi + +- # copy bash binary as the container init +- if ! cp "$(which bash)" "${rootfs}/sbin/init"; then +- echo "ERROR: Failed to copy bash binary" +- return 1 ++ # checking whether busybox has init or not ++ if ! ${rootfs}/bin/busybox --list | grep "init" > /dev/null; then ++ # copy bash binary as the container init ++ if ! cp "$(which bash)" "${rootfs}/sbin/init"; then ++ echo "ERROR: Failed to copy bash binary" ++ return 1 ++ fi ++ else ++ # relink /sbin/init ++ ln "${rootfs}/bin/busybox" "${rootfs}/sbin/init" + fi + + +-- +2.34.1 + diff --git a/recipes-containers/lxc/files/logs-optionally-use-base-filenames-to-report-src-fil.patch b/recipes-containers/lxc/files/logs-optionally-use-base-filenames-to-report-src-fil.patch deleted file mode 100644 index 648193b4..00000000 --- a/recipes-containers/lxc/files/logs-optionally-use-base-filenames-to-report-src-fil.patch +++ /dev/null @@ -1,69 +0,0 @@ -From c50ddb2b2cf22a29e4c671b1efbd338eeba694aa Mon Sep 17 00:00:00 2001 -From: Jim Somerville <Jim.Somerville@windriver.com> -Date: Fri, 25 Sep 2015 15:08:17 -0400 -Subject: [PATCH] logs: optionally use base filenames to report src files - -Message-Id: <4729d0f4c4d1dacd150ddfd7061dda875eb94e34.1443216870.git.Jim.Somerville@windriver.com> - -Problem: Logs are nice in that they report the source file, -routine, and line number where an issue occurs. But the -file is printed as the absolute filename. Users do not -need to see a long spew of path directory names where the package -was built. It just confuses things. - -Solution: Optionally chop off all leading directories so that just -the source filename ie. basename is printed. This is done by -setting a #ifdef LXC_LOG_USE_BASENAME check in the code. That -define is done via the optional --enable-log-src-basename provided -at configure time. - -Using __BASE_FILE__ instead of __FILE__ did not work. It -refers to the file name as presented to the compile -machinery, and that may still be the absolute pathname to -the file. - -Signed-off-by: Jim Somerville <Jim.Somerville@windriver.com> - ---- - configure.ac | 9 +++++++++ - src/lxc/log.h | 5 +++++ - 2 files changed, 14 insertions(+) - -diff --git a/configure.ac b/configure.ac -index 74b976a..9c561f7 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -356,6 +356,15 @@ AC_ARG_ENABLE([examples], - [], [enable_examples=yes]) - AM_CONDITIONAL([ENABLE_EXAMPLES], [test "x$enable_examples" = "xyes"]) - -+# Enable basenames in the logs for source files -+AC_ARG_ENABLE([log-src-basename], -+ [AC_HELP_STRING([--enable-log-src-basename], [Use the shorter source file basename in the logs [default=no]])], -+ [], [enable_log_src_basename=no]) -+ -+if test "x$enable_log_src_basename" = "xyes"; then -+ AC_DEFINE([LXC_LOG_USE_BASENAME], 1, [Enabling shorter src filenames in the logs]) -+fi -+ - # Enable dumping stack traces - AC_ARG_ENABLE([mutex-debugging], - [AC_HELP_STRING([--enable-mutex-debugging], [Makes mutexes to report error and provide stack trace [default=no]])], -diff --git a/src/lxc/log.h b/src/lxc/log.h -index 4654fd9..6885d78 100644 ---- a/src/lxc/log.h -+++ b/src/lxc/log.h -@@ -77,8 +77,13 @@ struct lxc_log_locinfo { - int line; - }; - -+#ifdef LXC_LOG_USE_BASENAME -+#define LXC_LOG_LOCINFO_INIT \ -+ { .file = (strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : __FILE__), .func = __func__, .line = __LINE__ } -+#else - #define LXC_LOG_LOCINFO_INIT \ - { .file = __FILE__, .func = __func__, .line = __LINE__ } -+#endif - - /* brief logging event object */ - struct lxc_log_event { diff --git a/recipes-containers/lxc/files/lxc-1.0.0-disable-udhcp-from-busybox-template.patch b/recipes-containers/lxc/files/lxc-1.0.0-disable-udhcp-from-busybox-template.patch index 85177c8f..ea7bee9b 100644 --- a/recipes-containers/lxc/files/lxc-1.0.0-disable-udhcp-from-busybox-template.patch +++ b/recipes-containers/lxc/files/lxc-1.0.0-disable-udhcp-from-busybox-template.patch @@ -1,17 +1,19 @@ -From 74efbe7f47379375c51948dd0f86248fb9429a1b Mon Sep 17 00:00:00 2001 +From 8227e720438ff0bdfe45d7307de85f660e491d49 Mon Sep 17 00:00:00 2001 From: Bogdan Purcareata <bogdan.purcareata@freescale.com> Date: Mon, 8 Apr 2013 18:30:19 +0300 Subject: [PATCH] lxc-0.9.0-disable-udhcp-from-busybox-template +Upstream-Status: Inappropriate [embedded specific] + --- templates/lxc-busybox.in | 1 - 1 file changed, 1 deletion(-) diff --git a/templates/lxc-busybox.in b/templates/lxc-busybox.in -index 7243b36..9637a71 100644 +index 1a8618b..8ba7cfe 100644 --- a/templates/lxc-busybox.in +++ b/templates/lxc-busybox.in -@@ -111,7 +111,6 @@ EOF +@@ -120,7 +120,6 @@ EOF #!/bin/sh /bin/syslogd /bin/mount -a diff --git a/recipes-containers/lxc/files/lxc-doc-upgrade-to-use-docbook-3.1-DTD.patch b/recipes-containers/lxc/files/lxc-doc-upgrade-to-use-docbook-3.1-DTD.patch deleted file mode 100644 index 085ffe80..00000000 --- a/recipes-containers/lxc/files/lxc-doc-upgrade-to-use-docbook-3.1-DTD.patch +++ /dev/null @@ -1,29 +0,0 @@ -From 5190dce1a675dfcdf88e3b94bd48070ac180bacc Mon Sep 17 00:00:00 2001 -From: Jim Somerville <Jim.Somerville@windriver.com> -Date: Tue, 11 Aug 2015 14:05:00 -0400 -Subject: [PATCH] lxc: doc: upgrade to use docbook 3.1 DTD - -docbook2man fails to build the man pages in poky -due to missing the ancient Davenport 3.0 DTD. -Poky meta has the Oasis 3.1 version so upgrade -to use that instead. - -Signed-off-by: Jim Somerville <Jim.Somerville@windriver.com> - ---- - configure.ac | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/configure.ac b/configure.ac -index 1acc461..74b976a 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -213,7 +213,7 @@ AM_CONDITIONAL([ENABLE_DOCBOOK], [test "x$db2xman" != "x"]) - AM_CONDITIONAL([USE_DOCBOOK2X], [test "x$db2xman" != "xdocbook2man"]) - - if test "x$db2xman" = "xdocbook2man"; then -- docdtd="\"-//Davenport//DTD DocBook V3.0//EN\"" -+ docdtd="\"-//OASIS//DTD DocBook V3.1//EN\"" - else - docdtd="\"-//OASIS//DTD DocBook XML\" \"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd\"" - fi diff --git a/recipes-containers/lxc/files/lxc-fix-B-S.patch b/recipes-containers/lxc/files/lxc-fix-B-S.patch deleted file mode 100644 index 6b09193a..00000000 --- a/recipes-containers/lxc/files/lxc-fix-B-S.patch +++ /dev/null @@ -1,24 +0,0 @@ -From 2fa77a1803939de2d155a14cf680b53140b92f06 Mon Sep 17 00:00:00 2001 -From: Dmitry Eremin-Solenikov <dmitry_eremin@mentor.com> -Date: Thu, 9 Apr 2015 23:01:48 +0300 - ---- - config/init/upstart/Makefile.am | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/config/init/upstart/Makefile.am b/config/init/upstart/Makefile.am -index 5552d32..186ae3d 100644 ---- a/config/init/upstart/Makefile.am -+++ b/config/init/upstart/Makefile.am -@@ -3,9 +3,9 @@ EXTRA_DIST = lxc.conf lxc-instance.conf lxc-net.conf.in - if INIT_SCRIPT_UPSTART - install-upstart: lxc.conf lxc-instance.conf lxc-net.conf - $(MKDIR_P) $(DESTDIR)$(sysconfdir)/init/ -- $(INSTALL_DATA) lxc.conf $(DESTDIR)$(sysconfdir)/init/ -+ $(INSTALL_DATA) $(srcdir)/lxc.conf $(DESTDIR)$(sysconfdir)/init/ - $(INSTALL_DATA) $(srcdir)/lxc-instance.conf $(DESTDIR)$(sysconfdir)/init/ -- $(INSTALL_DATA) lxc-net.conf $(DESTDIR)$(sysconfdir)/init/ -+ $(INSTALL_DATA) $(srcdir)/lxc-net.conf $(DESTDIR)$(sysconfdir)/init/ - - uninstall-upstart: - rm -f $(DESTDIR)$(sysconfdir)/init/lxc.conf diff --git a/recipes-containers/lxc/files/network-restore-ability-to-move-nl80211-devices.patch b/recipes-containers/lxc/files/network-restore-ability-to-move-nl80211-devices.patch deleted file mode 100644 index aa1aecd4..00000000 --- a/recipes-containers/lxc/files/network-restore-ability-to-move-nl80211-devices.patch +++ /dev/null @@ -1,94 +0,0 @@ -From 3dd7829433f63b2ec1323a1f237efa7d67ea6e2b Mon Sep 17 00:00:00 2001 -From: Christian Brauner <christian.brauner@ubuntu.com> -Date: Fri, 26 Jul 2019 08:20:02 +0200 -Subject: [PATCH] network: restore ability to move nl80211 devices - -Closes #3105. -Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com> ---- - src/lxc/network.c | 31 +++++++++++++++++-------------- - 1 file changed, 17 insertions(+), 14 deletions(-) - -diff --git a/src/lxc/network.c b/src/lxc/network.c -index 9755116..7684f95 100644 ---- a/src/lxc/network.c -+++ b/src/lxc/network.c -@@ -1248,22 +1248,21 @@ static int lxc_netdev_rename_by_name_in_netns(pid_t pid, const char *old, - static int lxc_netdev_move_wlan(char *physname, const char *ifname, pid_t pid, - const char *newname) - { -- char *cmd; -+ __do_free char *cmd = NULL; - pid_t fpid; -- int err = -1; - - /* Move phyN into the container. TODO - do this using netlink. - * However, IIUC this involves a bit more complicated work to talk to - * the 80211 module, so for now just call out to iw. - */ - cmd = on_path("iw", NULL); -- if (!cmd) -- goto out1; -- free(cmd); -+ if (!cmd) { -+ return -1; -+ } - - fpid = fork(); - if (fpid < 0) -- goto out1; -+ return -1; - - if (fpid == 0) { - char pidstr[30]; -@@ -1274,21 +1273,18 @@ static int lxc_netdev_move_wlan(char *physname, const char *ifname, pid_t pid, - } - - if (wait_for_pid(fpid)) -- goto out1; -+ return -1; - -- err = 0; - if (newname) -- err = lxc_netdev_rename_by_name_in_netns(pid, ifname, newname); -+ return lxc_netdev_rename_by_name_in_netns(pid, ifname, newname); - --out1: -- free(physname); -- return err; -+ return 0; - } - - int lxc_netdev_move_by_name(const char *ifname, pid_t pid, const char* newname) - { -+ __do_free char *physname = NULL; - int index; -- char *physname; - - if (!ifname) - return -EINVAL; -@@ -3279,13 +3275,20 @@ int lxc_network_move_created_netdev_priv(struct lxc_handler *handler) - return 0; - - lxc_list_for_each(iterator, network) { -+ __do_free char *physname = NULL; - int ret; - struct lxc_netdev *netdev = iterator->elem; - - if (!netdev->ifindex) - continue; - -- ret = lxc_netdev_move_by_index(netdev->ifindex, pid, NULL); -+ if (netdev->type == LXC_NET_PHYS) -+ physname = is_wlan(netdev->link); -+ -+ if (physname) -+ ret = lxc_netdev_move_wlan(physname, netdev->link, pid, NULL); -+ else -+ ret = lxc_netdev_move_by_index(netdev->ifindex, pid, NULL); - if (ret) { - errno = -ret; - SYSERROR("Failed to move network device \"%s\" with ifindex %d to network namespace %d", --- -2.7.4 - diff --git a/recipes-containers/lxc/files/run-ptest b/recipes-containers/lxc/files/run-ptest index 3f3a75f2..196adb04 100644 --- a/recipes-containers/lxc/files/run-ptest +++ b/recipes-containers/lxc/files/run-ptest @@ -9,10 +9,17 @@ dmesg -n 1 blacklist="" # Not applicable blacklist="$blacklist lxc-test-apparmor" +blacklist="$blacklist lxc-test-apparmor-mount" +#lxc-test-get_item would report Built without AppArmor support error +blacklist="$blacklist lxc-test-get_item" # These currently hang so skip them until someone fixes them up blacklist="$blacklist lxc-test-shutdowntest" blacklist="$blacklist lxc-test-state-server" +# Tests in firstrunlist will be run first +firstrunlist="" +firstrunlist="$firstrunlist lxc-test-unpriv" + passed=0 failed=0 skipped=0 @@ -23,11 +30,29 @@ rm -f logs/* echo "### Starting LXC ptest ###" +for test in $firstrunlist +do + ./tests/$test >logs/$(basename $test).log 2>&1 + if [ $? -eq 0 ] + then + echo "PASS: $(basename $test)" + passed=$((passed+1)) + else + echo "FAIL: $(basename $test)" + failed=$((failed+1)) + fi +done + for test in ./tests/* do if [[ ! $blacklist = *$(basename $test)* ]] then - $test >logs/$(basename $test).log 2>&1 + if [[ ! $firstrunlist = *$(basename $test)* ]] + then + $test >logs/$(basename $test).log 2>&1 + else + continue; + fi else echo "SKIPPED: $(basename $test)" skipped=$((skipped+1)) @@ -44,6 +69,7 @@ do fi done + echo "" echo "Results:" echo " PASSED = $passed" diff --git a/recipes-containers/lxc/files/template-make-busybox-template-compatible-with-core-.patch b/recipes-containers/lxc/files/template-make-busybox-template-compatible-with-core-.patch index e4bb72a0..1970fdd2 100644 --- a/recipes-containers/lxc/files/template-make-busybox-template-compatible-with-core-.patch +++ b/recipes-containers/lxc/files/template-make-busybox-template-compatible-with-core-.patch @@ -1,4 +1,4 @@ -From 3a7112a38d2c44b6fa49e0da1dc4765defd88dbb Mon Sep 17 00:00:00 2001 +From 96bf043ec0ed93613036c324174c149655cf52be Mon Sep 17 00:00:00 2001 From: Mark Asselstine <mark.asselstine@windriver.com> Date: Thu, 31 May 2018 11:44:44 -0400 Subject: [PATCH] template: make busybox template compatible with @@ -16,6 +16,8 @@ changes here to at least have the template work with core-image-minimal to be able to demonstrate that it can work as well as to have it available for the ptests. +Upstream-Status: Inappropriate [embedded specific] + Signed-off-by: Mark Asselstine <mark.asselstine@windriver.com> --- @@ -23,10 +25,10 @@ Signed-off-by: Mark Asselstine <mark.asselstine@windriver.com> 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/templates/lxc-busybox.in b/templates/lxc-busybox.in -index 9637a71..45b386f 100644 +index 8ba7cfe..effdb73 100644 --- a/templates/lxc-busybox.in +++ b/templates/lxc-busybox.in -@@ -181,6 +181,19 @@ configure_busybox() +@@ -194,6 +194,19 @@ configure_busybox() return 1 fi @@ -46,7 +48,7 @@ index 9637a71..45b386f 100644 # symlink busybox for the commands it supports # it would be nice to just use "chroot $rootfs busybox --install -s /bin" # but that only works right in a chroot with busybox >= 1.19.0 -@@ -189,9 +202,6 @@ configure_busybox() +@@ -202,9 +215,6 @@ configure_busybox() ./busybox --list | grep -v busybox | xargs -n1 ln -s busybox ) diff --git a/recipes-containers/lxc/files/templates-actually-create-DOWNLOAD_TEMP-directory.patch b/recipes-containers/lxc/files/templates-actually-create-DOWNLOAD_TEMP-directory.patch index 756cddc3..3a2b1f0d 100644 --- a/recipes-containers/lxc/files/templates-actually-create-DOWNLOAD_TEMP-directory.patch +++ b/recipes-containers/lxc/files/templates-actually-create-DOWNLOAD_TEMP-directory.patch @@ -1,4 +1,4 @@ -From 68b0dd97130ffc5776de9219a42188b4a140d446 Mon Sep 17 00:00:00 2001 +From b30643c37d0d64a15d15026ac94e548cae8a88d2 Mon Sep 17 00:00:00 2001 From: Mark Asselstine <mark.asselstine@windriver.com> Date: Thu, 31 May 2018 16:21:45 -0400 Subject: [PATCH] templates: actually create DOWNLOAD_TEMP directory @@ -23,12 +23,12 @@ Signed-off-by: Mark Asselstine <mark.asselstine@windriver.com> 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/lxc-download.in b/templates/lxc-download.in -index 973783b..015a679 100644 +index 4cb2129..923d2a1 100644 --- a/templates/lxc-download.in +++ b/templates/lxc-download.in -@@ -323,7 +323,7 @@ elif [ -n "${DOWNLOAD_TEMP}" ]; then +@@ -329,7 +329,7 @@ elif [ -n "${DOWNLOAD_TEMP}" ]; then mkdir -p "${DOWNLOAD_TEMP}" - DOWNLOAD_TEMP="$(mktemp -p ${DOWNLOAD_TEMP} -d)" + DOWNLOAD_TEMP="$(mktemp -p "${DOWNLOAD_TEMP}" -d)" else - DOWNLOAD_TEMP="${DOWNLOAD_TEMP}$(mktemp -d)" + DOWNLOAD_TEMP="$(mktemp -p ${DOWNLOAD_TEMP} -d)" diff --git a/recipes-containers/lxc/files/templates-use-curl-instead-of-wget.patch b/recipes-containers/lxc/files/templates-use-curl-instead-of-wget.patch index 4b185bf0..76704bb3 100644 --- a/recipes-containers/lxc/files/templates-use-curl-instead-of-wget.patch +++ b/recipes-containers/lxc/files/templates-use-curl-instead-of-wget.patch @@ -1,21 +1,24 @@ -From dd7b0a2e4542c352456747a45d7eeb11e9fdec26 Mon Sep 17 00:00:00 2001 -From: Joakim Roubert <joakimr@axis.com> -Date: Fri, 16 Aug 2019 07:52:48 +0200 -Subject: [PATCH] Use curl instead of wget +From 3e4cb0b738649f7750413cefbcfdb2115213ad0d Mon Sep 17 00:00:00 2001 +From: Bruce Ashfield <bruce.ashfield@gmail.com> +Date: Sun, 14 Aug 2022 14:08:56 -0400 +Subject: [PATCH] download: Use curl instead of wget When curl's MIT license is preferable to wget's GPLv3. -Change-Id: I4684ae7569704514fdcc63e0655c556efcaf44f8 +Upstream-Status: Inappropriate [embedded specific] + Signed-off-by: Joakim Roubert <joakimr@axis.com> +Signed-off-by: Yanfei Xu <yanfei.xu@windriver.com> +Signed-off-by: Bruce Ashfield <bruce.ashfield@gmail.com> --- - templates/lxc-download.in | 10 +++++----- - 1 file changed, 5 insertions(+), 5 deletions(-) + templates/lxc-download.in | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) -diff --git a/templates/lxc-download.in b/templates/lxc-download.in -index b70daaf..9526eae 100644 ---- a/templates/lxc-download.in -+++ b/templates/lxc-download.in -@@ -74,9 +74,9 @@ cleanup() { +Index: git/templates/lxc-download.in +=================================================================== +--- git.orig/templates/lxc-download.in ++++ git/templates/lxc-download.in +@@ -45,9 +45,9 @@ fi } @@ -27,18 +30,16 @@ index b70daaf..9526eae 100644 return 0 fi done -@@ -85,8 +85,8 @@ wget_wrapper() { - } - - download_file() { -- if ! wget_wrapper -T 30 -q "https://${DOWNLOAD_SERVER}/$1" -O "$2" >/dev/null 2>&1; then -- if ! wget_wrapper -T 30 -q "http://${DOWNLOAD_SERVER}/$1" -O "$2" >/dev/null 2>&1; then -+ if ! curl_wrapper -m 30 -s "https://${DOWNLOAD_SERVER}/$1" -o "$2" >/dev/null 2>&1; then -+ if ! curl_wrapper -m 30 -s "http://${DOWNLOAD_SERVER}/$1" -o "$2" >/dev/null 2>&1; then - if [ "$3" = "noexit" ]; then - return 1 - else -@@ -266,7 +266,7 @@ while :; do +@@ -59,7 +59,7 @@ + if [ "${DOWNLOAD_VERBOSE}" = "true" ]; then + echo "Download file: https://${DOWNLOAD_SERVER}$1" + fi +- if ! wget_wrapper --user-agent="lxc/@PACKAGE_VERSION@ compat:${DOWNLOAD_COMPAT_LEVEL}" -T 30 -q "https://${DOWNLOAD_SERVER}/$1" -O "$2" >/dev/null 2>&1; then ++ if ! curl_wrapper -L --user-agent "lxc/@PACKAGE_VERSION@ compat:${DOWNLOAD_COMPAT_LEVEL}" -m 30 -s "https://${DOWNLOAD_SERVER}/$1" -o "$2" >/dev/null 2>&1; then + if [ "$3" = "noexit" ]; then + return 1 + else +@@ -167,7 +167,7 @@ done # Check for required binaries diff --git a/recipes-containers/lxc/files/tests-add-no-validate-when-using-download-template.patch b/recipes-containers/lxc/files/tests-add-no-validate-when-using-download-template.patch deleted file mode 100644 index abddef6e..00000000 --- a/recipes-containers/lxc/files/tests-add-no-validate-when-using-download-template.patch +++ /dev/null @@ -1,85 +0,0 @@ -From 1b334bdaf598600314a678509a702728721001a2 Mon Sep 17 00:00:00 2001 -From: Mark Asselstine <mark.asselstine@windriver.com> -Date: Thu, 31 May 2018 15:14:26 -0400 -Subject: [PATCH] tests: add '--no-validate' when using download template - -We are usually running the ptests with core-image-minimal which has no -mechanism to validate the downloads. Validation isn't really of -interest to this test at any rate so simply add '--no-validate' to -avoid failing due to no GPG validation. - -Signed-off-by: Mark Asselstine <mark.asselstine@windriver.com> - ---- - src/tests/lxc-test-apparmor-mount | 2 +- - src/tests/lxc-test-autostart | 2 +- - src/tests/lxc-test-no-new-privs | 2 +- - src/tests/lxc-test-unpriv | 2 +- - src/tests/lxc-test-usernic.in | 2 +- - 5 files changed, 5 insertions(+), 5 deletions(-) - -diff --git a/src/tests/lxc-test-apparmor-mount b/src/tests/lxc-test-apparmor-mount -index 56d598f..573cff8 100755 ---- a/src/tests/lxc-test-apparmor-mount -+++ b/src/tests/lxc-test-apparmor-mount -@@ -169,7 +169,7 @@ if [ -f /etc/lsb-release ]; then - done - fi - --run_cmd lxc-create -t download -n $cname -- -d ubuntu -r $release -a $ARCH -+run_cmd lxc-create -t download -n $cname -- --no-validate -d ubuntu -r $release -a $ARCH - - echo "test default confined container" - run_cmd lxc-start -n $cname -d -lDEBUG -o "$logfile" -diff --git a/src/tests/lxc-test-autostart b/src/tests/lxc-test-autostart -index e5b651b..d15b79b 100755 ---- a/src/tests/lxc-test-autostart -+++ b/src/tests/lxc-test-autostart -@@ -55,7 +55,7 @@ if [ -f /etc/lsb-release ]; then - done - fi - --lxc-create -t download -n $CONTAINER_NAME -B dir -- -d ubuntu -r $release -a $ARCH -+lxc-create -t download -n $CONTAINER_NAME -B dir -- --no-validate -d ubuntu -r $release -a $ARCH - CONTAINER_PATH=$(dirname $(lxc-info -n $CONTAINER_NAME -c lxc.rootfs.path -H) | sed -e 's/dir://') - cp $CONTAINER_PATH/config $CONTAINER_PATH/config.bak - -diff --git a/src/tests/lxc-test-no-new-privs b/src/tests/lxc-test-no-new-privs -index 8642992..e72bdf0 100755 ---- a/src/tests/lxc-test-no-new-privs -+++ b/src/tests/lxc-test-no-new-privs -@@ -47,7 +47,7 @@ if type dpkg >/dev/null 2>&1; then - ARCH=$(dpkg --print-architecture) - fi - --lxc-create -t download -n c1 -- -d ubuntu -r xenial -a $ARCH -+lxc-create -t download -n c1 -- --no-validate -d ubuntu -r xenial -a $ARCH - echo "lxc.no_new_privs = 1" >> /var/lib/lxc/c1/config - - lxc-start -n c1 -diff --git a/src/tests/lxc-test-unpriv b/src/tests/lxc-test-unpriv -index 16ff12d..0958d48 100755 ---- a/src/tests/lxc-test-unpriv -+++ b/src/tests/lxc-test-unpriv -@@ -173,7 +173,7 @@ run_cmd mkdir -p $HDIR/.cache/lxc - cp -R /var/cache/lxc/download $HDIR/.cache/lxc && \ - chown -R $TUSER: $HDIR/.cache/lxc - --run_cmd lxc-create -t download -n c1 -- -d ubuntu -r $release -a $ARCH -+run_cmd lxc-create -t download -n c1 -- --no-validate -d ubuntu -r $release -a $ARCH - - # Make sure we can start it - twice - -diff --git a/src/tests/lxc-test-usernic.in b/src/tests/lxc-test-usernic.in -index 3e35008..f489286 100755 ---- a/src/tests/lxc-test-usernic.in -+++ b/src/tests/lxc-test-usernic.in -@@ -146,7 +146,7 @@ if [ -f /etc/lsb-release ]; then - fi - - # Create three containers --run_cmd "lxc-create -t download -n b1 -- -d ubuntu -r $release -a $ARCH" -+run_cmd "lxc-create -t download -n b1 -- --no-validate -d ubuntu -r $release -a $ARCH" - run_cmd "lxc-start -n b1 -d" - p1=$(run_cmd "lxc-info -n b1 -p -H") - diff --git a/recipes-containers/lxc/files/tests-our-init-is-not-busybox.patch b/recipes-containers/lxc/files/tests-our-init-is-not-busybox.patch index e6c71d3d..3a4855c8 100644 --- a/recipes-containers/lxc/files/tests-our-init-is-not-busybox.patch +++ b/recipes-containers/lxc/files/tests-our-init-is-not-busybox.patch @@ -1,4 +1,4 @@ -From 51d88d9741c30ff4a798698514cac831ae61680b Mon Sep 17 00:00:00 2001 +From 06b2a3054b9526c89d5abc314c7d7cda35ddb6a5 Mon Sep 17 00:00:00 2001 From: Mark Asselstine <mark.asselstine@windriver.com> Date: Thu, 31 May 2018 15:00:34 -0400 Subject: [PATCH] tests: our init is not busybox @@ -8,6 +8,8 @@ template) we can't compare '/sbin/init' and 'busybox'. Actually we are really only interested in the fact 'cmp' is being run and not the result, so simplify by comparing '/sbin/init' to itself. +Upstream-Status: Inappropriate [embedded specific] + Signed-off-by: Mark Asselstine <mark.asselstine@windriver.com> --- diff --git a/recipes-containers/lxc/lxc_3.2.1.bb b/recipes-containers/lxc/lxc_3.2.1.bb deleted file mode 100644 index b8525156..00000000 --- a/recipes-containers/lxc/lxc_3.2.1.bb +++ /dev/null @@ -1,198 +0,0 @@ -DESCRIPTION = "lxc aims to use these new functionnalities to provide an userspace container object" -SECTION = "console/utils" -LICENSE = "LGPLv2.1" -LIC_FILES_CHKSUM = "file://COPYING;md5=4fbd65380cdd255951079008b364516c" -DEPENDS = "libxml2 libcap" -RDEPENDS_${PN} = " \ - rsync \ - curl \ - gzip \ - xz \ - tar \ - libcap-bin \ - bridge-utils \ - dnsmasq \ - perl-module-strict \ - perl-module-getopt-long \ - perl-module-vars \ - perl-module-exporter \ - perl-module-constant \ - perl-module-overload \ - perl-module-exporter-heavy \ - gmp \ - libidn \ - gnutls \ - nettle \ - util-linux-mountpoint \ - util-linux-getopt \ -" - -RDEPENDS_${PN}_append_libc-glibc = " glibc-utils" - -RDEPENDS_${PN}-ptest += "file make gmp nettle gnutls bash libgcc" - -RDEPENDS_${PN}-networking += "iptables" - -SRC_URI = "http://linuxcontainers.org/downloads/${BPN}-${PV}.tar.gz \ - file://lxc-1.0.0-disable-udhcp-from-busybox-template.patch \ - file://run-ptest \ - file://lxc-fix-B-S.patch \ - file://lxc-doc-upgrade-to-use-docbook-3.1-DTD.patch \ - file://logs-optionally-use-base-filenames-to-report-src-fil.patch \ - file://templates-actually-create-DOWNLOAD_TEMP-directory.patch \ - file://template-make-busybox-template-compatible-with-core-.patch \ - file://templates-use-curl-instead-of-wget.patch \ - file://tests-our-init-is-not-busybox.patch \ - file://tests-add-no-validate-when-using-download-template.patch \ - file://network-restore-ability-to-move-nl80211-devices.patch \ - file://dnsmasq.conf \ - file://lxc-net \ - " - -SRC_URI[md5sum] = "4886c8d1c8e221fe526eefcb47857b85" -SRC_URI[sha256sum] = "5f903986a4b17d607eea28c0aa56bf1e76e8707747b1aa07d31680338b1cc3d4" - -S = "${WORKDIR}/${BPN}-${PV}" - -# Let's not configure for the host distro. -# -PTEST_CONF = "${@bb.utils.contains('DISTRO_FEATURES', 'ptest', '--enable-tests', '', d)}" -EXTRA_OECONF += "--with-distro=${DISTRO} ${PTEST_CONF}" - -EXTRA_OECONF += "--with-init-script=\ -${@bb.utils.contains('DISTRO_FEATURES', 'sysvinit', 'sysvinit,', '', d)}\ -${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'systemd', '', d)}" - -EXTRA_OECONF += "--enable-log-src-basename" - -CFLAGS_append = " -Wno-error=deprecated-declarations" - -PACKAGECONFIG ??= "templates \ - ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'systemd', '', d)} \ - ${@bb.utils.contains('DISTRO_FEATURES', 'selinux', 'selinux', '', d)} \ -" -PACKAGECONFIG[doc] = "--enable-doc --enable-api-docs,--disable-doc --disable-api-docs,," -PACKAGECONFIG[rpath] = "--enable-rpath,--disable-rpath,," -PACKAGECONFIG[apparmor] = "--enable-apparmor,--disable-apparmor,apparmor,apparmor" -PACKAGECONFIG[templates] = ",,, ${PN}-templates" -PACKAGECONFIG[selinux] = "--enable-selinux,--disable-selinux,libselinux,libselinux" -PACKAGECONFIG[seccomp] ="--enable-seccomp,--disable-seccomp,libseccomp,libseccomp" -PACKAGECONFIG[systemd] = "--with-systemdsystemunitdir=${systemd_unitdir}/system/,--without-systemdsystemunitdir,systemd," - -# required by python3 to run setup.py -export BUILD_SYS -export HOST_SYS -export STAGING_INCDIR -export STAGING_LIBDIR - -inherit autotools pkgconfig ptest update-rc.d systemd python3native - -SYSTEMD_PACKAGES = "${PN} ${PN}-networking" -SYSTEMD_SERVICE_${PN} = "lxc.service" -SYSTEMD_AUTO_ENABLE_${PN} = "disable" -SYSTEMD_SERVICE_${PN}-networking = "lxc-net.service" -SYSTEMD_AUTO_ENABLE_${PN}-networking = "enable" - -INITSCRIPT_PACKAGES = "${PN} ${PN}-networking" -INITSCRIPT_NAME_${PN} = "lxc-containers" -INITSCRIPT_PARAMS_${PN} = "defaults" -INITSCRIPT_NAME_${PN}-networking = "lxc-net" -INITSCRIPT_PARAMS_${PN}-networking = "defaults" - -FILES_${PN}-doc = "${mandir} ${infodir}" -# For LXC the docdir only contains example configuration files and should be included in the lxc package -FILES_${PN} += "${docdir}" -FILES_${PN} += "${libdir}/python3*" -FILES_${PN} += "${datadir}/bash-completion" -FILES_${PN}-dbg += "${libexecdir}/lxc/.debug" -FILES_${PN}-dbg += "${libexecdir}/lxc/hooks/.debug" -PACKAGES =+ "${PN}-templates ${PN}-networking ${PN}-lua" -FILES_lua-${PN} = "${datadir}/lua ${libdir}/lua" -FILES_lua-${PN}-dbg += "${libdir}/lua/lxc/.debug" -FILES_${PN}-templates += "${datadir}/lxc/templates" -RDEPENDS_${PN}-templates += "bash" - -FILES_${PN}-networking += " \ - ${sysconfdir}/init.d/lxc-net \ - ${sysconfdir}/default/lxc-net \ -" - -CACHED_CONFIGUREVARS += " \ - ac_cv_path_PYTHON='${STAGING_BINDIR_NATIVE}/python3-native/python3' \ - am_cv_python_pyexecdir='${exec_prefix}/${libdir}/python3.5/site-packages' \ - am_cv_python_pythondir='${prefix}/${libdir}/python3.5/site-packages' \ -" - -do_install_append() { - # The /var/cache/lxc directory created by the Makefile - # is wiped out in volatile, we need to create this at boot. - rm -rf ${D}${localstatedir}/cache - install -d ${D}${sysconfdir}/default/volatiles - echo "d root root 0755 ${localstatedir}/cache/lxc none" \ - > ${D}${sysconfdir}/default/volatiles/99_lxc - - for i in `grep -l "#! */bin/bash" ${D}${datadir}/lxc/hooks/*`; do \ - sed -e 's|#! */bin/bash|#!/bin/sh|' -i $i; done - - install -d ${D}${sysconfdir}/init.d - install -m 755 config/init/sysvinit/lxc* ${D}${sysconfdir}/init.d - - # since python3-native is used for install location this will not be - # suitable for the target and we will have to correct the package install - if ${@bb.utils.contains('PACKAGECONFIG', 'python', 'true', 'false', d)}; then - if [ -d ${D}${exec_prefix}/lib/python* ]; then mv ${D}${exec_prefix}/lib/python* ${D}${libdir}/; fi - rmdir --ignore-fail-on-non-empty ${D}${exec_prefix}/lib - fi - - # /etc/default/lxc sources lxc-net, this allows lxc bridge when lxc-networking - # is not installed this results in no lxcbr0, but when lxc-networking is installed - # lxcbr0 will be fully configured. - install -m 644 ${WORKDIR}/lxc-net ${D}${sysconfdir}/default/ - - # Force the main dnsmasq instance to bind only to specified interfaces and - # to not bind to virbr0. Libvirt will run its own instance on this interface. - install -d ${D}/${sysconfdir}/dnsmasq.d - install -m 644 ${WORKDIR}/dnsmasq.conf ${D}/${sysconfdir}/dnsmasq.d/lxc -} - -EXTRA_OEMAKE += "TEST_DIR=${D}${PTEST_PATH}/src/tests" - -do_install_ptest() { - # Move tests to the "ptest directory" - install -d ${D}/${PTEST_PATH}/tests - mv ${D}/usr/bin/lxc-test-* ${D}/${PTEST_PATH}/tests/. -} - -pkg_postinst_${PN}() { - if [ -z "$D" ] && [ -e /etc/init.d/populate-volatile.sh ] ; then - /etc/init.d/populate-volatile.sh update - fi -} - -pkg_postinst_ontarget_${PN}-networking() { -if ${@bb.utils.contains('DISTRO_FEATURES', 'sysvinit', 'true', 'false', d)}; then -cat >> /etc/network/interfaces << EOF - -auto lxcbr0 -iface lxcbr0 inet dhcp - bridge_ports eth0 - bridge_fd 0 - bridge_maxwait 0 -EOF - -cat<<EOF>/etc/network/if-pre-up.d/lxcbr0 -#! /bin/sh - -if test "x\$IFACE" = xlxcbr0 ; then - brctl show |grep lxcbr0 > /dev/null 2>/dev/null - if [ \$? != 0 ] ; then - brctl addbr lxcbr0 - brctl addif lxcbr0 eth0 - ip addr flush eth0 - ifconfig eth0 up - fi -fi -EOF -chmod 755 /etc/network/if-pre-up.d/lxcbr0 -fi -} diff --git a/recipes-containers/lxc/lxc_git.bb b/recipes-containers/lxc/lxc_git.bb new file mode 100644 index 00000000..09d5a05e --- /dev/null +++ b/recipes-containers/lxc/lxc_git.bb @@ -0,0 +1,210 @@ +DESCRIPTION = "lxc aims to use these new functionnalities to provide an userspace container object" +SECTION = "console/utils" +LICENSE = "LGPL-2.1-only & GPL-2.0-only" +LIC_FILES_CHKSUM = "file://LICENSE.LGPL2.1;md5=4fbd65380cdd255951079008b364516c \ + file://LICENSE.GPL2;md5=751419260aa954499f7abaabaa882bbe \ +" + +DEPENDS = "libxml2 libcap dbus" +RDEPENDS:${PN} = " \ + rsync \ + curl \ + gzip \ + xz \ + tar \ + libcap-bin \ + bridge-utils \ + dnsmasq \ + perl-module-strict \ + perl-module-getopt-long \ + perl-module-vars \ + perl-module-exporter \ + perl-module-constant \ + perl-module-overload \ + perl-module-exporter-heavy \ + gmp \ + libidn \ + gnutls \ + nettle \ + util-linux-mountpoint \ + util-linux-getopt \ +" + +RDEPENDS:${PN}:append:libc-glibc = " glibc-utils" + +RDEPENDS:${PN}-ptest += "file make gmp nettle gnutls bash libgcc" + +RDEPENDS:${PN}-networking += "iptables" + +SRC_URI = "git://github.com/lxc/lxc.git;branch=stable-6.0;protocol=https \ + file://lxc-1.0.0-disable-udhcp-from-busybox-template.patch \ + file://run-ptest \ + file://templates-actually-create-DOWNLOAD_TEMP-directory.patch \ + file://template-make-busybox-template-compatible-with-core-.patch \ + file://templates-use-curl-instead-of-wget.patch \ + file://0001-download-don-t-try-compatbility-index.patch \ + file://tests-our-init-is-not-busybox.patch \ + file://0001-template-if-busybox-contains-init-use-it-in-containe.patch \ + file://dnsmasq.conf \ + file://lxc-net \ + " + +SRCREV = "3dee5fb88c6f77496dbcab46f31bcd891c9ee4e0" +PV = "6.0.0+git" + +S = "${WORKDIR}/git" + +# Let's not configure for the host distro. +# +PTEST_CONF = "${@bb.utils.contains('DISTRO_FEATURES', 'ptest', '-Dtests=true', '', d)}" + +# No meson equivalent for --with-distro +# EXTRA_OECONF += "--with-distro=${DISTRO} ${PTEST_CONF}" +EXTRA_OEMESON += "${PTEST_CONF} -Ddistrosysconfdir=${sysconfdir}/default" +# No meson equivalent for these yet +# EXTRA_OECONF += "--enable-log-src-basename --disable-werror" + +PACKAGECONFIG ??= "templates \ + ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'systemd', '', d)} \ + ${@bb.utils.contains('DISTRO_FEATURES', 'selinux', 'selinux', '', d)} \ + ${@bb.utils.contains('DISTRO_FEATURES', 'seccomp', 'seccomp', '', d)} \ +" + +# Meson doesn't seem to be as fine grained as the autotools releases +# PACKAGECONFIG[doc] = "--enable-doc --enable-api-docs,--disable-doc --disable-api-docs,," +PACKAGECONFIG[doc] = "-Dman=true,-Dman=false,," +# No meson equiv found for rpath yet +# PACKAGECONFIG[rpath] = "--enable-rpath,--disable-rpath,," +PACKAGECONFIG[apparmor] = "-Dapparmor=true,-Dapparmor=false,apparmor,apparmor" +PACKAGECONFIG[templates] = ",,, ${PN}-templates" +PACKAGECONFIG[selinux] = "-Dselinux=true,-Dselinux=false,libselinux,libselinux" +PACKAGECONFIG[seccomp] ="-Dseccomp=true,-Dseccomp=false,libseccomp,libseccomp" +# meson equiv for the unitdir found yet +# PACKAGECONFIG[systemd] = "--with-systemdsystemunitdir=${systemd_unitdir}/system/,--without-systemdsystemunitdir,systemd," +PACKAGECONFIG[systemd] = "-Dinit-script=systemd,-Dinit-script=sysvinit,systemd," + +# required by python3 to run setup.py +export BUILD_SYS +export HOST_SYS +export STAGING_INCDIR +export STAGING_LIBDIR + +inherit meson pkgconfig ptest update-rc.d systemd python3native + +SYSTEMD_PACKAGES = "${PN} ${PN}-networking" +SYSTEMD_SERVICE:${PN} = "lxc.service lxc-monitord.service" +SYSTEMD_AUTO_ENABLE:${PN} = "disable" +SYSTEMD_SERVICE:${PN}-networking = "lxc-net.service" +SYSTEMD_AUTO_ENABLE:${PN}-networking = "enable" + +INITSCRIPT_PACKAGES = "${@bb.utils.contains('DISTRO_FEATURES', 'systemd', '', '${PN}', d)} ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', '', '${PN}-networking',d)}" +INITSCRIPT_NAME:${PN} = "${@bb.utils.contains('DISTRO_FEATURES', 'systemd', '', 'lxc-containers', d)}" +INITSCRIPT_PARAMS:${PN} = "defaults" +INITSCRIPT_NAME:${PN}-networking = "${@bb.utils.contains('DISTRO_FEATURES', 'systemd', '', 'lxc-net', d)}" +INITSCRIPT_PARAMS:${PN}-networking = "defaults" + +FILES:${PN}-doc = "${mandir} ${infodir}" +# For LXC the docdir only contains example configuration files and should be included in the lxc package +FILES:${PN} += "${docdir}" +FILES:${PN} += "${libdir}/python3*" +FILES:${PN} += "${datadir}/bash-completion" +FILES:${PN}-dbg += "${libexecdir}/lxc/.debug" +FILES:${PN}-dbg += "${libexecdir}/lxc/hooks/.debug" +PACKAGES =+ "${PN}-templates ${PN}-networking ${PN}-lua" +FILES:lua-${PN} = "${datadir}/lua ${libdir}/lua" +FILES:lua-${PN}-dbg += "${libdir}/lua/lxc/.debug" +FILES:${PN}-templates += "${datadir}/lxc/templates" +RDEPENDS:${PN}-templates += "bash" + +FILES:${PN}-networking += " \ + ${sysconfdir}/init.d/lxc-net \ + ${sysconfdir}/default/lxc-net \ +" + +# Not needed for meson +# CACHED_CONFIGUREVARS += " \ +# ac_cv_path_PYTHON='${STAGING_BINDIR_NATIVE}/python3-native/python3' \ +# am_cv_python_pyexecdir='${PYTHON_SITEPACKAGES_DIR}' \ +# am_cv_python_pythondir='${PYTHON_SITEPACKAGES_DIR}' \ +#" + +do_install:append() { + # The /var/cache/lxc directory created by the Makefile + # is wiped out in volatile, we need to create this at boot. + rm -rf ${D}${localstatedir}/cache + install -d ${D}${sysconfdir}/default/volatiles + echo "d root root 0755 ${localstatedir}/cache/lxc none" \ + > ${D}${sysconfdir}/default/volatiles/99_lxc + + for i in `grep -l "#! */bin/bash" ${D}${datadir}/lxc/hooks/*`; do \ + sed -e 's|#! */bin/bash|#!/bin/sh|' -i $i; done + + if "${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}"; then + # nothing special for systemd at the moment + true + else + # with meson, these aren't built unless sysvinit is the enabled + # init system. + install -d ${D}${sysconfdir}/init.d + install -m 755 config/init/sysvinit/lxc* ${D}${sysconfdir}/init.d + fi + + # since python3-native is used for install location this will not be + # suitable for the target and we will have to correct the package install + if ${@bb.utils.contains('PACKAGECONFIG', 'python', 'true', 'false', d)}; then + if [ -d ${D}${exec_prefix}/lib/python* ]; then mv ${D}${exec_prefix}/lib/python* ${D}${libdir}/; fi + rmdir --ignore-fail-on-non-empty ${D}${exec_prefix}/lib + fi + + # /etc/default/lxc sources lxc-net, this allows lxc bridge when lxc-networking + # is not installed this results in no lxcbr0, but when lxc-networking is installed + # lxcbr0 will be fully configured. + install -m 644 ${UNPACKDIR}/lxc-net ${D}${sysconfdir}/default/ + + # Force the main dnsmasq instance to bind only to specified interfaces and + # to not bind to virbr0. Libvirt will run its own instance on this interface. + install -d ${D}/${sysconfdir}/dnsmasq.d + install -m 644 ${UNPACKDIR}/dnsmasq.conf ${D}/${sysconfdir}/dnsmasq.d/lxc +} + +EXTRA_OEMAKE += "TEST_DIR=${D}${PTEST_PATH}/src/tests" + +do_install_ptest() { + # Move tests to the "ptest directory" + install -d ${D}/${PTEST_PATH}/tests + mv ${D}/usr/bin/lxc-test-* ${D}/${PTEST_PATH}/tests/. +} + +pkg_postinst:${PN}() { + if [ -z "$D" ] && [ -e /etc/init.d/populate-volatile.sh ] ; then + /etc/init.d/populate-volatile.sh update + fi +} + +pkg_postinst:${PN}-networking() { +if ${@bb.utils.contains('DISTRO_FEATURES', 'sysvinit', 'true', 'false', d)}; then +cat >> $D/etc/network/interfaces << EOF + +auto lxcbr0 +iface lxcbr0 inet dhcp + bridge_ports eth0 + bridge_fd 0 + bridge_maxwait 0 +EOF + +cat<<EOF>$D/etc/network/if-pre-up.d/lxcbr0 +#! /bin/sh + +if test "x\$IFACE" = xlxcbr0 ; then + brctl show |grep lxcbr0 > /dev/null 2>/dev/null + if [ \$? != 0 ] ; then + brctl addbr lxcbr0 + brctl addif lxcbr0 eth0 + ip addr flush eth0 + ifconfig eth0 up + fi +fi +EOF +chmod 755 $D/etc/network/if-pre-up.d/lxcbr0 +fi +} |