git: 3cfc085f8ac9 - stable/14 - nuageinit: make addsshkey friendly for testsuite

From: Baptiste Daroussin <bapt_at_FreeBSD.org>
Date: Thu, 27 Jun 2024 08:57:44 UTC
The branch stable/14 has been updated by bapt:

URL: https://cgit.FreeBSD.org/src/commit/?id=3cfc085f8ac9c24a3d6dac0027efa1d8e96197d1

commit 3cfc085f8ac9c24a3d6dac0027efa1d8e96197d1
Author:     Baptiste Daroussin <bapt@FreeBSD.org>
AuthorDate: 2024-06-05 08:44:17 +0000
Commit:     Baptiste Daroussin <bapt@FreeBSD.org>
CommitDate: 2024-06-27 08:55:07 +0000

    nuageinit: make addsshkey friendly for testsuite
    
    (cherry picked from commit fa07b02f6e09f776b3afe5709e8fee1764c11a2a)
---
 libexec/nuageinit/nuage.lua | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/libexec/nuageinit/nuage.lua b/libexec/nuageinit/nuage.lua
index 020b54b0776c..ca70c778791b 100644
--- a/libexec/nuageinit/nuage.lua
+++ b/libexec/nuageinit/nuage.lua
@@ -177,6 +177,10 @@ end
 local function addsshkey(homedir, key)
 	local chownak = false
 	local chowndotssh = false
+	local root = os.getenv("NUAGE_FAKE_ROOTDIR")
+	if root then
+		homedir = root .. "/" .. homedir
+	end
 	local ak_path = homedir .. "/.ssh/authorized_keys"
 	local dotssh_path = homedir .. "/.ssh"
 	local dirattrs = lfs.attributes(ak_path)