Remove double equals.

== is a bash specific alias for = , and
should not be used in #!/bin/sh scripts. Not in #!/usr/bin/haserl scripts
either, where the shell defaults to /bin/sh.

Signed-off-by: Robert Langhammer <rlanghammer@web.de>
Reviewed-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
Reviewed-by: Tim Niemeyer <tim@tn-x.org>
- rebased
Signed-off-by: Tim Niemeyer <tim@tn-x.org>
This commit is contained in:
Robert Langhammer 2018-07-26 19:22:22 +02:00 committed by Tim Niemeyer
parent 348cdbe8d3
commit 37c634ba7c
10 changed files with 40 additions and 40 deletions

View File

@ -94,10 +94,10 @@ getGatewayHoodfile() {
}
getKeyserverHoodfile() {
if [ $# == 1 ]; then
if [ $# = 1 ]; then
lat=$(uci -q get fff.system.latitude)
long=$(uci -q get fff.system.longitude)
elif [ $# == 3 ]; then
elif [ $# = 3 ]; then
lat=$2
long=$3
else

View File

@ -158,16 +158,16 @@ if [ -s "$hoodfiletmp" ]; then
exit 1
fi
# add 802.11s mesh if type == "802.11s"
if ( [ -n "$radio5" ] && [ "$mesh_type5" == "802.11s" ] ) || [ "$mesh_type2" == "802.11s" ]; then
# add 802.11s mesh if type = "802.11s"
if ( [ -n "$radio5" ] && [ "$mesh_type5" = "802.11s" ] ) || [ "$mesh_type2" = "802.11s" ]; then
if ! wifiAddMesh "$radio" "$mesh_id"; then
echo "Can't add Mesh interface on $radio."
exit 1
fi
fi
# add IBSS mesh if type == "ibss"
if ( [ -n "$radio5" ] && [ "$mesh_type5" == "ibss" ] ) || [ "$mesh_type2" == "ibss" ]; then
# add IBSS mesh if type = "ibss"
if ( [ -n "$radio5" ] && [ "$mesh_type5" = "ibss" ] ) || [ "$mesh_type2" = "ibss" ]; then
if ! wifiAddAdHocMesh "$radio" "$mesh_essid" "$mesh_bssid"; then
echo "Can't add AdHocMesh interface on $radio."
exit 1

View File

@ -15,7 +15,7 @@ json_select vpn
while json_select "$Index" > /dev/null
do
json_get_var protocol protocol
if [ "$protocol" == "fastd" ]; then
if [ "$protocol" = "fastd" ]; then
json_get_var servername name
filename="/etc/fastd/fff/peers/$servername"
echo "#name \"${servername}\";" > "$filename"

View File

@ -9,7 +9,7 @@ UPGRADE_PATH="$(getUpgradePath)"
echo -en "Content-Type: text/html\r\n\r\n"
nav_entry() {
script_file="/cgi-bin/$1"
if [ "$script_file" == "$REQUEST_URI" ] ; then
if [ "$script_file" = "$REQUEST_URI" ] ; then
local class_active=' class="active"'
fi
echo -ne "\t<li${class_active}><a href=\"${script_file}\">$2</a></li>\n\t\t"

View File

@ -5,7 +5,7 @@
. /lib/functions/fff/evalhoodinfo
# prepare
if [ "$REQUEST_METHOD" == "POST" ] ; then
if [ "$REQUEST_METHOD" = "POST" ] ; then
if [ "$POST_resethood" != "" ] ; then
# reset hood
rm "$hoodfileref" 2> /dev/null

View File

@ -2,10 +2,10 @@
<%
# write
if [ "$REQUEST_METHOD" == "POST" ] ; then
if [ "$REQUEST_METHOD" = "POST" ] ; then
#check for special characters in password
regex='^[a-zA-Z0-9!#\$%\(\)\*\+,\.:;=\?@\^_-]+$'
if [ "$POST_pass1" == "" ] ; then
if [ "$POST_pass1" = "" ] ; then
MSG='<span class="red">Das Passwort darf nicht leer sein!</span>'
elif ! echo -n "$POST_pass1" | egrep -q "$regex"; then
MSG='<span class="red">Passwort enth&auml;lt ung&uuml;ltige Zeichen!</span>'
@ -46,7 +46,7 @@ fi
<%in /www/ssl/cgi-bin/footer %>
<%
#force instant password change
if [ "$restart_uhttpd" == "1" ] ; then
if [ "$restart_uhttpd" = "1" ] ; then
/etc/init.d/uhttpd restart 2>/dev/null
fi
%>

View File

@ -3,7 +3,7 @@
<%
board_name=$(uci -q get board.model.name)
# write
if [ "$REQUEST_METHOD" == "POST" ] ; then
if [ "$REQUEST_METHOD" = "POST" ] ; then
if [ "$POST_change_mode" != "" ] ; then
sed -i '/^.*# set via WebUI/d' /etc/network.config
echo "ETHMODE=\"${POST_mode}\" # set via WebUI" >> /etc/network.config
@ -45,7 +45,7 @@ format_state() {
format_port() {
port=$(echo "$1" | sed 's/.* port:\([^ ]*\) .*/\1/')
link=$(echo "$1" | sed 's/.* link:\([^ ]*\).*/\1/')
if [ "$link" == "up" ] ; then
if [ "$link" = "up" ] ; then
speed=$(echo "$1" | sed 's/.* speed:\([^ ]*\).*/\1/')
duplex=$(echo "$1" | sed 's/.* \([^ ]*-duplex\).*/\1/')
else
@ -95,7 +95,7 @@ format_port() {
if [ ! "$(awk -F= '/WANDEV=/ { print $2 }' /etc/network.$board_name)" = "$(awk -F= '/SWITCHDEV=/ { print $2 }' /etc/network.$board_name)" ] ; then
wanif=$(uci -q get network.wan.ifname)
link=$(cat /sys/class/net/${wanif}/operstate)
if [ "$link" == "up" ] ; then
if [ "$link" = "up" ] ; then
speed="connected"
else
speed="no link"
@ -166,10 +166,10 @@ format_port() {
<th style="width: 1em;">Anschluss&nbsp;Modus:</th>
<td>
<select name="mode">
<option value="BATMAN" <% [ "$ETHMODE" == "BATMAN" ] && echo -n 'selected="selected" ' %>>BATMAN</option>
<option value="CLIENT" <% [ "$ETHMODE" == "CLIENT" ] && echo -n 'selected="selected" ' %>>CLIENT</option>
<option value="BATMAN" <% [ "$ETHMODE" = "BATMAN" ] && echo -n 'selected="selected" ' %>>BATMAN</option>
<option value="CLIENT" <% [ "$ETHMODE" = "CLIENT" ] && echo -n 'selected="selected" ' %>>CLIENT</option>
<% if grep -q "ONE_PORT" "/etc/network.$board_name" ; then %>
<option value="WAN" <% [ "$ETHMODE" == "WAN" ] && echo -n 'selected="selected" ' %>>WAN</option>
<option value="WAN" <% [ "$ETHMODE" = "WAN" ] && echo -n 'selected="selected" ' %>>WAN</option>
<% fi %>
</select>
</td>
@ -207,16 +207,16 @@ format_port() {
<tr>
<td>
<select name="mode0">
<option value="BATMAN" <% [ "$LAN0MODE" == "BATMAN" ] && echo -n 'selected="selected" ' %>>BATMAN</option>
<option value="CLIENT" <% [ "$LAN0MODE" == "CLIENT" ] && echo -n 'selected="selected" ' %>>CLIENT</option>
<option value="WAN" <% [ "$LAN0MODE" == "WAN" ] && echo -n 'selected="selected" ' %>>WAN</option>
<option value="BATMAN" <% [ "$LAN0MODE" = "BATMAN" ] && echo -n 'selected="selected" ' %>>BATMAN</option>
<option value="CLIENT" <% [ "$LAN0MODE" = "CLIENT" ] && echo -n 'selected="selected" ' %>>CLIENT</option>
<option value="WAN" <% [ "$LAN0MODE" = "WAN" ] && echo -n 'selected="selected" ' %>>WAN</option>
</select>
</td>
<td>
<select name="mode1">
<option value="BATMAN" <% [ "$LAN1MODE" == "BATMAN" ] && echo -n 'selected="selected" ' %>>BATMAN</option>
<option value="CLIENT" <% [ "$LAN1MODE" == "CLIENT" ] && echo -n 'selected="selected" ' %>>CLIENT</option>
<option value="WAN" <% [ "$LAN1MODE" == "WAN" ] && echo -n 'selected="selected" ' %>>WAN</option>
<option value="BATMAN" <% [ "$LAN1MODE" = "BATMAN" ] && echo -n 'selected="selected" ' %>>BATMAN</option>
<option value="CLIENT" <% [ "$LAN1MODE" = "CLIENT" ] && echo -n 'selected="selected" ' %>>CLIENT</option>
<option value="WAN" <% [ "$LAN1MODE" = "WAN" ] && echo -n 'selected="selected" ' %>>WAN</option>
</select>
</td>
<td><input type="submit" name="change_twoport" /></td>
@ -240,7 +240,7 @@ format_port() {
<%in /www/ssl/cgi-bin/footer %>
<%
# write
if [ "$do_reboot" == "1" ] ; then
if [ "$do_reboot" = "1" ] ; then
reboot
fi
%>

View File

@ -2,7 +2,7 @@
<%
# prepare
if [ "$REQUEST_METHOD" == "POST" ] ; then
if [ "$REQUEST_METHOD" = "POST" ] ; then
if [ "$POST_reboot" != "" ] ; then
do_reboot=1
MSG='<span class="green">Router wird neugestartet...</span>'
@ -29,7 +29,7 @@ fi
<%in /www/ssl/cgi-bin/footer %>
<%
# write
if [ "$do_reboot" == "1" ] ; then
if [ "$do_reboot" = "1" ] ; then
reboot
fi
%>

View File

@ -2,7 +2,7 @@
<%
# write
if [ "$REQUEST_METHOD" == "POST" ] ; then
if [ "$REQUEST_METHOD" = "POST" ] ; then
#check for valid hostname as specified in rfc 1123
#see http://stackoverflow.com/a/3824105
regex='^([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]{0,61}[a-zA-Z0-9])'
@ -24,7 +24,7 @@ if [ "$REQUEST_METHOD" == "POST" ] ; then
# Bitratenbegrenzung
uci -q get "fff.trafficcontrol" > /dev/null || uci -q set fff.trafficcontrol=fff
if [ "$POST_traffic_limit" == "on" ] ; then
if [ "$POST_traffic_limit" = "on" ] ; then
uci -q set "fff.trafficcontrol.enabled=1"
uci -q set "simple-tc.example.enabled=1"
else
@ -40,7 +40,7 @@ if [ "$REQUEST_METHOD" == "POST" ] ; then
# Restliche Einstellungen
uci -q set "fff.notifyupdate=webui"
if [ "$POST_upgrade_notification" == "on" ] ; then
if [ "$POST_upgrade_notification" = "on" ] ; then
uci -q set "fff.notifyupdate.value=1"
else
uci -q set "fff.notifyupdate.value=0"
@ -50,7 +50,7 @@ if [ "$REQUEST_METHOD" == "POST" ] ; then
if uci -q get system.poe_passthrough > /dev/null ; then
uci -q set "fff.poe_passthrough=fff"
if [ "$POST_poe_passthrough" == "on" ] ; then
if [ "$POST_poe_passthrough" = "on" ] ; then
uci -q set "fff.poe_passthrough.active=1"
uci -q set "system.poe_passthrough.value=1"
else
@ -70,12 +70,12 @@ fi
<%
# read
chkd='checked="checked" '
if [ "$(uci -q get 'fff.trafficcontrol.enabled')" == "1" ] ; then # not set=0
if [ "$(uci -q get 'fff.trafficcontrol.enabled')" = "1" ] ; then # not set=0
traffic_checked="$chkd"
else
traffic_checked=""
fi
if [ "$(uci -q get 'fff.notifyupdate.value')" == "0" ] ; then # not set=1
if [ "$(uci -q get 'fff.notifyupdate.value')" = "0" ] ; then # not set=1
upgrade_checked=""
else
upgrade_checked="$chkd"
@ -122,7 +122,7 @@ fi
<%
if uci -q get system.poe_passthrough > /dev/null ; then
if [ "$(uci -q get 'fff.poe_passthrough.active')" == "1" ] ; then # not set=0
if [ "$(uci -q get 'fff.poe_passthrough.active')" = "1" ] ; then # not set=0
poe_pt_checked="$chkd"
else
poe_pt_checked=""

View File

@ -2,10 +2,10 @@
<%
# prepare
if [ "$REQUEST_METHOD" == "POST" ] ; then
if [ "$REQUEST_METHOD" = "POST" ] ; then
if [ "$POST_reset" != "" ] ; then
# reset
if [ "$FORM_really_reset" == "on" ] ; then
if [ "$FORM_really_reset" = "on" ] ; then
do_reset=1
MSG='<span class="green">Router wird zur&uuml;ckgesetzt und anschlie&szlig;end neugestartet...</span>'
fi
@ -13,12 +13,12 @@ if [ "$REQUEST_METHOD" == "POST" ] ; then
# upgrade
if [ ! -f "$HASERL_firmware_path" ] ; then
MSG='<span class="red">Firmware Datei nicht gefunden!</span>'
elif [ "$(du -k "$HASERL_firmware_path" | cut -f1)" == "0" ] ; then
elif [ "$(du -k "$HASERL_firmware_path" | cut -f1)" = "0" ] ; then
MSG='<span class="red">Firmware Datei ist leer!</span>'
elif ! error=$(sysupgrade -T "$HASERL_firmware_path") ; then
MSG="<span class=\"red\">Firmware Datei ung&uuml;ltig: <tt>${error}</tt></span>"
else
if [ "$POST_keep_config" == "on" ] ; then
if [ "$POST_keep_config" = "on" ] ; then
args=""
else
args="-n"
@ -63,12 +63,12 @@ fi
<%in /www/ssl/cgi-bin/footer %>
<%
# write
if [ "$do_reset" == "1" ] ; then
if [ "$do_reset" = "1" ] ; then
echo "<pre>"
echo y | firstboot
reboot
echo "</pre>"
elif [ "$do_sysupgrade" == "1" ] ; then
elif [ "$do_sysupgrade" = "1" ] ; then
echo "<pre>"
echo "# sysupgrade $args $HASERL_firmware_path"
sysupgrade $args $HASERL_firmware_path