diff --git a/setup/linux-installer.py b/setup/linux-installer.py index a7a4c1b4ce..add3b0b9a7 100644 --- a/setup/linux-installer.py +++ b/setup/linux-installer.py @@ -654,8 +654,13 @@ def get_tarball_info(version): global dl_url, signature, calibre_version print('Downloading tarball signature securely...') if version: - signature = get_https_resource_securely( - 'https://code.calibre-ebook.com/signatures/calibre-' + version + '-' + arch + '.txz.sha512') + sigfname = 'calibre-' + version + '-' + arch + '.txz.sha512' + try: + signature = get_https_resource_securely('https://code.calibre-ebook.com/signatures/' + sigfname) + except HTTPError as err: + if err.code != 404: + raise + signature = get_https_resource_securely('https://code.calibre-ebook.com/signatures/old/' + sigfname) calibre_version = version dl_url = 'https://download.calibre-ebook.com/' + version + '/calibre-' + version + '-' + arch + '.txz' else: @@ -815,7 +820,7 @@ except NameError: def update_intaller_wrapper(): - # To run: python3 -c "import runpy; runpy.run_path('setup/linux-installer.py', run_name='update_wrapper')" + # To update: python3 -c "import runpy; runpy.run_path('setup/linux-installer.py', run_name='update_wrapper')" with open(__file__, 'rb') as f: src = f.read().decode('utf-8') wrapper = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'linux-installer.sh') diff --git a/setup/linux-installer.sh b/setup/linux-installer.sh index d697cfef82..9d36fe88f0 100644 --- a/setup/linux-installer.sh +++ b/setup/linux-installer.sh @@ -89,7 +89,8 @@ if py3: from urllib.parse import urlparse from urllib.request import BaseHandler, build_opener, Request, urlopen, getproxies, addinfourl import http.client as httplib - encode_for_subprocess = lambda x: x + def encode_for_subprocess(x): + return x else: from future_builtins import map from urlparse import urlparse @@ -702,8 +703,13 @@ def get_tarball_info(version): global dl_url, signature, calibre_version print('Downloading tarball signature securely...') if version: - signature = get_https_resource_securely( - 'https://code.calibre-ebook.com/signatures/calibre-' + version + '-' + arch + '.txz.sha512') + sigfname = 'calibre-' + version + '-' + arch + '.txz.sha512' + try: + signature = get_https_resource_securely('https://code.calibre-ebook.com/signatures/' + sigfname) + except HTTPError as err: + if err.code != 404: + raise + signature = get_https_resource_securely('https://code.calibre-ebook.com/signatures/old/' + sigfname) calibre_version = version dl_url = 'https://download.calibre-ebook.com/' + version + '/calibre-' + version + '-' + arch + '.txz' else: