mirror of
https://github.com/opnsense/src.git
synced 2026-05-28 04:12:45 -04:00
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)
This commit is contained in:
parent
c96dbfbd1b
commit
1eaf3331ea
1 changed files with 6 additions and 5 deletions
|
|
@ -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
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue