summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTed Trask <ttrask01@yahoo.com>2008-06-05 15:25:21 +0000
committerTed Trask <ttrask01@yahoo.com>2008-06-05 15:25:21 +0000
commitb4e8c5956ac0b6c7a8f95d14516caeb1a5b5968c (patch)
tree442bc669632c0dfff59936488efd2a80dbff21f2
parentb4b0051bc1f270eb42abb0262dc10dcd91ad48f1 (diff)
downloadacf-apk-tools-b4e8c5956ac0b6c7a8f95d14516caeb1a5b5968c.tar.bz2
acf-apk-tools-b4e8c5956ac0b6c7a8f95d14516caeb1a5b5968c.tar.xz
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
-rw-r--r--apk-config-html.lsp14
-rw-r--r--apk-controller.lua20
-rw-r--r--apk-model.lua16
-rw-r--r--apk.menu1
-rw-r--r--apk.roles2
5 files changed, 52 insertions, 1 deletions
diff --git a/apk-config-html.lsp b/apk-config-html.lsp
new file mode 100644
index 0000000..a884ec9
--- /dev/null
+++ b/apk-config-html.lsp
@@ -0,0 +1,14 @@
+<? local form = ... ?>
+<? require("viewfunctions") ?>
+<?
+--[[ DEBUG INFORMATION
+io.write("<H1>DEBUGGING</H1><span style='color:red'><H2>DEBUG INFO: CFE</H2>")
+io.write(html.cfe_unpack(form))
+io.write("</span>")
+--]]
+?>
+
+<H1><?= form.label ?></H1>
+<?
+ displayform(form)
+?>
diff --git a/apk-controller.lua b/apk-controller.lua
index 797c444..9bb53bb 100644
--- a/apk-controller.lua
+++ b/apk-controller.lua
@@ -36,3 +36,23 @@ install = function(self)
redirect(self)
end
+config = function(self)
+ local config = self.model.get_config()
+ if self.clientdata.Save then
+ for name,value in pairs(config.value) do
+ if self.clientdata[name] then
+ value.value = self.clientdata[name]
+ end
+ end
+ config = self.model.set_config(config)
+ if not config.errtxt then
+ config.descr = "Saved Configuration"
+ end
+ end
+
+ config.type = "form"
+ config.option = "Save"
+ config.label = "Edit Configuration"
+
+ return config
+end
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
diff --git a/apk.menu b/apk.menu
index 9d18125..c9132db 100644
--- a/apk.menu
+++ b/apk.menu
@@ -2,3 +2,4 @@
# Cat Group Tab Action
System 10Packages Loaded loaded
System 10Packages Available available
+System 10Packages Config config
diff --git a/apk.roles b/apk.roles
index b53e43d..1d36adf 100644
--- a/apk.roles
+++ b/apk.roles
@@ -1 +1 @@
-UPDATE=apk:loaded,apk:available,apk:delete,apk:install
+UPDATE=apk:loaded,apk:available,apk:delete,apk:install,apk:config