#!/usr/bin/lua local sys_stat = require 'posix.sys.stat' 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 sys_stat.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')) uci:set('gluon', 'core', 'domain', domain) os.remove(file) end uci:save('gluon')