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

  • From: René Hummen <rene.hummen@xxxxxxxxxxxxxx>
  • To: pisa-src@xxxxxxxxxxxxx
  • Date: Thu, 15 Oct 2009 16:38:03 +0200

Author: hummen
Date: Thu Oct 15 16:38:03 2009
New Revision: 1175

Log:
moved script settings into separate config file

Added:
   trunk/tools/pisa_scripts.conf
Modified:
   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.sh
==============================================================================
--- trunk/tools/auto-handover.sh        Thu Oct 15 16:22:16 2009        (r1174)
+++ trunk/tools/auto-handover.sh        Thu Oct 15 16:38:03 2009        (r1175)
@@ -2,13 +2,15 @@
 
 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
+fi
+
+source pisa_scripts.conf
 
-#your parameters
-WIFI_IF="wlan0"
-PATTERN="pisa-testbed"
-AP_IP="192.168.8.1"
-IP="192.168.8.123"
-NETMASK="255.255.255.0"
 
 ## internal parameters
 last_result="NONE"

Modified: trunk/tools/autoupdater.sh
==============================================================================
--- trunk/tools/autoupdater.sh  Thu Oct 15 16:22:16 2009        (r1174)
+++ trunk/tools/autoupdater.sh  Thu Oct 15 16:38:03 2009        (r1175)
@@ -1,28 +1,33 @@
-#!/bin/sh
+#!/bin/bash
 #author: Rene Hummen <rene.hummen@xxxxxxxxxxxxxxxxx>
 
 # This script provides auto-update functionality for the HIPL and PISA binaries
 # as well as for the PISA config files. The files are copied into a seperate
-# directory LOCAL_DIR and should be run from there.
+# directory BASE_DIR and should be run from there.
 
 #### CONFIG ####
-#Set your LuFG username here
-USER="root"
-SERVER="morpheus.informatik.rwth-aachen.de"
-PK=""
+
+# read config file
+if [ ! -e "$PWD/pisa_scripts.conf" ]
+then
+        echo "ERROR: "$PWD"/pisa_scripts.conf not found!"
+        exit 1
+fi
+
+source $PWD"/pisa_scripts.conf"
+
 # we need the fully qualified path
-REMOTE_DIR="/root/pisa_demo/"
 REMOTE_HIPL_DIR=$REMOTE_DIR"hipl--midauth2--2.6/"
 REMOTE_PISA_DIR=$REMOTE_DIR"pisa/trunk/"
 REMOTE_CUSTOM_DIR=$REMOTE_DIR"pisa_custom/"
-LOCAL_DIR=$HOME"/pisa_testbed/"
 
 HIPL_FILES="hipd/hipd tools/hipconf firewall/hipfw"
 PISA_FILES="pisacd/pisacd pisasd/pisasd pisabeacon/pisabeacon tools/msleep"
-PISA_FILES=$PISA_FILES" tools/iwlist_parser"
+PISA_FILES=$PISA_FILES" tools/trigger-hipupdate.sh 
tools/trigger-demo-update.sh"
+PISA_FILES=$PISA_FILES" tools/iwlist_parser tools/auto-handover.sh"
+PISA_FILES=$PISA_FILES" tools/create-screenrc.sh tools/autoupdater.sh"
 # These files might need modifications for your scenario
-CUSTOM_FILES="trigger-hipupdate.sh trigger-demo-update.sh switch-ip 
pisacd.conf"
-CUSTOM_FILES=$CUSTOM_FILES" auto-handover.sh autoupdater.sh"
+CUSTOM_FILES="pisa_scripts.conf pisacd.conf switch-ip"
 
 
 #### DON'T CHANGE BELOW ####
@@ -33,7 +38,7 @@
 echo
 echo "--- autoupdater for hipl and pisa binaries/configs ---"
 echo
-echo "files will be placed in: "$LOCAL_DIR
+echo "files will be placed in: "$BASE_DIR
 echo
 
 # Read user name if not set already
@@ -44,41 +49,44 @@
 fi
 
 # Create required directory structure
-if [ ! -d "$LOCAL_DIR" ]; then
-     echo "Directory $LOCAL_DIR does not exist. Creating directory.";
-     mkdir $LOCAL_DIR
+if [ ! -d "$BASE_DIR" ]; then
+     echo "Directory $BASE_DIR does not exist. Creating directory.";
+     mkdir $BASE_DIR
 fi
 
 #Change to target dir
 TMP_DIR=$PWD
-cd $LOCAL_DIR
+cd $BASE_DIR
 
 for FILE in $HIPL_FILES
 do
-       echo "get "$REMOTE_HIPL_DIR$FILE" "$LOCAL_DIR >> files_to_copy
+       echo "get "$REMOTE_HIPL_DIR$FILE" "$BASE_DIR >> files_to_copy
 done
 
 for FILE in $PISA_FILES
 do
