Browse Source

ffho-domain-migration: in some old experimental firmware versions the 'core' section was missing or named as 'system'

Karsten Böddeker 6 years ago
parent
commit
6421ec9968

+ 9 - 1
ffho/ffho-domain-migration/luasrc/lib/gluon/upgrade/002-domain-migration

@@ -4,9 +4,17 @@ 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')
 	uci:set('gluon', 'core', 'domain', domain:match('^ffho_(.*)$') or domain)
-	uci:save('gluon')
 	fs.remove(file)
 end
+
+uci:save('gluon')