summaryrefslogtreecommitdiffstats
path: root/apk-model.lua
diff options
context:
space:
mode:
authorTed Trask <ttrask01@yahoo.com>2009-05-26 16:06:30 +0000
committerTed Trask <ttrask01@yahoo.com>2009-05-26 16:06:30 +0000
commitdac9b6bad72f5c935b569c352c3e66a1be45ed86 (patch)
tree8ec188cd37ad65a66c2542b95d51d70410e8409d /apk-model.lua
parent09d10d76ae313c9e5fd198cb37d1eccc67433231 (diff)
downloadacf-apk-tools-dac9b6bad72f5c935b569c352c3e66a1be45ed86.tar.bz2
acf-apk-tools-dac9b6bad72f5c935b569c352c3e66a1be45ed86.tar.xz
Update for alpine 1.9 apk tools.
Diffstat (limited to 'apk-model.lua')
-rw-r--r--apk-model.lua23
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