From 8eb1377c5ef2f4ab7c203f0e30fab5c215ce10e4 Mon Sep 17 00:00:00 2001 From: "Tux3 / Mlkj / !Lev.uXFMLA" Date: Mon, 10 Nov 2014 12:11:55 +0100 Subject: [PATCH] Add S3 update deployement script Did I mention that https://s3.amazonaws.com/qtox-updater/ is online ? qTox is now officially SRS BZNS --- tools/update-server/deployUpdateS3.py | 51 +++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 tools/update-server/deployUpdateS3.py diff --git a/tools/update-server/deployUpdateS3.py b/tools/update-server/deployUpdateS3.py new file mode 100644 index 000000000..b02f1f36a --- /dev/null +++ b/tools/update-server/deployUpdateS3.py @@ -0,0 +1,51 @@ +#!/usr/bin/python2.7 + +# This script deploys a qTox update to Amazon S3: It will upload ./qtox/win32/version, ./qtox/win32/flist, and ./qtox/win32/files/* +# Pass the path to the root of the local update server as argument, no spaces allowed + +import sys +import os +import boto +from boto.s3.key import Key + +# Check our local folders +if (len(sys.argv) < 2): + print("ERROR: Needs the path to the local update server in argument") + sys.exit(1) + +localpath = sys.argv[1]; +prefix = "/qtox/win32/" # We only support Windows for now + +# Connect to S3 +conn = boto.connect_s3() +bucket = conn.get_bucket('qtox-updater') +print("Connected to S3") + +# Delete the old version, so nobody downloads a half-uploaded update +print("Deleting version ...") +oldversion = Key(bucket) +oldversion.key = prefix+'version' +bucket.delete_key(oldversion) + +# Upload files/ +filenames = next(os.walk(localpath+prefix+'/files/'))[2] +for filename in filenames: + print("Uploading files/"+filename+'...') + k = Key(bucket) + k.key = prefix+'files/'+filename + k.set_contents_from_filename(localpath+prefix+'/files/'+filename) + k.make_public() + +# Upload version and flist +print("Uploading flist...") +flist = Key(bucket) +flist.key = prefix+'flist' +flist.set_contents_from_filename(localpath+prefix+'flist') +flist.make_public() + +print("Uploading version...") +version = Key(bucket) +version.key = prefix+'version' +version.set_contents_from_filename(localpath+prefix+'version') +version.make_public() +