mirror of
https://github.com/dw-0/kiauh.git
synced 2025-12-14 02:54:28 +05:00
@@ -53,8 +53,7 @@ from utils.sys_utils import (
|
|||||||
cmd_sysctl_manage,
|
cmd_sysctl_manage,
|
||||||
cmd_sysctl_service,
|
cmd_sysctl_service,
|
||||||
create_python_venv,
|
create_python_venv,
|
||||||
get_distro_name,
|
get_distro_info,
|
||||||
get_distro_version,
|
|
||||||
install_python_requirements,
|
install_python_requirements,
|
||||||
parse_packages_from_file,
|
parse_packages_from_file,
|
||||||
)
|
)
|
||||||
@@ -163,8 +162,10 @@ def install_moonraker_packages() -> None:
|
|||||||
f"Parsing system dependencies from {MOONRAKER_DEPS_JSON_FILE.name} ..."
|
f"Parsing system dependencies from {MOONRAKER_DEPS_JSON_FILE.name} ..."
|
||||||
)
|
)
|
||||||
parsed_sysdeps = parse_sysdeps_file(MOONRAKER_DEPS_JSON_FILE)
|
parsed_sysdeps = parse_sysdeps_file(MOONRAKER_DEPS_JSON_FILE)
|
||||||
distro_name = get_distro_name().lower()
|
distro_name, distro_version = get_distro_info()
|
||||||
distro_version = get_distro_version()
|
|
||||||
|
Logger.print_info(f"Distro name: {distro_name}")
|
||||||
|
Logger.print_info(f"Distro version: {distro_version}")
|
||||||
|
|
||||||
for dep in parsed_sysdeps.get(distro_name, []):
|
for dep in parsed_sysdeps.get(distro_name, []):
|
||||||
pkg = dep[0].strip()
|
pkg = dep[0].strip()
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ import urllib.error
|
|||||||
import urllib.request
|
import urllib.request
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from subprocess import DEVNULL, PIPE, CalledProcessError, Popen, check_output, run
|
from subprocess import DEVNULL, PIPE, CalledProcessError, Popen, check_output, run
|
||||||
from typing import List, Literal, Set
|
from typing import List, Literal, Set, Tuple
|
||||||
|
|
||||||
from core.constants import SYSTEMD
|
from core.constants import SYSTEMD
|
||||||
from core.logger import Logger
|
from core.logger import Logger
|
||||||
@@ -540,9 +540,31 @@ def get_service_file_path(instance_type: type, suffix: str) -> Path:
|
|||||||
|
|
||||||
return file_path
|
return file_path
|
||||||
|
|
||||||
def get_distro_name() -> str:
|
|
||||||
return check_output(["lsb_release", "-is"]).decode().strip()
|
|
||||||
|
|
||||||
|
def get_distro_info() -> Tuple[str, str]:
|
||||||
|
distro_info: str = check_output(["cat", "/etc/os-release"]).decode().strip()
|
||||||
|
|
||||||
def get_distro_version() -> str:
|
if not distro_info:
|
||||||
return check_output(["lsb_release", "-rs"]).decode().strip()
|
raise ValueError("Error reading distro info!")
|
||||||
|
|
||||||
|
distro_id: str = ""
|
||||||
|
distro_id_like: str = ""
|
||||||
|
distro_version: str = ""
|
||||||
|
|
||||||
|
for line in distro_info.split("\n"):
|
||||||
|
if line.startswith("ID="):
|
||||||
|
distro_id = line.split("=")[1].strip('"').strip()
|
||||||
|
if line.startswith("ID_LIKE="):
|
||||||
|
distro_id_like = line.split("=")[1].strip('"').strip()
|
||||||
|
if line.startswith("VERSION_ID="):
|
||||||
|
distro_version = line.split("=")[1].strip('"').strip()
|
||||||
|
|
||||||
|
if distro_id == "raspbian":
|
||||||
|
distro_id = distro_id_like
|
||||||
|
|
||||||
|
if not distro_id:
|
||||||
|
raise ValueError("Error reading distro id!")
|
||||||
|
if not distro_version:
|
||||||
|
raise ValueError("Error reading distro version!")
|
||||||
|
|
||||||
|
return distro_id.lower(), distro_version
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ trusted_clients:
|
|||||||
cors_domains:
|
cors_domains:
|
||||||
*.lan
|
*.lan
|
||||||
*.local
|
*.local
|
||||||
|
*.internal
|
||||||
*://localhost
|
*://localhost
|
||||||
*://localhost:*
|
*://localhost:*
|
||||||
*://my.mainsail.xyz
|
*://my.mainsail.xyz
|
||||||
|
|||||||
Reference in New Issue
Block a user