2 LuCI - Lua Configuration Interface
4 Copyright 2008 Steven Barth <steven@midlink.org>
6 Licensed under the Apache License, Version 2.0 (the "License");
7 you may not use this file except in compliance with the License.
8 You may obtain a copy of the License at
10 http://www.apache.org/licenses/LICENSE-2.0
14 require("luci.tools.webadmin")
15 m = Map("fstab", translate("a_s_fstab"))
17 local mounts = luci.sys.mounts()
19 v = m:section(TypedSection, "_virtual", translate("a_s_fstab_active"))
22 v.template = "cbi/tblsection"
24 function v.cfgsections(self)
27 table.insert(sections, i)
32 fs = v:option(DummyValue, "fs", translate("filesystem"))
33 function fs.cfgvalue(self, section)
34 return mounts[section].fs
37 mp = v:option(DummyValue, "mountpoint", translate("a_s_fstab_mountpoint"))
38 function mp.cfgvalue(self, section)
39 return mounts[section].mountpoint
42 avail = v:option(DummyValue, "avail", translate("a_s_fstab_avail"))
43 function avail.cfgvalue(self, section)
44 return luci.tools.webadmin.byte_format(
45 tonumber(mounts[section].available) * 1024
46 ) .. " / " .. luci.tools.webadmin.byte_format(
47 tonumber(mounts[section].blocks) * 1024
51 used = v:option(DummyValue, "used", translate("a_s_fstab_used"))
52 function used.cfgvalue(self, section)
53 return mounts[section].percent .. " (" ..
54 luci.tools.webadmin.byte_format(
55 tonumber(mounts[section].used) * 1024
61 mount = m:section(TypedSection, "mount", translate("a_s_fstab_mountpoints"), translate("a_s_fstab_mountpoints1"))
62 mount.anonymous = true
63 mount.addremove = true
64 mount.template = "cbi/tblsection"
66 mount:option(Flag, "enabled", translate("enable"))
67 mount:option(Value, "device", translate("device"), translate("a_s_fstab_device1"))
68 mount:option(Value, "target", translate("a_s_fstab_mountpoint"))
69 mount:option(Value, "fstype", translate("filesystem"), translate("a_s_fstab_fs1"))
70 mount:option(Value, "options", translate("options"), translatef("manpage", "siehe '%s' manpage", "mount"))
73 swap = m:section(TypedSection, "swap", "SWAP", translate("a_s_fstab_swap1"))
76 swap.template = "cbi/tblsection"
78 swap:option(Flag, "enabled", translate("enable"))
79 swap:option(Value, "device", translate("device"), translate("a_s_fstab_device1"))