netifd: replace timesvr with timesrv
authorSukru Senli <sukru.senli@iopsys.eu>
Fri, 22 May 2020 14:33:04 +0000 (16:33 +0200)
committerHauke Mehrtens <hauke@hauke-m.de>
Fri, 26 Jun 2020 22:19:13 +0000 (00:19 +0200)
/lib/netifd/dhcp.script:
         Keep support for 'timesvr' while also supporting 'timesrv'
         Add log message indicating deprecation of 'timesvr'

Signed-off-by: Sukru Senli <sukru.senli@iopsys.eu>
package/network/config/netifd/files/lib/netifd/dhcp.script

index 00604f40e70e8ba988bde6af04437d326b5b548a..6585b641d6bfc5aa6acf0dd7237d7a2fadbe5e66 100755 (executable)
@@ -46,10 +46,16 @@ setup_interface () {
                proto_add_dns_search "$i"
        done
 
+       # TODO: Deprecate timesvr in favor of timesrv
+       if [ -n "$timesvr" -a -z "$timesrv" ]; then
+               timesrv="$timesvr"
+               echo "Environment variable 'timesvr' will be deprecated; use 'timesrv' instead."
+       fi
+
        proto_add_data
        [ -n "$ZONE" ]     && json_add_string zone "$ZONE"
        [ -n "$ntpsrv" ]   && json_add_string ntpserver "$ntpsrv"
-       [ -n "$timesvr" ]  && json_add_string timeserver "$timesvr"
+       [ -n "$timesrv" ]  && json_add_string timeserver "$timesrv"
        [ -n "$hostname" ] && json_add_string hostname "$hostname"
        [ -n "$message" ]  && json_add_string message "$message"
        [ -n "$timezone" ] && json_add_int timezone "$timezone"