From: Mike Engel <Mike.Engel@digi.com>
Date: Wed, 23 Jun 2021 15:11:12 +0200
Subject: [PATCH] config: add on the fly build configuration variable

This commit adds on the fly configuration to the swupdate
build system to correct an issue when using sw-description
files that support different images and installation locations.

Signed-off-by: Mike Engel <Mike.Engel@digi.com>
---
 Kconfig               | 7 +++++++
 core/network_thread.c | 4 +++-
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/Kconfig b/Kconfig
index 85fa5fd71c4c..5ad2026c675c 100644
--- a/Kconfig
+++ b/Kconfig
@@ -258,6 +258,13 @@ config FEATURE_SYSLOG
 	#  This option is auto-selected when you select any applet which may
 	#  send its output to syslog. You do not need to select it manually.
 
+config DIGI_ON_THE_FLY
+	string "Add Digi on the fly support"
+	default n
+	#help
+	# This option is used in on the fly support to skip selection
+	# verification.
+
 endmenu
 
 menu 'Build Options'
diff --git a/core/network_thread.c b/core/network_thread.c
index 88042f1238cb..4bc100055e42 100644
--- a/core/network_thread.c
+++ b/core/network_thread.c
@@ -106,7 +106,9 @@ static bool is_selection_allowed(const char *software_set, char *running_mode,
 		}
 		free(swset);
 	}
-
+#ifdef CONFIG_DIGI_ON_THE_FLY
+	allowed = true;
+#endif
 	if (allowed) {
 		INFO("Accepted selection %s,%s", software_set, running_mode);
 	}else
