002-domain-migration 474 B

1234567891011121314151617181920
  1. #!/usr/bin/lua
  2. local fs = require 'nixio.fs'
  3. local uci = require("simple-uci").cursor()
  4. local file = '/etc/config/currentsite'
  5. if not uci:get('gluon', 'core') then
  6. uci:section('gluon', 'core', 'core')
  7. end
  8. if uci:get('gluon', 'system') then
  9. uci:delete('gluon', 'system')
  10. end
  11. if fs.stat(file) then
  12. local domain = uci:get('currentsite', 'current', 'name')
  13. uci:set('gluon', 'core', 'domain', domain:match('^ffho_(.*)$') or domain)
  14. fs.remove(file)
  15. end
  16. uci:save('gluon')