ab4a9fd8c9e0f317bb0606fbc4982382ee0c90d6
[project/luci.git] / applications / luci-hd_idle / luasrc / model / cbi / hd_idle.lua
1 --[[
2
3 LuCI hd-idle
4 (c) 2008 Yanira <forum-2008@email.de>
5
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
9
10         http://www.apache.org/licenses/LICENSE-2.0
11
12 $Id$
13
14 ]]--
15
16 require("luci.fs")
17
18 m = Map("hd-idle", translate("hd_idle"), translate("hd_idle_desc"))
19
20 s = m:section(TypedSection, "hd-idle", translate("settings"))
21 s.addremove = true
22 s.anonymous = true
23
24 s:option(Flag, "enabled", translate("enable", "Enable"))
25
26 disk = s:option(Value, "disk", translate("disk"))
27 disk.rmempty = true
28 for _, dev in ipairs(luci.fs.glob("/dev/[sh]d[a-z]")) do
29         disk:value(luci.fs.basename(dev))
30 end
31
32 s:option(Value, "idle_time_interval", translate("idle_time_interval")).default = 10
33 s.rmempty = true
34 unit = s:option(ListValue, "idle_time_unit", translate("idle_time_unit"))
35 unit.default = "minutes"
36 unit:value("minutes", "min")
37 unit:value("hours", "h")
38 unit.rmempty = true
39
40 s:option(Flag, "enable_debug", translate("enable_debug"))
41
42 return m