Merge pull request #800 from jochym/main

Add support for debian >=10 to bootstrap.py
This commit is contained in:
Min RK
2023-03-21 09:32:45 +01:00
committed by GitHub

View File

@@ -132,7 +132,6 @@ progress_page_html = """
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
# This function is needed both by the process starting this script, and by the # 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 installer that this script execs in the end. Make sure its replica at
# tljh/utils.py stays in sync with this version! # tljh/utils.py stays in sync with this version!
@@ -200,15 +199,18 @@ def ensure_host_system_can_install_tljh():
.strip() .strip()
) )
# Require Ubuntu 18.04+ # Require Ubuntu 18.04+ or Debian 10+
distro = get_os_release_variable("ID") distro = get_os_release_variable("ID")
version = float(get_os_release_variable("VERSION_ID")) version = float(get_os_release_variable("VERSION_ID"))
if distro != "ubuntu": if distro not in ["ubuntu", "debian"]:
print("The Littlest JupyterHub currently supports Ubuntu Linux only") print("The Littlest JupyterHub currently supports Ubuntu or Debian Linux only")
sys.exit(1) 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") print("The Littlest JupyterHub requires Ubuntu 18.04 or higher")
sys.exit(1) 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+ # Require Python 3.6+
if sys.version_info < (3, 6): if sys.version_info < (3, 6):
@@ -228,6 +230,7 @@ def ensure_host_system_can_install_tljh():
"For local development, see http://tljh.jupyter.org/en/latest/contributing/dev-setup.html" "For local development, see http://tljh.jupyter.org/en/latest/contributing/dev-setup.html"
) )
sys.exit(1) sys.exit(1)
return distro, version
class ProgressPageRequestHandler(SimpleHTTPRequestHandler): class ProgressPageRequestHandler(SimpleHTTPRequestHandler):
@@ -330,7 +333,7 @@ def main():
start a local webserver temporarily and report its installation progress via start a local webserver temporarily and report its installation progress via
a web site served locally on port 80. a web site served locally on port 80.
""" """
ensure_host_system_can_install_tljh() distro, version = ensure_host_system_can_install_tljh()
parser = ArgumentParser() parser = ArgumentParser()
parser.add_argument("--show-progress-page", action="store_true") parser.add_argument("--show-progress-page", action="store_true")
@@ -425,7 +428,9 @@ def main():
["apt-get", "install", "--yes", "software-properties-common"], ["apt-get", "install", "--yes", "software-properties-common"],
env=apt_get_adjusted_env, env=apt_get_adjusted_env,
) )
run_subprocess(["add-apt-repository", "universe", "--yes"]) # Section "universe" exists and is required only in ubuntu.
if distro == "ubuntu":
run_subprocess(["add-apt-repository", "universe", "--yes"])
run_subprocess(["apt-get", "update"]) run_subprocess(["apt-get", "update"])
run_subprocess( run_subprocess(
[ [
@@ -436,6 +441,7 @@ def main():
"python3-venv", "python3-venv",
"python3-pip", "python3-pip",
"git", "git",
"sudo", # sudo is missing in default debian install
], ],
env=apt_get_adjusted_env, env=apt_get_adjusted_env,
) )