From 20940138ac41e3eca54afefc34f65e40834be3ea Mon Sep 17 00:00:00 2001 From: John Crispin Date: Tue, 14 Oct 2014 12:21:11 +0000 Subject: scripts: fix wrong usage of '==' operator [base-files] shell-scripting: fix wrong usage of '==' operator normally the '==' is used for invoking a regex parser and is a bashism. all of the fixes just want to compare a string. the used busybox-ash will silently "ignore" this mistake, but make it portable/clean at least. this patch does not change the behavior/logic of the scripts. Signed-off-by: Bastian Bittorf SVN-Revision: 42911 --- .../base-files/etc/uci-defaults/03_network-switchX-migration | 2 +- target/linux/ar71xx/base-files/etc/uci-defaults/04_led_migration | 4 ++-- target/linux/brcm2708/image/gen_rpi_sdcard_img.sh | 2 +- .../brcm47xx/base-files/lib/preinit/15_set_preinit_interface_brcm | 2 +- .../linux/ixp4xx/base-files/lib/preinit/05_set_ether_mac_ixp4xx | 8 ++++---- target/linux/ramips/base-files/etc/hotplug.d/usb/10-motion | 2 +- target/linux/ramips/base-files/lib/preinit/04_handle_checksumming | 2 +- target/linux/sunxi/image/gen_sunxi_sdcard_img.sh | 2 +- target/linux/x86_64/image/gen_image_generic.sh | 2 +- 9 files changed, 13 insertions(+), 13 deletions(-) (limited to 'target/linux') diff --git a/target/linux/ar71xx/base-files/etc/uci-defaults/03_network-switchX-migration b/target/linux/ar71xx/base-files/etc/uci-defaults/03_network-switchX-migration index 31ce548cdf..d9aa51989a 100755 --- a/target/linux/ar71xx/base-files/etc/uci-defaults/03_network-switchX-migration +++ b/target/linux/ar71xx/base-files/etc/uci-defaults/03_network-switchX-migration @@ -34,7 +34,7 @@ migrate_switch_name() { config_foreach do_change_switch_name switch name $oldname $newname config_foreach do_change_switch_name switch_vlan device $oldname $newname - [ "$SWITCH_NAME_CHANGED" == "1" ] && { + [ "$SWITCH_NAME_CHANGED" = "1" ] && { logger -t migrate-switchX "Switch names updated, saving network configuration" uci commit network } diff --git a/target/linux/ar71xx/base-files/etc/uci-defaults/04_led_migration b/target/linux/ar71xx/base-files/etc/uci-defaults/04_led_migration index 0fc632c689..0df94a01c0 100755 --- a/target/linux/ar71xx/base-files/etc/uci-defaults/04_led_migration +++ b/target/linux/ar71xx/base-files/etc/uci-defaults/04_led_migration @@ -26,7 +26,7 @@ do_led_update_sysfs() new_sysfs=$(echo ${sysfs} | sed "s/${old}/${new}/") - [ "${new_sysfs}" == "${sysfs}" ] && continue + [ "$new_sysfs" = "$sysfs" ] && continue uci set system.${cfg}.sysfs="${new_sysfs}" LED_OPTIONS_CHANGED=1 @@ -80,6 +80,6 @@ wnr612-v2) ;; esac -[ "$LED_OPTIONS_CHANGED" == "1" ] && uci commit system +[ "$LED_OPTIONS_CHANGED" = "1" ] && uci commit system exit 0 diff --git a/target/linux/brcm2708/image/gen_rpi_sdcard_img.sh b/target/linux/brcm2708/image/gen_rpi_sdcard_img.sh index 1b7e65ea52..ffe01fa32c 100755 --- a/target/linux/brcm2708/image/gen_rpi_sdcard_img.sh +++ b/target/linux/brcm2708/image/gen_rpi_sdcard_img.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash set -x -[ $# == 5 ] || { +[ $# -eq 5 ] || { echo "SYNTAX: $0 " exit 1 } diff --git a/target/linux/brcm47xx/base-files/lib/preinit/15_set_preinit_interface_brcm b/target/linux/brcm47xx/base-files/lib/preinit/15_set_preinit_interface_brcm index aab50bf1a9..f40e160b3b 100644 --- a/target/linux/brcm47xx/base-files/lib/preinit/15_set_preinit_interface_brcm +++ b/target/linux/brcm47xx/base-files/lib/preinit/15_set_preinit_interface_brcm @@ -11,6 +11,6 @@ preinit_ip() { ifconfig $pi_ifname $pi_ip netmask $pi_netmask broadcast $pi_broadcast up local try=0; - while [ $((try++)) -le 5 ] && [ ! $(cat /sys/class/net/$pi_ifname/operstate) == "up" ]; do sleep 1; done + while [ $((try++)) -le 5 ] && [ ! "$(cat /sys/class/net/$pi_ifname/operstate)" = "up" ]; do sleep 1; done } } diff --git a/target/linux/ixp4xx/base-files/lib/preinit/05_set_ether_mac_ixp4xx b/target/linux/ixp4xx/base-files/lib/preinit/05_set_ether_mac_ixp4xx index e707dabf05..adda197b59 100644 --- a/target/linux/ixp4xx/base-files/lib/preinit/05_set_ether_mac_ixp4xx +++ b/target/linux/ixp4xx/base-files/lib/preinit/05_set_ether_mac_ixp4xx @@ -6,7 +6,7 @@ set_ether_mac() { for npe in eth0 eth1 eth2 do - if [ "$(ifconfig $npe 2>/dev/null | grep -c 00:00:00:00:00:00)" == "1" ]; then + if [ "$(ifconfig $npe 2>/dev/null | grep -c 00:00:00:00:00:00)" = "1" ]; then ifconfig $npe hw ether $(fconfig -s -r -d /dev/$RB_CONFIG -n npe_"$npe"_esa) fi done @@ -14,16 +14,16 @@ set_ether_mac() { # Some developers should be shot on sight at Zcom/Netgear # -- Fixup for the WG302v1, need someone with a WAG302v1 to fix that, too - if [ "$(ifconfig eth0 2>/dev/null | grep -c 00:00:00:00:00:00)" == "1" ]; then + if [ "$(ifconfig eth0 2>/dev/null | grep -c 00:00:00:00:00:00)" = "1" ]; then ifconfig eth0 hw ether $(fconfig -s -r -d /dev/$RB_CONFIG -n zcom_npe_esa) fi # Others (*cough*, Tonze) are dumb enough to not handle mac addresses at all - if [ "$(ifconfig eth0 2>/dev/null | grep -c 00:00:00:00:00:00)" == "1" ]; then + if [ "$(ifconfig eth0 2>/dev/null | grep -c 00:00:00:00:00:00)" = "1" ]; then ifconfig eth0 hw ether 00:11:22:33:44:55 fi - if [ "$(ifconfig eth1 2>/dev/null | grep -c 00:00:00:00:00:00)" == "1" ]; then + if [ "$(ifconfig eth1 2>/dev/null | grep -c 00:00:00:00:00:00)" = "1" ]; then ifconfig eth1 hw ether 00:11:22:33:44:56 fi } diff --git a/target/linux/ramips/base-files/etc/hotplug.d/usb/10-motion b/target/linux/ramips/base-files/etc/hotplug.d/usb/10-motion index 557698b1a2..e96acc8501 100644 --- a/target/linux/ramips/base-files/etc/hotplug.d/usb/10-motion +++ b/target/linux/ramips/base-files/etc/hotplug.d/usb/10-motion @@ -1 +1 @@ -[ "$ACTION" == "motion" ] && logger webcam motion event +[ "$ACTION" = "motion" ] && logger webcam motion event diff --git a/target/linux/ramips/base-files/lib/preinit/04_handle_checksumming b/target/linux/ramips/base-files/lib/preinit/04_handle_checksumming index fd06d20c99..057fe45444 100644 --- a/target/linux/ramips/base-files/lib/preinit/04_handle_checksumming +++ b/target/linux/ramips/base-files/lib/preinit/04_handle_checksumming @@ -44,7 +44,7 @@ do_checksumming_disable() { local rootfs_data_len=$(grep \"rootfs_data\" /proc/mtd | awk -F' ' '{print "0x"$2}') local offset=$(echo "$rootfs_len $rootfs_data_len 0x40" | awk -F' ' '{printf "%i",$1-$2-$3}') local signature=$(dd if=$rootfs_mtd skip=$offset bs=1 count=4 2>/dev/null | hexdump -v -n 4 -e '1/1 "%02x"') - if [ "$signature" == "27051956" ]; then + if [ "$signature" = "27051956" ]; then dd conv=notrunc if=$rootfs_mtd skip=$offset of=$firmware_mtd bs=1 count=64 2>/dev/null fi ;; diff --git a/target/linux/sunxi/image/gen_sunxi_sdcard_img.sh b/target/linux/sunxi/image/gen_sunxi_sdcard_img.sh index 06957a5aec..2a09306af6 100755 --- a/target/linux/sunxi/image/gen_sunxi_sdcard_img.sh +++ b/target/linux/sunxi/image/gen_sunxi_sdcard_img.sh @@ -8,7 +8,7 @@ # set -x -[ $# == 6 ] || { +[ $# -eq 6 ] || { echo "SYNTAX: $0 " exit 1 } diff --git a/target/linux/x86_64/image/gen_image_generic.sh b/target/linux/x86_64/image/gen_image_generic.sh index 9d11efbb05..b4bf901fb4 100755 --- a/target/linux/x86_64/image/gen_image_generic.sh +++ b/target/linux/x86_64/image/gen_image_generic.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash # Copyright (C) 2006-2012 OpenWrt.org set -x -[ $# == 5 -o $# == 6 ] || { +[ $# -eq 5 -o $# -eq 6 ] || { echo "SYNTAX: $0 []" exit 1 } -- cgit v1.2.3