[lxc-devel] [distrobuilder/master] generators/lxd-agent: Add symlink workaround for openSUSE

monstermunchkin on Github lxc-bot at linuxcontainers.org
Tue Jun 23 14:45:34 UTC 2020


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 310 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20200623/c76c5d87/attachment.bin>
-------------- next part --------------
From 874c7c61fcd7b68251c377b714e839bf34415185 Mon Sep 17 00:00:00 2001
From: Thomas Hipp <thomas.hipp at canonical.com>
Date: Tue, 23 Jun 2020 16:45:10 +0200
Subject: [PATCH] generators/lxd-agent: Add symlink workaround for openSUSE

Signed-off-by: Thomas Hipp <thomas.hipp at canonical.com>
---
 generators/lxd-agent.go | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/generators/lxd-agent.go b/generators/lxd-agent.go
index 251ff05..1b95aa8 100644
--- a/generators/lxd-agent.go
+++ b/generators/lxd-agent.go
@@ -129,7 +129,13 @@ WantedBy=multi-user.target
 	}
 
 	udevPath := filepath.Join("/", "lib", "udev", "rules.d")
-	if !lxd.PathExists(filepath.Dir(filepath.Join(sourceDir, udevPath))) {
+
+	stat, err := os.Lstat(filepath.Join(sourceDir, "lib", "udev"))
+	if err != nil {
+		return err
+	}
+
+	if stat.Mode()&os.ModeSymlink != 0 || !lxd.PathExists(filepath.Dir(filepath.Join(sourceDir, udevPath))) {
 		udevPath = filepath.Join("/", "usr", "lib", "udev", "rules.d")
 	}
 


More information about the lxc-devel mailing list