mirror of
https://github.com/dw-0/kiauh.git
synced 2025-12-25 16:53:36 +05:00
Compare commits
1 Commits
aa5cf8e774
...
bd425a08dd
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
bd425a08dd |
@@ -271,6 +271,7 @@ def handle_disruptive_system_packages() -> None:
|
|||||||
"Please fix the problem manually. Otherwise, this may have "
|
"Please fix the problem manually. Otherwise, this may have "
|
||||||
"undesirable effects on the operation of Klipper."
|
"undesirable effects on the operation of Klipper."
|
||||||
],
|
],
|
||||||
|
padding_bottom="",
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -20,6 +20,8 @@ OE_STORE_DIR = OE_DIR.joinpath("octoeverywhere-store")
|
|||||||
OE_REQ_FILE = OE_DIR.joinpath("requirements.txt")
|
OE_REQ_FILE = OE_DIR.joinpath("requirements.txt")
|
||||||
OE_DEPS_JSON_FILE = OE_DIR.joinpath("moonraker-system-dependencies.json")
|
OE_DEPS_JSON_FILE = OE_DIR.joinpath("moonraker-system-dependencies.json")
|
||||||
OE_INSTALL_SCRIPT = OE_DIR.joinpath("install.sh")
|
OE_INSTALL_SCRIPT = OE_DIR.joinpath("install.sh")
|
||||||
|
OE_UPDATE_SCRIPT = OE_DIR.joinpath("update.sh")
|
||||||
|
OE_REMOVE_SCRIPT = OE_DIR.joinpath("uninstall.sh")
|
||||||
|
|
||||||
# filenames
|
# filenames
|
||||||
OE_CFG_NAME = "octoeverywhere.conf"
|
OE_CFG_NAME = "octoeverywhere.conf"
|
||||||
|
|||||||
@@ -23,11 +23,14 @@ from components.octoeverywhere import (
|
|||||||
from core.instance_manager.base_instance import BaseInstance
|
from core.instance_manager.base_instance import BaseInstance
|
||||||
from utils.logger import Logger
|
from utils.logger import Logger
|
||||||
|
|
||||||
|
MODULE_PATH = Path(__file__).resolve().parent
|
||||||
|
|
||||||
|
|
||||||
|
# noinspection PyMethodMayBeStatic
|
||||||
class Octoeverywhere(BaseInstance):
|
class Octoeverywhere(BaseInstance):
|
||||||
@classmethod
|
@classmethod
|
||||||
def blacklist(cls) -> List[str]:
|
def blacklist(cls) -> List[str]:
|
||||||
return ["None", "mcu", "bambu", "companion"]
|
return ["None", "mcu"]
|
||||||
|
|
||||||
def __init__(self, suffix: str = ""):
|
def __init__(self, suffix: str = ""):
|
||||||
super().__init__(instance_type=self, suffix=suffix)
|
super().__init__(instance_type=self, suffix=suffix)
|
||||||
@@ -42,10 +45,6 @@ class Octoeverywhere(BaseInstance):
|
|||||||
def cfg_file(self) -> Path:
|
def cfg_file(self) -> Path:
|
||||||
return self._cfg_file
|
return self._cfg_file
|
||||||
|
|
||||||
@property
|
|
||||||
def sys_cfg_file(self) -> Path:
|
|
||||||
return self._sys_cfg_file
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def log(self) -> Path:
|
def log(self) -> Path:
|
||||||
return self._log
|
return self._log
|
||||||
@@ -55,6 +54,7 @@ class Octoeverywhere(BaseInstance):
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
cmd = f"{OE_INSTALL_SCRIPT} {self.cfg_dir}/moonraker.conf"
|
cmd = f"{OE_INSTALL_SCRIPT} {self.cfg_dir}/moonraker.conf"
|
||||||
|
print(cmd)
|
||||||
run(cmd, check=True, shell=True)
|
run(cmd, check=True, shell=True)
|
||||||
|
|
||||||
except CalledProcessError as e:
|
except CalledProcessError as e:
|
||||||
|
|||||||
@@ -23,12 +23,9 @@ from components.octoeverywhere import (
|
|||||||
)
|
)
|
||||||
from components.octoeverywhere.octoeverywhere import Octoeverywhere
|
from components.octoeverywhere.octoeverywhere import Octoeverywhere
|
||||||
from core.instance_manager.instance_manager import InstanceManager
|
from core.instance_manager.instance_manager import InstanceManager
|
||||||
from utils.common import (
|
from utils.common import check_install_dependencies, moonraker_exists
|
||||||
check_install_dependencies,
|
|
||||||
get_install_status,
|
|
||||||
moonraker_exists,
|
|
||||||
)
|
|
||||||
from utils.config_utils import (
|
from utils.config_utils import (
|
||||||
|
add_config_section,
|
||||||
remove_config_section,
|
remove_config_section,
|
||||||
)
|
)
|
||||||
from utils.fs_utils import run_remove_routines
|
from utils.fs_utils import run_remove_routines
|
||||||
@@ -37,14 +34,10 @@ from utils.input_utils import get_confirm
|
|||||||
from utils.logger import DialogType, Logger
|
from utils.logger import DialogType, Logger
|
||||||
from utils.sys_utils import (
|
from utils.sys_utils import (
|
||||||
cmd_sysctl_manage,
|
cmd_sysctl_manage,
|
||||||
|
create_python_venv,
|
||||||
install_python_requirements,
|
install_python_requirements,
|
||||||
parse_packages_from_file,
|
parse_packages_from_file,
|
||||||
)
|
)
|
||||||
from utils.types import ComponentStatus
|
|
||||||
|
|
||||||
|
|
||||||
def get_octoeverywhere_status() -> ComponentStatus:
|
|
||||||
return get_install_status(OE_DIR, OE_ENV_DIR, Octoeverywhere)
|
|
||||||
|
|
||||||
|
|
||||||
def install_octoeverywhere() -> None:
|
def install_octoeverywhere() -> None:
|
||||||
@@ -64,8 +57,6 @@ def install_octoeverywhere() -> None:
|
|||||||
"It is save to run the installer again to link your "
|
"It is save to run the installer again to link your "
|
||||||
"printer or repair any issues.",
|
"printer or repair any issues.",
|
||||||
],
|
],
|
||||||
padding_top=0,
|
|
||||||
padding_bottom=0,
|
|
||||||
)
|
)
|
||||||
if not get_confirm("Re-run OctoEverywhere installation?"):
|
if not get_confirm("Re-run OctoEverywhere installation?"):
|
||||||
Logger.print_info("Exiting OctoEverywhere for Klipper installation ...")
|
Logger.print_info("Exiting OctoEverywhere for Klipper installation ...")
|
||||||
@@ -86,8 +77,6 @@ def install_octoeverywhere() -> None:
|
|||||||
"\n\n",
|
"\n\n",
|
||||||
"The setup will apply the same names to OctoEverywhere!",
|
"The setup will apply the same names to OctoEverywhere!",
|
||||||
],
|
],
|
||||||
padding_top=0,
|
|
||||||
padding_bottom=0,
|
|
||||||
)
|
)
|
||||||
|
|
||||||
if not get_confirm(
|
if not get_confirm(
|
||||||
@@ -100,6 +89,7 @@ def install_octoeverywhere() -> None:
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
git_clone_wrapper(OE_REPO, OE_DIR)
|
git_clone_wrapper(OE_REPO, OE_DIR)
|
||||||
|
install_oe_dependencies()
|
||||||
|
|
||||||
for moonraker in mr_instances:
|
for moonraker in mr_instances:
|
||||||
oe_im.current_instance = Octoeverywhere(suffix=moonraker.suffix)
|
oe_im.current_instance = Octoeverywhere(suffix=moonraker.suffix)
|
||||||
@@ -170,9 +160,16 @@ def install_oe_dependencies() -> None:
|
|||||||
raise ValueError("Error reading OctoEverywhere dependencies!")
|
raise ValueError("Error reading OctoEverywhere dependencies!")
|
||||||
|
|
||||||
check_install_dependencies(oe_deps)
|
check_install_dependencies(oe_deps)
|
||||||
|
|
||||||
|
# create virtualenv
|
||||||
|
create_python_venv(OE_ENV_DIR)
|
||||||
install_python_requirements(OE_ENV_DIR, OE_REQ_FILE)
|
install_python_requirements(OE_ENV_DIR, OE_REQ_FILE)
|
||||||
|
|
||||||
|
|
||||||
|
def patch_moonraker_conf(instances: List[Moonraker]) -> None:
|
||||||
|
add_config_section(section=f"include {OE_SYS_CFG_NAME}", instances=instances)
|
||||||
|
|
||||||
|
|
||||||
def remove_oe_instances(
|
def remove_oe_instances(
|
||||||
instance_manager: InstanceManager,
|
instance_manager: InstanceManager,
|
||||||
instance_list: List[Octoeverywhere],
|
instance_list: List[Octoeverywhere],
|
||||||
|
|||||||
@@ -16,7 +16,6 @@ from components.klipperscreen.klipperscreen import get_klipperscreen_status
|
|||||||
from components.log_uploads.menus.log_upload_menu import LogUploadMenu
|
from components.log_uploads.menus.log_upload_menu import LogUploadMenu
|
||||||
from components.mobileraker.mobileraker import get_mobileraker_status
|
from components.mobileraker.mobileraker import get_mobileraker_status
|
||||||
from components.moonraker.moonraker_utils import get_moonraker_status
|
from components.moonraker.moonraker_utils import get_moonraker_status
|
||||||
from components.octoeverywhere.octoeverywhere_setup import get_octoeverywhere_status
|
|
||||||
from components.webui_client.client_utils import (
|
from components.webui_client.client_utils import (
|
||||||
get_client_status,
|
get_client_status,
|
||||||
get_current_client_config,
|
get_current_client_config,
|
||||||
@@ -92,7 +91,6 @@ class MainMenu(BaseMenu):
|
|||||||
self._get_component_status("ks", get_klipperscreen_status)
|
self._get_component_status("ks", get_klipperscreen_status)
|
||||||
self._get_component_status("mb", get_mobileraker_status)
|
self._get_component_status("mb", get_mobileraker_status)
|
||||||
self._get_component_status("cn", get_crowsnest_status)
|
self._get_component_status("cn", get_crowsnest_status)
|
||||||
self._get_component_status("oe", get_octoeverywhere_status)
|
|
||||||
|
|
||||||
def _get_component_status(self, name: str, status_fn: callable, *args) -> None:
|
def _get_component_status(self, name: str, status_fn: callable, *args) -> None:
|
||||||
status_data: ComponentStatus = status_fn(*args)
|
status_data: ComponentStatus = status_fn(*args)
|
||||||
|
|||||||
@@ -25,10 +25,6 @@ from components.mobileraker.mobileraker import (
|
|||||||
)
|
)
|
||||||
from components.moonraker.moonraker_setup import update_moonraker
|
from components.moonraker.moonraker_setup import update_moonraker
|
||||||
from components.moonraker.moonraker_utils import get_moonraker_status
|
from components.moonraker.moonraker_utils import get_moonraker_status
|
||||||
from components.octoeverywhere.octoeverywhere_setup import (
|
|
||||||
get_octoeverywhere_status,
|
|
||||||
update_octoeverywhere,
|
|
||||||
)
|
|
||||||
from components.webui_client.client_config.client_config_setup import (
|
from components.webui_client.client_config.client_config_setup import (
|
||||||
update_client_config,
|
update_client_config,
|
||||||
)
|
)
|
||||||
@@ -61,7 +57,7 @@ class UpdateMenu(BaseMenu):
|
|||||||
self.ms_local = self.ms_remote = self.fl_local = self.fl_remote = ""
|
self.ms_local = self.ms_remote = self.fl_local = self.fl_remote = ""
|
||||||
self.mc_local = self.mc_remote = self.fc_local = self.fc_remote = ""
|
self.mc_local = self.mc_remote = self.fc_local = self.fc_remote = ""
|
||||||
self.ks_local = self.ks_remote = self.mb_local = self.mb_remote = ""
|
self.ks_local = self.ks_remote = self.mb_local = self.mb_remote = ""
|
||||||
self.cn_local = self.cn_remote = self.oe_local = self.oe_remote = ""
|
self.cn_local = self.cn_remote = ""
|
||||||
|
|
||||||
self.mainsail_data = MainsailData()
|
self.mainsail_data = MainsailData()
|
||||||
self.fluidd_data = FluiddData()
|
self.fluidd_data = FluiddData()
|
||||||
@@ -86,8 +82,7 @@ class UpdateMenu(BaseMenu):
|
|||||||
"7": Option(self.update_klipperscreen, menu=False),
|
"7": Option(self.update_klipperscreen, menu=False),
|
||||||
"8": Option(self.update_mobileraker, menu=False),
|
"8": Option(self.update_mobileraker, menu=False),
|
||||||
"9": Option(self.update_crowsnest, menu=False),
|
"9": Option(self.update_crowsnest, menu=False),
|
||||||
"10": Option(self.update_octoeverywhere, menu=False),
|
"10": Option(self.upgrade_system_packages, menu=False),
|
||||||
"11": Option(self.upgrade_system_packages, menu=False),
|
|
||||||
}
|
}
|
||||||
|
|
||||||
def print_menu(self):
|
def print_menu(self):
|
||||||
@@ -119,9 +114,8 @@ class UpdateMenu(BaseMenu):
|
|||||||
║ 7) KlipperScreen │ {self.ks_local:<22} │ {self.ks_remote:<22} ║
|
║ 7) KlipperScreen │ {self.ks_local:<22} │ {self.ks_remote:<22} ║
|
||||||
║ 8) Mobileraker │ {self.mb_local:<22} │ {self.mb_remote:<22} ║
|
║ 8) Mobileraker │ {self.mb_local:<22} │ {self.mb_remote:<22} ║
|
||||||
║ 9) Crowsnest │ {self.cn_local:<22} │ {self.cn_remote:<22} ║
|
║ 9) Crowsnest │ {self.cn_local:<22} │ {self.cn_remote:<22} ║
|
||||||
║ 10) OctoEverywhere │ {self.oe_local:<22} │ {self.oe_remote:<22} ║
|
|
||||||
║ ├───────────────┴───────────────╢
|
║ ├───────────────┴───────────────╢
|
||||||
║ 11) System │ ║
|
║ 10) System │ ║
|
||||||
╟───────────────────────┴───────────────────────────────╢
|
╟───────────────────────┴───────────────────────────────╢
|
||||||
"""
|
"""
|
||||||
)[1:]
|
)[1:]
|
||||||
@@ -157,9 +151,6 @@ class UpdateMenu(BaseMenu):
|
|||||||
def update_crowsnest(self, **kwargs):
|
def update_crowsnest(self, **kwargs):
|
||||||
update_crowsnest()
|
update_crowsnest()
|
||||||
|
|
||||||
def update_octoeverywhere(self, **kwargs):
|
|
||||||
update_octoeverywhere()
|
|
||||||
|
|
||||||
def upgrade_system_packages(self, **kwargs): ...
|
def upgrade_system_packages(self, **kwargs): ...
|
||||||
|
|
||||||
def _fetch_update_status(self):
|
def _fetch_update_status(self):
|
||||||
@@ -181,8 +172,6 @@ class UpdateMenu(BaseMenu):
|
|||||||
self._get_update_status("mb", get_mobileraker_status)
|
self._get_update_status("mb", get_mobileraker_status)
|
||||||
# crowsnest
|
# crowsnest
|
||||||
self._get_update_status("cn", get_crowsnest_status)
|
self._get_update_status("cn", get_crowsnest_status)
|
||||||
# octoeverywhere
|
|
||||||
self._get_update_status("oe", get_octoeverywhere_status)
|
|
||||||
|
|
||||||
def _format_local_status(self, local_version, remote_version) -> str:
|
def _format_local_status(self, local_version, remote_version) -> str:
|
||||||
if local_version == remote_version:
|
if local_version == remote_version:
|
||||||
|
|||||||
Reference in New Issue
Block a user