-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathdevelop.py
50 lines (37 loc) · 1.4 KB
/
develop.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
45
46
47
48
49
50
#!/usr/bin/env python
import os
import shutil
current_dir = os.path.dirname(os.path.relpath(__file__))
def create_folders(folders):
for folder in folders:
try:
new_folder = os.path.join(current_dir, 'devel', folder)
print "Creating %s" % new_folder
os.makedirs(new_folder)
except OSError:
continue
def copy_conf_files(files):
current_conf_folder = os.path.join(current_dir, 'conf')
new_conf_folder = os.path.join(current_dir, 'devel', 'etc/synapse-agent')
for fn in files:
current_conf = os.path.join(current_conf_folder, fn)
new_conf = os.path.join(new_conf_folder, fn)
print "Copying %s to %s" % (current_conf, new_conf)
if os.path.exists(new_conf):
print "Saving existing %s to %s.save" % (fn, fn)
shutil.copy(new_conf, new_conf + '.save')
shutil.copy(current_conf, new_conf)
if __name__ == '__main__':
folder = ['etc/synapse-agent',
'etc/synapse-agent/ssl',
'etc/synapse-agent/ssl/private',
'etc/synapse-agent/ssl/certs',
'etc/synapse-agent/ssl/csr',
'var/lib/synapse-agent/persistence',
'var/log/synapse-agent',
'var/run']
files = ['synapse-agent.conf',
'logger.conf',
'permissions.conf']
create_folders(folder)
copy_conf_files(files)