Browse Source

Fixed configurescript

Michael Schwarz 9 years ago
parent
commit
d7a3ff3856
2 changed files with 21 additions and 10 deletions
  1. 10 8
      configure-node.sh
  2. 11 2
      listconfigure.sh

+ 10 - 8
configure-node.sh

@@ -13,11 +13,11 @@ longitude=$4
 [ -z "$hostname" ] && { echo "USAGE: $0 <hostname> <owner> [<latitude> <longitude>]"; exit 1; }
 [ -z "$owner" ] && { echo "ERROR: need at least hostname and owner as params"; exit 1; }
 
-if [ "$IDid" != "ReadTheScript" ]; then
-	echo "WORK IN PROGRESS: Dieses Skript ist noch nicht fertig und tut nicht was es soll."
-	echo "Die uci-set Kommandos werden scheinbar nicht ausgeführt!"
-	exit 42
-fi
+#if [ "$IDid" != "ReadTheScript" ]; then
+#	echo "WORK IN PROGRESS: Dieses Skript ist noch nicht fertig und tut nicht was es soll."
+#	echo "Die uci-set Kommandos werden scheinbar nicht ausgeführt!"
+#	exit 42
+#fi
 
 mac=`echo "lua -e 'print(require(\"gluon.sysconfig\").primary_mac)'" | nc -q1 192.168.1.1 23 | grep -o '^[0-9a-fA-F\:]\{17\}'`
 
@@ -42,11 +42,13 @@ else
 fi
 cmd 'uci commit gluon-node-info'
 
-cmd 'uci set gluon-config-mode.@setup-mode[0].configured=1'
-cmd 'uci commit gluon-config-mode'
+cmd 'uci set gluon-setup-mode.@setup_mode[0]=setup_mode'
+cmd 'uci set gluon-setup-mode.@setup_mode[0].enabled=0'
+cmd 'uci set gluon-setup-mode.@setup_mode[0].configured=1'
+cmd 'uci commit gluon-setup-mode'
 
 cmd 'uci commit'
-#cmd "poweroff"
+cmd "reboot"
 
 echo "# Owner: $owner"
 echo "# MAC: $mac"

+ 11 - 2
listflash.sh → listconfigure.sh

@@ -25,8 +25,17 @@ cat $listfile | while read line; do
 	[ -z "$line" ] && continue
 
 	name=`echo $line | cut -d"=" -f 1`
-	latlon=`echo $line | cut -d"=" -f 2`
-	echo "$name { $latlon }"
+	latlon=`echo $line | cut -d"=" -f 2 | awk '{print $1" "$2}'`
+	echo "Next node: $name at $latlon"
 
+    echo -n "Waiting for an uncofigured router to appear on 192.168.1.1 ..."
+    while ! ping -n -c 1 -W 1 192.168.1.1 > /dev/null; do
+        echo -n "."
+        sleep 1
+    done
+    echo " found."
+	echo "Waiting for router to come up completly (waiting 15 Seconds)"
+	sleep 15
+	echo "Let the show begin ..."
 	./configure-node.sh $name $owner $latlon > "${peersdir}/${name}"
 done