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 /lbu-model.lua | |
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
Diffstat (limited to 'lbu-model.lua')
-rw-r--r-- | lbu-model.lua | 27 |
1 files changed, 27 insertions, 0 deletions
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 |