git: 1eaf3331eaee - stable/14 - nuageinit: Replace os.execute with Lua libraries
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 08 Oct 2024 07:07:46 UTC
The branch stable/14 has been updated by bapt:
URL: https://cgit.FreeBSD.org/src/commit/?id=1eaf3331eaee56f012191195dc3e688f5284f69d
commit 1eaf3331eaee56f012191195dc3e688f5284f69d
Author: Jose Luis Duran <jlduran@gmail.com>
AuthorDate: 2024-07-30 00:37:10 +0000
Commit: Baptiste Daroussin <bapt@FreeBSD.org>
CommitDate: 2024-10-08 07:04:01 +0000
nuageinit: Replace os.execute with Lua libraries
Prefer posix.sys.stat's chmod() to os.execute(). While here, change the
name of the locals to be more descriptive.
Signed-off-by: Jose Luis Duran <jlduran@gmail.com>
(cherry picked from commit 9b2d92addc31ba6f5696c85d184a45d43e9073dc)
---
libexec/nuageinit/nuage.lua | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/libexec/nuageinit/nuage.lua b/libexec/nuageinit/nuage.lua
index d35d3725fa99..1f035036f802 100644
--- a/libexec/nuageinit/nuage.lua
+++ b/libexec/nuageinit/nuage.lua
@@ -3,8 +3,9 @@
--
-- Copyright(c) 2022 Baptiste Daroussin <bapt@FreeBSD.org>
+local unistd = require("posix.unistd")
+local sys_stat = require("posix.sys.stat")
local lfs = require("lfs")
-local pu = require("posix.unistd")
local function warnmsg(str)
io.stderr:write(str .. "\n")
@@ -206,12 +207,12 @@ local function addsshkey(homedir, key)
f:write(key .. "\n")
f:close()
if chownak then
- os.execute("chmod 0600 " .. ak_path)
- pu.chown(ak_path, dirattrs.uid, dirattrs.gid)
+ sys_stat.chmod(ak_path, 384)
+ unistd.chown(ak_path, dirattrs.uid, dirattrs.gid)
end
if chowndotssh then
- os.execute("chmod 0700 " .. dotssh_path)
- pu.chown(dotssh_path, dirattrs.uid, dirattrs.gid)
+ sys_stat.chmod(dotssh_path, 448)
+ unistd.chown(dotssh_path, dirattrs.uid, dirattrs.gid)
end
end