[source] base-files: implement ucidef_set_hostname(), ucidef_set_ntpserver()

LEDE Commits lede-commits at lists.infradead.org
Wed May 3 04:48:06 PDT 2017


jow pushed a commit to source.git, branch master:
https://git.lede-project.org/65de093c18dab98046865c588fe7623e531f9580

commit 65de093c18dab98046865c588fe7623e531f9580
Author: Jo-Philipp Wich <jo at mein.io>
AuthorDate: Wed May 3 13:32:33 2017 +0200

    base-files: implement ucidef_set_hostname(), ucidef_set_ntpserver()
    
    Commit 2036ae4 (base-files: support hostname and ntp servers through board.d)
    was supposed to implement these procedures but lacked the required changes
    to uci-defaults.sh.
    
    Add the missing procedures now to fix config generation on targets relying
    on hostname or NTP server presetting.
    
    Fixes FS#754.
    
    Reported-by: Cristian Morales Vega <cristian at samknows.com>
    Signed-off-by: Jo-Philipp Wich <jo at mein.io>
---
 .../base-files/files/lib/functions/uci-defaults.sh   | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/package/base-files/files/lib/functions/uci-defaults.sh b/package/base-files/files/lib/functions/uci-defaults.sh
index 9fad189..f5e8ebe 100755
--- a/package/base-files/files/lib/functions/uci-defaults.sh
+++ b/package/base-files/files/lib/functions/uci-defaults.sh
@@ -619,6 +619,26 @@ ucidef_add_gpio_switch() {
 	json_select ..
 }
 
+ucidef_set_hostname() {
+	local hostname="$1"
+
+	json_select_object system
+		json_add_string hostname "$hostname"
+	json_select ..
+}
+
+ucidef_set_ntpserver() {
+	local server
+
+	json_select_object system
+		json_select_array ntpserver
+			for server in "$@"; do
+				json_add_string "" "$server"
+			done
+		json_select ..
+	json_select ..
+}
+
 board_config_update() {
 	json_init
 	[ -f ${CFG} ] && json_load "$(cat ${CFG})"



More information about the lede-commits mailing list