From a83f38291b0de75d5f92f5cda7a9cabd8518faee Mon Sep 17 00:00:00 2001 From: Mika Havela Date: Thu, 17 Jan 2008 09:38:24 +0000 Subject: Starts showing current config on the config-tab git-svn-id: svn://svn.alpinelinux.org/acf/lbu/trunk@594 ab2d0c66-481e-0410-8bed-d214d4d58bed --- lbu-model.lua | 33 ++++++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) (limited to 'lbu-model.lua') diff --git a/lbu-model.lua b/lbu-model.lua index 8a362ce..3170736 100644 --- a/lbu-model.lua +++ b/lbu-model.lua @@ -1,6 +1,8 @@ module (..., package.seeall) -require "fs" +require("fs") +require("getopts") + local configfile = "/etc/lbu/lbu.conf" -- ################################################################################ @@ -29,6 +31,22 @@ local function getLbuStatus() return ret end +local function getciphers() + local opensslciphers = {} + local watchdog = nil + local f = io.popen("/usr/bin/openssl -v 2>&1", "r") + if not (f) then return ciphers end + for line in f:lines() do + if (watchdog) then + for cipher in string.gmatch(line, "(%S+)") do + table.insert(opensslciphers,tostring(cipher)) + end + end + if (string.match(line, "^Cipher commands")) then watchdog="yes" end + end + f:close() + return opensslciphers +end -- ################################################################################ -- PUBLIC FUNCTIONS @@ -57,6 +75,19 @@ function list(self) return ret end +function getconfig () + local path = configfile + local config = {} + local lbumedias = {} + table.insert(lbumedias, {name="No default", value=""}) + table.insert(lbumedias, {name="floppy", value="floppy"}) + table.insert(lbumedias, {name="usb", value="usb"}) + config = getopts.getoptsfromfile(path) + config["LBU_MEDIA_LIST"]= lbumedias + config["DEFAULT_CIPHER_LIST"]= getciphers() +-- config["debug"] = getciphers() + return config +end -- ################################################################################ -- OLD FUNCTIONS -- cgit v1.2.3