summaryrefslogtreecommitdiffstats
path: root/lbu-model.lua
diff options
context:
space:
mode:
Diffstat (limited to 'lbu-model.lua')
-rw-r--r--lbu-model.lua22
1 files changed, 21 insertions, 1 deletions
diff --git a/lbu-model.lua b/lbu-model.lua
index 3170736..7757332 100644
--- a/lbu-model.lua
+++ b/lbu-model.lua
@@ -48,18 +48,36 @@ local function getciphers()
return opensslciphers
end
+local function getincexl(state)
+ local incexl = {}
+ if (string.lower(state) == "include") or (string.lower(state) == "exclude") then
+ local f = io.popen("/sbin/lbu " .. state .. " -l 2>&1", "r")
+ if not (f) then return ciphers end
+ for line in f:lines() do
+ table.insert(incexl,tostring(line))
+ end
+ f:close()
+ end
+ return incexl
+end
+
-- ################################################################################
-- PUBLIC FUNCTIONS
function getstatus ()
+ local path = configfile
local status = {}
local statustxt = nil
local lbustatus = list()
if (#lbustatus == 0) then
statustxt = "OK! (There is no uncommited files)"
else
- statustxt = "WARNING! (Until you commit, you will loose your changes at next reboot/shutdown!)"
+ statustxt = "WARNING! (Until you commit, you will lose your changes at next reboot/shutdown!)"
end
+ local config = getopts.getoptsfromfile(path)
+ status["LBU_MEDIA"] = config["LBU_MEDIA"]
+ status["ENCRYPTION"] = config["ENCRYPTION"]
+ status["DEFAULT_CIPHER"] = config["DEFAULT_CIPHER"]
status["version"] = get_version()
status["status"] = statustxt
return status
@@ -83,6 +101,8 @@ function getconfig ()
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
config["DEFAULT_CIPHER_LIST"]= getciphers()
-- config["debug"] = getciphers()