check_site.lua 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. need_string 'site_code'
  2. need_string 'site_name'
  3. if need_table('opkg', nil, false) then
  4. need_string('opkg.openwrt', false)
  5. function check_repo(k, _)
  6. -- this is not actually a uci name, but using the same naming rules here is fine
  7. assert_uci_name(k)
  8. need_string(string.format('opkg.extra[%q]', k))
  9. end
  10. need_table('opkg.extra', check_repo, false)
  11. end
  12. need_string('hostname_prefix', false)
  13. need_string 'timezone'
  14. need_string_array('ntp_servers', false)
  15. need_string_match('prefix4', '^%d+.%d+.%d+.%d+/%d+$')
  16. need_string_match('prefix6', '^[%x:]+/%d+$')
  17. for _, config in ipairs({'wifi24', 'wifi5'}) do
  18. if need_table(config, nil, false) then
  19. need_string('regdom') -- regdom is only required when wifi24 or wifi5 is configured
  20. need_number(config .. '.channel')
  21. local rates = {1000, 2000, 5500, 6000, 9000, 11000, 12000, 18000, 24000, 36000, 48000, 54000}
  22. local supported_rates = need_array_of(config .. '.supported_rates', rates, false)
  23. if supported_rates then
  24. need_array_of(config .. '.basic_rate', supported_rates, true)
  25. else
  26. need_array_of(config .. '.basic_rate', rates, false)
  27. end
  28. end
  29. end
  30. need_boolean('poe_passthrough', false)