[pisa-src] r1201 - in trunk/tools: auto-handover-tablet.sh auto-handover.sh autoupdater.sh create-screenrc.sh trigger-demo-update.sh

  • From: Diego Biurrun <diego@xxxxxxxxxx>
  • To: pisa-src@xxxxxxxxxxxxx
  • Date: Thu, 15 Oct 2009 19:59:41 +0200

Author: biurrun
Date: Thu Oct 15 19:59:41 2009
New Revision: 1201

Log:
cosmetics: Fix indentation and ugly formatting.

Modified:
   trunk/tools/auto-handover-tablet.sh
   trunk/tools/auto-handover.sh
   trunk/tools/autoupdater.sh
   trunk/tools/create-screenrc.sh
   trunk/tools/trigger-demo-update.sh

Modified: trunk/tools/auto-handover-tablet.sh
==============================================================================
--- trunk/tools/auto-handover-tablet.sh Thu Oct 15 19:51:52 2009        (r1200)
+++ trunk/tools/auto-handover-tablet.sh Thu Oct 15 19:59:41 2009        (r1201)
@@ -1,6 +1,6 @@
-#!/bin/bash  
+#!/bin/bash
 
-echo "This file searches APs with SSID $PATTERN* and switches to the strongest 
signal" 
+echo "This file searches APs with SSID $PATTERN* and switches to the strongest 
signal"
 
 
 #your parameters
@@ -27,22 +27,16 @@
 
 
 fail_counter=0
-while [ 1 ]
-do
-
+while [ 1 ]; do
 
 result=($(iwlist $WIFI_IF scanning | ./iwlist_parser -s $PATTERN))
 
-
-
-if [ "${result[0]}" == "NONE" ]
-then
+if [ "${result[0]}" == "NONE" ]; then
         echo "No PISA access points nearby"
         fail_counter=$(($fail_counter+1))
-        echo "Increasing module fail counter $fail_counter"     
+        echo "Increasing module fail counter $fail_counter"
         last_result=${result[0]}
-        if [ "$fail_counter" == "5" ]
-        then
+        if [ "$fail_counter" == "5" ]; then
                 echo "Restarting kernel modules"
                 rmmod ath9k
                 modprobe ath9k
@@ -53,8 +47,7 @@
         sleep 1
 else
         fail_counter=0
-        if [ "$last_result" != "${result[0]}" ]
-        then
+        if [ "$last_result" != "${result[0]}" ]; then
                 echo "Changing to " ${result[1]}
                 #echo iwconfig $WIFI_IF ap  ${result[0]} essid  ${result[1]}
                 #iwconfig $WIFI_IF ap  ${result[0]} essid  ${result[1]}
@@ -62,8 +55,7 @@
                 iwconfig $WIFI_IF  essid  ${result[1]}
                 arp -d $AP_IP 2> /dev/null
 
-                if [ "$last_result" = "NONE" ]
-                then
+                if [ "$last_result" = "NONE" ]; then
                         ifconfig $WIFI_IF $IP
                 fi
 
@@ -75,4 +67,5 @@
         fi
 
 fi
+
 done

Modified: trunk/tools/auto-handover.sh
==============================================================================
--- trunk/tools/auto-handover.sh        Thu Oct 15 19:51:52 2009        (r1200)
+++ trunk/tools/auto-handover.sh        Thu Oct 15 19:59:41 2009        (r1201)
@@ -1,12 +1,11 @@
-#!/bin/bash  
+#!/bin/bash
 
-echo "This file searches APs with SSID $PATTERN* and switches to the strongest 
signal" 
+echo "This file searches APs with SSID $PATTERN* and switches to the strongest 
signal"
 
 # read config file
-if [ ! -e "pisa_scripts.conf" ]
-then
-       echo "ERROR: "$PWD"/pisa_scripts.conf not found!"
-       exit 1
+if [ ! -e "pisa_scripts.conf" ]; then
+    echo "ERROR: "$PWD"/pisa_scripts.conf not found!"
+    exit 1
 fi
 
 . pisa_scripts.conf
@@ -15,36 +14,32 @@
 ## internal parameters
 last_result="NONE"
 
-while [ 1 ]
-do
+while [ 1 ]; do
     result=($(iwlist $WIFI_IF scan | ./iwlist_parser -s $PATTERN))
 
