base-files: uci-defaults-new: don't store switch attr numbers as strings
authorJo-Philipp Wich <jow@openwrt.org>
Wed, 25 Nov 2015 15:43:15 +0000 (15:43 +0000)
committerJo-Philipp Wich <jow@openwrt.org>
Wed, 25 Nov 2015 15:43:15 +0000 (15:43 +0000)
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
SVN-Revision: 47643

package/base-files/files/lib/functions/uci-defaults-new.sh

index 6a8b6b9029d29674993e780b56f24a1b3cf58f17..64241d5a5e6776ae77073c9c07dafe29cc77125f 100755 (executable)
@@ -91,11 +91,14 @@ ucidef_add_switch_attr() {
        local val=$3
 
        json_select_object switch
-
        json_select_object $name
-       json_add_string $key $val
-       json_select ..
 
+       case "$val" in
+               [0-9]) json_add_int "$key" "$val" ;;
+               *) json_add_string "$key" "$val" ;;
+       esac
+
+       json_select ..
        json_select ..
 }