diff options
author | Ted Trask <ttrask01@yahoo.com> | 2008-11-19 14:25:49 +0000 |
---|---|---|
committer | Ted Trask <ttrask01@yahoo.com> | 2008-11-19 14:25:49 +0000 |
commit | 61104b8eed155a798a69256d45776cb3e1a40ccf (patch) | |
tree | e7e9313b08c15e0934b9729dbfb1f2ffcc8781ec | |
parent | 4db5cfc0fcaa6f7b46458c9b6fdf964c4bebcfc8 (diff) | |
download | acf-alpine-conf-61104b8eed155a798a69256d45776cb3e1a40ccf.tar.bz2 acf-alpine-conf-61104b8eed155a798a69256d45776cb3e1a40ccf.tar.xz |
Modified lbu to add ability to download overlay package.
git-svn-id: svn://svn.alpinelinux.org/acf/alpine-conf/trunk@1601 ab2d0c66-481e-0410-8bed-d214d4d58bed
-rw-r--r-- | lbu-controller.lua | 5 | ||||
-rw-r--r-- | lbu-listchanges-html.lsp | 9 | ||||
-rw-r--r-- | lbu-model.lua | 27 | ||||
-rw-r--r-- | lbu.roles | 4 |
4 files changed, 43 insertions, 2 deletions
diff --git a/lbu-controller.lua b/lbu-controller.lua index 3db860d..8ced688 100644 --- a/lbu-controller.lua +++ b/lbu-controller.lua @@ -42,3 +42,8 @@ end function selectbackup(self) return self:redirect_to_referrer(self.model.selectbackupfile(self.clientdata.backup)) end + +function getpackage(self) + self.conf.viewtype = "stream" + return self.model.getpackage() +end diff --git a/lbu-listchanges-html.lsp b/lbu-listchanges-html.lsp index 88c1655..0733e96 100644 --- a/lbu-listchanges-html.lsp +++ b/lbu-listchanges-html.lsp @@ -18,6 +18,15 @@ io.write("</span>") end end %> +<% if session.permissions.lbu.getpackage then %> +<H1>Download Overlay</H1> +<DL> + <DT>Generate and download overlay</DT> + <DD><form action="<%= page_info.script .. page_info.prefix %>lbu/getpackage" method="POST"> + <input class="submit" type="submit" name="Download" value="Download"></form></DD> +</DL> +<% end %> + <H1>Changes Since Last Commit</H1> <DL> <dt>Files changed since last commit</dt> diff --git a/lbu-model.lua b/lbu-model.lua index ae91096..a5856d2 100644 --- a/lbu-model.lua +++ b/lbu-model.lua @@ -433,3 +433,30 @@ function selectbackupfile(selectfile) end return cmdresult end + +function getpackage() + -- create a temporary directory to store the file + require("session") + local tmp = "/tmp/"..session.random_hash(10) + while posix.stat( tmp ) do + tmp = "/tmp/"..session.random_hash(10) + end + posix.mkdir(tmp) + local f = io.popen("PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin lbu package "..tmp.." 2>&1") + local cmdresult = f:read("*a") + f:close() + + -- find and read the file + local package = cfe({ type="raw", label="error", option="application/x-gzip" }) + for name in fs.find(".*tar%.gz", tmp) do + package.label = basename(name) + package.value = fs.read_file(name) + break + end + + -- delete the temp directory and file + f = io.popen("rm -r "..tmp) + f:close() + + return package +end @@ -1,5 +1,5 @@ GUEST=lbu:status -USER=lbu:listchanges +USER=lbu:listchanges,lbu:getpackage EDITOR=lbu:config,lbu:commit,lbu:editincluded,lbu:editexcluded,lbu:listbackups,lbu:selectbackup EXPERT=lbu:expert -ADMIN=lbu:status,lbu:listchanges,lbu:config,lbu:commit,lbu:editincluded,lbu:editexcluded,lbu:listbackups,lbu:selectbackup,lbu:expert +ADMIN=lbu:status,lbu:listchanges,lbu:getpackage,lbu:config,lbu:commit,lbu:editincluded,lbu:editexcluded,lbu:listbackups,lbu:selectbackup,lbu:expert |