-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathnew_test_sys
More file actions
executable file
·68 lines (54 loc) · 1.81 KB
/
new_test_sys
File metadata and controls
executable file
·68 lines (54 loc) · 1.81 KB
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#!/usr/bin/python
# Set up a new system and planet for fed2
import os
import shutil
import sys
if len(sys.argv) < 4:
print 'usage is new_sys system_filename planet_filename owner_name'
sys.exit(1)
src = '/home/alan/fed2d/'
maps = src + 'maps/' + sys.argv[1]
dest = '/var/opt/fed2test/maps/'+ sys.argv[1];
# create the directories
print "creating directory for", maps
os.mkdir(maps)
pwd = os.getcwd()
os.chdir(src + 'maps')
print "creating directory for", dest
os.mkdir(dest)
os.chmod(dest,0775);
# move the new files into the maps directory
os.system("mv " + src + "space.* " + maps)
os.system("mv " + src + sys.argv[2] +".* " + maps)
# create Makefile
print "creating Makefile"
os.chdir(maps)
makefile = file("./Makefile","w+")
makefile.write("# Makefile for the fed2 " + sys.argv[1] + " system\n")
makefile.write("\nDEST=" + dest + "\n")
makefile.write("include ../data.mk\n")
makefile.write("all:$(DEST)/" + sys.argv[2] + ".* $(DEST)/space.* ")
makefile.close()
# misc activities and copy to destination,
# then set permissions on dest files
os.system("chmod g+w *")
os.system("cp " + sys.argv[2] + ".* " + dest)
os.system("cp space.* " + dest)
os.chdir(dest)
# creat .inf files
print "creating .inf files"
space_file = file("./space.inf","w+")
space_file.write('<?xml version="1.0"?>\n')
space_file.write("<infrastructure owner='" + sys.argv[3] +"' economy='None' closed='true'>\n")
space_file.write("</infrastructure>\n")
space_file.close()
planet_file = file("./" + sys.argv[2] + ".inf","w+")
planet_file.write('<?xml version="1.0"?>\n')
planet_file.write("<infrastructure owner='" + sys.argv[3] +"' economy='Agricultural' closed='false'>\n")
planet_file.write("</infrastructure>\n")
planet_file.close()
os.system("chmod g+w *")
os.system("chgrp fed2 *")
print "new system set up: completed"
os.system("pwd")
os.system("ls -l")