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
|
## Requirements
|
||||||
- Debian 13 / Ubuntu 24.04 (root privileges).
|
- Debian 12+ / Ubuntu 24.04 (root privileges).
|
||||||
- `curl`, `python3`
|
- `curl`, `python3`
|
||||||
- Network access to fetch packages and Node/Yarn artifacts.
|
- Network access to fetch packages and Node/Yarn artifacts.
|
||||||
- ~2 GB RAM (recommended) or add 2 GB swap for safer frontend builds.
|
- ~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:
|
if available_python:
|
||||||
with step(f"Using system Python ({available_python}) for certbot venv"):
|
with step(f"Using system Python ({available_python}) for certbot venv"):
|
||||||
# Ensure python3-venv is installed
|
|
||||||
if distro_id in ["debian", "ubuntu"]:
|
if distro_id in ["debian", "ubuntu"]:
|
||||||
apt_try_install(["python3-venv", "python3-pip"])
|
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", "pip", "setuptools", "wheel"], env=env_build)
|
||||||
run([str(pip_path), "install", "-U", "cryptography", "cffi", "certbot", "tldextract"], 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)
|
Path("/usr/local/bin").mkdir(parents=True, exist_ok=True)
|
||||||
target = Path("/usr/local/bin/certbot")
|
target = Path("/usr/local/bin/certbot")
|
||||||
if target.exists() or target.is_symlink():
|
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 ""
|
cb_ver = run_out([str(certbot_path), "--version"], check=False) or ""
|
||||||
pip_ver = run_out([str(pip_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
|
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 ""
|
cb_ver = run_out([str(certbot_path), "--version"], check=False) or ""
|
||||||
pip_ver = run_out([str(pip_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
|
return
|
||||||
|
|
||||||
# ============================================================
|
# ============================================================
|
||||||
@@ -478,7 +483,9 @@ fi
|
|||||||
|
|
||||||
cb_ver = run_out([str(certbot_path), "--version"], check=False) or ""
|
cb_ver = run_out([str(certbot_path), "--version"], check=False) or ""
|
||||||
pip_ver = run_out([str(pip_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)
|
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)
|
write_file(Path("/etc/letsencrypt.ini"), ini, 0o644)
|
||||||
run(["chown", "-R", "npm:npm", "/etc/letsencrypt"], check=False)
|
run(["chown", "-R", "npm:npm", "/etc/letsencrypt"], check=False)
|
||||||
|
|
||||||
|
|
||||||
def ensure_nginx_symlink():
|
def ensure_nginx_symlink():
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
target = Path("/etc/angie")
|
target = Path("/etc/angie")
|
||||||
|
|||||||
Reference in New Issue
Block a user