ubus-scripts: remove local declarations in main scope ref #14338
authorReidar Cederqvist <reidar.cederqvist@gmail.com>
Thu, 1 Mar 2018 09:39:10 +0000 (10:39 +0100)
committerReidar Cederqvist <reidar.cederqvist@gmail.com>
Thu, 1 Mar 2018 09:39:14 +0000 (10:39 +0100)
juci/ubus/juci.core
plugins/juci-ddns/ubus/juci.ddns
plugins/juci-diagnostics/ubus/juci.diagnostics
plugins/juci-mod-system/ubus/juci.service
plugins/juci-mod-system/ubus/juci.system
plugins/juci-mod-system/ubus/juci.unauthenticated
plugins/juci-network-netifd/ubus/juci.network
plugins/juci-sysupgrade/ubus/juci.sysupgrade

index bd6e95b..b3a6708 100755 (executable)
@@ -11,7 +11,8 @@ case "$1" in
        call)
                case "$2" in
                        default_password)
-                               local input username
+                               input=""
+                               username=""
                                read -r input
                                json_load "$input"
                                json_get_var username username
index 295e52a..15e49b7 100755 (executable)
@@ -17,7 +17,8 @@ case "$1" in
                                json_dump
                        ;;
                        status)
-                               local input service running ret file pid_line pid content
+                               input=""
+                               service=""
                                read input
                                json_load "$input"
                                json_get_var service service
@@ -32,7 +33,6 @@ case "$1" in
                                content=$(cat $file | awk "/PID '$pid' /{y=1;next}y")
                                IFS=$'\n'
                                if [ "$content" ]; then
-                                       local reload_time last_reload cur_time diff time_left ERRORS WARNINGS
                                        reload_time=$(echo "$content" | awk '/Waiting [0-9]* seconds/ {i=$4} END {print i}')
                                        last_reload=$(echo "$content" | awk -F 'at ' '/info : [RS]/ {i=$2} END {print i}')
                                        if [ "$reload_time" -a "$last_reload" ]; then
index 7e7affc..5befdce 100755 (executable)
@@ -67,9 +67,7 @@ run_cmd() {
 ifaces="ethernet vdsl adsl"
 
 get_packet_sizes () {
-       local option="$1"
-       local packetsizes
-
+       option="$1"
        packetsizes=$(uci -q get speedtest.@packetsize[0].$option)
 
        if [ "$packetsizes" ]; then
@@ -119,7 +117,7 @@ get_iface () {
        esac
 }
 
-local input
+input=""
 
 case "$1" in
        list)
@@ -134,8 +132,11 @@ case "$1" in
        call)
                case "$2" in
                        ping|ping6)
-                               local cmd=$2
-                               local host seq count timeout
+                               cmd=$2
+                               host=""
+                               seq=""
+                               count=""
+                               timeout=""
                                read input
                                json_load "$input"
                                json_get_var host host
@@ -156,8 +157,11 @@ case "$1" in
                                }
                                ;;
                        traceroute|traceroute6)
-                               local cmd=$2
-                               local host seq count timeout
+                               cmd=$2
+                               host=""
+                               seq=""
+                               count=""
+                               timeout=""
                                read input
                                json_load "$input"
                                json_get_var host host
@@ -178,7 +182,13 @@ case "$1" in
                                }
                                ;;
                        tptest_start)
-                               local host seq testmode packetsize_up packetsize_down port auto
+                               host=""
+                               seq=""
+                               testmode=""
+                               packetsize_up=""
+                               packetsize_down=""
+                               port=""
+                               auto=""
                                read input
                                json_load "$input"
                                json_get_var host host ""
index 7ef67d7..ae699aa 100755 (executable)
@@ -31,9 +31,9 @@ case "$1" in
        call)
                case "$2" in
                        list)
-                               local enabled=0
-                               local running=0
-                               local start=0
+                               enabled=0
+                               running=0
+                               start=0
 
                                json_init
                                json_add_array "services"
@@ -60,7 +60,7 @@ case "$1" in
                                [ -n "$name" ] && handle_service $2 $name
                        ;;
                        status)
-                               local running=0
+                               running=0
 
                                read input
                                json_load "$input"
index 5c24b57..74af6fa 100755 (executable)
@@ -473,7 +473,7 @@ case "$1" in
                        ;;
                        #users) for future reference
                        #       add_user(){
-                       #               local username
+                       #               username=""
                        #               config_get username "$1" username
                        #               json_add_string "" "$username"
                        #       }
index 87e3a84..5444253 100755 (executable)
@@ -11,7 +11,7 @@ case "$1" in
        call)
                case "$2" in
                        username)
-                               local username="$(uci -q get juci.login.defaultuser)"
+                               username="$(uci -q get juci.login.defaultuser)"
                                #config_load juci  // this is mutch to slow
                                #config_get username login defaultuser "user"
                                json_init
@@ -19,7 +19,7 @@ case "$1" in
                                json_dump
                        ;;
                        firmware)
-                               local firmware=$(db show | awk -F"'" '/iopVersion/ {print $2}')
+                               firmware=$(db show | awk -F"'" '/iopVersion/ {print $2}')
                                json_init
                                json_add_string firmware "$firmware"
                                json_dump
index 77341e4..660aeaa 100755 (executable)
@@ -9,7 +9,10 @@ case "$1" in
        call)
                case "$2" in
                        has_link)
-                               local input interface ifstatus up device present ret up
+                               input=""
+                               interface=""
+                               up=""
+                               device=""
                                read input;
                                json_load "$input"
                                json_get_var interface interface
@@ -47,7 +50,8 @@ case "$1" in
                                fi
                        ;;
                        ifup)
-                               local input interface
+                               input=""
+                               interface=""
                                read input;
                                json_load "$input"
                                json_get_var interface interface
@@ -98,7 +102,7 @@ case "$1" in
                                json_dump
                        ;;
                        services)
-                               local netstatlist=/tmp/netstatlist
+                               netstatlist=/tmp/netstatlist
                                netstat -plan | grep -w LISTEN | tr -d '*' > $netstatlist
                                json_init
                                json_add_array "list"
index 1bc6acd..d871efd 100755 (executable)
@@ -19,7 +19,7 @@ case "$1" in
                                json_dump
                        ;;
                        create-backup)
-                               local output=""
+                               output=""
 
                                read input
                                json_load "$input"
@@ -36,8 +36,8 @@ case "$1" in
                                json_dump                               
                        ;;
                        restore-backup)
-                               local error=""
-                               local stdout=""
+                               error=""
+                               stdout=""
 
                                read input
                                json_load "$input"