-    if [ "${result[0]}" == "NONE" ]
-    then
-       echo "No PISA access points nearby"
-    else 
-       if [ "$last_result" != "${result[0]}" ]
-       then
-               echo "Changing to " ${result[1]}
-               iwconfig $WIFI_IF ap  ${result[0]} essid  ${result[1]}
-
-               if [ "$last_result" = "NONE" ]
-               then
-                       ifconfig $WIFI_IF $IP netmask $NETMASK
-                       route add default gw $AP_IP $WIFI_IF
-                       route del default eth0
-               else
-                       arp -d $AP_IP 2> /dev/null                      
-               fi
-
-               last_result=${result[0]}
-
-               # We don't want to change AP immediately, do we!?
-               sleep 10
-       else
-               echo "Access Point is still best"
-               # Let's check for better AP after a short delay
-               sleep 1
-       fi
+    if [ "${result[0]}" == "NONE" ]; then
+        echo "No PISA access points nearby"
+    else
+        if [ "$last_result" != "${result[0]}" ]; then
+            echo "Changing to " ${result[1]}
+            iwconfig $WIFI_IF ap  ${result[0]} essid  ${result[1]}
+
+            if [ "$last_result" = "NONE" ]; then
+                ifconfig $WIFI_IF $IP netmask $NETMASK
+                route add default gw $AP_IP $WIFI_IF
+                route del default eth0
+            else
+                arp -d $AP_IP 2> /dev/null
+            fi
+
+            last_result=${result[0]}
+
+            # We don't want to change AP immediately, do we!?
+            sleep 10
+        else
+            echo "Access Point is still best"
+            # Let's check for better AP after a short delay
+            sleep 1
+        fi
     fi
 done

Modified: trunk/tools/autoupdater.sh
==============================================================================
--- trunk/tools/autoupdater.sh  Thu Oct 15 19:51:52 2009        (r1200)
+++ trunk/tools/autoupdater.sh  Thu Oct 15 19:59:41 2009        (r1201)
@@ -8,8 +8,7 @@
 #### CONFIG ####
 
 # read config file
-if [ ! -e "$PWD/pisa_scripts.conf" ]
-then
+if [ ! -e "$PWD/pisa_scripts.conf" ]; then
         echo "ERROR: "$PWD"/pisa_scripts.conf not found!"
         exit 1
 fi
@@ -58,20 +57,16 @@
 TMP_DIR=$PWD
 cd $BASE_DIR
 
-for FILE in $HIPL_FILES
-do
+for FILE in $HIPL_FILES; do
        echo "get "$REMOTE_HIPL_DIR$FILE" "$BASE_DIR >> files_to_copy
 done
 
-for FILE in $PISA_FILES
-do
+for FILE in $PISA_FILES; do
        echo "get "$REMOTE_PISA_DIR$FILE" "$BASE_DIR >> files_to_copy
 done
 
-for FILE in $CUSTOM_FILES
-do
-       if [ ! -e "$BASE_DIR$FILE" ]
-       then
+for FILE in $CUSTOM_FILES; do
+       if [ ! -e "$BASE_DIR$FILE" ]; then
                echo "get "$REMOTE_CUSTOM_DIR$FILE" "$BASE_DIR >> files_to_copy
        else
                echo "Local config file "$BASE_DIR$FILE" already exists. 
Skipping!"

Modified: trunk/tools/create-screenrc.sh
==============================================================================
--- trunk/tools/create-screenrc.sh      Thu Oct 15 19:51:52 2009        (r1200)
+++ trunk/tools/create-screenrc.sh      Thu Oct 15 19:59:41 2009        (r1201)
@@ -1,11 +1,10 @@
 #!/bin/sh
 
-if [ ! -e "$PWD/pisa_scripts.conf" ]
-then
+if [ ! -e "$PWD/pisa_scripts.conf" ]; then
         echo "ERROR: "$PWD"/pisa_scripts.conf not found!"
         exit 1
 fi
-                
+
 . $PWD"/pisa_scripts.conf"
 
 

Modified: trunk/tools/trigger-demo-update.sh
==============================================================================
--- trunk/tools/trigger-demo-update.sh  Thu Oct 15 19:51:52 2009        (r1200)
+++ trunk/tools/trigger-demo-update.sh  Thu Oct 15 19:59:41 2009        (r1201)
@@ -4,8 +4,7 @@
 # It is supposed to be used in combination with pisabeacon
 
 # read config file
-if [ ! -e "$PWD/pisa_scripts.conf" ]
-then
+if [ ! -e "$PWD/pisa_scripts.conf" ]; then
         echo "ERROR: "$PWD"/pisa_scripts.conf not found!"
         exit 1
 fi
@@ -13,7 +12,7 @@
 . $PWD"/pisa_scripts.conf"
 
 # check for curl
-if which curl >/dev/null; then
+if which curl > /dev/null; then
     echo "GOOD: curl found"
 else
     echo "ERROR: curl NOT found! Install curl: apt-get install curl"
@@ -23,7 +22,8 @@
 
 #echo "Fast switches are not supported. Wait at least 10 s before switching 
back"
 
-update_geo_id (){
+update_geo_id ()
+{
 curl --fail --connect-timeout 3  $GEO_URL$1 > /dev/null  2>&1  &
 }
 
@@ -40,6 +40,6 @@
 $(sleep 1; update_hip) &
 
 echo "Associated with $1"
-$(sleep 4; update_geo_id $1 )&
+$(sleep 4; update_geo_id $1) &
 
 echo Done

Other related posts:

  • » [pisa-src] r1201 - in trunk/tools: auto-handover-tablet.sh auto-handover.sh autoupdater.sh create-screenrc.sh trigger-demo-update.sh - Diego Biurrun