summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lbu-controller.lua2
-rw-r--r--lbu-model.lua28
2 files changed, 3 insertions, 27 deletions
diff --git a/lbu-controller.lua b/lbu-controller.lua
index 64a479c..124a9d5 100644
--- a/lbu-controller.lua
+++ b/lbu-controller.lua
@@ -35,7 +35,7 @@ function listbackups(self)
end
--[[
function deletebackup(self)
- return self:redirect_to_referrer(self.model.deletebackupfile(self.clientdata.backup))
+ return self.handle_form(self, self.model.get_deletebackup, self.model.deletebackupfile, self.clientdata, "Delete", "Delete backup file", "Backup file deleted")
end
--]]
function selectbackup(self)
diff --git a/lbu-model.lua b/lbu-model.lua
index 1022e32..14d025b 100644
--- a/lbu-model.lua
+++ b/lbu-model.lua
@@ -178,6 +178,7 @@ local function validatefilecontent (filedetails)
return success, filedetails
end
--[[
+-- FIXME - now the USB is mounted readonly by default, so have to check that too
local was_mounted
local mnt
local function mount()
@@ -398,32 +399,7 @@ function commit(self, input)
return input
end
--[[
-function getbackupfiles()
- mount()
- local files = {}
- local selected
- local f = io.popen("ls "..mnt.."/*.[0-9]*[0-9].tar.gz")
- for line in f:lines() do
- files[#files + 1] = line
- end
- f:close()
- if #files then
- f = io.popen("date -u -r "..mnt.."/*.apkovl.tar.gz +%Y%m%d%H%m%S")
- selected = string.match(files[1], "^[^.]*.") .. f:read("*l") .. ".tar.gz"
- end
- unmount()
- return cfe({ type="list", value=files, label="Backup archive list", selected = selected })
-end
-
-function selectbackupfile(file)
- mount()
- if string.find(file, "^"..mnt) and fs.is_file(file) then
- local f = io.popen("cp -p "..file.." "..string.match(file, "^[^.]*.").."apkovl.tar.gz")
- f:close()
- end
- unmount()
-end
-
+-- FIXME - create get_deletebackupfile function and modify for use with handle_form
function deletebackupfile(file)
mount()
if string.find(file, "^"..mnt) and fs.is_file(file) then