From b4e8c5956ac0b6c7a8f95d14516caeb1a5b5968c Mon Sep 17 00:00:00 2001 From: Ted Trask Date: Thu, 5 Jun 2008 15:25:21 +0000 Subject: Added config page to apk to modify path git-svn-id: svn://svn.alpinelinux.org/acf/apk-tools/trunk@1199 ab2d0c66-481e-0410-8bed-d214d4d58bed --- apk-model.lua | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'apk-model.lua') 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 -- cgit v1.2.3