summaryrefslogtreecommitdiffstats
path: root/lbu-model.lua
diff options
context:
space:
mode:
Diffstat (limited to 'lbu-model.lua')
-rw-r--r--lbu-model.lua17
1 files changed, 12 insertions, 5 deletions
diff --git a/lbu-model.lua b/lbu-model.lua
index e8ac94a..14fb9d3 100644
--- a/lbu-model.lua
+++ b/lbu-model.lua
@@ -99,7 +99,7 @@ function getstatus ()
else
statustxt = "WARNING! (Until you commit, you will lose your changes at next reboot/shutdown!)"
end
- local config = getopts.getoptsfromfile(path)
+ local config = getconfig()
status["LBU_MEDIA"] = config["LBU_MEDIA"]
status["ENCRYPTION"] = config["ENCRYPTION"]
status["DEFAULT_CIPHER"] = config["DEFAULT_CIPHER"]
@@ -144,10 +144,17 @@ function getconfig ()
local lbumedias = {}
table.insert(lbumedias, {name="floppy", value="floppy"})
table.insert(lbumedias, {name="usb", value="usb"})
- config = getopts.getoptsfromfile(path)
- config["lbu_included"]= getincexl("include")
- config["lbu_excluded"]= getincexl("exclude")
- config["LBU_MEDIA_LIST"]= lbumedias
+ if (fs.is_file(path)) then
+ config = getopts.getoptsfromfile(path)
+ config["lbu_included"]= getincexl("include")
+ config["lbu_excluded"]= getincexl("exclude")
+ config["LBU_MEDIA_LIST"]= lbumedias
+ else
+ --FIXME: What if the configfile doesn't exist (below is a beginning of fixing it... please continue)
+ config["lbu_included"]= ""
+ config["lbu_excluded"]= ""
+ config["LBU_MEDIA_LIST"]= ""
+ end
config["DEFAULT_CIPHER_LIST"]= getciphers()
-- config["debug"] = getciphers()
return config