From 9d223e0ab1fea6a6573805f7bde1ea0c6e538cb6 Mon Sep 17 00:00:00 2001 From: Tomas Popela Date: Wed, 18 Oct 2017 13:28:53 +0200 Subject: [PATCH] Update the chromium-lastest.py to always download the policy templates They are changing across the releases - always download the latest one. --- chromium-latest.py | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/chromium-latest.py b/chromium-latest.py index 88703dbc..242e8d86 100755 --- a/chromium-latest.py +++ b/chromium-latest.py @@ -42,7 +42,7 @@ chromium_root_dir = "." version_string = "stable" name = 'Chromium Latest' -script_version = 0.8 +script_version = 0.9 my_description = '{0} {1}'.format(name, script_version) @@ -205,6 +205,26 @@ def download_chrome_latest_rpm(arch): remove_file_if_exists (chrome_rpm) sys.exit(1) +def remove_and_download_latest_policy_templates(): + + policy_file = 'policy_templates.zip' + path = 'https://dl.google.com/dl/edgedl/chrome/policy/%s' % policy_file + remove_file_if_exists(policy_file) + + # Let's make sure we haven't already downloaded it. + if os.path.isfile("./%s" % policy_file): + print "%s already exists!" % policy_file + else: + print "Downloading %s" % path + # Perhaps look at using python-progressbar at some point? + info=urllib.urlretrieve(path, policy_file, reporthook=dlProgress)[1] + urllib.urlcleanup() + print "" + if (info["Content-Type"] != "application/octet-stream"): + print 'Policy templates are not on servers.' % version_string + remove_file_if_exists (policy_file) + sys.exit(1) + # This is where the magic happens if __name__ == '__main__': @@ -291,6 +311,9 @@ if __name__ == '__main__': download_version(chromium_version) + # Always download the newest policy templates + remove_and_download_latest_policy_templates() + # Lets make sure we haven't unpacked it already latest_dir = "%s/chromium-%s" % (chromium_root_dir, chromium_version) if (args.clean and os.path.isdir(latest_dir)):