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 <bittorf@bluebottle.com>

SVN-Revision: 42911
This commit is contained in:
John Crispin
2014-10-14 12:21:11 +00:00
parent 8267c0e2ac
commit 20940138ac
23 changed files with 35 additions and 35 deletions

View File

@@ -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
}

View File

@@ -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

View File

@@ -1,7 +1,7 @@
#!/usr/bin/env bash
set -x
[ $# == 5 ] || {
[ $# -eq 5 ] || {
echo "SYNTAX: $0 <file> <bootfs image> <rootfs image> <bootfs size> <rootfs size>"
exit 1
}

View File

@@ -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
}
}

View File

@@ -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
}

View File

@@ -1 +1 @@
[ "$ACTION" == "motion" ] && logger webcam motion event
[ "$ACTION" = "motion" ] && logger webcam motion event

View File

@@ -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
;;

View File

@@ -8,7 +8,7 @@
#
set -x
[ $# == 6 ] || {
[ $# -eq 6 ] || {
echo "SYNTAX: $0 <file> <bootfs image> <rootfs image> <bootfs size> <rootfs size> <u-boot image>"
exit 1
}

View File

@@ -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 <file> <kernel size> <kernel directory> <rootfs size> <rootfs image> [<align>]"
exit 1
}