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