mirror of
https://github.com/renbaoshuo/S2OJ.git
synced 2024-12-24 01:11:52 +00:00
c5ef73dc76
The installation files are dirty when they are outside of the folder. It now looks not so mess. And there is no need to place empty jdk files. 果断删除之。
39 lines
1.2 KiB
Python
39 lines
1.2 KiB
Python
#!/usr/bin/python
|
|
|
|
import sys, json, random, os
|
|
|
|
def translate(filename, target, tab):
|
|
with open(filename, 'r') as f:
|
|
content = f.read()
|
|
for k, v in tab.items():
|
|
content = content.replace('__' + k + '__', v)
|
|
with open(target, 'w') as f:
|
|
f.write(content)
|
|
|
|
cid = raw_input('uoj container id: ')
|
|
ip = raw_input('uoj ip: ')
|
|
name = raw_input('judger name: ')
|
|
|
|
os.system("docker cp " + cid + ":/home/local_main_judger/judge_client/.conf.json conf.json")
|
|
|
|
with open('conf.json', 'r') as f:
|
|
conf = json.load(f)
|
|
|
|
conf['uoj_host'] = ip
|
|
conf['judger_name'] = name
|
|
conf['judger_password'] = ''.join(random.choice('0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ') for i in range(32))
|
|
|
|
with open('conf.json', 'w') as f:
|
|
json.dump(conf, f, indent=4, separators=(',', ': '))
|
|
print >>f
|
|
|
|
translate_table = {
|
|
'svn_cert': '--username %s --password %s' % (conf['svn_username'], conf['svn_password']),
|
|
'uoj_host': ip
|
|
}
|
|
|
|
translate('install', 'cur_install', translate_table)
|
|
|
|
print "please modify the database after getting the judger server ready:"
|
|
print "insert into judger_info (judger_name, password, ip) values ('%s', '%s', '__judger_ip_here__');" % (name, conf['judger_password'])
|