summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTed Trask <ttrask01@yahoo.com>2008-06-25 13:28:22 +0000
committerTed Trask <ttrask01@yahoo.com>2008-06-25 13:28:22 +0000
commite36290cc32c9d9a7b70e1ce09127517be7aadf9a (patch)
tree5d097817b00bf5603263221752f43c694fd47a53
parent09584e26d2022c19e6323cba4c03ab64af928190 (diff)
downloadacf-alpine-conf-e36290cc32c9d9a7b70e1ce09127517be7aadf9a.tar.bz2
acf-alpine-conf-e36290cc32c9d9a7b70e1ce09127517be7aadf9a.tar.xz
Updated lbu to use lbu list-backup and revert.
git-svn-id: svn://svn.alpinelinux.org/acf/alpine-conf/trunk@1261 ab2d0c66-481e-0410-8bed-d214d4d58bed
-rw-r--r--lbu-controller.lua4
-rw-r--r--lbu-listbackups-html.lsp12
-rw-r--r--lbu-model.lua36
-rw-r--r--lbu.roles2
4 files changed, 36 insertions, 18 deletions
diff --git a/lbu-controller.lua b/lbu-controller.lua
index 4072740..d70dde7 100644
--- a/lbu-controller.lua
+++ b/lbu-controller.lua
@@ -123,12 +123,12 @@ end
function listbackups(self)
return self.model.getbackupfiles()
end
-
+--[[
function deletebackup(self)
self.model.deletebackupfile(self.clientdata.backup)
redirect_to_referrer(self)
end
-
+--]]
function selectbackup(self)
self.model.selectbackupfile(self.clientdata.backup)
redirect_to_referrer(self)
diff --git a/lbu-listbackups-html.lsp b/lbu-listbackups-html.lsp
index ad26069..cfd6efc 100644
--- a/lbu-listbackups-html.lsp
+++ b/lbu-listbackups-html.lsp
@@ -13,27 +13,17 @@ io.write("</span>")
<DL>
<? if #view.value == 0 then ?>
No backup files
-<? else
- local selected = false ?>
+<? else ?>
<table><tr>
<td class="header">Action</td>
<td class="header">File</td>
</tr>
<? for i,name in ipairs(view.value) do ?>
<tr><td>
- <?= html.link{value="deletebackup?backup="..name, label="Delete "} ?>
- <? if name == view.selected then
- selected = true ?>
- selected
- <? else ?>
<?= html.link{value="selectbackup?backup="..name, label="Select "} ?>
- <? end ?>
</td>
<td><?= name ?></td></tr>
<? end
- if not selected then ?>
- Warning!! Selecting a backup file will cause the current lbu overlay to be lost!!
- <? end
end ?>
</table>
</DL>
diff --git a/lbu-model.lua b/lbu-model.lua
index 81236eb..3ae6c87 100644
--- a/lbu-model.lua
+++ b/lbu-model.lua
@@ -59,7 +59,7 @@ end
local function getciphers()
local opensslciphers = {}
local watchdog = nil
- local f = io.popen("/usr/bin/openssl -v 2>&1", "r")
+ local f = io.popen("PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin openssl -v 2>&1", "r")
if not (f) then return ciphers end
for line in f:lines() do
if (watchdog) then
@@ -168,7 +168,7 @@ local function validatefilecontent (filecontent)
return filecontent
end
-
+--[[
local was_mounted
local mnt
local function mount()
@@ -192,7 +192,7 @@ local function unmount()
g:close()
end
end
-
+--]]
-- ################################################################################
-- PUBLIC FUNCTIONS
@@ -387,7 +387,7 @@ function commit(input)
return input
end
-
+--[[
function getbackupfiles()
mount()
local files = {}
@@ -422,3 +422,31 @@ function deletebackupfile(file)
end
unmount()
end
+--]]
+function getbackupfiles()
+ local files = {}
+ local f = io.popen("PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin lbu lb 2>&1", "r")
+ for line in f:lines() do
+ files[#files + 1] = line
+ end
+ f:close()
+ return cfe({ type="list", value=files, label="Backup archive list"})
+end
+
+function selectbackupfile(selectfile)
+ local cmdresult = cfe({ value="Failed to select backup", errtxt="Backup not found", label="Select Backup result"})
+ local files = getbackupfiles()
+ for i,file in ipairs(files.value) do
+ if file == selectfile then
+ local f = io.popen("PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin lbu revert "..file.." 2>&1", "r")
+ cmdresult.errtxt = f:read("*a")
+ if "" == cmdresult.errtxt then
+ cmdresult.errtxt = nil
+ cmdresult.value = "Selected backup "..file
+ end
+ f:close()
+ break
+ end
+ end
+ return cmdresult
+end
diff --git a/lbu.roles b/lbu.roles
index 525df12..8aaeb48 100644
--- a/lbu.roles
+++ b/lbu.roles
@@ -1,2 +1,2 @@
-UPDATE=lbu:config,lbu:commit,lbu:expert,lbu:editincluded,lbu:editexcluded,lbu:listbackups,lbu:deletebackup,lbu:selectbackup
+UPDATE=lbu:config,lbu:commit,lbu:expert,lbu:editincluded,lbu:editexcluded,lbu:listbackups,lbu:selectbackup
ALL=lbu:basicstatus,lbu:status