-       echo "get "$REMOTE_PISA_DIR$FILE" "$LOCAL_DIR >> files_to_copy
+       echo "get "$REMOTE_PISA_DIR$FILE" "$BASE_DIR >> files_to_copy
 done
 
 for FILE in $CUSTOM_FILES
 do
-       echo "get "$REMOTE_CUSTOM_DIR$FILE" "$LOCAL_DIR >> files_to_copy
+       if [ ! -e "$BASE_DIR$FILE" ]
+       then
+               echo "get "$REMOTE_CUSTOM_DIR$FILE" "$BASE_DIR >> files_to_copy
+       fi
 done
 
 # We want to exit the sftp client, right!?
 echo "exit" >> files_to_copy
 
 # check for ssh public key
-if [ "$PK" = "" ] || [ ! -e "$HOME/.ssh/$PK" ]; then
+if [ "$PUBLIC_KEY" = "" ] || [ ! -e "$HOME/.ssh/$PUBLIC_KEY" ]; then
     echo "No public key found. You will be asked for your login password."
     echo
 else
-    echo "public key found: "$PK;
+    echo "public key found: "$PUBLIC_KEY;
     echo
-    PK_OPTION="-o IdentityFile "$PK
+    PK_OPTION="-o IdentityFile "$PUBLIC_KEY
 fi
 
 
@@ -95,18 +103,18 @@
 echo "done."
 echo
 echo "Make sure that you have the correct HIPL settings in 
[/usr/local]/etc/hosts and \
-[/usr/local]/etc/hip/hosts. Also ensure your PISA settings in 
"$LOCAL_DIR"pisa*d.conf \
+[/usr/local]/etc/hip/hosts. Also ensure your PISA settings in 
"$BASE_DIR"pisa*d.conf \
 correspond to your needs."
 echo
 echo "Then run the following commands:"
 echo "- Client"
-echo "1) HIPL:" $LOCAL_DIR"hipd -kb"
-echo "2) PISA Client:" $LOCAL_DIR"pisacd -bf" $LOCAL_DIR"pisacd.conf"
-echo "3) PISA Beacon: "$LOCAL_DIR"pisabeacon -lbs" 
$LOCAL_DIR"trigger-demo-update.sh"
-echo "4) Roaming: "$LOCAL_DIR"auto-handover.sh"
+echo "1) HIPL:" $BASE_DIR"hipd -kb"
+echo "2) PISA Client:" $BASE_DIR"pisacd -bf" $BASE_DIR"pisacd.conf"
+echo "3) PISA Beacon: "$BASE_DIR"pisabeacon -lbs" 
$BASE_DIR"trigger-demo-update.sh"
+echo "4) Roaming: "$BASE_DIR"auto-handover.sh"
 echo "- Access Point"
 echo "1) IPTABLES: iptables -F; iptables -P FORWARD ACCEPT"
-echo "2) PISA Beacon: "$LOCAL_DIR"pisabeacon -bd #BROADCAST-IP# -g #GEO-ID#"
+echo "2) PISA Beacon: "$BASE_DIR"pisabeacon -bd #BROADCAST-IP# -g #GEO-ID#"
 echo "- Server"
-echo "1) HIPL: "$LOCAL_DIR"hipd -kb"
-echo "2) PISA Server: "$LOCAL_DIR"pisasd"
+echo "1) HIPL: "$BASE_DIR"hipd -kb"
+echo "2) PISA Server: "$BASE_DIR"pisasd"

Modified: trunk/tools/create-screenrc.sh
==============================================================================
--- trunk/tools/create-screenrc.sh      Thu Oct 15 16:22:16 2009        (r1174)
+++ trunk/tools/create-screenrc.sh      Thu Oct 15 16:38:03 2009        (r1175)
@@ -1,17 +1,12 @@
-#! /bin/sh
-#author: Rene Hummen <rene.hummen@xxxxxxxxxxxxxxxxx>
+#!/bin/bash
 
-SERVICE_IP="192.168.44.4"
-GW_IP="192.168.5.1"
-GW_HIT="2001:0010:17e5:e586:5f1b:a01b:f5c9:f825"
-
-BASE_DIR=$HOME"/pisa_testbed/"
-SCREENRC=$BASE_DIR"screenrc-demo"
-
-HIPD_CMD=$BASE_DIR"hipd -k"
-PISACD_CMD=$BASE_DIR"pisacd -f "$BASE_DIR"pisacd.conf"
-PISABEACON_CMD=$BASE_DIR"pisabeacon -ls "$BASE_DIR"trigger-demo-update.sh"
-HANDOVER_CMD=$BASE_DIR"auto-handover.sh"
+if [ ! -e "$PWD/pisa_scripts.conf" ]
+then
+        echo "ERROR: "$PWD"/pisa_scripts.conf not found!"
+        exit 1
+fi
+                
+source $PWD"/pisa_scripts.conf"
 
 
 ### Content creation of screenrc starts here ###
