From c0cb0aadd3965e6b860d0cc42182e48432b66674 Mon Sep 17 00:00:00 2001 From: David Schroff Date: Fri, 24 Feb 2023 17:50:21 +0100 Subject: [PATCH 1/3] fix(old-relases): use old-releases path when 404 current --- container/Dockerfile | 2 +- container/build-iso.py | 19 ++++++++++++++----- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/container/Dockerfile b/container/Dockerfile index 456fbaa..7fd2c9d 100644 --- a/container/Dockerfile +++ b/container/Dockerfile @@ -3,7 +3,7 @@ FROM ubuntu:22.04 WORKDIR /potos-iso # Install ISO creation depencies -RUN apt update && apt install -y gfxboot p7zip-full xorriso wget curl libhtml-parser-perl cpio whois python3 python3-pip fdisk squashfs-tools +RUN apt update && apt install -y gfxboot p7zip-full xorriso wget curl libhtml-parser-perl cpio whois python3 python3-pip fdisk squashfs-tools python3-requests COPY requirements.txt . RUN pip3 install -r requirements.txt diff --git a/container/build-iso.py b/container/build-iso.py index 4ccd3e3..60247f3 100755 --- a/container/build-iso.py +++ b/container/build-iso.py @@ -4,6 +4,7 @@ import os import shutil import jinja2 +import requests from datetime import date import subprocess from pprint import pprint @@ -56,10 +57,8 @@ # switch iso by selected os if config['os'] == "jammy": config['input'] = {} - config['input']['iso_filename'] = "ubuntu-22.04.2-live-server-amd64.iso" - config['input']['iso_url'] = ( - "https://releases.ubuntu.com/22.04/ubuntu-22.04.2-live-server-amd64.iso" - ) + config['input']['iso_filename'] = "ubuntu-22.04.1-live-server-amd64.iso" + config['input']['iso_url'] = "https://releases.ubuntu.com/22.04/" + config['input']['iso_filename'] config['input']['sha256_filename'] = "SHA256SUMS" config['input']['sha256_url'] = "https://releases.ubuntu.com/22.04/SHA256SUMS" config['packages'] = {} @@ -70,7 +69,17 @@ "plymouth-theme-ubuntu-logo", "ldap-utils", "yad", - ] +] + + #Test the URL, if 404 use old-relesaes.ubuntu.com + response = requests.get(config['input']['iso_url'] + config['input']['iso_filename']) + if response.status_code == 404: + #extract figures in between first both dashes. + version = config['input']['iso_filename'].split("-")[1] + config['input']['iso_url'] = "https://releases.ubuntu.com/22.04/" + config['input']['iso_filename'] + config['input']['iso_url'] = "https://old-releases.ubuntu.com/releases/" + version + "/" + config['input']['iso_filename'] + config['input']['sha256_url'] = "https://old-releases.ubuntu.com/releases/" + version + "/" + config['input']['sha256_filename'] + elif config['os'] == "focal": config['input'] = {} config['input']['iso_filename'] = "ubuntu-20.04.5-live-server-amd64.iso" From 3bcba135582efb59675965eb6131ee1177184a87 Mon Sep 17 00:00:00 2001 From: David Schroff Date: Sat, 25 Feb 2023 02:18:11 +0100 Subject: [PATCH 2/3] fix(old-relases): fix url path --- container/build-iso.py | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/container/build-iso.py b/container/build-iso.py index 60247f3..d18c84b 100755 --- a/container/build-iso.py +++ b/container/build-iso.py @@ -57,7 +57,7 @@ # switch iso by selected os if config['os'] == "jammy": config['input'] = {} - config['input']['iso_filename'] = "ubuntu-22.04.1-live-server-amd64.iso" + config['input']['iso_filename'] = "ubuntu-22.04.2-live-server-amd64.iso" config['input']['iso_url'] = "https://releases.ubuntu.com/22.04/" + config['input']['iso_filename'] config['input']['sha256_filename'] = "SHA256SUMS" config['input']['sha256_url'] = "https://releases.ubuntu.com/22.04/SHA256SUMS" @@ -70,22 +70,18 @@ "ldap-utils", "yad", ] - #Test the URL, if 404 use old-relesaes.ubuntu.com - response = requests.get(config['input']['iso_url'] + config['input']['iso_filename']) + response = requests.get(config['input']['iso_url']) if response.status_code == 404: #extract figures in between first both dashes. version = config['input']['iso_filename'].split("-")[1] config['input']['iso_url'] = "https://releases.ubuntu.com/22.04/" + config['input']['iso_filename'] config['input']['iso_url'] = "https://old-releases.ubuntu.com/releases/" + version + "/" + config['input']['iso_filename'] config['input']['sha256_url'] = "https://old-releases.ubuntu.com/releases/" + version + "/" + config['input']['sha256_filename'] - elif config['os'] == "focal": config['input'] = {} config['input']['iso_filename'] = "ubuntu-20.04.5-live-server-amd64.iso" - config['input']['iso_url'] = ( - "https://releases.ubuntu.com/20.04/ubuntu-20.04.5-live-server-amd64.iso" - ) + config['input']['iso_url'] = "https://releases.ubuntu.com/20.04/" + config['input']['iso_filename'] config['input']['sha256_filename'] = "SHA256SUMS" config['input']['sha256_url'] = "https://releases.ubuntu.com/20.04/SHA256SUMS" config['packages'] = {} From e0125ce0cb21f5b88353eb240edfa8e4fcede18f Mon Sep 17 00:00:00 2001 From: David Schroff Date: Sat, 25 Feb 2023 02:28:25 +0100 Subject: [PATCH 3/3] fix(old-relases): fix url path --- container/build-iso.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/container/build-iso.py b/container/build-iso.py index d18c84b..2eaec31 100755 --- a/container/build-iso.py +++ b/container/build-iso.py @@ -70,7 +70,7 @@ "ldap-utils", "yad", ] - #Test the URL, if 404 use old-relesaes.ubuntu.com + #Test the URL, if 404 use old-releases.ubuntu.com response = requests.get(config['input']['iso_url']) if response.status_code == 404: #extract figures in between first both dashes.