autodetect python version for debian 12

This commit is contained in:
Mateusz Gruszczyński
2025-10-25 21:56:22 +02:00
parent e4cd853001
commit c0b4181ddf
2 changed files with 19 additions and 13 deletions

View File

@@ -13,7 +13,7 @@ Base URL: **https://gitea.linuxiarz.pl/gru/npm-angie-auto-install**
---
## Requirements
- Debian 13 / Ubuntu 24.04 (root privileges).
- Debian 12+ / Ubuntu 24.04 (root privileges).
- `curl`, `python3`
- Network access to fetch packages and Node/Yarn artifacts.
- ~2 GB RAM (recommended) or add 2 GB swap for safer frontend builds.

View File

@@ -301,7 +301,6 @@ def setup_certbot_venv(venv_dir: Path = Path("/opt/certbot")):
# ============================================================
if available_python:
with step(f"Using system Python ({available_python}) for certbot venv"):
# Ensure python3-venv is installed
if distro_id in ["debian", "ubuntu"]:
apt_try_install(["python3-venv", "python3-pip"])
@@ -317,7 +316,6 @@ def setup_certbot_venv(venv_dir: Path = Path("/opt/certbot")):
run([str(pip_path), "install", "-U", "pip", "setuptools", "wheel"], env=env_build)
run([str(pip_path), "install", "-U", "cryptography", "cffi", "certbot", "tldextract"], env=env_build)
# Create symlink
Path("/usr/local/bin").mkdir(parents=True, exist_ok=True)
target = Path("/usr/local/bin/certbot")
if target.exists() or target.is_symlink():
@@ -327,7 +325,13 @@ def setup_certbot_venv(venv_dir: Path = Path("/opt/certbot")):
cb_ver = run_out([str(certbot_path), "--version"], check=False) or ""
pip_ver = run_out([str(pip_path), "--version"], check=False) or ""
print(f"✔ Certbot: {cb_ver.strip()} | Pip: {pip_ver.strip()} | Python: {python_version_str}")
cb_clean = cb_ver.strip().split('\n')[0]
pip_clean = pip_ver.strip().split(' from ')[0]
print(f" Python: {python_version_str}")
print(f" Certbot: {cb_clean}")
print(f" Pip: {pip_clean}")
return
# ============================================================
@@ -367,7 +371,8 @@ def setup_certbot_venv(venv_dir: Path = Path("/opt/certbot")):
cb_ver = run_out([str(certbot_path), "--version"], check=False) or ""
pip_ver = run_out([str(pip_path), "--version"], check=False) or ""
print(f" Certbot: {cb_ver.strip()} | Pip: {pip_ver.strip()}")
print(f" Certbot: {cb_ver.strip()}")
print(f" Pip: {pip_ver.strip().split(' from ')[0]}")
return
# ============================================================
@@ -478,7 +483,9 @@ fi
cb_ver = run_out([str(certbot_path), "--version"], check=False) or ""
pip_ver = run_out([str(pip_path), "--version"], check=False) or ""
#print(f"✔ Certbot: {cb_ver.strip()} | Pip: {pip_ver.strip()}")
print(f" Python: {PYTHON_VERSION} (pyenv)")
print(f" Certbot: {cb_ver.strip()}")
print(f" Pip: {pip_ver.strip().split(' from ')[0]}")
run(["chown", "-R", f"{PYENV_OWNER}:{PYENV_OWNER}", str(PYENV_ROOT)], check=False)
@@ -498,7 +505,6 @@ preferred-chain = ISRG Root X1
write_file(Path("/etc/letsencrypt.ini"), ini, 0o644)
run(["chown", "-R", "npm:npm", "/etc/letsencrypt"], check=False)
def ensure_nginx_symlink():
from pathlib import Path
target = Path("/etc/angie")