gluon-core: sysconfig: avoid unnecessary writes
Do not write files when the content is unchanged. Avoids a few unnecessary filesystem writes when resetting ifname sysconfigs on each upgrade.
This commit is contained in:
parent
c2a5f57c40
commit
05c29512ec
@ -11,6 +11,10 @@ local function get(_, name)
|
|||||||
end
|
end
|
||||||
|
|
||||||
local function set(_, name, val)
|
local function set(_, name, val)
|
||||||
|
if val == get(nil, name) then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
if val then
|
if val then
|
||||||
local f = io.open(sysconfigdir .. name, 'w+')
|
local f = io.open(sysconfigdir .. name, 'w+')
|
||||||
f:write(val, '\n')
|
f:write(val, '\n')
|
||||||
|
Loading…
Reference in New Issue
Block a user