From 6ab9d3415dd2e5c280ae5273d578a37bdb1b4378 Mon Sep 17 00:00:00 2001
From: Matthias Schiffer <mschiffer@universe-factory.net>
Date: Tue, 30 Jun 2020 22:49:08 +0200
Subject: [PATCH] gluon-hoodselector: use gluon-switch-domain

---
 .../luasrc/usr/lib/lua/hoodselector/util.lua                 | 4 +---
 package/gluon-hoodselector/luasrc/usr/sbin/hoodselector      | 5 +----
 2 files changed, 2 insertions(+), 7 deletions(-)

diff --git a/package/gluon-hoodselector/luasrc/usr/lib/lua/hoodselector/util.lua b/package/gluon-hoodselector/luasrc/usr/lib/lua/hoodselector/util.lua
index b93097a66..af079f368 100644
--- a/package/gluon-hoodselector/luasrc/usr/lib/lua/hoodselector/util.lua
+++ b/package/gluon-hoodselector/luasrc/usr/lib/lua/hoodselector/util.lua
@@ -67,9 +67,7 @@ end
 
 function M.set_domain_config(domain)
 	if uci:get('gluon', 'core', 'domain') ~= domain.domain_code then
-		uci:set('gluon', 'core', 'domain', domain.domain_code)
-		uci:commit('gluon')
-		os.execute('gluon-reconfigure')
+		os.execute(string.format("exec gluon-switch-domain --no-reboot '%s'", domain.domain_code))
 		M.log('Set domain "'..domain.domain.domain_names[domain.domain_code]..'"')
 		return true
 	end
diff --git a/package/gluon-hoodselector/luasrc/usr/sbin/hoodselector b/package/gluon-hoodselector/luasrc/usr/sbin/hoodselector
index 12125da76..03852272e 100755
--- a/package/gluon-hoodselector/luasrc/usr/sbin/hoodselector
+++ b/package/gluon-hoodselector/luasrc/usr/sbin/hoodselector
@@ -40,7 +40,6 @@ if geo.lat ~= nil and geo.lon ~= nil then
 	local geo_base_domain = hoodutil.get_domain_by_geo(jdomains, geo)
 	if geo_base_domain ~= nil then
 		if hoodutil.set_domain_config(geo_base_domain) then
-			os.execute("gluon-reload")
 			hoodutil.log('Domain set by geolocation mode.\n')
 		end
 		return
@@ -51,6 +50,4 @@ else
 end
 
 -- default domain mode
-if hoodutil.set_domain_config(hoodutil.get_default_domain(hoodutil.get_domains())) then
-	os.execute("gluon-reload")
-end
+hoodutil.set_domain_config(hoodutil.get_default_domain(hoodutil.get_domains()))
-- 
GitLab