diff options
Diffstat (limited to 'apk-model.lua')
-rw-r--r-- | apk-model.lua | 23 |
1 files changed, 6 insertions, 17 deletions
diff --git a/apk-model.lua b/apk-model.lua index dda4bad..66a9a30 100644 --- a/apk-model.lua +++ b/apk-model.lua @@ -1,10 +1,9 @@ -- acf model for packages (apk) module (..., package.seeall) require("apk") -require("fs") -require("format") +require("modelfunctions") -local configfile = "/etc/apk/apk.conf" +local configfile = "/etc/apk/repositories" get_all_packages = function() -- read in all of the packages @@ -47,20 +46,10 @@ install_package = function(package,sessiondata) return cfe({ value=cmdresult, label="Result of Install" }) end -get_config = function() - local config = format.parse_ini_file(fs.read_file(configfile) or "", "") or {} - local source = cfe({ value=config.APK_PATH or "", label="APK Source" }) - return cfe({ type="group", value={source=source}, label="APK Config" }) +get_configfile = function() + return modelfunctions.getfiledetails(configfile) end -set_config = function(newconfig) - -- FIXME - don't know how to validate - local success = true - if success then - fs.write_file(configfile, format.update_ini_file(fs.read_file(configfile) or "", "", "APK_PATH", newconfig.value.source.value)) - else - newconfig.errtxt = "Failed to update config" - end - - return newconfig +update_configfile = function(newconfig) + return modelfunctions.setfiledetails(newconfig, {configfile}) end |