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 1/5] 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, ) From 48a8e5fcb5f2c91389f8c919ed59034e73d10f1a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20T=2E=20Jochym?= Date: Sun, 20 Feb 2022 10:41:36 +0100 Subject: [PATCH 2/5] Typo --- bootstrap/bootstrap.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bootstrap/bootstrap.py b/bootstrap/bootstrap.py index f88a6d2..a5fe97b 100644 --- a/bootstrap/bootstrap.py +++ b/bootstrap/bootstrap.py @@ -348,7 +348,7 @@ def main(): ["apt-get", "install", "--yes", "software-properties-common"], env=apt_get_adjusted_env, ) - if distro == "ubuntu" + if distro == "ubuntu": run_subprocess(["add-apt-repository", "universe", "--yes"]) run_subprocess(["apt-get", "update"]) run_subprocess( From e408d99a5adbd82d8c1aff5cc08cfe860ff49ab6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20T=2E=20Jochym?= Date: Sun, 20 Feb 2022 10:44:24 +0100 Subject: [PATCH 3/5] Missing negation --- bootstrap/bootstrap.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bootstrap/bootstrap.py b/bootstrap/bootstrap.py index a5fe97b..14b6fce 100644 --- a/bootstrap/bootstrap.py +++ b/bootstrap/bootstrap.py @@ -198,7 +198,7 @@ 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 in ["ubuntu", "debian"]: + if distro not in ["ubuntu", "debian"]: print("The Littlest JupyterHub currently supports Ubuntu or Debian Linux only") sys.exit(1) elif distro == "ubuntu" and float(version) < 18.04: From 45abba3c374b41c6a326a48cee1ed28950aa84bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20T=2E=20Jochym?= Date: Thu, 15 Sep 2022 17:34:25 +0200 Subject: [PATCH 4/5] Add requested comments specific to debian --- bootstrap/bootstrap.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/bootstrap/bootstrap.py b/bootstrap/bootstrap.py index a34df09..5b14db7 100644 --- a/bootstrap/bootstrap.py +++ b/bootstrap/bootstrap.py @@ -421,6 +421,7 @@ def main(): ["apt-get", "install", "--yes", "software-properties-common"], env=apt_get_adjusted_env, ) + # Section "universe" exists and is required only in ubuntu. if distro == "ubuntu": run_subprocess(["add-apt-repository", "universe", "--yes"]) run_subprocess(["apt-get", "update"]) @@ -433,7 +434,7 @@ def main(): "python3-venv", "python3-pip", "git", - "sudo", + "sudo", # sudo is missing in default debian install ], env=apt_get_adjusted_env, ) From 5f2e3b1726de1506e6657861752dab5ac76e4177 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20T=2E=20Jochym?= Date: Wed, 21 Sep 2022 20:28:25 +0200 Subject: [PATCH 5/5] Reflect distro support i comment --- bootstrap/bootstrap.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bootstrap/bootstrap.py b/bootstrap/bootstrap.py index 5b14db7..b912dde 100644 --- a/bootstrap/bootstrap.py +++ b/bootstrap/bootstrap.py @@ -199,7 +199,7 @@ def ensure_host_system_can_install_tljh(): .strip() ) - # Require Ubuntu 18.04+ + # Require Ubuntu 18.04+ or Debian 10+ distro = get_os_release_variable("ID") version = float(get_os_release_variable("VERSION_ID")) if distro not in ["ubuntu", "debian"]: