mirror of
https://github.com/dw-0/kiauh.git
synced 2025-12-23 15:53:36 +05:00
Compare commits
32 Commits
8808add217
...
f0aa0f16ab
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f0aa0f16ab | ||
|
|
72e3a56e4f | ||
|
|
e64aa94df4 | ||
|
|
58719a4ca0 | ||
|
|
59a83aee12 | ||
|
|
7104eb078f | ||
|
|
341ecb325c | ||
|
|
e3a6d8a0ab | ||
|
|
b6c6edb622 | ||
|
|
099d47df2f | ||
|
|
ba1cdb3739 | ||
|
|
8e7d4db988 | ||
|
|
8f960495ba | ||
|
|
095823bf28 | ||
|
|
397038e43e | ||
|
|
061e222664 | ||
|
|
3f5ff50d69 | ||
|
|
5ebe941125 | ||
|
|
f5eb9486cc | ||
|
|
7a9e752f9c | ||
|
|
30bc56b198 | ||
|
|
b2567995de | ||
|
|
6fcd7a3f08 | ||
|
|
25dfbb83df | ||
|
|
899b204dc7 | ||
|
|
5cf4b018fc | ||
|
|
ae9d1b98da | ||
|
|
16d3388ff2 | ||
|
|
b88d0085ba | ||
|
|
0b6613e464 | ||
|
|
d99cda544a | ||
|
|
a50dce20de |
2
.github/FUNDING.yml
vendored
2
.github/FUNDING.yml
vendored
@@ -9,4 +9,4 @@ community_bridge: # Replace with a single Community Bridge project-name e.g., cl
|
||||
liberapay: # Replace with a single Liberapay username
|
||||
issuehunt: # Replace with a single IssueHunt username
|
||||
otechie: # Replace with a single Otechie username
|
||||
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
|
||||
custom: https://paypal.me/dwillner0
|
||||
|
||||
1
.gitignore
vendored
1
.gitignore
vendored
@@ -1,3 +1,4 @@
|
||||
.idea
|
||||
.vscode
|
||||
.idea
|
||||
.pytest_cache
|
||||
|
||||
18
README.md
18
README.md
@@ -29,7 +29,7 @@
|
||||
### 📋 Prerequisites
|
||||
KIAUH is a script that assists you in installing Klipper on a Linux operating system that has
|
||||
already been flashed to your Raspberry Pi's (or other SBC's) SD card. As a result, you must ensure
|
||||
that you have a functional Linux system on hand. `Raspberry Pi OS Lite (32bit)` is a recommended Linux image
|
||||
that you have a functional Linux system on hand. `Raspberry Pi OS Lite (either 32bit or 64bit)` is a recommended Linux image
|
||||
if you are using a Raspberry Pi. The [official Raspberry Pi Imager](https://www.raspberrypi.com/software/)
|
||||
is the simplest way to flash an image like this to an SD card.
|
||||
|
||||
@@ -39,7 +39,7 @@ select `Choose OS -> Raspberry Pi OS (other)`: \
|
||||
<img src="https://raw.githubusercontent.com/dw-0/kiauh/master/resources/screenshots/rpi_imager1.png" alt="KIAUH logo" height="350">
|
||||
</p>
|
||||
|
||||
* Then select `Raspberry Pi OS Lite (32bit)`:
|
||||
* Then select `Raspberry Pi OS Lite (32bit)` (or 64bit if you want to use that instead):
|
||||
<p align="center">
|
||||
<img src="https://raw.githubusercontent.com/dw-0/kiauh/master/resources/screenshots/rpi_imager2.png" alt="KIAUH logo" height="350">
|
||||
</p>
|
||||
@@ -125,7 +125,7 @@ prompt and confirm by hitting ENTER.
|
||||
<tr>
|
||||
<th><img src="https://raw.githubusercontent.com/fluidd-core/fluidd/master/docs/assets/images/logo.svg" alt="Fluidd Logo" height="64"></th>
|
||||
<th><img src="https://avatars.githubusercontent.com/u/31575189?v=4" alt="jordanruthe avatar" height="64"></th>
|
||||
<th><img src="https://camo.githubusercontent.com/627be7fc67195b626b298af9b9677d7c58e698c67305e54324cffbe06130d4a4/68747470733a2f2f6f63746f7072696e742e6f72672f6173736574732f696d672f6c6f676f2e706e67" alt="OctoPrint Logo" height="64"></th>
|
||||
<th><img src="https://raw.githubusercontent.com/OctoPrint/OctoPrint/master/docs/images/octoprint-logo.png" alt="OctoPrint Logo" height="64"></th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>by <a href="https://github.com/fluidd-core">fluidd-core</a></th>
|
||||
@@ -158,7 +158,7 @@ prompt and confirm by hitting ENTER.
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th><a href="https://github.com/Clon1998/mobileraker_companion"><img src="https://raw.githubusercontent.com/Clon1998/mobileraker/master/assets/icon/mr_appicon.png" alt="OctoEverywhere Logo" height="64"></th>
|
||||
<th><a href="https://github.com/Clon1998/mobileraker_companion"><img src="https://raw.githubusercontent.com/Clon1998/mobileraker/master/assets/icon/mr_appicon.png" alt="OctoEverywhere Logo" height="64"></a></th>
|
||||
<th><a href="https://octoeverywhere.com/?source=kiauh_readme"><img src="https://octoeverywhere.com/img/logo.svg" alt="OctoEverywhere Logo" height="64"></a></th>
|
||||
<th></th>
|
||||
</tr>
|
||||
@@ -174,6 +174,16 @@ prompt and confirm by hitting ENTER.
|
||||
|
||||
<hr>
|
||||
|
||||
<h2 align="center">🎖️ Contributors 🎖️</h2>
|
||||
|
||||
<div align="center">
|
||||
<a href="https://github.com/dw-0/kiauh/graphs/contributors">
|
||||
<img src="https://contrib.rocks/image?repo=dw-0/kiauh" alt=""/>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<hr>
|
||||
|
||||
<h2 align="center">✨ Credits ✨</h2>
|
||||
|
||||
* A big thank you to [lixxbox](https://github.com/lixxbox) for that awesome KIAUH-Logo!
|
||||
|
||||
2
kiauh.sh
2
kiauh.sh
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
#=======================================================================#
|
||||
# Copyright (C) 2020 - 2023 Dominik Willner <th33xitus@gmail.com> #
|
||||
# Copyright (C) 2020 - 2024 Dominik Willner <th33xitus@gmail.com> #
|
||||
# #
|
||||
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||
# https://github.com/dw-0/kiauh #
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
# ======================================================================= #
|
||||
|
||||
import textwrap
|
||||
from enum import Enum, unique
|
||||
from typing import List
|
||||
|
||||
from core.instance_manager.base_instance import BaseInstance
|
||||
@@ -15,17 +16,29 @@ from core.menus.base_menu import print_back_footer
|
||||
from utils.constants import COLOR_GREEN, RESET_FORMAT, COLOR_YELLOW, COLOR_CYAN
|
||||
|
||||
|
||||
@unique
|
||||
class DisplayType(Enum):
|
||||
SERVICE_NAME = "SERVICE_NAME"
|
||||
PRINTER_NAME = "PRINTER_NAME"
|
||||
|
||||
|
||||
def print_instance_overview(
|
||||
instances: List[BaseInstance], show_index=False, show_select_all=False
|
||||
instances: List[BaseInstance],
|
||||
display_type: DisplayType = DisplayType.SERVICE_NAME,
|
||||
show_headline=True,
|
||||
show_index=False,
|
||||
show_select_all=False,
|
||||
):
|
||||
headline = f"{COLOR_GREEN}The following Klipper instances were found:{RESET_FORMAT}"
|
||||
dialog = textwrap.dedent(
|
||||
f"""
|
||||
/=======================================================\\
|
||||
|{headline:^64}|
|
||||
|-------------------------------------------------------|
|
||||
"""
|
||||
)[1:]
|
||||
dialog = "/=======================================================\\\n"
|
||||
if show_headline:
|
||||
d_type = (
|
||||
"Klipper instances"
|
||||
if display_type is DisplayType.SERVICE_NAME
|
||||
else "printer directories"
|
||||
)
|
||||
headline = f"{COLOR_GREEN}The following {d_type} were found:{RESET_FORMAT}"
|
||||
dialog += f"|{headline:^64}|\n"
|
||||
dialog += "|-------------------------------------------------------|\n"
|
||||
|
||||
if show_select_all:
|
||||
select_all = f"{COLOR_YELLOW}a) Select all{RESET_FORMAT}"
|
||||
@@ -33,7 +46,11 @@ def print_instance_overview(
|
||||
dialog += "| |\n"
|
||||
|
||||
for i, s in enumerate(instances):
|
||||
line = f"{COLOR_CYAN}{f'{i})' if show_index else '●'} {s.get_service_file_name()}{RESET_FORMAT}"
|
||||
if display_type is DisplayType.SERVICE_NAME:
|
||||
name = s.get_service_file_name()
|
||||
else:
|
||||
name = s.data_dir
|
||||
line = f"{COLOR_CYAN}{f'{i})' if show_index else '●'} {name}{RESET_FORMAT}"
|
||||
dialog += f"| {line:<63}|\n"
|
||||
|
||||
print(dialog, end="")
|
||||
|
||||
@@ -62,7 +62,7 @@ def run_klipper_removal(
|
||||
def select_instances_to_remove(
|
||||
instances: List[Klipper],
|
||||
) -> Union[List[Klipper], None]:
|
||||
print_instance_overview(instances, True, True)
|
||||
print_instance_overview(instances, show_index=True, show_select_all=True)
|
||||
|
||||
options = [str(i) for i in range(len(instances))]
|
||||
options.extend(["a", "A", "b", "B"])
|
||||
|
||||
@@ -48,10 +48,12 @@ from utils.logger import Logger
|
||||
from utils.system_utils import mask_system_service
|
||||
|
||||
|
||||
def get_klipper_status() -> Dict[
|
||||
Literal["status", "status_code", "instances", "repo", "local", "remote"],
|
||||
Union[str, int],
|
||||
]:
|
||||
def get_klipper_status() -> (
|
||||
Dict[
|
||||
Literal["status", "status_code", "instances", "repo", "local", "remote"],
|
||||
Union[str, int],
|
||||
]
|
||||
):
|
||||
status = get_install_status_common(Klipper, KLIPPER_DIR, KLIPPER_ENV_DIR)
|
||||
return {
|
||||
"status": status.get("status"),
|
||||
@@ -69,7 +71,9 @@ def check_is_multi_install(
|
||||
return not existing_instances and install_count > 1
|
||||
|
||||
|
||||
def check_is_single_to_multi_conversion(existing_instances: List[Klipper]) -> bool:
|
||||
def check_is_single_to_multi_conversion(
|
||||
existing_instances: List[Klipper],
|
||||
) -> bool:
|
||||
return len(existing_instances) == 1 and existing_instances[0].suffix == ""
|
||||
|
||||
|
||||
|
||||
@@ -50,5 +50,5 @@ def upload_logfile(logfile: LogFile) -> None:
|
||||
Logger.print_ok("Upload successful! Access it via the following link:")
|
||||
Logger.print_ok(f">>>> {link}", False)
|
||||
except Exception as e:
|
||||
Logger.print_error(f"Uploading logfile failed!")
|
||||
Logger.print_error("Uploading logfile failed!")
|
||||
Logger.print_error(str(e))
|
||||
|
||||
@@ -68,7 +68,7 @@ def run_moonraker_removal(
|
||||
def select_instances_to_remove(
|
||||
instances: List[Moonraker],
|
||||
) -> Union[List[Moonraker], None]:
|
||||
print_instance_overview(instances, True, True)
|
||||
print_instance_overview(instances, show_index=True, show_select_all=True)
|
||||
|
||||
options = [str(i) for i in range(len(instances))]
|
||||
options.extend(["a", "A", "b", "B"])
|
||||
@@ -130,9 +130,15 @@ def remove_polkit_rules() -> None:
|
||||
return
|
||||
|
||||
try:
|
||||
command = [f"{MOONRAKER_DIR}/scripts/set-policykit-rules.sh", "--clear"]
|
||||
command = [
|
||||
f"{MOONRAKER_DIR}/scripts/set-policykit-rules.sh",
|
||||
"--clear",
|
||||
]
|
||||
subprocess.run(
|
||||
command, stderr=subprocess.PIPE, stdout=subprocess.DEVNULL, check=True
|
||||
command,
|
||||
stderr=subprocess.PIPE,
|
||||
stdout=subprocess.DEVNULL,
|
||||
check=True,
|
||||
)
|
||||
except subprocess.CalledProcessError as e:
|
||||
Logger.print_error(f"Error while removing policykit rules: {e}")
|
||||
|
||||
@@ -12,7 +12,10 @@ import sys
|
||||
from pathlib import Path
|
||||
|
||||
from components.webui_client import MAINSAIL_DIR
|
||||
from components.webui_client.client_utils import enable_mainsail_remotemode, get_existing_clients
|
||||
from components.webui_client.client_utils import (
|
||||
enable_mainsail_remotemode,
|
||||
get_existing_clients,
|
||||
)
|
||||
from kiauh import KIAUH_CFG
|
||||
from components.klipper.klipper import Klipper
|
||||
from components.moonraker import (
|
||||
@@ -170,7 +173,10 @@ def install_moonraker_polkit() -> None:
|
||||
try:
|
||||
command = [POLKIT_SCRIPT, "--disable-systemctl"]
|
||||
result = subprocess.run(
|
||||
command, stderr=subprocess.PIPE, stdout=subprocess.DEVNULL, text=True
|
||||
command,
|
||||
stderr=subprocess.PIPE,
|
||||
stdout=subprocess.DEVNULL,
|
||||
text=True,
|
||||
)
|
||||
if result.returncode != 0 or result.stderr:
|
||||
Logger.print_error(f"{result.stderr}", False)
|
||||
|
||||
@@ -32,10 +32,12 @@ from utils.system_utils import (
|
||||
)
|
||||
|
||||
|
||||
def get_moonraker_status() -> Dict[
|
||||
Literal["status", "status_code", "instances", "repo", "local", "remote"],
|
||||
Union[str, int],
|
||||
]:
|
||||
def get_moonraker_status() -> (
|
||||
Dict[
|
||||
Literal["status", "status_code", "instances", "repo", "local", "remote"],
|
||||
Union[str, int],
|
||||
]
|
||||
):
|
||||
status = get_install_status_common(Moonraker, MOONRAKER_DIR, MOONRAKER_ENV_DIR)
|
||||
return {
|
||||
"status": status.get("status"),
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
# ======================================================================= #
|
||||
|
||||
from pathlib import Path
|
||||
from typing import Literal, TypedDict, Set
|
||||
from typing import Literal, TypedDict
|
||||
|
||||
from core.backup_manager import BACKUP_ROOT_DIR
|
||||
|
||||
|
||||
@@ -16,7 +16,9 @@ from kiauh import KIAUH_CFG
|
||||
from components.klipper.klipper import Klipper
|
||||
from components.moonraker.moonraker import Moonraker
|
||||
from components.webui_client import ClientConfigData, ClientName, ClientData
|
||||
from components.webui_client.client_dialogs import print_client_already_installed_dialog
|
||||
from components.webui_client.client_dialogs import (
|
||||
print_client_already_installed_dialog,
|
||||
)
|
||||
from components.webui_client.client_utils import (
|
||||
load_client_data,
|
||||
backup_client_config_data,
|
||||
@@ -29,8 +31,9 @@ from core.repo_manager.repo_manager import RepoManager
|
||||
from utils.common import backup_printer_config_dir
|
||||
from utils.filesystem_utils import (
|
||||
create_symlink,
|
||||
add_config_section, add_config_section_at_top,
|
||||
)
|
||||
add_config_section,
|
||||
add_config_section_at_top,
|
||||
)
|
||||
from utils.input_utils import get_confirm
|
||||
from utils.logger import Logger
|
||||
|
||||
|
||||
@@ -112,7 +112,9 @@ def get_client_status(client: ClientData) -> str:
|
||||
)
|
||||
|
||||
|
||||
def get_client_config_status(client: ClientData) -> Dict[
|
||||
def get_client_config_status(
|
||||
client: ClientData,
|
||||
) -> Dict[
|
||||
Literal["repo", "local", "remote"],
|
||||
Union[str, int],
|
||||
]:
|
||||
|
||||
@@ -16,34 +16,34 @@ from core.instance_manager.base_instance import BaseInstance
|
||||
from utils.constants import SYSTEMD
|
||||
from utils.logger import Logger
|
||||
|
||||
I = TypeVar(name="I", bound=BaseInstance, covariant=True)
|
||||
T = TypeVar(name="T", bound=BaseInstance, covariant=True)
|
||||
|
||||
|
||||
# noinspection PyMethodMayBeStatic
|
||||
class InstanceManager:
|
||||
def __init__(self, instance_type: I) -> None:
|
||||
def __init__(self, instance_type: T) -> None:
|
||||
self._instance_type = instance_type
|
||||
self._current_instance: Optional[I] = None
|
||||
self._current_instance: Optional[T] = None
|
||||
self._instance_suffix: Optional[str] = None
|
||||
self._instance_service: Optional[str] = None
|
||||
self._instance_service_full: Optional[str] = None
|
||||
self._instance_service_path: Optional[str] = None
|
||||
self._instances: List[I] = []
|
||||
self._instances: List[T] = []
|
||||
|
||||
@property
|
||||
def instance_type(self) -> I:
|
||||
def instance_type(self) -> T:
|
||||
return self._instance_type
|
||||
|
||||
@instance_type.setter
|
||||
def instance_type(self, value: I):
|
||||
def instance_type(self, value: T):
|
||||
self._instance_type = value
|
||||
|
||||
@property
|
||||
def current_instance(self) -> I:
|
||||
def current_instance(self) -> T:
|
||||
return self._current_instance
|
||||
|
||||
@current_instance.setter
|
||||
def current_instance(self, value: I) -> None:
|
||||
def current_instance(self, value: T) -> None:
|
||||
self._current_instance = value
|
||||
self.instance_suffix = value.suffix
|
||||
self.instance_service = value.get_service_file_name()
|
||||
@@ -78,11 +78,11 @@ class InstanceManager:
|
||||
self._instance_service_path = value
|
||||
|
||||
@property
|
||||
def instances(self) -> List[I]:
|
||||
def instances(self) -> List[T]:
|
||||
return self.find_instances()
|
||||
|
||||
@instances.setter
|
||||
def instances(self, value: List[I]):
|
||||
def instances(self, value: List[T]):
|
||||
self._instances = value
|
||||
|
||||
def create_instance(self) -> None:
|
||||
@@ -108,7 +108,12 @@ class InstanceManager:
|
||||
def enable_instance(self) -> None:
|
||||
Logger.print_status(f"Enabling {self.instance_service_full} ...")
|
||||
try:
|
||||
command = ["sudo", "systemctl", "enable", self.instance_service_full]
|
||||
command = [
|
||||
"sudo",
|
||||
"systemctl",
|
||||
"enable",
|
||||
self.instance_service_full,
|
||||
]
|
||||
if subprocess.run(command, check=True):
|
||||
Logger.print_ok(f"{self.instance_service_full} enabled.")
|
||||
except subprocess.CalledProcessError as e:
|
||||
@@ -118,7 +123,12 @@ class InstanceManager:
|
||||
def disable_instance(self) -> None:
|
||||
Logger.print_status(f"Disabling {self.instance_service_full} ...")
|
||||
try:
|
||||
command = ["sudo", "systemctl", "disable", self.instance_service_full]
|
||||
command = [
|
||||
"sudo",
|
||||
"systemctl",
|
||||
"disable",
|
||||
self.instance_service_full,
|
||||
]
|
||||
if subprocess.run(command, check=True):
|
||||
Logger.print_ok(f"{self.instance_service_full} disabled.")
|
||||
except subprocess.CalledProcessError as e:
|
||||
@@ -128,7 +138,12 @@ class InstanceManager:
|
||||
def start_instance(self) -> None:
|
||||
Logger.print_status(f"Starting {self.instance_service_full} ...")
|
||||
try:
|
||||
command = ["sudo", "systemctl", "start", self.instance_service_full]
|
||||
command = [
|
||||
"sudo",
|
||||
"systemctl",
|
||||
"start",
|
||||
self.instance_service_full,
|
||||
]
|
||||
if subprocess.run(command, check=True):
|
||||
Logger.print_ok(f"{self.instance_service_full} started.")
|
||||
except subprocess.CalledProcessError as e:
|
||||
@@ -138,7 +153,12 @@ class InstanceManager:
|
||||
def restart_instance(self) -> None:
|
||||
Logger.print_status(f"Restarting {self.instance_service_full} ...")
|
||||
try:
|
||||
command = ["sudo", "systemctl", "restart", self.instance_service_full]
|
||||
command = [
|
||||
"sudo",
|
||||
"systemctl",
|
||||
"restart",
|
||||
self.instance_service_full,
|
||||
]
|
||||
if subprocess.run(command, check=True):
|
||||
Logger.print_ok(f"{self.instance_service_full} restarted.")
|
||||
except subprocess.CalledProcessError as e:
|
||||
@@ -182,7 +202,7 @@ class InstanceManager:
|
||||
Logger.print_error(f"{e}")
|
||||
raise
|
||||
|
||||
def find_instances(self) -> List[I]:
|
||||
def find_instances(self) -> List[T]:
|
||||
name = self.instance_type.__name__.lower()
|
||||
pattern = re.compile(f"^{name}(-[0-9a-zA-Z]+)?.service$")
|
||||
excluded = self.instance_type.blacklist()
|
||||
|
||||
@@ -68,7 +68,11 @@ class MainMenu(BaseMenu):
|
||||
def init_status(self) -> None:
|
||||
status_vars = ["kl", "mr", "ms", "fl", "ks", "mb", "cn"]
|
||||
for var in status_vars:
|
||||
setattr(self, f"{var}_status", f"{COLOR_RED}Not installed!{RESET_FORMAT}")
|
||||
setattr(
|
||||
self,
|
||||
f"{var}_status",
|
||||
f"{COLOR_RED}Not installed!{RESET_FORMAT}",
|
||||
)
|
||||
|
||||
def fetch_status(self) -> None:
|
||||
# klipper
|
||||
|
||||
@@ -10,7 +10,9 @@
|
||||
import textwrap
|
||||
|
||||
from components.klipper.menus.klipper_remove_menu import KlipperRemoveMenu
|
||||
from components.moonraker.menus.moonraker_remove_menu import MoonrakerRemoveMenu
|
||||
from components.moonraker.menus.moonraker_remove_menu import (
|
||||
MoonrakerRemoveMenu,
|
||||
)
|
||||
from components.webui_client.client_utils import load_client_data
|
||||
from components.webui_client.menus.client_remove_menu import ClientRemoveMenu
|
||||
from core.menus import BACK_FOOTER
|
||||
|
||||
@@ -24,7 +24,7 @@ class RepoManager:
|
||||
branch: str = None,
|
||||
):
|
||||
self._repo = repo
|
||||
self._branch = branch if branch is not None else "master"
|
||||
self._branch = branch
|
||||
self._method = self._get_method()
|
||||
self._target_dir = target_dir
|
||||
|
||||
@@ -110,7 +110,7 @@ class RepoManager:
|
||||
if Path(self.target_dir).exists():
|
||||
question = f"'{self.target_dir}' already exists. Overwrite?"
|
||||
if not get_confirm(question, default_choice=False):
|
||||
Logger.print_info("Skipping re-clone of repository.")
|
||||
Logger.print_info("Skip cloning of repository ...")
|
||||
return
|
||||
shutil.rmtree(self.target_dir)
|
||||
|
||||
@@ -145,6 +145,9 @@ class RepoManager:
|
||||
raise
|
||||
|
||||
def _checkout(self):
|
||||
if self.branch is None:
|
||||
return
|
||||
|
||||
try:
|
||||
command = ["git", "checkout", f"{self.branch}"]
|
||||
subprocess.run(command, cwd=self.target_dir, check=True)
|
||||
|
||||
@@ -44,7 +44,9 @@ class GcodeShellCmdExtension(BaseExtension):
|
||||
overwrite = True
|
||||
if extension_installed:
|
||||
overwrite = get_confirm(
|
||||
"Extension seems to be installed already. Overwrite?", True, False
|
||||
"Extension seems to be installed already. Overwrite?",
|
||||
True,
|
||||
False,
|
||||
)
|
||||
|
||||
if not overwrite:
|
||||
|
||||
@@ -0,0 +1,173 @@
|
||||
# ======================================================================= #
|
||||
# Copyright (C) 2020 - 2024 Dominik Willner <th33xitus@gmail.com> #
|
||||
# #
|
||||
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||
# https://github.com/dw-0/kiauh #
|
||||
# #
|
||||
# This file may be distributed under the terms of the GNU GPLv3 license #
|
||||
# ======================================================================= #
|
||||
|
||||
import csv
|
||||
import shutil
|
||||
import textwrap
|
||||
import urllib.request
|
||||
from typing import List, Union
|
||||
from typing import TypedDict
|
||||
|
||||
from components.klipper.klipper import Klipper
|
||||
from components.klipper.klipper_dialogs import (
|
||||
print_instance_overview,
|
||||
DisplayType,
|
||||
)
|
||||
from core.base_extension import BaseExtension
|
||||
from core.instance_manager.base_instance import BaseInstance
|
||||
from core.instance_manager.instance_manager import InstanceManager
|
||||
from core.menus import BACK_FOOTER
|
||||
from core.menus.base_menu import BaseMenu
|
||||
from core.repo_manager.repo_manager import RepoManager
|
||||
from utils.constants import COLOR_YELLOW, COLOR_CYAN, RESET_FORMAT
|
||||
from utils.input_utils import get_selection_input
|
||||
from utils.logger import Logger
|
||||
|
||||
|
||||
class ThemeData(TypedDict):
|
||||
name: str
|
||||
short_note: str
|
||||
author: str
|
||||
repo: str
|
||||
|
||||
|
||||
# noinspection PyMethodMayBeStatic
|
||||
class MainsailThemeInstallerExtension(BaseExtension):
|
||||
im = InstanceManager(Klipper)
|
||||
instances: List[Klipper] = im.instances
|
||||
|
||||
def install_extension(self, **kwargs) -> None:
|
||||
install_menu = MainsailThemeInstallMenu(self.instances)
|
||||
install_menu.start()
|
||||
|
||||
def remove_extension(self, **kwargs) -> None:
|
||||
print_instance_overview(
|
||||
self.instances,
|
||||
display_type=DisplayType.PRINTER_NAME,
|
||||
show_headline=True,
|
||||
show_index=True,
|
||||
show_select_all=True,
|
||||
)
|
||||
printer_list = get_printer_selection(self.instances, True)
|
||||
if printer_list is None:
|
||||
return
|
||||
|
||||
for printer in printer_list:
|
||||
Logger.print_status(f"Uninstalling theme from {printer.cfg_dir} ...")
|
||||
theme_dir = printer.cfg_dir.joinpath(".theme")
|
||||
if not theme_dir.exists():
|
||||
Logger.print_info(f"{theme_dir} not found. Skipping ...")
|
||||
continue
|
||||
try:
|
||||
shutil.rmtree(theme_dir)
|
||||
Logger.print_ok("Theme successfully uninstalled!")
|
||||
except OSError as e:
|
||||
Logger.print_error("Unable to uninstall theme")
|
||||
Logger.print_error(e)
|
||||
|
||||
|
||||
# noinspection PyMethodMayBeStatic
|
||||
class MainsailThemeInstallMenu(BaseMenu):
|
||||
THEMES_URL: str = (
|
||||
"https://raw.githubusercontent.com/mainsail-crew/gb-docs/main/_data/themes.csv"
|
||||
)
|
||||
|
||||
def __init__(self, instances: List[Klipper]):
|
||||
self.instances = instances
|
||||
self.themes: List[ThemeData] = self.load_themes()
|
||||
options = {f"{index}": self.install_theme for index in range(len(self.themes))}
|
||||
super().__init__(
|
||||
header=False,
|
||||
options=options,
|
||||
footer_type=BACK_FOOTER,
|
||||
)
|
||||
|
||||
def print_menu(self) -> None:
|
||||
header = " [ Mainsail Theme Installer ] "
|
||||
color = COLOR_YELLOW
|
||||
line1 = f"{COLOR_CYAN}A preview of each Mainsail theme can be found here:{RESET_FORMAT}"
|
||||
count = 62 - len(color) - len(RESET_FORMAT)
|
||||
menu = textwrap.dedent(
|
||||
f"""
|
||||
/=======================================================\\
|
||||
| {color}{header:~^{count}}{RESET_FORMAT} |
|
||||
|-------------------------------------------------------|
|
||||
| {line1:<62} |
|
||||
| https://docs.mainsail.xyz/theming/themes |
|
||||
|-------------------------------------------------------|
|
||||
"""
|
||||
)[1:]
|
||||
for i, theme in enumerate(self.themes):
|
||||
i = f" {i}" if i < 10 else f"{i}"
|
||||
row = f"{i}) [{theme.get('name')}]"
|
||||
menu += f"| {row:<53} |\n"
|
||||
print(menu, end="")
|
||||
|
||||
def load_themes(self) -> List[ThemeData]:
|
||||
with urllib.request.urlopen(self.THEMES_URL) as response:
|
||||
themes: List[ThemeData] = []
|
||||
csv_data: str = response.read().decode().splitlines()
|
||||
csv_reader = csv.DictReader(csv_data, delimiter=",")
|
||||
for row in csv_reader:
|
||||
row: ThemeData = row
|
||||
themes.append(row)
|
||||
|
||||
return themes
|
||||
|
||||
def install_theme(self, **kwargs):
|
||||
index = int(kwargs.get("opt_index"))
|
||||
theme_data: ThemeData = self.themes[index]
|
||||
theme_author: str = theme_data.get("author")
|
||||
theme_repo: str = theme_data.get("repo")
|
||||
theme_repo_url: str = f"https://github.com/{theme_author}/{theme_repo}"
|
||||
|
||||
print_instance_overview(
|
||||
self.instances,
|
||||
display_type=DisplayType.PRINTER_NAME,
|
||||
show_headline=True,
|
||||
show_index=True,
|
||||
show_select_all=True,
|
||||
)
|
||||
|
||||
printer_list = get_printer_selection(self.instances, True)
|
||||
if printer_list is None:
|
||||
return
|
||||
|
||||
repo_manager = RepoManager(theme_repo_url, "")
|
||||
for printer in printer_list:
|
||||
repo_manager.target_dir = printer.cfg_dir.joinpath(".theme")
|
||||
repo_manager.clone_repo()
|
||||
|
||||
if len(theme_data.get("short_note", "")) > 1:
|
||||
Logger.print_warn("Info from the creator:", prefix=False, start="\n")
|
||||
Logger.print_info(theme_data.get("short_note"), prefix=False, end="\n\n")
|
||||
|
||||
|
||||
def get_printer_selection(
|
||||
instances: List[BaseInstance], is_install: bool
|
||||
) -> Union[List[BaseInstance], None]:
|
||||
options = [str(i) for i in range(len(instances))]
|
||||
options.extend(["a", "A", "b", "B"])
|
||||
|
||||
if is_install:
|
||||
q = "Select the printer to install the theme for"
|
||||
else:
|
||||
q = "Select the printer to remove the theme from"
|
||||
selection = get_selection_input(q, options)
|
||||
|
||||
install_for = []
|
||||
if selection == "b".lower():
|
||||
return None
|
||||
elif selection == "a".lower():
|
||||
install_for.extend(instances)
|
||||
else:
|
||||
instance = instances[int(selection)]
|
||||
install_for.append(instance)
|
||||
|
||||
return install_for
|
||||
9
kiauh/extensions/mainsail_theme_installer/metadata.json
Normal file
9
kiauh/extensions/mainsail_theme_installer/metadata.json
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"metadata": {
|
||||
"index": 2,
|
||||
"module": "mainsail_theme_installer_extension",
|
||||
"maintained_by": "dw-0",
|
||||
"display_name": "Mainsail Theme Installer",
|
||||
"description": "Install Mainsail Themes maintained by the community."
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,4 @@
|
||||
#!/usr/bin/env python3
|
||||
import os
|
||||
|
||||
# ======================================================================= #
|
||||
# Copyright (C) 2020 - 2024 Dominik Willner <th33xitus@gmail.com> #
|
||||
@@ -209,11 +208,10 @@ def add_config_section(
|
||||
|
||||
cm.write_config()
|
||||
|
||||
def add_config_section_at_top(
|
||||
section: str,
|
||||
instances: List[B]):
|
||||
|
||||
def add_config_section_at_top(section: str, instances: List[B]):
|
||||
for instance in instances:
|
||||
tmp_cfg = tempfile.NamedTemporaryFile(mode="w" ,delete=False)
|
||||
tmp_cfg = tempfile.NamedTemporaryFile(mode="w", delete=False)
|
||||
tmp_cfg_path = Path(tmp_cfg.name)
|
||||
cmt = ConfigManager(tmp_cfg_path)
|
||||
cmt.config.add_section(section)
|
||||
|
||||
@@ -51,7 +51,11 @@ def get_confirm(
|
||||
|
||||
|
||||
def get_number_input(
|
||||
question: str, min_count: int, max_count=None, default=None, allow_go_back=False
|
||||
question: str,
|
||||
min_count: int,
|
||||
max_count=None,
|
||||
default=None,
|
||||
allow_go_back=False,
|
||||
) -> Union[int, None]:
|
||||
"""
|
||||
Helper method to get a number input from the user
|
||||
|
||||
@@ -130,7 +130,12 @@ def install_python_requirements(target: Path, requirements: Path) -> None:
|
||||
update_python_pip(target)
|
||||
|
||||
Logger.print_status("Installing Python requirements ...")
|
||||
command = [target.joinpath("bin/pip"), "install", "-r", f"{requirements}"]
|
||||
command = [
|
||||
target.joinpath("bin/pip"),
|
||||
"install",
|
||||
"-r",
|
||||
f"{requirements}",
|
||||
]
|
||||
result = subprocess.run(command, stderr=subprocess.PIPE, text=True)
|
||||
|
||||
if result.returncode != 0 or result.stderr:
|
||||
@@ -196,7 +201,10 @@ def check_package_install(packages: List[str]) -> List[str]:
|
||||
for package in packages:
|
||||
command = ["dpkg-query", "-f'${Status}'", "--show", package]
|
||||
result = subprocess.run(
|
||||
command, stdout=subprocess.PIPE, stderr=subprocess.DEVNULL, text=True
|
||||
command,
|
||||
stdout=subprocess.PIPE,
|
||||
stderr=subprocess.DEVNULL,
|
||||
text=True,
|
||||
)
|
||||
if "installed" not in result.stdout.strip("'").split():
|
||||
not_installed.append(package)
|
||||
|
||||
@@ -1,13 +1,16 @@
|
||||
[tool.black]
|
||||
[project]
|
||||
requires-python = ">=3.8"
|
||||
|
||||
[tool.ruff]
|
||||
required-version = ">=0.3.4"
|
||||
respect-gitignore = true
|
||||
exclude = [".git",".github", "./docs"]
|
||||
line-length = 88
|
||||
target-version = ['py38']
|
||||
include = '\.pyi?$'
|
||||
exclude = '''
|
||||
(
|
||||
\.git/
|
||||
| \.github/
|
||||
| docs/
|
||||
| resources/
|
||||
| scripts/
|
||||
)
|
||||
'''
|
||||
indent-width = 4
|
||||
output-format = "full"
|
||||
|
||||
[tool.ruff.format]
|
||||
indent-style = "space"
|
||||
line-ending = "lf"
|
||||
quote-style = "double"
|
||||
|
||||
|
||||
@@ -1,7 +1,11 @@
|
||||
[mcu]
|
||||
serial: /dev/serial/by-id/<your-mcu-id>
|
||||
|
||||
[virtual_sdcard]
|
||||
path: %GCODES_DIR%
|
||||
on_error_gcode: CANCEL_PRINT
|
||||
|
||||
[printer]
|
||||
kinematics: none
|
||||
max_velocity: 1000
|
||||
max_accel: 1000
|
||||
max_accel: 1000
|
||||
|
||||
@@ -8,22 +8,26 @@ import shlex
|
||||
import subprocess
|
||||
import logging
|
||||
|
||||
|
||||
class ShellCommand:
|
||||
def __init__(self, config):
|
||||
self.name = config.get_name().split()[-1]
|
||||
self.printer = config.get_printer()
|
||||
self.gcode = self.printer.lookup_object('gcode')
|
||||
cmd = config.get('command')
|
||||
self.gcode = self.printer.lookup_object("gcode")
|
||||
cmd = config.get("command")
|
||||
cmd = os.path.expanduser(cmd)
|
||||
self.command = shlex.split(cmd)
|
||||
self.timeout = config.getfloat('timeout', 2., above=0.)
|
||||
self.verbose = config.getboolean('verbose', True)
|
||||
self.timeout = config.getfloat("timeout", 2.0, above=0.0)
|
||||
self.verbose = config.getboolean("verbose", True)
|
||||
self.proc_fd = None
|
||||
self.partial_output = ""
|
||||
self.gcode.register_mux_command(
|
||||
"RUN_SHELL_COMMAND", "CMD", self.name,
|
||||
"RUN_SHELL_COMMAND",
|
||||
"CMD",
|
||||
self.name,
|
||||
self.cmd_RUN_SHELL_COMMAND,
|
||||
desc=self.cmd_RUN_SHELL_COMMAND_help)
|
||||
desc=self.cmd_RUN_SHELL_COMMAND_help,
|
||||
)
|
||||
|
||||
def _process_output(self, eventime):
|
||||
if self.proc_fd is None:
|
||||
@@ -33,11 +37,11 @@ class ShellCommand:
|
||||
except Exception:
|
||||
pass
|
||||
data = self.partial_output + data.decode()
|
||||
if '\n' not in data:
|
||||
if "\n" not in data:
|
||||
self.partial_output = data
|
||||
return
|
||||
elif data[-1] != '\n':
|
||||
split = data.rfind('\n') + 1
|
||||
elif data[-1] != "\n":
|
||||
split = data.rfind("\n") + 1
|
||||
self.partial_output = data[split:]
|
||||
data = data[:split]
|
||||
else:
|
||||
@@ -45,16 +49,19 @@ class ShellCommand:
|
||||
self.gcode.respond_info(data)
|
||||
|
||||
cmd_RUN_SHELL_COMMAND_help = "Run a linux shell command"
|
||||
|
||||
def cmd_RUN_SHELL_COMMAND(self, params):
|
||||
gcode_params = params.get('PARAMS','')
|
||||
gcode_params = params.get("PARAMS", "")
|
||||
gcode_params = shlex.split(gcode_params)
|
||||
reactor = self.printer.get_reactor()
|
||||
try:
|
||||
proc = subprocess.Popen(
|
||||
self.command + gcode_params, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
|
||||
self.command + gcode_params,
|
||||
stdout=subprocess.PIPE,
|
||||
stderr=subprocess.STDOUT,
|
||||
)
|
||||
except Exception:
|
||||
logging.exception(
|
||||
"shell_command: Command {%s} failed" % (self.name))
|
||||
logging.exception("shell_command: Command {%s} failed" % (self.name))
|
||||
raise self.gcode.error("Error running command {%s}" % (self.name))
|
||||
if self.verbose:
|
||||
self.proc_fd = proc.stdout.fileno()
|
||||
@@ -64,7 +71,7 @@ class ShellCommand:
|
||||
endtime = eventtime + self.timeout
|
||||
complete = False
|
||||
while eventtime < endtime:
|
||||
eventtime = reactor.pause(eventtime + .05)
|
||||
eventtime = reactor.pause(eventtime + 0.05)
|
||||
if proc.poll() is not None:
|
||||
complete = True
|
||||
break
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
#=======================================================================#
|
||||
# Copyright (C) 2020 - 2023 Dominik Willner <th33xitus@gmail.com> #
|
||||
# Copyright (C) 2020 - 2024 Dominik Willner <th33xitus@gmail.com> #
|
||||
# #
|
||||
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||
# https://github.com/dw-0/kiauh #
|
||||
@@ -33,23 +33,25 @@ function backup_before_update() {
|
||||
|
||||
function backup_config_dir() {
|
||||
check_for_backup_dir
|
||||
local current_date instance_names config_pathes
|
||||
local current_date config_pathes
|
||||
|
||||
config_pathes=$(get_config_folders)
|
||||
readarray -t -d" " instance_names < <(get_multi_instance_names)
|
||||
|
||||
if [[ -n "${config_pathes}" ]]; then
|
||||
current_date=$(get_date)
|
||||
status_msg "Timestamp: ${current_date}"
|
||||
|
||||
local i=0 folder
|
||||
local i=0 folder folder_name target_dir
|
||||
for folder in ${config_pathes}; do
|
||||
local folder_name="${instance_names[${i}]}"
|
||||
status_msg "Create backup of ${folder} ..."
|
||||
mkdir -p "${BACKUP_DIR}/configs/${current_date}/${folder_name}"
|
||||
cp -r "${folder}" "${_}"
|
||||
ok_msg "Backup created in:\n${BACKUP_DIR}/configs/${current_date}/${folder_name}"
|
||||
|
||||
folder_name=$(echo "${folder}" | rev | cut -d"/" -f2 | rev)
|
||||
target_dir="${BACKUP_DIR}/configs/${current_date}/${folder_name}"
|
||||
mkdir -p "${target_dir}"
|
||||
cp -r "${folder}" "${target_dir}"
|
||||
i=$(( i + 1 ))
|
||||
|
||||
ok_msg "Backup created in:\n${target_dir}"
|
||||
done
|
||||
else
|
||||
ok_msg "No config directory found! Skipping backup ..."
|
||||
@@ -61,20 +63,22 @@ function backup_moonraker_database() {
|
||||
local current_date db_pathes
|
||||
|
||||
db_pathes=$(get_instance_folder_path "database")
|
||||
readarray -t -d" " instance_names < <(get_multi_instance_names)
|
||||
|
||||
if [[ -n ${db_pathes} ]]; then
|
||||
current_date=$(get_date)
|
||||
status_msg "Timestamp: ${current_date}"
|
||||
|
||||
local i=0 database
|
||||
local i=0 database folder_name target_dir
|
||||
for database in ${db_pathes}; do
|
||||
local folder_name="${instance_names[${i}]}"
|
||||
status_msg "Create backup of ${database} ..."
|
||||
mkdir -p "${BACKUP_DIR}/moonraker_databases/${current_date}/${folder_name}"
|
||||
cp -r "${database}" "${_}"
|
||||
ok_msg "Backup created in:\n${BACKUP_DIR}/moonraker_databases/${current_date}/${folder_name}"
|
||||
|
||||
folder_name=$(echo "${database}" | rev | cut -d"/" -f2 | rev)
|
||||
target_dir="${BACKUP_DIR}/moonraker_databases/${current_date}/${folder_name}"
|
||||
mkdir -p "${target_dir}"
|
||||
cp -r "${database}" "${target_dir}"
|
||||
i=$(( i + 1 ))
|
||||
|
||||
ok_msg "Backup created in:\n${target_dir}"
|
||||
done
|
||||
else
|
||||
print_error "No Moonraker database found! Skipping backup ..."
|
||||
@@ -191,3 +195,19 @@ function backup_telegram_bot() {
|
||||
print_error "Can't back up MoonrakerTelegramBot directory!\n Not found!"
|
||||
fi
|
||||
}
|
||||
|
||||
function backup_octoeverywhere() {
|
||||
local current_date
|
||||
|
||||
if [[ -d ${OCTOEVERYWHERE_DIR} ]] ; then
|
||||
status_msg "Creating OctoEverywhere backup ..."
|
||||
check_for_backup_dir
|
||||
current_date=$(get_date)
|
||||
status_msg "Timestamp: ${current_date}"
|
||||
mkdir -p "${BACKUP_DIR}/OctoEverywhere-backups/${current_date}"
|
||||
cp -r "${OCTOEVERYWHERE_DIR}" "${_}" && cp -r "${OCTOEVERYWHERE_ENV}" "${_}"
|
||||
print_confirm "OctoEverywhere backup complete!"
|
||||
else
|
||||
print_error "Can't back up OctoEverywhere directory!\n Not found!"
|
||||
fi
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
#=======================================================================#
|
||||
# Copyright (C) 2020 - 2023 Dominik Willner <th33xitus@gmail.com> #
|
||||
# Copyright (C) 2020 - 2024 Dominik Willner <th33xitus@gmail.com> #
|
||||
# #
|
||||
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||
# https://github.com/dw-0/kiauh #
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
#=======================================================================#
|
||||
# Copyright (C) 2020 - 2023 Dominik Willner <th33xitus@gmail.com> #
|
||||
# Copyright (C) 2020 - 2024 Dominik Willner <th33xitus@gmail.com> #
|
||||
# #
|
||||
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||
# https://github.com/dw-0/kiauh #
|
||||
@@ -52,16 +52,57 @@ function init_flash_process() {
|
||||
esac
|
||||
done
|
||||
|
||||
### step 2: select how the mcu is connected to the host
|
||||
### step 2: select how the mcu is flashed (flash/serialflash)
|
||||
select_flash_command
|
||||
|
||||
### step 3: select how the mcu is connected to the host
|
||||
select_mcu_connection
|
||||
|
||||
### step 3: select which detected mcu should be flashed
|
||||
### step 4: select which detected mcu should be flashed
|
||||
select_mcu_id "${method}"
|
||||
}
|
||||
|
||||
#================================================#
|
||||
#=================== STEP 2 =====================#
|
||||
#================================================#
|
||||
function select_flash_command() {
|
||||
unset flash_command
|
||||
|
||||
top_border
|
||||
echo -e "| How to flash MCU? |"
|
||||
echo -e "| 1) make flash (default) |"
|
||||
echo -e "| 2) make serialflash (stm32flash) |"
|
||||
blank_line
|
||||
back_help_footer
|
||||
|
||||
local choice
|
||||
while true; do
|
||||
read -p "${cyan}###### Flashing command:${white} " -i "1" -e choice
|
||||
case "${choice}" in
|
||||
1)
|
||||
select_msg "Selected 'make flash' command"
|
||||
flash_command="flash"
|
||||
break;;
|
||||
2)
|
||||
select_msg "Selected 'make serialflash' command"
|
||||
flash_command="serialflash"
|
||||
break;;
|
||||
B|b)
|
||||
advanced_menu
|
||||
break;;
|
||||
H|h)
|
||||
clear && print_header
|
||||
show_mcu_flash_command_help
|
||||
break;;
|
||||
*)
|
||||
error_msg "Invalid command!";;
|
||||
esac
|
||||
done
|
||||
}
|
||||
|
||||
#================================================#
|
||||
#=================== STEP 3 =====================#
|
||||
#================================================#
|
||||
function select_mcu_connection() {
|
||||
top_border
|
||||
echo -e "| ${yellow}Make sure that the controller board is connected now!${white} |"
|
||||
@@ -112,7 +153,6 @@ function print_detected_mcu_to_screen() {
|
||||
fi
|
||||
|
||||
for mcu in "${mcu_list[@]}"; do
|
||||
mcu=$(echo "${mcu}" | rev | cut -d"/" -f1 | rev)
|
||||
echo -e " ● MCU #${i}: ${cyan}${mcu}${white}"
|
||||
i=$(( i + 1 ))
|
||||
done
|
||||
@@ -120,7 +160,7 @@ function print_detected_mcu_to_screen() {
|
||||
}
|
||||
|
||||
#================================================#
|
||||
#=================== STEP 3 =====================#
|
||||
#=================== STEP 4 =====================#
|
||||
#================================================#
|
||||
function select_mcu_id() {
|
||||
local i=0 sel_index=0 method=${1}
|
||||
@@ -195,7 +235,7 @@ function start_flash_mcu() {
|
||||
local device=${1}
|
||||
do_action_service "stop" "klipper"
|
||||
|
||||
if make flash FLASH_DEVICE="${device}"; then
|
||||
if make ${flash_command} FLASH_DEVICE="${device}"; then
|
||||
ok_msg "Flashing successfull!"
|
||||
else
|
||||
warn_msg "Flashing failed!"
|
||||
@@ -387,6 +427,36 @@ function show_flash_method_help() {
|
||||
done
|
||||
}
|
||||
|
||||
function show_mcu_flash_command_help() {
|
||||
top_border
|
||||
echo -e "| ~~~~~~~~ < ? > Help: Flash MCU < ? > ~~~~~~~~ |"
|
||||
hr
|
||||
echo -e "| ${cyan}make flash:${white} |"
|
||||
echo -e "| The default command to flash controller board, it |"
|
||||
echo -e "| will detect selected microcontroller and use suitable |"
|
||||
echo -e "| tool for flashing it. |"
|
||||
blank_line
|
||||
echo -e "| ${cyan}make serialflash:${white} |"
|
||||
echo -e "| Special command to flash STM32 microcontrollers in |"
|
||||
echo -e "| DFU mode but connected via serial. stm32flash command |"
|
||||
echo -e "| will be used internally. |"
|
||||
blank_line
|
||||
back_footer
|
||||
|
||||
local choice
|
||||
while true; do
|
||||
read -p "${cyan}###### Please select:${white} " choice
|
||||
case "${choice}" in
|
||||
B|b)
|
||||
clear && print_header
|
||||
select_flash_command
|
||||
break;;
|
||||
*)
|
||||
error_msg "Invalid command!";;
|
||||
esac
|
||||
done
|
||||
}
|
||||
|
||||
function show_mcu_connection_help() {
|
||||
top_border
|
||||
echo -e "| ~~~~~~~~ < ? > Help: Flash MCU < ? > ~~~~~~~~ |"
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
#=======================================================================#
|
||||
# Copyright (C) 2020 - 2023 Dominik Willner <th33xitus@gmail.com> #
|
||||
# Copyright (C) 2020 - 2024 Dominik Willner <th33xitus@gmail.com> #
|
||||
# #
|
||||
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||
# https://github.com/dw-0/kiauh #
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
#=======================================================================#
|
||||
# Copyright (C) 2020 - 2023 Dominik Willner <th33xitus@gmail.com> #
|
||||
# Copyright (C) 2020 - 2024 Dominik Willner <th33xitus@gmail.com> #
|
||||
# #
|
||||
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||
# https://github.com/dw-0/kiauh #
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
#=======================================================================#
|
||||
# Copyright (C) 2020 - 2023 Dominik Willner <th33xitus@gmail.com> #
|
||||
# Copyright (C) 2020 - 2024 Dominik Willner <th33xitus@gmail.com> #
|
||||
# #
|
||||
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||
# https://github.com/dw-0/kiauh #
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
#=======================================================================#
|
||||
# Copyright (C) 2020 - 2023 Dominik Willner <th33xitus@gmail.com> #
|
||||
# Copyright (C) 2020 - 2024 Dominik Willner <th33xitus@gmail.com> #
|
||||
# #
|
||||
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||
# https://github.com/dw-0/kiauh #
|
||||
@@ -244,6 +244,7 @@ function run_klipper_setup() {
|
||||
|
||||
### finalizing the setup with writing instance names to the kiauh.ini
|
||||
set_multi_instance_names
|
||||
mask_disrupting_services
|
||||
|
||||
print_confirm "${confirm}" && return
|
||||
}
|
||||
@@ -333,6 +334,7 @@ function create_klipper_service() {
|
||||
|
||||
local printer_data
|
||||
local cfg_dir
|
||||
local gcodes_dir
|
||||
local cfg
|
||||
local log
|
||||
local klippy_serial
|
||||
@@ -345,6 +347,7 @@ function create_klipper_service() {
|
||||
|
||||
printer_data="${HOME}/${instance_name}_data"
|
||||
cfg_dir="${printer_data}/config"
|
||||
gcodes_dir="${printer_data}/gcodes"
|
||||
cfg="${cfg_dir}/printer.cfg"
|
||||
log="${printer_data}/logs/klippy.log"
|
||||
klippy_serial="${printer_data}/comms/klippy.serial"
|
||||
@@ -375,18 +378,20 @@ function create_klipper_service() {
|
||||
fi
|
||||
|
||||
if [[ ! -f ${cfg} ]]; then
|
||||
write_example_printer_cfg "${cfg}"
|
||||
write_example_printer_cfg "${cfg}" "${gcodes_dir}"
|
||||
fi
|
||||
}
|
||||
|
||||
function write_example_printer_cfg() {
|
||||
local cfg=${1}
|
||||
local gcodes_dir=${2}
|
||||
local cfg_template
|
||||
|
||||
cfg_template="${KIAUH_SRCDIR}/resources/example.printer.cfg"
|
||||
|
||||
status_msg "Creating minimal example printer.cfg ..."
|
||||
if cp "${cfg_template}" "${cfg}"; then
|
||||
sed -i "s|%GCODES_DIR%|${gcodes_dir}|" "${cfg}"
|
||||
ok_msg "Minimal example printer.cfg created!"
|
||||
else
|
||||
error_msg "Couldn't create minimal example printer.cfg!"
|
||||
@@ -625,3 +630,34 @@ function get_klipper_python_ver() {
|
||||
version=$("${KLIPPY_ENV}"/bin/python --version 2>&1 | cut -d" " -f2 | cut -d"." -f1)
|
||||
echo "${version}"
|
||||
}
|
||||
|
||||
function mask_disrupting_services() {
|
||||
local brltty="false"
|
||||
local brltty_udev="false"
|
||||
local modem_manager="false"
|
||||
|
||||
[[ $(dpkg -s brltty 2>/dev/null | grep "Status") = *\ installed ]] && brltty="true"
|
||||
[[ $(dpkg -s brltty-udev 2>/dev/null | grep "Status") = *\ installed ]] && brltty_udev="true"
|
||||
[[ $(dpkg -s ModemManager 2>/dev/null | grep "Status") = *\ installed ]] && modem_manager="true"
|
||||
|
||||
status_msg "Installed brltty package detected, masking brltty service ..."
|
||||
if [[ ${brltty} == "true" ]]; then
|
||||
sudo systemctl stop brltty
|
||||
sudo systemctl mask brltty
|
||||
fi
|
||||
ok_msg "brltty service masked!"
|
||||
|
||||
status_msg "Installed brltty-udev package detected, masking brltty-udev service ..."
|
||||
if [[ ${brltty_udev} == "true" ]]; then
|
||||
sudo systemctl stop brltty-udev
|
||||
sudo systemctl mask brltty-udev
|
||||
fi
|
||||
ok_msg "brltty-udev service masked!"
|
||||
|
||||
status_msg "Installed ModemManager package detected, masking ModemManager service ..."
|
||||
if [[ ${modem_manager} == "true" ]]; then
|
||||
sudo systemctl stop ModemManager
|
||||
sudo systemctl mask ModemManager
|
||||
fi
|
||||
ok_msg "ModemManager service masked!"
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
#=======================================================================#
|
||||
# Copyright (C) 2020 - 2023 Dominik Willner <th33xitus@gmail.com> #
|
||||
# Copyright (C) 2020 - 2024 Dominik Willner <th33xitus@gmail.com> #
|
||||
# #
|
||||
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||
# https://github.com/dw-0/kiauh #
|
||||
@@ -119,6 +119,8 @@ function update_klipperscreen() {
|
||||
old_md5=$(md5sum "${KLIPPERSCREEN_DIR}/scripts/KlipperScreen-requirements.txt" | cut -d " " -f1)
|
||||
|
||||
do_action_service "stop" "KlipperScreen"
|
||||
backup_before_update "klipperscreen"
|
||||
|
||||
cd "${KLIPPERSCREEN_DIR}"
|
||||
git pull origin master -q && ok_msg "Fetch successfull!"
|
||||
git checkout -f master && ok_msg "Checkout successfull"
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
#=======================================================================#
|
||||
# Copyright (C) 2020 - 2023 Dominik Willner <th33xitus@gmail.com> #
|
||||
# Copyright (C) 2020 - 2024 Dominik Willner <th33xitus@gmail.com> #
|
||||
# #
|
||||
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||
# https://github.com/dw-0/kiauh #
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
#=======================================================================#
|
||||
# Copyright (C) 2020 - 2023 Dominik Willner <th33xitus@gmail.com> #
|
||||
# Copyright (C) 2020 - 2024 Dominik Willner <th33xitus@gmail.com> #
|
||||
# #
|
||||
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||
# https://github.com/dw-0/kiauh #
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
#=======================================================================#
|
||||
# Copyright (C) 2020 - 2023 Dominik Willner <th33xitus@gmail.com> #
|
||||
# Copyright (C) 2020 - 2024 Dominik Willner <th33xitus@gmail.com> #
|
||||
# #
|
||||
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||
# https://github.com/dw-0/kiauh #
|
||||
@@ -61,8 +61,8 @@ function mobileraker_setup() {
|
||||
exit 1
|
||||
fi
|
||||
|
||||
status_msg "Installing Mobileraker's companion ..."
|
||||
if "${MOBILERAKER_DIR}"/scripts/install-mobileraker-companion.sh; then
|
||||
status_msg "Starting installer of Mobileraker's companion ..."
|
||||
if "${MOBILERAKER_DIR}"/scripts/install.sh; then
|
||||
ok_msg "Mobileraker's companion successfully installed!"
|
||||
else
|
||||
print_error "Mobileraker's companion installation failed!"
|
||||
@@ -233,7 +233,7 @@ primary_branch:main
|
||||
managed_services: mobileraker
|
||||
env: ${HOME}/mobileraker-env/bin/python
|
||||
requirements: scripts/mobileraker-requirements.txt
|
||||
install_script: scripts/install-mobileraker-companion.sh
|
||||
install_script: scripts/install.sh
|
||||
MOONRAKER_CONF
|
||||
|
||||
fi
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
#=======================================================================#
|
||||
# Copyright (C) 2020 - 2023 Dominik Willner <th33xitus@gmail.com> #
|
||||
# Copyright (C) 2020 - 2024 Dominik Willner <th33xitus@gmail.com> #
|
||||
# #
|
||||
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||
# https://github.com/dw-0/kiauh #
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
#=======================================================================#
|
||||
# Copyright (C) 2020 - 2023 Dominik Willner <th33xitus@gmail.com> #
|
||||
# Copyright (C) 2020 - 2024 Dominik Willner <th33xitus@gmail.com> #
|
||||
# #
|
||||
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||
# https://github.com/dw-0/kiauh #
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
#=======================================================================#
|
||||
# Copyright (C) 2020 - 2023 Dominik Willner <th33xitus@gmail.com> #
|
||||
# Copyright (C) 2020 - 2024 Dominik Willner <th33xitus@gmail.com> #
|
||||
# #
|
||||
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||
# https://github.com/dw-0/kiauh #
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
#=======================================================================#
|
||||
# Copyright (C) 2020 - 2023 Dominik Willner <th33xitus@gmail.com> #
|
||||
# Copyright (C) 2020 - 2024 Dominik Willner <th33xitus@gmail.com> #
|
||||
# #
|
||||
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||
# https://github.com/dw-0/kiauh #
|
||||
@@ -63,7 +63,7 @@ function obico_server_url_prompt() {
|
||||
}
|
||||
|
||||
function moonraker_obico_setup_dialog() {
|
||||
status_msg "Initializing Moonraker-obico installation ..."
|
||||
status_msg "Initializing Obico installation ..."
|
||||
|
||||
local moonraker_count
|
||||
local moonraker_names
|
||||
@@ -73,7 +73,7 @@ function moonraker_obico_setup_dialog() {
|
||||
if (( moonraker_count == 0 )); then
|
||||
### return early if moonraker is not installed
|
||||
local error="Moonraker not installed! Please install Moonraker first!"
|
||||
log_error "Moonraker-obico setup started without Moonraker being installed. Aborting setup."
|
||||
log_error "Obico setup started without Moonraker being installed. Aborting setup."
|
||||
print_error "${error}" && return
|
||||
elif (( moonraker_count > 1 )); then
|
||||
# moonraker_names is valid only in case of multi-instance
|
||||
@@ -90,10 +90,10 @@ function moonraker_obico_setup_dialog() {
|
||||
if (( allowed_moonraker_obico_count == 0 && moonraker_count > 0 )) && [[ $(get_moonraker_obico_status) != "Not linked!" ]]; then
|
||||
local yn
|
||||
while true; do
|
||||
echo "${yellow}Obico for Klipper is already installed.${white}"
|
||||
echo "${yellow}Obico is already installed.${white}"
|
||||
echo "It is safe to run the install again to repair any issues."
|
||||
echo ""
|
||||
local question="Do you want to reinstall Obico for Klipper?"
|
||||
local question="Do you want to reinstall Obico?"
|
||||
read -p "${cyan}###### ${question} (Y/n):${white} " yn
|
||||
case "${yn}" in
|
||||
Y|y|Yes|yes|"")
|
||||
@@ -101,7 +101,7 @@ function moonraker_obico_setup_dialog() {
|
||||
break;;
|
||||
N|n|No|no)
|
||||
select_msg "No"
|
||||
abort_msg "Exiting Obico for Klipper installation...\n"
|
||||
abort_msg "Exiting Obico installation...\n"
|
||||
return;;
|
||||
*)
|
||||
error_msg "Invalid Input!";;
|
||||
@@ -126,31 +126,30 @@ function moonraker_obico_setup_dialog() {
|
||||
done
|
||||
blank_line
|
||||
if (( existing_moonraker_obico_count > 0 )); then
|
||||
printf "|${green}%-55s${white}|\n" " ${existing_moonraker_obico_count} Moonraker-obico instances already installed!"
|
||||
printf "|${green}%-55s${white}|\n" " ${existing_moonraker_obico_count} Obico instances already installed!"
|
||||
for svc in ${moonraker_obico_services}; do
|
||||
printf "|${cyan}%-57s${white}|\n" " ● moonraker-obco-$(get_instance_name "${svc}")"
|
||||
done
|
||||
fi
|
||||
blank_line
|
||||
echo -e "| The setup will apply the same names to |"
|
||||
echo -e "| Moonraker-obico! |"
|
||||
echo -e "| The setup will apply the same names to Obico! |"
|
||||
blank_line
|
||||
echo -e "| Please select the number of Moonraker-obico instances |"
|
||||
echo -e "| to install. Usually one Moonraker-obico instance per |"
|
||||
echo -e "| Please select the number of Obico instances |"
|
||||
echo -e "| to install. Usually one Obico instance per |"
|
||||
echo -e "| Moonraker instance is required, but you may not |"
|
||||
echo -e "| install more Moonraker-obico instances than available |"
|
||||
echo -e "| install more Obico instances than available |"
|
||||
echo -e "| Moonraker instances. |"
|
||||
bottom_border
|
||||
|
||||
### ask for amount of instances
|
||||
local re="^[1-9][0-9]*$"
|
||||
while [[ ! ${new_moonraker_obico_count} =~ ${re} || ${new_moonraker_obico_count} -gt ${allowed_moonraker_obico_count} ]]; do
|
||||
read -p "${cyan}###### Number of new Moonraker-obico instances to set up:${white} " -i "${allowed_moonraker_obico_count}" -e new_moonraker_obico_count
|
||||
read -p "${cyan}###### Number of new Obico instances to set up:${white} " -i "${allowed_moonraker_obico_count}" -e new_moonraker_obico_count
|
||||
### break if input is valid
|
||||
[[ ${new_moonraker_obico_count} =~ ${re} && ${new_moonraker_obico_count} -le ${allowed_moonraker_obico_count} ]] && break
|
||||
### conditional error messages
|
||||
[[ ! ${new_moonraker_obico_count} =~ ${re} ]] && error_msg "Input not a number"
|
||||
(( new_moonraker_obico_count > allowed_moonraker_obico_count )) && error_msg "Number of Moonraker-obico instances larger than installed Moonraker instances"
|
||||
(( new_moonraker_obico_count > allowed_moonraker_obico_count )) && error_msg "Number of Obico instances larger than installed Moonraker instances"
|
||||
done && select_msg "${new_moonraker_obico_count}"
|
||||
else
|
||||
log_error "Internal error. moonraker_count of '${moonraker_count}' not equal or grather than one!"
|
||||
@@ -160,8 +159,8 @@ function moonraker_obico_setup_dialog() {
|
||||
### Step 2: Confirm instance amount
|
||||
local yn
|
||||
while true; do
|
||||
(( new_moonraker_obico_count == 1 )) && local question="Install Moonraker-obico?"
|
||||
(( new_moonraker_obico_count > 1 )) && local question="Install ${new_moonraker_obico_count} Moonraker-obico instances?"
|
||||
(( new_moonraker_obico_count == 1 )) && local question="Install Obico?"
|
||||
(( new_moonraker_obico_count > 1 )) && local question="Install ${new_moonraker_obico_count} Obico instances?"
|
||||
read -p "${cyan}###### ${question} (Y/n):${white} " yn
|
||||
case "${yn}" in
|
||||
Y|y|Yes|yes|"")
|
||||
@@ -169,7 +168,7 @@ function moonraker_obico_setup_dialog() {
|
||||
break;;
|
||||
N|n|No|no)
|
||||
select_msg "No"
|
||||
abort_msg "Exiting Moonraker-obico setup ...\n"
|
||||
abort_msg "Exiting Obico setup ...\n"
|
||||
return;;
|
||||
*)
|
||||
error_msg "Invalid Input!";;
|
||||
@@ -191,8 +190,8 @@ function moonraker_obico_setup_dialog() {
|
||||
fi
|
||||
done
|
||||
|
||||
(( new_moonraker_obico_count > 1 )) && status_msg "Installing ${new_moonraker_obico_count} Moonraker-obico instances ..."
|
||||
(( new_moonraker_obico_count == 1 )) && status_msg "Installing Moonraker-obico ..."
|
||||
(( new_moonraker_obico_count > 1 )) && status_msg "Installing ${new_moonraker_obico_count} Obico instances ..."
|
||||
(( new_moonraker_obico_count == 1 )) && status_msg "Installing Obico ..."
|
||||
|
||||
### Step 5: Clone the moonraker-obico repo
|
||||
clone_moonraker_obico "${MOONRAKER_OBICO_REPO}"
|
||||
@@ -244,17 +243,16 @@ function moonraker_obico_setup_dialog() {
|
||||
if (( ${#not_linked_instances[@]} > 0 )); then
|
||||
top_border
|
||||
if (( moonraker_count == 1 )); then
|
||||
printf "|${green}%-55s${white}|\n" " Moonraker-obico not linked to the server!"
|
||||
printf "|${green}%-55s${white}|\n" " Obico not linked to the server!"
|
||||
else
|
||||
printf "|${green}%-55s${white}|\n" " ${#not_linked_instances[@]} Moonraker-obico instances not linked to the server!"
|
||||
printf "|${green}%-55s${white}|\n" " ${#not_linked_instances[@]} Obico instances not linked to the server!"
|
||||
for i in "${not_linked_instances[@]}"; do
|
||||
printf "|${cyan}%-57s${white}|\n" " ● moonraker-obico-${moonraker_names[${i}]}"
|
||||
done
|
||||
fi
|
||||
blank_line
|
||||
echo -e "| To link to your Obico Server account, you need to |"
|
||||
echo -e "| obtain the 6-digit verification code in the Obico |"
|
||||
echo -e "| mobile or web app. For more information, visit: |"
|
||||
echo -e "| It will take only 10 seconds to link printer to Obico.|"
|
||||
echo -e "| For more information, visit: |"
|
||||
echo -e "| https://www.obico.io/docs/user-guides/klipper-setup/ |"
|
||||
blank_line
|
||||
echo -e "| If you don't want to link the printer now, you can |"
|
||||
@@ -272,7 +270,7 @@ function moonraker_obico_setup_dialog() {
|
||||
break;;
|
||||
N|n|No|no)
|
||||
select_msg "No"
|
||||
abort_msg "Exiting Moonraker-obico setup ...\n"
|
||||
abort_msg "Exiting Obico setup ...\n"
|
||||
return;;
|
||||
*)
|
||||
error_msg "Invalid Input!";;
|
||||
@@ -295,13 +293,13 @@ function moonraker_obico_setup_dialog() {
|
||||
function clone_moonraker_obico() {
|
||||
local repo=${1}
|
||||
|
||||
status_msg "Cloning Moonraker-obico from ${repo} ..."
|
||||
### force remove existing Moonraker-obico dir
|
||||
status_msg "Cloning Obico from ${repo} ..."
|
||||
### force remove existing Obico dir
|
||||
[[ -d "${MOONRAKER_OBICO_DIR}" ]] && rm -rf "${MOONRAKER_OBICO_DIR}"
|
||||
|
||||
cd "${HOME}" || exit 1
|
||||
if ! git clone "${repo}" "${MOONRAKER_OBICO_DIR}"; then
|
||||
print_error "Cloning Moonraker-obico from\n ${repo}\n failed!"
|
||||
print_error "Cloning Obico from\n ${repo}\n failed!"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
@@ -316,7 +314,7 @@ function moonraker_obico_install() {
|
||||
|
||||
function remove_moonraker_obico_systemd() {
|
||||
[[ -z $(moonraker_obico_systemd) ]] && return
|
||||
status_msg "Removing Moonraker-obico Systemd Services ..."
|
||||
status_msg "Removing Obico Systemd Services ..."
|
||||
|
||||
for service in $(moonraker_obico_systemd | cut -d"/" -f5); do
|
||||
status_msg "Removing ${service} ..."
|
||||
@@ -329,7 +327,7 @@ function remove_moonraker_obico_systemd() {
|
||||
### reloading units
|
||||
sudo systemctl daemon-reload
|
||||
sudo systemctl reset-failed
|
||||
ok_msg "Moonraker-obico Services removed!"
|
||||
ok_msg "Obico Services removed!"
|
||||
}
|
||||
|
||||
function remove_moonraker_obico_logs() {
|
||||
@@ -361,7 +359,7 @@ function remove_legacy_moonraker_obico_logs() {
|
||||
function remove_moonraker_obico_dir() {
|
||||
[[ ! -d ${MOONRAKER_OBICO_DIR} ]] && return
|
||||
|
||||
status_msg "Removing Moonraker-obico directory ..."
|
||||
status_msg "Removing Obico directory ..."
|
||||
rm -rf "${MOONRAKER_OBICO_DIR}"
|
||||
ok_msg "Directory removed!"
|
||||
}
|
||||
@@ -380,7 +378,7 @@ function remove_moonraker_obico() {
|
||||
remove_moonraker_obico_dir
|
||||
remove_moonraker_obico_env
|
||||
|
||||
print_confirm "Moonraker-obico was successfully removed!"
|
||||
print_confirm "Obico was successfully removed!"
|
||||
return
|
||||
}
|
||||
|
||||
@@ -394,7 +392,7 @@ function update_moonraker_obico() {
|
||||
if [[ ! -d ${MOONRAKER_OBICO_DIR} ]]; then
|
||||
clone_moonraker_obico "${MOONRAKER_OBICO_REPO}"
|
||||
else
|
||||
status_msg "Updating Moonraker-obico ..."
|
||||
status_msg "Updating Obico ..."
|
||||
cd "${MOONRAKER_OBICO_DIR}" && git pull
|
||||
fi
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
#=======================================================================#
|
||||
# Copyright (C) 2020 - 2023 Dominik Willner <th33xitus@gmail.com> #
|
||||
# Copyright (C) 2020 - 2024 Dominik Willner <th33xitus@gmail.com> #
|
||||
# #
|
||||
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||
# https://github.com/dw-0/kiauh #
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
#=======================================================================#
|
||||
# Copyright (C) 2020 - 2023 Dominik Willner <th33xitus@gmail.com> #
|
||||
# Copyright (C) 2020 - 2024 Dominik Willner <th33xitus@gmail.com> #
|
||||
# #
|
||||
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||
# https://github.com/dw-0/kiauh #
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
#=======================================================================#
|
||||
# Copyright (C) 2020 - 2023 Dominik Willner <th33xitus@gmail.com> #
|
||||
# Copyright (C) 2020 - 2024 Dominik Willner <th33xitus@gmail.com> #
|
||||
# #
|
||||
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||
# https://github.com/dw-0/kiauh #
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
#=======================================================================#
|
||||
# Copyright (C) 2020 - 2023 Dominik Willner <th33xitus@gmail.com> #
|
||||
# Copyright (C) 2020 - 2024 Dominik Willner <th33xitus@gmail.com> #
|
||||
# #
|
||||
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||
# https://github.com/dw-0/kiauh #
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
#=======================================================================#
|
||||
# Copyright (C) 2020 - 2023 Dominik Willner <th33xitus@gmail.com> #
|
||||
# Copyright (C) 2020 - 2024 Dominik Willner <th33xitus@gmail.com> #
|
||||
# #
|
||||
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||
# https://github.com/dw-0/kiauh #
|
||||
@@ -77,10 +77,12 @@ function change_klipper_repo_menu() {
|
||||
error_msg "Invalid command!";;
|
||||
esac
|
||||
done
|
||||
break
|
||||
else
|
||||
status_msg "Set custom Klipper repository to:\n ● Repository: ${repos[${option}]}\n ● Branch: ${branches[${option}]}"
|
||||
set_custom_klipper_repo "${repos[${option}]}" "${branches[${option}]}"
|
||||
ok_msg "This repo will now be used for new Klipper installations!\n"
|
||||
break
|
||||
fi
|
||||
|
||||
elif [[ ${option} =~ ${back} ]]; then
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
#=======================================================================#
|
||||
# Copyright (C) 2020 - 2023 Dominik Willner <th33xitus@gmail.com> #
|
||||
# Copyright (C) 2020 - 2024 Dominik Willner <th33xitus@gmail.com> #
|
||||
# #
|
||||
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||
# https://github.com/dw-0/kiauh #
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
#=======================================================================#
|
||||
# Copyright (C) 2020 - 2023 Dominik Willner <th33xitus@gmail.com> #
|
||||
# Copyright (C) 2020 - 2024 Dominik Willner <th33xitus@gmail.com> #
|
||||
# #
|
||||
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||
# https://github.com/dw-0/kiauh #
|
||||
@@ -25,7 +25,7 @@ function backup_ui() {
|
||||
echo -e "| | |"
|
||||
echo -e "| Klipper Webinterface: | Other: |"
|
||||
echo -e "| 5) [Mainsail] | 9) [Telegram Bot] |"
|
||||
echo -e "| 6) [Fluidd] | |"
|
||||
echo -e "| 6) [Fluidd] | 10) [OctoEverywhere] |"
|
||||
back_footer
|
||||
}
|
||||
|
||||
@@ -54,6 +54,8 @@ function backup_menu() {
|
||||
do_action "backup_octoprint" "backup_ui";;
|
||||
9)
|
||||
do_action "backup_telegram_bot" "backup_ui";;
|
||||
10)
|
||||
do_action "backup_octoeverywhere" "backup_ui";;
|
||||
B|b)
|
||||
clear; main_menu; break;;
|
||||
*)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
#=======================================================================#
|
||||
# Copyright (C) 2020 - 2023 Dominik Willner <th33xitus@gmail.com> #
|
||||
# Copyright (C) 2020 - 2024 Dominik Willner <th33xitus@gmail.com> #
|
||||
# #
|
||||
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||
# https://github.com/dw-0/kiauh #
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
#=======================================================================#
|
||||
# Copyright (C) 2020 - 2023 Dominik Willner <th33xitus@gmail.com> #
|
||||
# Copyright (C) 2020 - 2024 Dominik Willner <th33xitus@gmail.com> #
|
||||
# #
|
||||
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||
# https://github.com/dw-0/kiauh #
|
||||
@@ -35,7 +35,7 @@ function install_ui() {
|
||||
}
|
||||
|
||||
function install_menu() {
|
||||
clear -x && sudo -v && clear -x # (re)cache sudo credentials so password prompt doesn't bork ui
|
||||
clear -x && sudo true && clear -x # (re)cache sudo credentials so password prompt doesn't bork ui
|
||||
print_header
|
||||
install_ui
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
#=======================================================================#
|
||||
# Copyright (C) 2020 - 2023 Dominik Willner <th33xitus@gmail.com> #
|
||||
# Copyright (C) 2020 - 2024 Dominik Willner <th33xitus@gmail.com> #
|
||||
# #
|
||||
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||
# https://github.com/dw-0/kiauh #
|
||||
@@ -57,7 +57,7 @@ function print_status() {
|
||||
elif [[ ${status} == "Incomplete!" ]]; then
|
||||
status="${yellow}${status}${white}"
|
||||
elif [[ ${status} == "Not linked!" ]]; then
|
||||
### "Not linked!" is only required for Moonraker-obico
|
||||
### "Not linked!" is only required for Obico for Klipper
|
||||
status="${yellow}${status}${white}"
|
||||
else
|
||||
status="${green}${status}${white}"
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
#=======================================================================#
|
||||
# Copyright (C) 2020 - 2023 Dominik Willner <th33xitus@gmail.com> #
|
||||
# Copyright (C) 2020 - 2024 Dominik Willner <th33xitus@gmail.com> #
|
||||
# #
|
||||
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||
# https://github.com/dw-0/kiauh #
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
#=======================================================================#
|
||||
# Copyright (C) 2020 - 2023 Dominik Willner <th33xitus@gmail.com> #
|
||||
# Copyright (C) 2020 - 2024 Dominik Willner <th33xitus@gmail.com> #
|
||||
# #
|
||||
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||
# https://github.com/dw-0/kiauh #
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
#=======================================================================#
|
||||
# Copyright (C) 2020 - 2023 Dominik Willner <th33xitus@gmail.com> #
|
||||
# Copyright (C) 2020 - 2024 Dominik Willner <th33xitus@gmail.com> #
|
||||
# #
|
||||
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||
# https://github.com/dw-0/kiauh #
|
||||
@@ -41,7 +41,7 @@ function update_ui() {
|
||||
}
|
||||
|
||||
function update_menu() {
|
||||
clear -x && sudo -v && clear -x # (re)cache sudo credentials so password prompt doesn't bork ui
|
||||
clear -x && sudo true && clear -x # (re)cache sudo credentials so password prompt doesn't bork ui
|
||||
do_action "" "update_ui"
|
||||
|
||||
local action
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
#=======================================================================#
|
||||
# Copyright (C) 2020 - 2023 Dominik Willner <th33xitus@gmail.com> #
|
||||
# Copyright (C) 2020 - 2024 Dominik Willner <th33xitus@gmail.com> #
|
||||
# #
|
||||
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||
# https://github.com/dw-0/kiauh #
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
#=======================================================================#
|
||||
# Copyright (C) 2020 - 2023 Dominik Willner <th33xitus@gmail.com> #
|
||||
# Copyright (C) 2020 - 2024 Dominik Willner <th33xitus@gmail.com> #
|
||||
# #
|
||||
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||
# https://github.com/dw-0/kiauh #
|
||||
|
||||
Reference in New Issue
Block a user