summaryrefslogtreecommitdiffstats
path: root/modules-model.lua
blob: a21a46b771726df68cfd4a71afb654b3396cf076 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
module (..., package.seeall)

require("modelfunctions")
require("fs")

local configfile = "/etc/modules"

function read_modules()
	local f = io.popen("/sbin/lsmod")
	local retval = f:read("*a")
	f:close()
	return cfe({ type="longtext", value=retval, label="Modules List" })
end

function read_file()
	return modelfunctions.getfiledetails(configfile)
end

function write_file(filedetails)
	return modelfunctions.setfiledetails(filedetails, {configfile})
end

function reloadmodules()
	local retval = modelfunctions.startstop_service("modules", "restart", {"restart"})
	return retval.value.result
end