mirror of
https://github.com/renbaoshuo/S2OJ.git
synced 2024-11-25 06:58:40 +00:00
69912ba9b3
* feat(install, svn): remove svn Remove everything related to svn. Rename uoj-svn-lib to uoj-data-lib. Save preparing problem data to /var/uoj_data/prepare/problem_id. * Typo: uoj_date -> uoj_data * add: backward compatibility BREAKING CHANGE: Preparing problem data location is changed You need to move files from /var/svn/problem/{id}/cur/{id}/1 to /var/uoj_data/upload/{id}
38 lines
1.1 KiB
Python
38 lines
1.1 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 = {
|
|
'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'])
|