diff options
Diffstat (limited to 'apk-model.lua')
-rw-r--r-- | apk-model.lua | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/apk-model.lua b/apk-model.lua index f281dd0..eaf1f40 100644 --- a/apk-model.lua +++ b/apk-model.lua @@ -1,5 +1,8 @@ -- acf model for packages (apk) module (..., package.seeall) +require("getopts") + +local configfile = "/etc/apk/apk.conf" get_all_packages = function() -- read in all of the packages @@ -68,3 +71,16 @@ install_package = function(package,sessiondata) if sessiondata then sessiondata.permissions = nil end return cfe({ value=cmdresult, label="Result of Install" }) end + +get_config = function() + local config = getopts.getoptsfromfile(configfile, "") + local source = cfe({ value=config.APK_PATH or "", label="APK Source" }) + return cfe({ type="group", value={source=source}, label="APK Config" }) +end + +set_config = function(newconfig) + if not getopts.setoptsinfile(configfile, "", "APK_PATH", newconfig.value.source.value) then + newconfig.errtxt = "Failed to update config" + end + return newconfig +end |