From 8236b6ad920ef121f1bcba4688c6bc2b31f81689 Mon Sep 17 00:00:00 2001 From: Simon Quigley Date: Thu, 9 Aug 2018 20:45:07 -0500 Subject: [PATCH] Move the sources into the Python file for now. --- common/modules/automirror/main.py | 67 +++++++++++++++++-- common/modules/automirror/ubuntu.sources.list | 56 ---------------- 2 files changed, 61 insertions(+), 62 deletions(-) delete mode 100644 common/modules/automirror/ubuntu.sources.list diff --git a/common/modules/automirror/main.py b/common/modules/automirror/main.py index 57f9a5b..5986d3d 100644 --- a/common/modules/automirror/main.py +++ b/common/modules/automirror/main.py @@ -19,6 +19,65 @@ import json import subprocess import libcalamares from urllib import request +from lsb_release import get_distro_information + +global sources +sources = """# Automatically generated by Calamares on DATE. +# Lines starting with "deb" are mandatory, while lines starting with "deb-src" +# are for more detailed package information. + +## See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to +## newer versions of DISTRIBUTION. +deb URL/ubuntu/ CODENAME main restricted +# deb-src URL/ubuntu/ CODENAME main restricted + +## Major bug fix updates produced after the final release of DISTRIBUTION. +## Have you noticed a regression? Please report it! +## https://wiki.ubuntu.com/StableReleaseUpdates#Regressions +deb URL/ubuntu/ CODENAME-updates main restricted +# deb-src URL/ubuntu/ CODENAME-updates main restricted + +## Software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu team. +## Also, please note that software in Universe WILL NOT receive any review or +## updates from the Ubuntu security team directly. Updates in this repository +## are provided by volunteers, but most come from Debian. +deb URL/ubuntu/ CODENAME universe +# deb-src URL/ubuntu/ CODENAME universe +deb URL/ubuntu/ CODENAME-updates universe +# deb-src URL/ubuntu/ CODENAME-updates universe + +## Software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu team, +## and may not be under a free licence. Please satisfy yourself as your rights +## to use the software. Also, please note that software in Multiverse WILL NOT +## receive any review or updates from the Ubuntu security team directly. +deb URL/ubuntu/ CODENAME multiverse +# deb-src URL/ubuntu/ CODENAME multiverse +deb URL/ubuntu/ CODENAME-updates multiverse +# deb-src URL/ubuntu/ CODENAME-updates multiverse + +## Software from this repository contains tested security updates from the +## Ubuntu security team. +deb http://security.ubuntu.com/ubuntu CODENAME-security main restricted +# deb-src http://security.ubuntu.com/ubuntu CODENAME-security main restricted +deb http://security.ubuntu.com/ubuntu CODENAME-security universe +# deb-src http://security.ubuntu.com/ubuntu CODENAME-security universe +deb http://security.ubuntu.com/ubuntu CODENAME-security multiverse +# deb-src http://security.ubuntu.com/ubuntu CODENAME-security multiverse + +## Software from this repository may not have been tested as extensively as +## software contained in the main release, although it includes newer versions +## of some applications which may provide useful features. Also, please note +## that software in Backports WILL NOT receive any review or updates from the +## Ubuntu security team. +deb URL/ubuntu/ CODENAME-backports main restricted universe multiverse +# deb-src URL/ubuntu/ CODENAME-backports main restricted universe multiverse + +## Uncomment the following two lines to add software from Canonical's +## "partner" repository. +## This software is not part of Ubuntu, but is offered by Canonical and the +## respective vendors as a service to Ubuntu users. +# deb http://archive.canonical.com/ubuntu CODENAME partner +# deb-src http://archive.canonical.com/ubuntu CODENAME partner""" def getcountry(): # This is hardcoded for now, but should eventually be put into the config @@ -35,7 +94,7 @@ def getmirror(country): return "" def getcodename(): - return libcalamares.check_target_env_output("lsb_release -c -s") + return get_distro_information()["CODENAME"] def changesources(prefix): root = libcalamares.globalstorage.value("rootMountPoint") @@ -47,8 +106,7 @@ def changesources(prefix): if libcalamares.job.configuration["backend"] == "apt": distro = libcalamares.job.configuration["distribution"] if "ubuntu" in distro.lower(): - with open("ubuntu.sources.list", "r") as sourcesfile: - sources = sourcesfile.read() + global sources sources = sources.replace("DISTRIBUTION", distro) sources = sources.replace("CODENAME", getcodename()) sources = sources.replace("URL", url) @@ -58,9 +116,6 @@ def changesources(prefix): sourcesfile.write(sources) sourcesfile.truncate() - if libcalamares.globalstorage.value("hasInternet"): - libcalamares.check_target_env_call("apt-get update") - def run(): """Autoselect a mirror from a list.""" if libcalamares.globalstorage.value("hasInternet"): diff --git a/common/modules/automirror/ubuntu.sources.list b/common/modules/automirror/ubuntu.sources.list deleted file mode 100644 index 2fb84ed..0000000 --- a/common/modules/automirror/ubuntu.sources.list +++ /dev/null @@ -1,56 +0,0 @@ -# Automatically generated by Calamares on DATE. -# Lines starting with "deb" are mandatory, while lines starting with "deb-src" -# are for more detailed package information. - -## See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to -## newer versions of DISTRIBUTION. -deb URL/ubuntu/ CODENAME main restricted -# deb-src URL/ubuntu/ CODENAME main restricted - -## Major bug fix updates produced after the final release of DISTRIBUTION. -## Have you noticed a regression? Please report it! -## https://wiki.ubuntu.com/StableReleaseUpdates#Regressions -deb URL/ubuntu/ CODENAME-updates main restricted -# deb-src URL/ubuntu/ CODENAME-updates main restricted - -## Software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu team. -## Also, please note that software in Universe WILL NOT receive any review or -## updates from the Ubuntu security team directly. Updates in this repository -## are provided by volunteers, but most come from Debian. -deb URL/ubuntu/ CODENAME universe -# deb-src URL/ubuntu/ CODENAME universe -deb URL/ubuntu/ CODENAME-updates universe -# deb-src URL/ubuntu/ CODENAME-updates universe - -## Software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu team, -## and may not be under a free licence. Please satisfy yourself as your rights -## to use the software. Also, please note that software in Multiverse WILL NOT -## receive any review or updates from the Ubuntu security team directly. -deb URL/ubuntu/ CODENAME multiverse -# deb-src URL/ubuntu/ CODENAME multiverse -deb URL/ubuntu/ CODENAME-updates multiverse -# deb-src URL/ubuntu/ CODENAME-updates multiverse - -## Software from this repository contains tested security updates from the -## Ubuntu security team. -deb http://security.ubuntu.com/ubuntu CODENAME-security main restricted -# deb-src http://security.ubuntu.com/ubuntu CODENAME-security main restricted -deb http://security.ubuntu.com/ubuntu CODENAME-security universe -# deb-src http://security.ubuntu.com/ubuntu CODENAME-security universe -deb http://security.ubuntu.com/ubuntu CODENAME-security multiverse -# deb-src http://security.ubuntu.com/ubuntu CODENAME-security multiverse - -## Software from this repository may not have been tested as extensively as -## software contained in the main release, although it includes newer versions -## of some applications which may provide useful features. Also, please note -## that software in Backports WILL NOT receive any review or updates from the -## Ubuntu security team. -deb URL/ubuntu/ CODENAME-backports main restricted universe multiverse -# deb-src URL/ubuntu/ CODENAME-backports main restricted universe multiverse - -## Uncomment the following two lines to add software from Canonical's -## "partner" repository. -## This software is not part of Ubuntu, but is offered by Canonical and the -## respective vendors as a service to Ubuntu users. -# deb http://archive.canonical.com/ubuntu CODENAME partner -# deb-src http://archive.canonical.com/ubuntu CODENAME partner