From 9cd4c138af69421eab0899df495a834d7a6816fb Mon Sep 17 00:00:00 2001 From: Mika Havela Date: Thu, 24 Jan 2008 20:41:58 +0000 Subject: Save work for today Working on: What happens if config-file doesnt exist. git-svn-id: svn://svn.alpinelinux.org/acf/alpine-conf/trunk@645 ab2d0c66-481e-0410-8bed-d214d4d58bed --- lbu-model.lua | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'lbu-model.lua') 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 -- cgit v1.2.3