diff --git a/bsp/default/root_file_system/etc/configurator.sh b/bsp/default/root_file_system/etc/configurator.sh index 4dd6237a..9f51b3d1 100644 --- a/bsp/default/root_file_system/etc/configurator.sh +++ b/bsp/default/root_file_system/etc/configurator.sh @@ -28,13 +28,13 @@ fi API_RETRY=$(($API_RETRY - 1)) -if [[ $API_IPV4_ADRESS != "1" ]]; then +if [ "$API_IPV4_ADRESS" != "1" ]; then netmon_api=$API_IPV4_ADRESS else netmon_api="[$API_IPV6_ADRESS"%"$API_IPV6_INTERFACE]" fi -if [ $SCRIPT_ERROR_LEVEL -gt "1" ]; then +if [ "$SCRIPT_ERROR_LEVEL" -gt "1" ]; then err() { echo "$(date) [configurator]: $1" >> $SCRIPT_LOGFILE } @@ -59,7 +59,7 @@ sync_hostname() { #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])' regex=$regex'(\.([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]{0,61}[a-zA-Z0-9]))*$' - if [ ${#netmon_hostname} -le 255 ]; then + if [ "${#netmon_hostname}" -le "255" ]; then if echo -n $netmon_hostname | egrep -q "$regex"; then if [ "$netmon_hostname" != "`cat /proc/sys/kernel/hostname`" ]; then err "Setting new hostname: $netmon_hostname" @@ -140,7 +140,7 @@ autoadd_ipv6_address() { err "IPv6 Autoadd has been disabled cause it is no longer necesarry" else routerid=${ergebnis##*,} - if [ "$routerid" == "$CRAWL_ROUTER_ID" ]; then + if [ "$routerid" = "$CRAWL_ROUTER_ID" ]; then err "The IPv6 address already exists in Netmon on this router. Maybe because of a previos assignment" uci set configurator.@netmon[0].autoadd_ipv6_address='0' uci commit @@ -151,12 +151,12 @@ autoadd_ipv6_address() { fi } -if [ $CRAWL_METHOD == "login" ]; then +if [ "$CRAWL_METHOD" = "login" ]; then err "Authentification method is: username and passwort" -elif [ $CRAWL_METHOD == "hash" ]; then +elif [ "$CRAWL_METHOD" = "hash" ]; then err "Authentification method: autoassign and hash" err "Checking if the router is already assigned to a router in Netmon" - if [ $CRAWL_UPDATE_HASH == "1" ]; then + if [ "$CRAWL_UPDATE_HASH" = "1" ]; then err "The router is not assigned to a router in Netmon" err "Trying to assign the router" assign_router @@ -165,10 +165,10 @@ elif [ $CRAWL_METHOD == "hash" ]; then fi fi -if [[ $AUTOADD_IPV6_ADDRESS = "1" ]]; then +if [ "$AUTOADD_IPV6_ADDRESS" = "1" ]; then autoadd_ipv6_address fi -if [[ $SCRIPT_SYNC_HOSTNAME = "1" ]]; then +if [ "$SCRIPT_SYNC_HOSTNAME" = "1" ]; then sync_hostname fi diff --git a/bsp/default/root_file_system/etc/fastdstart.sh.tpl b/bsp/default/root_file_system/etc/fastdstart.sh.tpl index 46b5d07a..46c0e093 100755 --- a/bsp/default/root_file_system/etc/fastdstart.sh.tpl +++ b/bsp/default/root_file_system/etc/fastdstart.sh.tpl @@ -8,7 +8,7 @@ project="${VPN_PROJECT}" test_internet_host1="mastersword.de" test_internet_host2="109.163.229.254" -if [ "$SERVER" == "no" ]; then +if [ "$SERVER" = "no" ]; then test -f /tmp/started || exit fi @@ -17,14 +17,14 @@ if ping -w5 -c3 "$test_internet_host1" &>/dev/null || ping -w5 -c3 "$test_internet_host2" &>/dev/null || ping6 -w5 -c3 heise.de &>/dev/null; then mac=$(awk '{ mac=toupper($1); gsub(":", "", mac); print mac }' /sys/class/net/br-mesh/address 2>/dev/null) - if [ "$SERVER" == "no" ]; then + if [ "$SERVER" = "no" ]; then hostname=$(cat /proc/sys/kernel/hostname) - if [ "$hostname" == "OpenWrt" ]; then + if [ "$hostname" = "OpenWrt" ]; then hostname="" fi - if [ "$hostname" == "" ]; then + if [ "$hostname" = "" ]; then hostname=$mac fi else @@ -68,7 +68,7 @@ if ping -w5 -c3 "$test_internet_host1" &>/dev/null || # fire up - if [ "$(/sbin/ifconfig -a | grep -i ethernet | grep $project)" == "" ]; then + if [ "$(/sbin/ifconfig -a | grep -i ethernet | grep $project)" = "" ]; then /bin/rm /var/run/fastd.$project.pid fastd -c /etc/fastd/$project/$project.conf -d --pid-file /var/run/fastd.$project.pid fi diff --git a/bsp/default/root_file_system/etc/wlanwatchdog.sh b/bsp/default/root_file_system/etc/wlanwatchdog.sh index ebf7200e..d1737f3a 100755 --- a/bsp/default/root_file_system/etc/wlanwatchdog.sh +++ b/bsp/default/root_file_system/etc/wlanwatchdog.sh @@ -126,7 +126,7 @@ fsm_entry() { scan_wlan ;; error) - if [ -n "$DEBUG" ] && [ $DEBUG -eq 1 ]; then + if [ -n "$DEBUG" ] && [ "$DEBUG" -eq "1" ]; then debug_output | gzip > ${DEBUGFILE} fi reboot @@ -140,28 +140,28 @@ fsm_transition() { local OLDSTATE=$STATE case $STATE in working) - if [ $(count_neighbours) -eq 0 ] && [ $(count_clients) -eq 0 ]; then + if [ "$(count_neighbours)" -eq "0" ] && [ "$(count_clients)" -eq "0" ]; then STATE=pending fi ;; pending) - if [ $AGE -ge $TIMEOUT_MEDIUM ]; then + if [ "$AGE" -ge "$TIMEOUT_MEDIUM" ]; then STATE=error - elif [ $(count_originators) -eq 0 ] && [ $AGE -ge $TIMEOUT_SHORT ]; then + elif [ "$(count_originators)" -eq "0" ] && [ "$AGE" -ge "$TIMEOUT_SHORT" ]; then STATE=error - elif [ $(count_neighbours) -gt 0 ] || [ $(count_clients) -gt 0 ]; then + elif [ "$(count_neighbours)" -gt "0" ] || [ "$(count_clients)" -gt "0" ]; then STATE=working fi ;; *) - if [ $AGE -ge $TIMEOUT_LONG ]; then + if [ "$AGE" -ge "$TIMEOUT_LONG" ]; then STATE=error - elif [ $(count_neighbours) -gt 0 ] || [ $(count_clients) -gt 0 ]; then + elif [ "$(count_neighbours)" -gt "0" ] || [ "$(count_clients)" -gt "0" ]; then STATE=working fi ;; esac - if [ ! "$OLDSTATE" == "$STATE" ]; then + if [ ! "$OLDSTATE" = "$STATE" ]; then echo "$(date) '$OLDSTATE' -> '$STATE'" fsm_entry fi