gluon-core: add functions to unset sysconfig settings

This commit is contained in:
Matthias Schiffer 2014-07-05 19:39:24 +02:00
parent ac997386a9
commit 6ccbb22f4e
2 changed files with 11 additions and 4 deletions

View File

@ -12,3 +12,7 @@ sysconfig_isset() {
sysconfig_set() {
echo -n "$2" > "$SYSCONFIGDIR/$1"
}
sysconfig_unset() {
rm -f "$SYSCONFIGDIR/$1"
}

View File

@ -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