Merge pull request #278 from nmav/ocserv
[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("nixio.fs")
17
18 m = Map("hd-idle", "hd-idle",
19         translate("hd-idle is a utility program for spinning-down external " ..
20                 "disks after a period of idle time."))
21
22 s = m:section(TypedSection, "hd-idle", translate("Settings"))
23 s.anonymous = true
24
25 s:option(Flag, "enabled", translate("Enable"))
26
27 disk = s:option(Value, "disk", translate("Disk"))
28 disk.rmempty = true
29 for dev in nixio.fs.glob("/dev/[sh]d[a-z]") do
30         disk:value(nixio.fs.basename(dev))
31 end
32
33 s:option(Value, "idle_time_interval", translate("Idle-time")).default = 10
34 s.rmempty = true
35 unit = s:option(ListValue, "idle_time_unit", translate("Idle-time unit"))
36 unit.default = "minutes"
37 unit:value("minutes", translate("min"))
38 unit:value("hours", translate("h"))
39 unit.rmempty = true
40
41 return m