summaryrefslogtreecommitdiffstats
path: root/lbu-model.lua
diff options
context:
space:
mode:
Diffstat (limited to 'lbu-model.lua')
-rw-r--r--lbu-model.lua17
1 files changed, 17 insertions, 0 deletions
diff --git a/lbu-model.lua b/lbu-model.lua
index 9ff31a4..f38d34d 100644
--- a/lbu-model.lua
+++ b/lbu-model.lua
@@ -3,6 +3,7 @@ module (..., package.seeall)
require("fs")
require("format")
require("getopts")
+require("daemoncontrol")
local configfile = "/etc/lbu/lbu.conf"
@@ -200,4 +201,20 @@ function editconfig (self,variable,value)
fs.write_file(path,table.concat(cmdoutput,"\n"))
return cmdoutput
end
+function get_filedetails()
+ local filedetails = {}
+ local path = configfile
+ filedetails.details = {path=path, size="0",mtime=""}
+ filedetails.content = ""
+ if (fs.is_file(path)) then
+ filedetails.details = fs.stat(path)
+ filedetails.content = fs.read_file(path)
+ end
+ return filedetails
+end
+function update_filecontent (self, modifications)
+ local path = configfile
+ local file_result,err = fs.write_file(path, format.dostounix(modifications))
+ return file_result, err
+end