-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathnew_sys
More file actions
executable file
·44 lines (34 loc) · 1.12 KB
/
new_sys
File metadata and controls
executable file
·44 lines (34 loc) · 1.12 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
#!/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)
dest = '/var/opt/fed2/maps/'+ sys.argv[1];
print "creating directory for", dest
os.mkdir(dest)
os.chmod(dest,0775);
# copy files to production folder
os.system("mv " + sys.argv[2] + ".* " + dest)
os.system("mv 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()
print "Setting permissions"
os.system("chmod g+w *")
os.system("chgrp fed2 *")
print "new system set up: completed"
os.system("pwd")
os.system("ls -l")