From 05c29512ec030792c7f8218211a1b44a1caa0de6 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Tue, 28 Dec 2021 20:41:29 +0100 Subject: [PATCH] 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. --- package/gluon-core/luasrc/usr/lib/lua/gluon/sysconfig.lua | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/package/gluon-core/luasrc/usr/lib/lua/gluon/sysconfig.lua b/package/gluon-core/luasrc/usr/lib/lua/gluon/sysconfig.lua index 93eb6ed1..7caf05c6 100644 --- a/package/gluon-core/luasrc/usr/lib/lua/gluon/sysconfig.lua +++ b/package/gluon-core/luasrc/usr/lib/lua/gluon/sysconfig.lua @@ -11,6 +11,10 @@ local function get(_, name) end local function set(_, name, val) + if val == get(nil, name) then + return + end + if val then local f = io.open(sysconfigdir .. name, 'w+') f:write(val, '\n')