@@ -30,12 +25,12 @@
 
 echo "split" >> $SCREENRC
 
-echo "screen -t HIP bash -c '"$HIPD_CMD"; bash'" >> $SCREENRC
-echo "screen -t PISACD bash -c '"$PISACD_CMD"; bash'" >> $SCREENRC
-echo "screen -t PISABEACON bash -c 'sleep 1; "$PISABEACON_CMD"; bash'" >> 
$SCREENRC
+echo "screen -t HIP bash -c '"$HIPD_CMD" -k; bash'" >> $SCREENRC
+echo "screen -t PISACD bash -c '"$PISACD_CMD" -f "$BASE_DIR"pisacd.conf; 
bash'" >> $SCREENRC
+echo "screen -t PISABEACON bash -c 'sleep 1; "$PISABEACON_CMD" -ls 
"$BASE_DIR"trigger-demo-update.sh; bash'" >> $SCREENRC
 echo "focus" >> $SCREENRC
-echo "screen -t ServiceGWip bash -c 'sleep 5; ping "$GW_IP"; bash'" >> 
$SCREENRC
-echo "screen -t ServiceGWhit bash -c 'sleep 5; ping6 "$GW_HIT"; bash'" >> 
$SCREENRC
+echo "screen -t ServiceGWip bash -c 'sleep 5; ping "$SERVICE_GW_IP"; bash'" >> 
$SCREENRC
+echo "screen -t ServiceGWhit bash -c 'sleep 5; ping6 "$SERVICE_GW_HIT"; bash'" 
>> $SCREENRC
 echo "screen -t ServiceIP bash -c 'sleep 5; ping "$SERVICE_IP"; bash'" >> 
$SCREENRC
 echo "screen -t HANDOVER bash -c 'sleep 4; "$HANDOVER_CMD"; bash'" >> $SCREENRC
 

Added: trunk/tools/pisa_scripts.conf
==============================================================================
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ trunk/tools/pisa_scripts.conf       Thu Oct 15 16:38:03 2009        (r1175)
@@ -0,0 +1,38 @@
+### general settings
+
+# local env-dependent settings
+WIFI_IF="wlan0"
+BASE_DIR=$HOME"/pisa_testbed/"
+
+# IP settings 
+IP="192.168.8.123"
+NETMASK="255.255.255.0"
+AP_IP="192.168.8.1"
+SERVICE_GW_IP="192.168.5.1"
+SERVICE_GW_HIT="2001:0010:17e5:e586:5f1b:a01b:f5c9:f825"
+SERVICE_IP="192.168.44.4"
+
+# command settings
+HIPD_CMD=$BASE_DIR"hipd"
+HIPCONF_CMD=$BASE_DIR"hipconf"
+PISACD_CMD=$BASE_DIR"pisacd"
+PISABEACON_CMD=$BASE_DIR"pisabeacon"
+HANDOVER_CMD=$BASE_DIR"auto-handover.sh"
+
+
+### script-specific settings
+
+# auto-handover.sh
+PATTERN="pisa-testbed"
+
+# autoupdater.sh
+REMOTE_USER="root"
+SERVER="morpheus.informatik.rwth-aachen.de"
+REMOTE_DIR="/root/pisa_demo/"
+PUBLIC_KEY=""
+
+# create-screenrc.sh
+SCREENRC=$BASE_DIR"screenrc-demo"
+
+# trigger-demo-update.sh
+GEO_URL="http://mobile-access-demo:8080/setPos/";

Modified: trunk/tools/trigger-demo-update.sh
==============================================================================
--- trunk/tools/trigger-demo-update.sh  Thu Oct 15 16:22:16 2009        (r1174)
+++ trunk/tools/trigger-demo-update.sh  Thu Oct 15 16:38:03 2009        (r1175)
@@ -1,11 +1,16 @@
-#!/bin/sh
+#!/bin/bash
 
 # This script was written for the demo in Oct/Nov 2009
 # It is supposed to be used in combination with pisabeacon
 
-HIPCONF=$HOME"/pisa_testbed/hipconf"
-GEO_URL="http://mobile-access-demo:8080/setPos/";
-WIFI_IF="wlan0"
+# read config file
+if [ ! -e "$PWD/pisa_scripts.conf" ]
+then
+        echo "ERROR: "$PWD"/pisa_scripts.conf not found!"
+        exit 1
+fi
+
+source $PWD"/pisa_scripts.conf"
 
 # check for curl
 if which curl >/dev/null; then
@@ -24,7 +29,7 @@
 
 update_hip ()
 {
-$HIPCONF manual-update $WIFI_IF
+$HIPCONF_CMD manual-update $WIFI_IF
 }
 
 date

Other related posts: