From aebcd59a3400f255aa9da97d271ec4c2b9ba4eb2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgraber@stgraber.org>
Date: Tue, 30 Jan 2024 11:32:45 -0500
Subject: [PATCH] incusd/instance/qemu/agent-loader: Handle legacy
 lxd-agent-loader
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Signed-off-by: Stéphane Graber <stgraber@stgraber.org>
---
 internal/server/instance/drivers/agent-loader/incus-agent | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/internal/server/instance/drivers/agent-loader/incus-agent b/internal/server/instance/drivers/agent-loader/incus-agent
index 6ed5ece1ac..b0ebc25b68 100644
--- a/internal/server/instance/drivers/agent-loader/incus-agent
+++ b/internal/server/instance/drivers/agent-loader/incus-agent
@@ -1,5 +1,11 @@
 #!/bin/sh
 PREFIX="/run/incus_agent"
+
+# Legacy handling
+if [ ! -e "${PREFIX}" ] && [ -d "/run/lxd_agent" ]; then
+    ln -s "/run/lxd_agent" "${PREFIX}"
+fi
+
 mkdir -p "${PREFIX}/.mnt"
 
 # Functions.
