lsb-release

This commit is contained in:
Mateusz Gruszczyński
2025-10-24 09:23:28 +02:00
parent 4d4bea23e9
commit 7646c627d0

View File

@@ -376,6 +376,10 @@ def lsb_info():
# ========== Angie ==========
def setup_angie(ipv6_enabled: bool):
def _norm(s: str, allow_dot: bool = False) -> str:
pat = r"[^a-z0-9+\-\.]" if allow_dot else r"[^a-z0-9+\-]"
return re.sub(pat, "", s.strip().lower())
with step("Adding Angie repo and installing Angie packages"):
apt_try_install([
"ca-certificates", "curl", "gnupg", "apt-transport-https",
@@ -388,22 +392,19 @@ def setup_angie(ipv6_enabled: bool):
])
try:
dist = run_out(["bash", "-lc", "lsb_release -si"]).strip().lower().replace(" ", "")
rel = run_out(["bash", "-lc", "lsb_release -sr"]).strip()
code = run_out(["bash", "-lc", "lsb_release -sc"]).strip()
dist = run_out(["lsb_release", "-si"])
rel = run_out(["lsb_release", "-sr"])
code = run_out(["lsb_release", "-sc"])
except Exception:
os_id = run_out([
"bash","-lc",". /etc/os-release && echo \"$ID\""
]).strip()
rel = run_out([
"bash","-lc",". /etc/os-release && echo \"$VERSION_ID\""
]).strip()
code = run_out([
"bash","-lc",". /etc/os-release && echo \"$VERSION_CODENAME\""
]).strip()
dist = os_id.lower().replace(" ", "")
dist = run_out(["bash","-c",". /etc/os-release && printf %s \"$ID\""])
rel = run_out(["bash","-c",". /etc/os-release && printf %s \"$VERSION_ID\""])
code = run_out(["bash","-c",". /etc/os-release && printf %s \"$VERSION_CODENAME\""])
os_id = f"{dist}/{rel}".strip().strip("/")
dist = _norm(dist)
rel = _norm(rel, allow_dot=True)
code = _norm(code)
os_id = f"{dist}/{rel}" if rel else dist
if code:
line = f"deb https://download.angie.software/angie/{os_id} {code} main\n"
else:
@@ -426,7 +427,6 @@ def setup_angie(ipv6_enabled: bool):
exec sudo -n /usr/sbin/angie "$@"
"""
write_file(Path("/usr/sbin/nginx"), WRAP, 0o755)
Path("/etc/nginx/conf.d/include").mkdir(parents=True, exist_ok=True)
with step("Setting resolver(s) and cache directories"):
@@ -438,7 +438,6 @@ exec sudo -n /usr/sbin/angie "$@"
with step("Installing corrected systemd unit for Angie"):
write_file(Path("/etc/systemd/system/angie.service"), ANGIE_UNIT, 0o644)
def write_metrics_files():
"""Create /etc/angie/metrics.conf (port 82 with console & status)."""
with step("Adding Angie metrics & console on :82"):