summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJo-Philipp Wich <jo@mein.io>2017-05-03 13:32:33 +0200
committerJo-Philipp Wich <jo@mein.io>2017-05-03 13:48:44 +0200
commit0c8f72639ff018510974dc3c4059ad23a5c5c358 (patch)
tree8268c2505898b1c3d1780342dd2dd89ac2b79f6d
parenteb11207397fe39ab37407ceeafb94b340d05a9e9 (diff)
downloadmtk-20170518-0c8f72639ff018510974dc3c4059ad23a5c5c358.zip
mtk-20170518-0c8f72639ff018510974dc3c4059ad23a5c5c358.tar.gz
mtk-20170518-0c8f72639ff018510974dc3c4059ad23a5c5c358.tar.bz2
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@samknows.com> Signed-off-by: Jo-Philipp Wich <jo@mein.io>
-rwxr-xr-xpackage/base-files/files/lib/functions/uci-defaults.sh20
1 files changed, 20 insertions, 0 deletions
diff --git a/package/base-files/files/lib/functions/uci-defaults.sh b/package/base-files/files/lib/functions/uci-defaults.sh
index 3500d49..06004c3 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})"