From 2ec02a41c208f599a2bac0a523959588e11bdde3 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Sat, 5 Jul 2014 19:39:24 +0200 Subject: [PATCH] gluon-core: add functions to unset sysconfig settings --- .../gluon-core/files/lib/gluon/functions/sysconfig.sh | 4 ++++ .../gluon-core/files/usr/lib/lua/gluon/sysconfig.lua | 11 +++++++---- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/package/gluon-core/files/lib/gluon/functions/sysconfig.sh b/package/gluon-core/files/lib/gluon/functions/sysconfig.sh index 67aa1061..60b410f2 100644 --- a/package/gluon-core/files/lib/gluon/functions/sysconfig.sh +++ b/package/gluon-core/files/lib/gluon/functions/sysconfig.sh @@ -12,3 +12,7 @@ sysconfig_isset() { sysconfig_set() { echo -n "$2" > "$SYSCONFIGDIR/$1" } + +sysconfig_unset() { + rm -f "$SYSCONFIGDIR/$1" +} diff --git a/package/gluon-core/files/usr/lib/lua/gluon/sysconfig.lua b/package/gluon-core/files/usr/lib/lua/gluon/sysconfig.lua index 35c5062c..3ba26e95 100644 --- a/package/gluon-core/files/usr/lib/lua/gluon/sysconfig.lua +++ b/package/gluon-core/files/usr/lib/lua/gluon/sysconfig.lua @@ -11,10 +11,13 @@ local function get(_, name) end local function set(_, name, val) - local ret = nil - local f = io.open(sysconfigdir .. name, 'w+') - f:write(val) - f:close() + if val then + local f = io.open(sysconfigdir .. name, 'w+') + f:write(val) + f:close() + else + os.remove(sysconfigdir .. name) + end end local setmetatable = setmetatable