update osx installer to work with data/config
This commit is contained in:
parent
9d7763e017
commit
9da362ced6
2 changed files with 10 additions and 7 deletions
|
@ -19,7 +19,7 @@
|
||||||
<key>CFBundlePackageType</key>
|
<key>CFBundlePackageType</key>
|
||||||
<string>APPL</string>
|
<string>APPL</string>
|
||||||
<key>CFBundleShortVersionString</key>
|
<key>CFBundleShortVersionString</key>
|
||||||
<string>0.4</string>
|
<string>0.5</string>
|
||||||
<key>CFBundleSignature</key>
|
<key>CFBundleSignature</key>
|
||||||
<string>????</string>
|
<string>????</string>
|
||||||
<key>CFBundleSupportedPlatforms</key>
|
<key>CFBundleSupportedPlatforms</key>
|
||||||
|
|
|
@ -16,6 +16,9 @@ from threading import Thread
|
||||||
PORT = 9841
|
PORT = 9841
|
||||||
static_dir = os.path.normpath(os.path.abspath(os.path.dirname(__file__)))
|
static_dir = os.path.normpath(os.path.abspath(os.path.dirname(__file__)))
|
||||||
|
|
||||||
|
def makedirs(dirname):
|
||||||
|
if not os.path.exists(dirname):
|
||||||
|
os.makedirs(dirname)
|
||||||
|
|
||||||
class Handler(SimpleHTTPServer.SimpleHTTPRequestHandler):
|
class Handler(SimpleHTTPServer.SimpleHTTPRequestHandler):
|
||||||
def do_OPTIONS(self):
|
def do_OPTIONS(self):
|
||||||
|
@ -61,8 +64,7 @@ class Install(Thread):
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
target = self.target
|
target = self.target
|
||||||
if not os.path.exists(target):
|
makedirs(target)
|
||||||
os.makedirs(target)
|
|
||||||
os.chdir(target)
|
os.chdir(target)
|
||||||
release = self.get_release()
|
release = self.get_release()
|
||||||
self.status["release"] = release
|
self.status["release"] = release
|
||||||
|
@ -84,18 +86,19 @@ class Install(Thread):
|
||||||
self.status["step"] = "setup"
|
self.status["step"] = "setup"
|
||||||
os.system("./ctl setup")
|
os.system("./ctl setup")
|
||||||
self.status["progress"] = 1
|
self.status["progress"] = 1
|
||||||
with open('config/release.json', 'w') as fd:
|
makedirs('data')
|
||||||
|
with open('data/release.json', 'w') as fd:
|
||||||
json.dump(release, fd, indent=2)
|
json.dump(release, fd, indent=2)
|
||||||
self.status = {"installation finished. starting...": True}
|
self.status = {"installation finished. starting...": True}
|
||||||
os.system("./ctl start &")
|
os.system("./ctl start &")
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
self.httpd.shutdown()
|
self.httpd.shutdown()
|
||||||
|
|
||||||
|
|
||||||
def download(self, url, filename):
|
def download(self, url, filename):
|
||||||
dirname = os.path.dirname(filename)
|
dirname = os.path.dirname(filename)
|
||||||
if dirname and not os.path.exists(dirname):
|
if dirname:
|
||||||
os.makedirs(dirname)
|
makedirs(dirname)
|
||||||
with open(filename, 'w') as f:
|
with open(filename, 'w') as f:
|
||||||
with closing(urllib2.urlopen(url)) as u:
|
with closing(urllib2.urlopen(url)) as u:
|
||||||
size = int(u.headers.get('content-length', 0))
|
size = int(u.headers.get('content-length', 0))
|
||||||
|
|
Loading…
Reference in a new issue