From dac9b6bad72f5c935b569c352c3e66a1be45ed86 Mon Sep 17 00:00:00 2001 From: Ted Trask Date: Tue, 26 May 2009 16:06:30 +0000 Subject: Update for alpine 1.9 apk tools. --- apk-model.lua | 23 ++++++----------------- 1 file changed, 6 insertions(+), 17 deletions(-) (limited to 'apk-model.lua') 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 -- cgit v1.2.3