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(Table, mounts, translate("a_s_fstab_active"))
21 fs = v:option(DummyValue, "fs", translate("filesystem"))
23 mp = v:option(DummyValue, "mountpoint", translate("a_s_fstab_mountpoint"))
25 avail = v:option(DummyValue, "avail", translate("a_s_fstab_avail"))
26 function avail.cfgvalue(self, section)
27 return luci.tools.webadmin.byte_format(
28 tonumber(mounts[section].available) * 1024
29 ) .. " / " .. luci.tools.webadmin.byte_format(
30 tonumber(mounts[section].blocks) * 1024
34 used = v:option(DummyValue, "used", translate("a_s_fstab_used"))
35 function used.cfgvalue(self, section)
36 return mounts[section].percent .. " (" ..
37 luci.tools.webadmin.byte_format(
38 tonumber(mounts[section].used) * 1024
44 mount = m:section(TypedSection, "mount", translate("a_s_fstab_mountpoints"), translate("a_s_fstab_mountpoints1"))
45 mount.anonymous = true
46 mount.addremove = true
47 mount.template = "cbi/tblsection"
49 mount:option(Flag, "enabled", translate("enable"))
50 mount:option(Value, "device", translate("device"), translate("a_s_fstab_device1"))
51 mount:option(Value, "target", translate("a_s_fstab_mountpoint"))
52 mount:option(Value, "fstype", translate("filesystem"), translate("a_s_fstab_fs1"))
53 mount:option(Value, "options", translate("options"), translatef("manpage", "siehe '%s' manpage", "mount"))
56 swap = m:section(TypedSection, "swap", "SWAP", translate("a_s_fstab_swap1"))
59 swap.template = "cbi/tblsection"
61 swap:option(Flag, "enabled", translate("enable"))
62 swap:option(Value, "device", translate("device"), translate("a_s_fstab_device1"))