autodetect python version for debian 12
This commit is contained in:
@@ -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.
|
||||
|
||||
@@ -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():
|
||||
@@ -325,10 +323,16 @@ def setup_certbot_venv(venv_dir: Path = Path("/opt/certbot")):
|
||||
except Exception: pass
|
||||
target.symlink_to(certbot_path)
|
||||
|
||||
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}")
|
||||
return
|
||||
cb_ver = run_out([str(certbot_path), "--version"], check=False) or ""
|
||||
pip_ver = run_out([str(pip_path), "--version"], check=False) or ""
|
||||
|
||||
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
|
||||
|
||||
# ============================================================
|
||||
# STEP 3: Ubuntu - install Python 3.11 from deadsnakes PPA
|
||||
@@ -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
|
||||
|
||||
# ============================================================
|
||||
@@ -476,9 +481,11 @@ fi
|
||||
except Exception: pass
|
||||
target.symlink_to(certbot_path)
|
||||
|
||||
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()}")
|
||||
cb_ver = run_out([str(certbot_path), "--version"], check=False) or ""
|
||||
pip_ver = run_out([str(pip_path), "--version"], check=False) or ""
|
||||
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")
|
||||
|
||||
Reference in New Issue
Block a user