cleanup
This commit is contained in:
parent
cd8158de05
commit
0e87b10079
2 changed files with 6 additions and 8 deletions
11
install
11
install
|
@ -10,8 +10,7 @@ from urllib.request import urlopen
|
|||
from threading import Thread
|
||||
import subprocess
|
||||
|
||||
def makefolder(path):
|
||||
dirname = os.path.dirname(path)
|
||||
def makedirs(dirname):
|
||||
if not os.path.exists(dirname):
|
||||
os.makedirs(dirname)
|
||||
|
||||
|
@ -92,8 +91,7 @@ class Install(Thread):
|
|||
return
|
||||
target = self.target
|
||||
target = os.path.normpath(os.path.join(os.path.abspath(target)))
|
||||
if not os.path.exists(target):
|
||||
os.makedirs(target)
|
||||
makedirs(target)
|
||||
os.chdir(target)
|
||||
release = self.get_release()
|
||||
self.status['release'] = release
|
||||
|
@ -114,15 +112,16 @@ class Install(Thread):
|
|||
self.status['installing'] = 'setup'
|
||||
if sys.platform.startswith('linux'):
|
||||
os.system('./ctl install_launcher')
|
||||
makedirs('config')
|
||||
with open('config/release.json', 'w') as fd:
|
||||
json.dump(release, fd, indent=2)
|
||||
os.makedirs('updates')
|
||||
makedirs('updates')
|
||||
os.system('./ctl setup')
|
||||
self.status['progress'] = 1
|
||||
self.status['done'] = True
|
||||
|
||||
def download(self, url, filename):
|
||||
makefolder(filename)
|
||||
makedirs(os.path.dirname(filename))
|
||||
print('downloading',os.path.basename(filename))
|
||||
with open(filename, 'wb') as f:
|
||||
with closing(urlopen(url)) as u:
|
||||
|
|
|
@ -86,7 +86,6 @@ def shutdown():
|
|||
os.unlink(state.PID)
|
||||
|
||||
def run():
|
||||
setup.create_db()
|
||||
PID = sys.argv[2] if len(sys.argv) > 2 else None
|
||||
if len(sys.argv) > 3 and sys.argv[2] == 'debug':
|
||||
PID = sys.argv[3]
|
||||
|
@ -130,8 +129,8 @@ def run():
|
|||
(r"(.*)", MainHandler),
|
||||
]
|
||||
|
||||
setup.create_db()
|
||||
http_server = HTTPServer(Application(handlers, **options))
|
||||
|
||||
http_server.listen(settings.server['port'], settings.server['address'])
|
||||
|
||||
if PID:
|
||||
|
|
Loading…
Reference in a new issue