mirror of
https://github.com/dw-0/kiauh.git
synced 2026-04-04 16:55:13 +05:00
Compare commits
1 Commits
50b1bc5154
...
6178e7100d
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6178e7100d |
@@ -1,11 +0,0 @@
|
|||||||
root = true
|
|
||||||
|
|
||||||
[*]
|
|
||||||
indent_style = space
|
|
||||||
indent_size = 4
|
|
||||||
insert_final_newline = true
|
|
||||||
trim_trailing_whitespace = true
|
|
||||||
charset = utf-8
|
|
||||||
|
|
||||||
[*.py]
|
|
||||||
max_line_length = 88
|
|
||||||
20
kiauh.cfg.example
Normal file
20
kiauh.cfg.example
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
[kiauh]
|
||||||
|
backup_before_update: False
|
||||||
|
|
||||||
|
[klipper]
|
||||||
|
repository_url: https://github.com/Klipper3d/klipper
|
||||||
|
branch: master
|
||||||
|
method: https
|
||||||
|
|
||||||
|
[moonraker]
|
||||||
|
repository_url: https://github.com/Arksine/moonraker
|
||||||
|
branch: master
|
||||||
|
method: https
|
||||||
|
|
||||||
|
[mainsail]
|
||||||
|
port: 80
|
||||||
|
unstable_releases: False
|
||||||
|
|
||||||
|
[fluidd]
|
||||||
|
port: 80
|
||||||
|
unstable_releases: False
|
||||||
@@ -9,30 +9,29 @@
|
|||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
import shutil
|
import shutil
|
||||||
import time
|
import textwrap
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from subprocess import CalledProcessError, run
|
from subprocess import run, CalledProcessError
|
||||||
from typing import Dict, List, Literal, Union
|
from typing import List, Dict, Literal, Union
|
||||||
|
|
||||||
from components.crowsnest import CROWSNEST_BACKUP_DIR, CROWSNEST_DIR, CROWSNEST_REPO
|
from components.crowsnest import CROWSNEST_REPO, CROWSNEST_DIR, CROWSNEST_BACKUP_DIR
|
||||||
from components.klipper.klipper import Klipper
|
from components.klipper.klipper import Klipper
|
||||||
from core.backup_manager.backup_manager import BackupManager
|
from core.backup_manager.backup_manager import BackupManager
|
||||||
from core.instance_manager.instance_manager import InstanceManager
|
from core.instance_manager.instance_manager import InstanceManager
|
||||||
from core.settings.kiauh_settings import KiauhSettings
|
from core.settings.kiauh_settings import KiauhSettings
|
||||||
from utils.common import check_install_dependencies, get_install_status
|
from utils.common import get_install_status, check_install_dependencies
|
||||||
from utils.constants import CURRENT_USER
|
from utils.constants import COLOR_CYAN, RESET_FORMAT, CURRENT_USER
|
||||||
from utils.git_utils import (
|
from utils.git_utils import (
|
||||||
|
git_clone_wrapper,
|
||||||
|
get_repo_name,
|
||||||
get_local_commit,
|
get_local_commit,
|
||||||
get_remote_commit,
|
get_remote_commit,
|
||||||
get_repo_name,
|
|
||||||
git_clone_wrapper,
|
|
||||||
git_pull_wrapper,
|
git_pull_wrapper,
|
||||||
)
|
)
|
||||||
from utils.input_utils import get_confirm
|
from utils.logger import Logger
|
||||||
from utils.logger import DialogType, Logger
|
|
||||||
from utils.sys_utils import (
|
from utils.sys_utils import (
|
||||||
cmd_sysctl_service,
|
|
||||||
parse_packages_from_file,
|
parse_packages_from_file,
|
||||||
|
cmd_sysctl_service,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@@ -45,22 +44,14 @@ def install_crowsnest() -> None:
|
|||||||
|
|
||||||
# Step 3: Check for Multi Instance
|
# Step 3: Check for Multi Instance
|
||||||
im = InstanceManager(Klipper)
|
im = InstanceManager(Klipper)
|
||||||
instances: List[Klipper] = im.instances
|
instances: List[Klipper] = im.find_instances()
|
||||||
|
|
||||||
if len(instances) > 1:
|
if len(instances) > 1:
|
||||||
print_multi_instance_warning(instances)
|
configure_multi_instance(instances)
|
||||||
|
|
||||||
if not get_confirm("Do you want to continue with the installation?"):
|
|
||||||
Logger.print_info("Crowsnest installation aborted!")
|
|
||||||
return
|
|
||||||
|
|
||||||
Logger.print_status("Launching crowsnest's install configurator ...")
|
|
||||||
time.sleep(3)
|
|
||||||
configure_multi_instance()
|
|
||||||
|
|
||||||
# Step 4: Launch crowsnest installer
|
# Step 4: Launch crowsnest installer
|
||||||
|
print(f"{COLOR_CYAN}Installer will prompt you for sudo password!{RESET_FORMAT}")
|
||||||
Logger.print_status("Launching crowsnest installer ...")
|
Logger.print_status("Launching crowsnest installer ...")
|
||||||
Logger.print_info("Installer will prompt you for sudo password!")
|
|
||||||
try:
|
try:
|
||||||
run(
|
run(
|
||||||
f"sudo make install BASE_USER={CURRENT_USER}",
|
f"sudo make install BASE_USER={CURRENT_USER}",
|
||||||
@@ -73,25 +64,20 @@ def install_crowsnest() -> None:
|
|||||||
return
|
return
|
||||||
|
|
||||||
|
|
||||||
def print_multi_instance_warning(instances: List[Klipper]) -> None:
|
def configure_multi_instance(instances: List[Klipper]) -> None:
|
||||||
_instances = [f"● {instance.data_dir_name}" for instance in instances]
|
Logger.print_status("Multi instance install detected ...")
|
||||||
Logger.print_dialog(
|
info = textwrap.dedent("""
|
||||||
DialogType.WARNING,
|
Crowsnest is NOT designed to support multi instances.
|
||||||
[
|
A workaround for this is to choose the most used instance as a 'master'
|
||||||
"Multi instance install detected!",
|
Use this instance to set up your 'crowsnest.conf' and steering it's service.
|
||||||
"\n\n",
|
Found the following instances:
|
||||||
"Crowsnest is NOT designed to support multi instances. A workaround "
|
""")[:-1]
|
||||||
"for this is to choose the most used instance as a 'master' and use "
|
print(info, end="")
|
||||||
"this instance to set up your 'crowsnest.conf' and steering it's service.",
|
for instance in instances:
|
||||||
"\n\n",
|
print(f"● {instance.data_dir_name}")
|
||||||
"The following instances were found:",
|
|
||||||
*_instances,
|
|
||||||
],
|
|
||||||
end="",
|
|
||||||
)
|
|
||||||
|
|
||||||
|
Logger.print_status("\nLaunching crowsnest's configuration tool ...")
|
||||||
|
|
||||||
def configure_multi_instance() -> None:
|
|
||||||
config = Path(CROWSNEST_DIR).joinpath("tools/.config")
|
config = Path(CROWSNEST_DIR).joinpath("tools/.config")
|
||||||
try:
|
try:
|
||||||
run(
|
run(
|
||||||
@@ -108,6 +94,7 @@ def configure_multi_instance() -> None:
|
|||||||
|
|
||||||
if not config.exists():
|
if not config.exists():
|
||||||
Logger.print_error("Generating .config failed, installation aborted")
|
Logger.print_error("Generating .config failed, installation aborted")
|
||||||
|
return
|
||||||
|
|
||||||
|
|
||||||
def update_crowsnest() -> None:
|
def update_crowsnest() -> None:
|
||||||
|
|||||||
@@ -1,9 +1,6 @@
|
|||||||
[project]
|
[project]
|
||||||
requires-python = ">=3.8"
|
requires-python = ">=3.8"
|
||||||
|
|
||||||
[project.optional-dependencies]
|
|
||||||
dev=["ruff"]
|
|
||||||
|
|
||||||
[tool.ruff]
|
[tool.ruff]
|
||||||
required-version = ">=0.3.4"
|
required-version = ">=0.3.4"
|
||||||
respect-gitignore = true
|
respect-gitignore = true
|
||||||
|
|||||||
Reference in New Issue
Block a user