[lxc-devel] [lxd/master] lxd/vm: Add install script in 9p

stgraber on Github lxc-bot at linuxcontainers.org
Thu Nov 14 16:12:19 UTC 2019


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 354 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20191114/881e4dab/attachment-0001.bin>
-------------- next part --------------
From b2d7c4855d9dbc6cb712ded7cadebd926859fbc2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgraber at ubuntu.com>
Date: Thu, 14 Nov 2019 08:02:27 -0800
Subject: [PATCH] lxd/vm: Add install script in 9p
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Signed-off-by: Stéphane Graber <stgraber at ubuntu.com>
---
 lxd/vm_qemu.go | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)

diff --git a/lxd/vm_qemu.go b/lxd/vm_qemu.go
index 8fa3b683b3..bc146d5312 100644
--- a/lxd/vm_qemu.go
+++ b/lxd/vm_qemu.go
@@ -764,6 +764,34 @@ WantedBy=multi-user.target
 		return err
 	}
 
+	// Install script for manual installs.
+	lxdConfigShareInstall := `#!/bin/sh
+set -eux
+if [ ! -e "systemd" ] || [ ! -e "lxd-agent" ]; then
+    echo "This script must be run from within the 9p mount"
+    exit 1
+fi
+
+if [ ! -e "/lib/systemd/system" ]; then
+    echo "This script only works on systemd systems"
+    exit 1
+fi
+
+cp systemd/lxd-agent.service /lib/systemd/system/
+cp systemd/run-lxd_config.mount /lib/systemd/system/
+systemctl daemon-reload
+systemctl enable run-lxd_config.mount lxd-agent.service
+
+mkdir -p /run/lxd_config
+mount -o bind . /run/lxd_config
+systemctl start run-lxd_config.mount lxd-agent.service
+`
+
+	err = ioutil.WriteFile(filepath.Join(configDrivePath, "install.sh"), []byte(lxdConfigShareInstall), 0700)
+	if err != nil {
+		return err
+	}
+
 	return nil
 }
 


More information about the lxc-devel mailing list