diff options
author | Steven Barth <steven@midlink.org> | 2008-04-11 18:13:58 +0000 |
---|---|---|
committer | Steven Barth <steven@midlink.org> | 2008-04-11 18:13:58 +0000 |
commit | cd498aa924553422e64c4b56d2fb01e63a170bac (patch) | |
tree | 8dc47490dff680dc2c67a0c30e0bd64e1b34d008 /src/ffluci/controller | |
parent | b864e2933ddab6bb40868cd878c9b89f9073ad12 (diff) |
* Major repository revision
Diffstat (limited to 'src/ffluci/controller')
-rw-r--r-- | src/ffluci/controller/admin/index.lua | 1 | ||||
-rw-r--r-- | src/ffluci/controller/admin/network.lua | 1 | ||||
-rw-r--r-- | src/ffluci/controller/admin/services.lua | 1 | ||||
-rw-r--r-- | src/ffluci/controller/admin/status.lua | 1 | ||||
-rw-r--r-- | src/ffluci/controller/admin/system.lua | 202 | ||||
-rw-r--r-- | src/ffluci/controller/admin/uci.lua | 59 | ||||
-rw-r--r-- | src/ffluci/controller/admin/wifi.lua | 1 | ||||
-rw-r--r-- | src/ffluci/controller/public/index.lua | 1 |
8 files changed, 0 insertions, 267 deletions
diff --git a/src/ffluci/controller/admin/index.lua b/src/ffluci/controller/admin/index.lua deleted file mode 100644 index b4a7720f8..000000000 --- a/src/ffluci/controller/admin/index.lua +++ /dev/null @@ -1 +0,0 @@ -module("ffluci.controller.admin.index", package.seeall)
\ No newline at end of file diff --git a/src/ffluci/controller/admin/network.lua b/src/ffluci/controller/admin/network.lua deleted file mode 100644 index 4f8160a4c..000000000 --- a/src/ffluci/controller/admin/network.lua +++ /dev/null @@ -1 +0,0 @@ -module(..., package.seeall)
\ No newline at end of file diff --git a/src/ffluci/controller/admin/services.lua b/src/ffluci/controller/admin/services.lua deleted file mode 100644 index 42181212b..000000000 --- a/src/ffluci/controller/admin/services.lua +++ /dev/null @@ -1 +0,0 @@ -module("ffluci.controller.admin.services", package.seeall)
\ No newline at end of file diff --git a/src/ffluci/controller/admin/status.lua b/src/ffluci/controller/admin/status.lua deleted file mode 100644 index bdd51d462..000000000 --- a/src/ffluci/controller/admin/status.lua +++ /dev/null @@ -1 +0,0 @@ -module("ffluci.controller.admin.status", package.seeall)
\ No newline at end of file diff --git a/src/ffluci/controller/admin/system.lua b/src/ffluci/controller/admin/system.lua deleted file mode 100644 index b0763d8af..000000000 --- a/src/ffluci/controller/admin/system.lua +++ /dev/null @@ -1,202 +0,0 @@ -module("ffluci.controller.admin.system", package.seeall) - -require("ffluci.sys") -require("ffluci.http") -require("ffluci.util") -require("ffluci.fs") -require("ffluci.model.ipkg") -require("ffluci.model.uci") - -function action_editor() - local file = ffluci.http.formvalue("file", "") - local data = ffluci.http.formvalue("data") - local err = nil - local msg = nil - local stat = true - - if file and data then - stat, err = ffluci.fs.writefile(file, data) - end - - if not stat then - err = ffluci.util.split(err, " ") - table.remove(err, 1) - msg = table.concat(err, " ") - end - - local cnt, err = ffluci.fs.readfile(file) - if cnt then - cnt = ffluci.util.pcdata(cnt) - end - ffluci.template.render("admin_system/editor", {fn=file, cnt=cnt, msg=msg}) -end - -function action_ipkg() - local file = "/etc/ipkg.conf" - local data = ffluci.http.formvalue("data") - local stat = nil - local err = nil - - if data then - stat, err = ffluci.fs.writefile(file, data) - end - - local cnt = ffluci.fs.readfile(file) - if cnt then - cnt = ffluci.util.pcdata(cnt) - end - - ffluci.template.render("admin_system/ipkg", {cnt=cnt, msg=err}) -end - -function action_packages() - local ipkg = ffluci.model.ipkg - local void = nil - local submit = ffluci.http.formvalue("submit") - - - -- Search query - local query = ffluci.http.formvalue("query") - query = (query ~= '') and query or nil - - - -- Packets to be installed - local install = ffluci.http.formvalue("install") - install = (type(install) == "table" and submit) and install or nil - - -- Install from URL - local url = ffluci.http.formvalue("url") - if url and url ~= '' and submit then - if not install then - install = {} - end - install[url] = 1 - end - - -- Do install - if install then - for k, v in pairs(install) do - void, install[k] = ipkg.install(k) - end - end - - - -- Remove packets - local remove = ffluci.http.formvalue("remove") - remove = (type(remove) == "table" and submit) and remove or nil - if remove then - for k, v in pairs(remove) do - void, remove[k] = ipkg.remove(k) - end - end - - - -- Update all packets - local update = ffluci.http.formvalue("update") - if update then - void, update = ipkg.update() - end - - - -- Upgrade all packets - local upgrade = ffluci.http.formvalue("upgrade") - if upgrade then - void, upgrade = ipkg.upgrade() - end - - - -- Package info - local info = ffluci.model.ipkg.info(query) - info = info or {} - local pkgs = {} - - -- Sort after status and name - for k, v in pairs(info) do - local x = 0 - for i, j in pairs(pkgs) do - local vins = (v.Status and v.Status.installed) - local jins = (j.Status and j.Status.installed) - if vins ~= jins then - if vins then - break - end - else - if j.Package > v.Package then - break - end - end - x = i - end - table.insert(pkgs, x+1, v) - end - - ffluci.template.render("admin_system/packages", {pkgs=pkgs, query=query, - install=install, remove=remove, update=update, upgrade=upgrade}) -end - -function action_passwd() - local p1 = ffluci.http.formvalue("pwd1") - local p2 = ffluci.http.formvalue("pwd2") - local stat = nil - - if p1 or p2 then - if p1 == p2 then - stat = ffluci.sys.user.setpasswd("root", p1) - else - stat = 10 - end - end - - ffluci.template.render("admin_system/passwd", {stat=stat}) -end - -function action_reboot() - local reboot = ffluci.http.formvalue("reboot") - ffluci.template.render("admin_system/reboot", {reboot=reboot}) - if reboot then - ffluci.sys.reboot() - end -end - -function action_sshkeys() - local file = "/etc/dropbear/authorized_keys" - local data = ffluci.http.formvalue("data") - local stat = nil - local err = nil - - if data then - stat, err = ffluci.fs.writefile(file, data) - end - - local cnt = ffluci.fs.readfile(file) - if cnt then - cnt = ffluci.util.pcdata(cnt) - end - - ffluci.template.render("admin_system/sshkeys", {cnt=cnt, msg=err}) -end - -function action_upgrade() - local ret = nil - local plat = ffluci.fs.mtime("/lib/upgrade/platform.sh") - - local image = ffluci.http.formvalue("image") - local imgname = ffluci.http.formvalue("image_name") - local keepcfg = ffluci.http.formvalue("keepcfg") - - if plat and imgname then - local kpattern = nil - if keepcfg then - local files = ffluci.model.uci.show("luci", "flash_keep") - if files.luci and files.luci.flash_keep then - kpattern = "" - for k,v in pairs(files.luci.flash_keep) do - kpattern = kpattern .. " " .. v - end - end - end - ret = ffluci.sys.flash(image, kpattern) - end - - ffluci.template.render("admin_system/upgrade", {sysupgrade=plat, ret=ret}) -end
\ No newline at end of file diff --git a/src/ffluci/controller/admin/uci.lua b/src/ffluci/controller/admin/uci.lua deleted file mode 100644 index 3c9fc8739..000000000 --- a/src/ffluci/controller/admin/uci.lua +++ /dev/null @@ -1,59 +0,0 @@ -module("ffluci.controller.admin.uci", package.seeall) -require("ffluci.util") -require("ffluci.sys") - --- This function has a higher priority than the admin_uci/apply template -function action_apply() - local changes = ffluci.model.uci.changes() - local output = "" - - if changes then - local apply = {} - - -- Collect files to be applied - for i, line in ipairs(ffluci.util.split(changes)) do - local r = line:match("^-?([^.]+)") - if r then - apply[r] = true - end - end - - -- Commit changes - ffluci.model.uci.commit() - - -- Search for post-commit commands - if ffluci.config.uci_oncommit then - for k, v in pairs(apply) do - local cmd = ffluci.config.uci_oncommit[k] - if cmd then - output = output .. cmd .. ":" .. ffluci.sys.exec(cmd) - end - end - end - end - - ffluci.template.render("admin_uci/apply", {changes=changes, output=output}) -end - - -function action_revert() - local changes = ffluci.model.uci.changes() - if changes then - local revert = {} - - -- Collect files to be reverted - for i, line in ipairs(ffluci.util.split(changes)) do - local r = line:match("^-?([^.]+)") - if r then - revert[r] = true - end - end - - -- Revert them - for k, v in pairs(revert) do - ffluci.model.uci.revert(k) - end - end - - ffluci.template.render("admin_uci/revert", {changes=changes}) -end
\ No newline at end of file diff --git a/src/ffluci/controller/admin/wifi.lua b/src/ffluci/controller/admin/wifi.lua deleted file mode 100644 index bc1040c71..000000000 --- a/src/ffluci/controller/admin/wifi.lua +++ /dev/null @@ -1 +0,0 @@ -module("ffluci.controller.admin.wifi", package.seeall)
\ No newline at end of file diff --git a/src/ffluci/controller/public/index.lua b/src/ffluci/controller/public/index.lua deleted file mode 100644 index 4f8160a4c..000000000 --- a/src/ffluci/controller/public/index.lua +++ /dev/null @@ -1 +0,0 @@ -module(..., package.seeall)
\ No newline at end of file |