From 94f57fc3dd7a52acac5a11d91fc561095037d17e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20T=2E=20Jochym?= Date: Sun, 20 Feb 2022 10:33:23 +0100 Subject: [PATCH] Add Debian >10 to supported distros --- bootstrap/bootstrap.py | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/bootstrap/bootstrap.py b/bootstrap/bootstrap.py index dab7f8e..f88a6d2 100644 --- a/bootstrap/bootstrap.py +++ b/bootstrap/bootstrap.py @@ -130,7 +130,6 @@ progress_page_html = """ logger = logging.getLogger(__name__) - # This function is needed both by the process starting this script, and by the # TLJH installer that this script execs in the end. Make sure its replica at # tljh/utils.py stays in sync with this version! @@ -199,12 +198,15 @@ def ensure_host_system_can_install_tljh(): # Require Ubuntu 18.04+ distro = get_os_release_variable("ID") version = float(get_os_release_variable("VERSION_ID")) - if distro != "ubuntu": - print("The Littlest JupyterHub currently supports Ubuntu Linux only") + if distro in ["ubuntu", "debian"]: + print("The Littlest JupyterHub currently supports Ubuntu or Debian Linux only") sys.exit(1) - elif float(version) < 18.04: + elif distro == "ubuntu" and float(version) < 18.04: print("The Littlest JupyterHub requires Ubuntu 18.04 or higher") sys.exit(1) + elif distro == "debian" and float(version) < 10: + print("The Littlest JupyterHub requires Debian 10 or higher") + sys.exit(1) # Require Python 3.6+ if sys.version_info < (3, 6): @@ -224,6 +226,7 @@ def ensure_host_system_can_install_tljh(): "For local development, see http://tljh.jupyter.org/en/latest/contributing/dev-setup.html" ) sys.exit(1) + return distro, version class ProgressPageRequestHandler(SimpleHTTPRequestHandler): @@ -259,7 +262,7 @@ def main(): start a local webserver temporarily and report its installation progress via a web site served locally on port 80. """ - ensure_host_system_can_install_tljh() + distro, version = ensure_host_system_can_install_tljh() # Various related constants install_prefix = os.environ.get("TLJH_INSTALL_PREFIX", "/opt/tljh") @@ -345,7 +348,8 @@ def main(): ["apt-get", "install", "--yes", "software-properties-common"], env=apt_get_adjusted_env, ) - run_subprocess(["add-apt-repository", "universe", "--yes"]) + if distro == "ubuntu" + run_subprocess(["add-apt-repository", "universe", "--yes"]) run_subprocess(["apt-get", "update"]) run_subprocess( [ @@ -356,6 +360,7 @@ def main(): "python3-venv", "python3-pip", "git", + "sudo", ], env=apt_get_adjusted_env, )