hd_idle.lua 855 B

1234567891011121314151617181920212223242526272829
  1. -- Copyright 2008 Yanira <forum-2008@email.de>
  2. -- Licensed to the public under the Apache License 2.0.
  3. require("nixio.fs")
  4. m = Map("hd-idle", "hd-idle",
  5. translate("hd-idle is a utility program for spinning-down external " ..
  6. "disks after a period of idle time."))
  7. s = m:section(TypedSection, "hd-idle", translate("Settings"))
  8. s.anonymous = true
  9. s:option(Flag, "enabled", translate("Enable"))
  10. disk = s:option(Value, "disk", translate("Disk"))
  11. disk.rmempty = true
  12. for dev in nixio.fs.glob("/dev/[sh]d[a-z]") do
  13. disk:value(nixio.fs.basename(dev))
  14. end
  15. s:option(Value, "idle_time_interval", translate("Idle-time")).default = 10
  16. s.rmempty = true
  17. unit = s:option(ListValue, "idle_time_unit", translate("Idle-time unit"))
  18. unit.default = "minutes"
  19. unit:value("minutes", translate("min"))
  20. unit:value("hours", translate("h"))
  21. unit.rmempty = true
  22. return m