Skip to content
Snippets Groups Projects
0002-lxc-Use-our-servers-by-default.patch 3.03 KiB
From cc6343a717e7601cbf931354548438d16f2c298f Mon Sep 17 00:00:00 2001
From: Michal Hrusecky <Michal@Hrusecky.net>
Date: Wed, 30 Jan 2019 00:13:20 +0100
Subject: [PATCH] lxc: Use our servers by default

Signed-off-by: Michal Hrusecky <Michal@Hrusecky.net>
---
 utils/lxc/Makefile                         |  1 +
 utils/lxc/files/systemd-workaround         |  4 +++
 utils/lxc/patches/030-turris-servers.patch | 44 ++++++++++++++++++++++
 3 files changed, 49 insertions(+)
 create mode 100644 utils/lxc/files/systemd-workaround
 create mode 100644 utils/lxc/patches/030-turris-servers.patch

diff --git a/utils/lxc/Makefile b/utils/lxc/Makefile
index 89a760e98..fb6edf706 100644
--- a/utils/lxc/Makefile
+++ b/utils/lxc/Makefile
@@ -216,6 +216,7 @@ define Package/lxc-hooks/install
 	$(CP) \
 		$(PKG_INSTALL_DIR)/usr/share/lxc/hooks/* \
 		$(1)/usr/share/lxc/hooks/
+	$(INSTALL_BIN) ./files/systemd-workaround $(1)/usr/share/lxc/hooks/
 endef
 
 define Package/lxc-templates/install
diff --git a/utils/lxc/files/systemd-workaround b/utils/lxc/files/systemd-workaround
new file mode 100644
index 000000000..2e343dc68
--- /dev/null
+++ b/utils/lxc/files/systemd-workaround
@@ -0,0 +1,4 @@
+#!/bin/sh
+[ -d /sys/fs/cgroup/systemd ] || {
+mkdir /sys/fs/cgroup/systemd && mount -t cgroup -o none,name=systemd systemd /sys/fs/cgroup/systemd/
+}
diff --git a/utils/lxc/patches/030-turris-servers.patch b/utils/lxc/patches/030-turris-servers.patch
new file mode 100644
index 000000000..4fd5c0956
--- /dev/null
+++ b/utils/lxc/patches/030-turris-servers.patch
@@ -0,0 +1,46 @@
+--- a/config/etc/default.conf.unknown
++++ b/config/etc/default.conf.unknown
+@@ -1 +1,9 @@
+-lxc.net.0.type = empty
++lxc.net.0.type = veth
++lxc.net.0.link = br-lan
++lxc.net.0.flags = up
++lxc.net.0.name = eth0
++# # Some workarounds
++lxc.include = /usr/share/lxc/config/common.conf
++lxc.hook.start-host = /usr/share/lxc/hooks/systemd-workaround
++# Template to generate fixed MAC address
++lxc.net.0.hwaddr = x2:xx:xx:xx:xx:xx
+--- a/config/etc/default.conf.lxcbr
++++ b/config/etc/default.conf.lxcbr
+@@ -1,4 +1,9 @@
+ lxc.net.0.type = veth
+-lxc.net.0.link = lxcbr0
++lxc.net.0.link = br-lan
+ lxc.net.0.flags = up
+-lxc.net.0.hwaddr = 00:16:3e:xx:xx:xx
++lxc.net.0.name = eth0
++# # Some workarounds
++lxc.include = /usr/share/lxc/config/common.conf
++lxc.hook.start-host = /usr/share/lxc/hooks/systemd-workaround
++# Template to generate fixed MAC address
++lxc.net.0.hwaddr = x2:xx:xx:xx:xx:xx
+--- a/templates/lxc-download.in
++++ b/templates/lxc-download.in
+@@ -30,13 +30,13 @@ DOWNLOAD_ARCH=
+ DOWNLOAD_BUILD=
+ DOWNLOAD_COMPAT_LEVEL=7
+ DOWNLOAD_DIST=
+-DOWNLOAD_FLUSH_CACHE="false"
++DOWNLOAD_FLUSH_CACHE="true"
+ DOWNLOAD_FORCE_CACHE="false"
+ DOWNLOAD_INTERACTIVE="false"
+ DOWNLOAD_LIST_IMAGES="false"
+ DOWNLOAD_MODE="system"
+ DOWNLOAD_RELEASE=
+-DOWNLOAD_SERVER="images.linuxcontainers.org"
++DOWNLOAD_SERVER="$(uci get lxc.lxc.url 2> /dev/null || echo repo.turris.cz/lxc)"
+ DOWNLOAD_TARGET="system"
+ DOWNLOAD_URL=
+ DOWNLOAD_USE_CACHE="false"                                                        
+
-- 
2.40.1