summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
l---------apk-config-html.lsp1
-rw-r--r--apk-controller.lua4
l---------apk-expert-html.lsp1
-rw-r--r--apk-model.lua23
-rw-r--r--apk.menu2
-rw-r--r--apk.roles5
6 files changed, 12 insertions, 24 deletions
diff --git a/apk-config-html.lsp b/apk-config-html.lsp
deleted file mode 120000
index 4b6b762..0000000
--- a/apk-config-html.lsp
+++ /dev/null
@@ -1 +0,0 @@
-../form-html.lsp \ No newline at end of file
diff --git a/apk-controller.lua b/apk-controller.lua
index 9876347..8ceace3 100644
--- a/apk-controller.lua
+++ b/apk-controller.lua
@@ -25,6 +25,6 @@ install = function(self)
return self:redirect_to_referrer(self.model.install_package(self.clientdata.package or "", self.sessiondata))
end
-config = function(self)
- return controllerfunctions.handle_form(self, self.model.get_config, self.model.set_config, self.clientdata, "Save", "Edit Configuration", "Configuration Saved")
+expert = function(self)
+ return controllerfunctions.handle_form(self, self.model.get_configfile, self.model.update_configfile, self.clientdata, "Save", "Edit Configuration", "Configuration Saved")
end
diff --git a/apk-expert-html.lsp b/apk-expert-html.lsp
new file mode 120000
index 0000000..15b1930
--- /dev/null
+++ b/apk-expert-html.lsp
@@ -0,0 +1 @@
+../filedetails-html.lsp \ No newline at end of file
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
diff --git a/apk.menu b/apk.menu
index 1a3e8e0..9ed7b5a 100644
--- a/apk.menu
+++ b/apk.menu
@@ -2,4 +2,4 @@
# Cat Group Tab Action
System 30Packages Loaded loaded
System 30Packages Available available
-System 30Packages Config config
+System 30Packages Expert expert
diff --git a/apk.roles b/apk.roles
index 408915e..3c1f2b0 100644
--- a/apk.roles
+++ b/apk.roles
@@ -1,4 +1,3 @@
USER=apk:loaded,apk:available
-EDITOR=apk:config
-EXPERT=apk:delete,apk:install
-ADMIN=apk:loaded,apk:available,apk:config,apk:delete,apk:install,apk:read
+EXPERT=apk:expert,apk:delete,apk:install
+ADMIN=apk:loaded,apk:available,apk:expert,apk:delete,apk:install,apk:read