diff options
author | Jesusaves <cpntb1@ymail.com> | 2020-12-20 23:12:39 -0300 |
---|---|---|
committer | Jesusaves <cpntb1@ymail.com> | 2020-12-20 23:12:39 -0300 |
commit | 07c2deec2aaec66ee8675135dfaeeb7e08ffd80d (patch) | |
tree | d85b3fcb1ed57f4ec3eb02e26e34340f8683755b | |
parent | 7fe93f8785f8d1db8a6038c3b97133ff4d9fd1a3 (diff) | |
download | updates-07c2deec2aaec66ee8675135dfaeeb7e08ffd80d.tar.gz updates-07c2deec2aaec66ee8675135dfaeeb7e08ffd80d.tar.bz2 updates-07c2deec2aaec66ee8675135dfaeeb7e08ffd80d.tar.xz updates-07c2deec2aaec66ee8675135dfaeeb7e08ffd80d.zip |
This tool will now generate a zip file with maximum compression possible.
The name will be hashed; Server may send this hash to client download the zip.
Do note that currently, that is not supported neither in server nor in client.
The reason for the hashing is to prevent unauthed users from downloading it.
The hash is regenerated every time.
-rwxr-xr-x | comp.py | 14 |
1 files changed, 9 insertions, 5 deletions
@@ -18,13 +18,12 @@ # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA ######################################################################################## # This builds live/ folder for Update Server -import subprocess, os, traceback +import subprocess, os, uuid, traceback PATH="/var/www/html/assets" # Delete previous deployment subprocess.call("rm --recursive %s/*" % PATH, shell=True) -rc=[] # Go through every file in raw and give them a hash for path, subdir, files in os.walk("raw/"): @@ -46,7 +45,7 @@ for path, subdir, files in os.walk("raw/"): subprocess.call("convert %s %s/%s" % (fn, PATH, NAME), shell=True) EXT="webp" elif EXT in ["xcf", "psd"]: - pass + continue elif EXT in ["mp3", "ogg"]: subprocess.call("cp %s %s/%s" % (fn, PATH, NAME), shell=True) else: @@ -58,9 +57,14 @@ for path, subdir, files in os.walk("raw/"): # Create blank index page to disable dir listing subprocess.call("touch %s/index.html" % PATH, shell=True) +# TODO: zip everything and provide an all-in-one download? +fn="%s/%s.zip" % (PATH, uuid.uuid4().hex) +subprocess.call('cd %s; find . -printf "%%P\n" | zip -X -9 -@ %s' % (PATH, fn), shell=True) + # Correct permissions subprocess.call("chown -R www-data:www-data %s/*" % PATH, shell=True) subprocess.call("chmod --recursive o-rwx %s/*" % PATH, shell=True) -# TODO: zip everything and provide an all-in-one download? - +print("FILENAME: %s" % fn) +print("Register it in \"token\" value of server config to serve all-in-one downloads.") +print("(This feature might not yet have been implemented, though)") |