forked from mhaberler/directoryd
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgenerator.py
44 lines (40 loc) · 1.16 KB
/
generator.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/bin/bash
import sys
MAIN = 0
QUADCOPTER = 1
def getips(ipfile):
f = open(ipfile,"r")
l = f.readlines()
botdict = {}
for line in l:
p = line.strip().split(" ")
botdict[p[1]] = p[2]
return botdict
#print botdict
def generatescript(key,ip):
s = ""
s+= "python botinfoupdate.py " + str(key) + " " + str(ip) +"\n"
s+= "python testmainupdate.py " + str(key) + " " + str(ip) +"\n"
s+= "cp TestMain.java ../src/main/java/testmain/\n"
s+= "cp BotInfoSelector.java ../src/main/java/testmain/\n"
#s+= "mvn compile\n"
#s+= "mvn clean install\n"
#s+= "git checkout quadcopter\n"
#s+= "git add -A\n"
#s+= 'git commit -m "update"\n'
#s+= "git push\n"
s+= "echo "+'"'+str(ip)+'"\n'
s+= "./bin/simple_client "+str(ip)+"\n"
s+= "echo "+'"done"\n'
s+= "#add lines for functions for and waiting for messages"
return s
launchscript = "launch.sh"
s = "#!/bin/bash\n\n"
ipdict = getips("addresses.txt")
for key in ipdict.keys():
s+= generatescript(key,ipdict[key])
f = open(launchscript,"w")
f.write(s)
f.close()
#print botdict.keys()
#updatebotinfo("botinfofile",1,botdict['1'],4)