#!/usr/bin/lua local fs = require 'nixio.fs' local uci = require("simple-uci").cursor() local file = '/etc/config/currentsite' if not uci:get('gluon', 'core') then uci:section('gluon', 'core', 'core') end if uci:get('gluon', 'system') then uci:delete('gluon', 'system') end if fs.stat(file) then local domain = uci:get('currentsite', 'current', 'name') -- We can't use gluon.site yet, as it depends on gluon.core.domain to be set local json = require 'jsonc' local site = assert(json.load('/lib/gluon/site.json')) if (site.domain_migration or {}).match then domain = domain:match(site.domain_migration.match) or domain end uci:set('gluon', 'core', 'domain', domain) fs.remove(file) end uci:save('gluon')