Compare commits

...

28 Commits

Author SHA1 Message Date
dw-0
5c5e30295a Merge 655b781aef into b6c6edb622 2024-03-03 18:29:29 +01:00
dw-0
655b781aef refactor(KIAUH): move util functions into util modules
Signed-off-by: Dominik Willner <th33xitus@gmail.com>
2024-03-03 11:42:27 +01:00
dw-0
14aafd558a refactor(moonraker): add existing client and client configs to example config upon creation
Signed-off-by: Dominik Willner <th33xitus@gmail.com>
2024-03-03 11:33:49 +01:00
dw-0
bd1aa1ae2b refactor(klipper): add existing client configs to example config upon creation
Signed-off-by: Dominik Willner <th33xitus@gmail.com>
2024-03-03 11:04:06 +01:00
dw-0
b6c6edb622 refactor(Mobileraker): update companion install script (#431) (#433) 2024-02-24 14:53:41 +01:00
dw-0
099d47df2f fix: revert "refactor(Mobileraker): update companion install script (#431)" (#432)
This reverts commit ba1cdb3739.
2024-01-29 17:17:09 +01:00
Patrick Schmidt
ba1cdb3739 refactor(Mobileraker): update companion install script (#431) 2024-01-29 17:09:30 +01:00
Anna
8e7d4db988 fix: OctoPrint logo in README.md (#424)
* Fix OctoPrint logo in Readme

Fixed the broken link to the OctoPrint logo in the Readme under the Sources section. Now uses the logo present in the octoprint docs directory.

* Update OctoPrint logo to "raw" cdn link

* Changed ?raw=true link to raw.githubusercontent.com

---------

Co-authored-by: dw-0 <th33xitus@gmail.com>
2024-01-23 22:47:37 +01:00
jneilliii
8f960495ba fix: OctoPrint logo in README.md (#423) 2024-01-22 17:57:37 +01:00
dw-0
095823bf28 chore(kiauh): update FUNDING.yml
Signed-off-by: Dominik Willner <th33xitus@gmail.com>
2024-01-01 20:02:29 +01:00
dw-0
397038e43e chore(kiauh): add .idea to .gitignore
Signed-off-by: Dominik Willner <th33xitus@gmail.com>
2024-01-01 19:55:47 +01:00
dw-0
061e222664 chore(kiauh): update copyright
Signed-off-by: Dominik Willner <th33xitus@gmail.com>
2024-01-01 19:54:13 +01:00
dw-0
3f5ff50d69 refactor(kiauh): use sudo true instead of sudo -v to prevent password prompts
Signed-off-by: Dominik Willner <th33xitus@gmail.com>
2024-01-01 19:51:56 +01:00
dw-0
5ebe941125 readme: don't recommend a specific architecture anymore
Fixes #403 

Both 32bit and 64bit images were reported to work fine. So we don't need a strict 32bit recommendation anymore which may confuses users, why they should pick 32bit over 64bit.

Signed-off-by: Dominik Willner <th33xitus@gmail.com>
2023-12-17 12:18:04 +01:00
dw-0
f5eb9486cc refactor(kiauh): use sudo true instead of sudo -v to prevent password prompts
Fixes #395 

Signed-off-by: Dominik Willner <th33xitus@gmail.com>
2023-12-17 12:10:36 +01:00
Stefan Dej
7a9e752f9c fix: fix typo in example.printer.cfg (#412)
rename virtual_sd_card to virtual_sdcard

Signed-off-by: Stefan Dej <meteyou@gmail.com>
2023-12-12 08:21:51 +01:00
CODeRUS
30bc56b198 feat(advanced): add selection between flash/serialflash methods (#410) 2023-12-10 16:57:59 +01:00
dw-0
b2567995de feat(klipper): add virtual_sd_card_block to example printer.cfg (#411) 2023-12-10 15:12:28 +01:00
dw-0
6fcd7a3f08 refactor(klipper): improve disruptive package handling
fix #293

Signed-off-by: Dominik Willner <th33xitus@gmail.com>
2023-10-31 15:09:31 +01:00
dw-0
25dfbb83df fix(kiauh): display custom repo dialog again after user interaction
fix #394

Signed-off-by: Dominik Willner <th33xitus@gmail.com>
2023-10-28 20:48:57 +02:00
Sineos
899b204dc7 refactor: show full path of mcu (#391) 2023-10-15 10:08:41 +02:00
Kenneth Jiang
5cf4b018fc refactor: change wording now that moonraker-obico can link printer using auto-discovery (#389) 2023-10-12 20:26:30 +02:00
dw-0
ae9d1b98da feat(klipper): remove/disable brltty and ModemManager during installation (#387) 2023-10-01 18:30:01 +02:00
Kenneth Jiang
16d3388ff2 refactor: make the 'Obico for Klipper' name consistent (#385) 2023-09-29 20:20:21 +02:00
th33xitus
b88d0085ba fix(backups): fix broken config target folder name
Signed-off-by: Dominik Willner <th33xitus@gmail.com>
2023-09-04 21:17:10 +02:00
th33xitus
0b6613e464 fix(backups): fix broken moonraker database target folder name
Signed-off-by: Dominik Willner <th33xitus@gmail.com>
2023-09-04 21:02:22 +02:00
th33xitus
d99cda544a fix(backups): add backup before update function for KlipperScreen
Signed-off-by: Dominik Willner <th33xitus@gmail.com>
2023-08-30 19:48:55 +02:00
th33xitus
a50dce20de fix(backups): add backup function for OctoEverywhere
fix #380

Signed-off-by: Dominik Willner <th33xitus@gmail.com>
2023-08-30 19:48:53 +02:00
42 changed files with 332 additions and 127 deletions

2
.github/FUNDING.yml vendored
View File

@@ -9,4 +9,4 @@ community_bridge: # Replace with a single Community Bridge project-name e.g., cl
liberapay: # Replace with a single Liberapay username liberapay: # Replace with a single Liberapay username
issuehunt: # Replace with a single IssueHunt username issuehunt: # Replace with a single IssueHunt username
otechie: # Replace with a single Otechie 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
View File

@@ -1,3 +1,4 @@
.idea
.vscode .vscode
.idea .idea
.pytest_cache .pytest_cache

View File

@@ -29,7 +29,7 @@
### 📋 Prerequisites ### 📋 Prerequisites
KIAUH is a script that assists you in installing Klipper on a Linux operating system that has 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 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/) 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. 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"> <img src="https://raw.githubusercontent.com/dw-0/kiauh/master/resources/screenshots/rpi_imager1.png" alt="KIAUH logo" height="350">
</p> </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"> <p align="center">
<img src="https://raw.githubusercontent.com/dw-0/kiauh/master/resources/screenshots/rpi_imager2.png" alt="KIAUH logo" height="350"> <img src="https://raw.githubusercontent.com/dw-0/kiauh/master/resources/screenshots/rpi_imager2.png" alt="KIAUH logo" height="350">
</p> </p>
@@ -125,7 +125,7 @@ prompt and confirm by hitting ENTER.
<tr> <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://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://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>
<tr> <tr>
<th>by <a href="https://github.com/fluidd-core">fluidd-core</a></th> <th>by <a href="https://github.com/fluidd-core">fluidd-core</a></th>

View File

@@ -1,7 +1,7 @@
#!/usr/bin/env bash #!/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 # # This file is part of KIAUH - Klipper Installation And Update Helper #
# https://github.com/dw-0/kiauh # # https://github.com/dw-0/kiauh #

View File

@@ -11,6 +11,7 @@
from pathlib import Path from pathlib import Path
from components.webui_client.client_utils import get_existing_client_config
from kiauh import KIAUH_CFG from kiauh import KIAUH_CFG
from components.klipper import ( from components.klipper import (
EXIT_KLIPPER_SETUP, EXIT_KLIPPER_SETUP,
@@ -180,5 +181,7 @@ def create_klipper_instance(name: str, create_example_cfg: bool) -> None:
kl_im.create_instance() kl_im.create_instance()
kl_im.enable_instance() kl_im.enable_instance()
if create_example_cfg: if create_example_cfg:
create_example_printer_cfg(new_instance) # if a client-config is installed, include it in the new example cfg
client_configs = get_existing_client_config()
create_example_printer_cfg(new_instance, client_configs)
kl_im.start_instance() kl_im.start_instance()

View File

@@ -16,7 +16,7 @@ import shutil
import subprocess import subprocess
import textwrap import textwrap
from pathlib import Path from pathlib import Path
from typing import List, Union, Literal, Dict from typing import List, Union, Literal, Dict, Optional
from components.klipper import ( from components.klipper import (
MODULE_PATH, MODULE_PATH,
@@ -33,6 +33,7 @@ from components.klipper.klipper_dialogs import (
) )
from components.moonraker.moonraker import Moonraker from components.moonraker.moonraker import Moonraker
from components.moonraker.moonraker_utils import moonraker_to_multi_conversion from components.moonraker.moonraker_utils import moonraker_to_multi_conversion
from components.webui_client import ClientData
from core.backup_manager.backup_manager import BackupManager from core.backup_manager.backup_manager import BackupManager
from core.config_manager.config_manager import ConfigManager from core.config_manager.config_manager import ConfigManager
from core.instance_manager.base_instance import BaseInstance from core.instance_manager.base_instance import BaseInstance
@@ -261,7 +262,9 @@ def get_highest_index(instance_list: List[Klipper]) -> int:
return max(indices) return max(indices)
def create_example_printer_cfg(instance: Klipper) -> None: def create_example_printer_cfg(
instance: Klipper, client_configs: Optional[List[ClientData]] = None
) -> None:
Logger.print_status(f"Creating example printer.cfg in '{instance.cfg_dir}'") Logger.print_status(f"Creating example printer.cfg in '{instance.cfg_dir}'")
if instance.cfg_file.is_file(): if instance.cfg_file.is_file():
Logger.print_info(f"'{instance.cfg_file}' already exists.") Logger.print_info(f"'{instance.cfg_file}' already exists.")
@@ -277,7 +280,15 @@ def create_example_printer_cfg(instance: Klipper) -> None:
cm = ConfigManager(target) cm = ConfigManager(target)
cm.set_value("virtual_sdcard", "path", str(instance.gcodes_dir)) cm.set_value("virtual_sdcard", "path", str(instance.gcodes_dir))
# include existing client configs in the example config
if client_configs is not None and len(client_configs) > 0:
for c in client_configs:
section = c.get("client_config").get("printer_cfg_section")
cm.config.add_section(section=section)
cm.write_config() cm.write_config()
Logger.print_ok(f"Example printer.cfg created in '{instance.cfg_dir}'") Logger.print_ok(f"Example printer.cfg created in '{instance.cfg_dir}'")

View File

@@ -15,7 +15,7 @@ from pathlib import Path
from typing import List from typing import List
from components.webui_client import MAINSAIL_DIR from components.webui_client import MAINSAIL_DIR
from components.webui_client.client_utils import enable_mainsail_remotemode from components.webui_client.client_utils import enable_mainsail_remotemode, get_existing_clients
from kiauh import KIAUH_CFG from kiauh import KIAUH_CFG
from components.klipper.klipper import Klipper from components.klipper.klipper import Klipper
from components.klipper.klipper_dialogs import print_instance_overview from components.klipper.klipper_dialogs import print_instance_overview
@@ -104,7 +104,9 @@ def install_moonraker() -> None:
mr_im.enable_instance() mr_im.enable_instance()
if create_example_cfg: if create_example_cfg:
create_example_moonraker_conf(current_instance, used_ports_map) # if a webclient and/or it's config is installed, patch its update section to the config
clients = get_existing_clients()
create_example_moonraker_conf(current_instance, used_ports_map, clients)
mr_im.start_instance() mr_im.start_instance()

View File

@@ -10,7 +10,7 @@
# ======================================================================= # # ======================================================================= #
import shutil import shutil
from typing import Dict, Literal, List, Union from typing import Dict, Literal, List, Union, Optional
from components.moonraker import ( from components.moonraker import (
DEFAULT_MOONRAKER_PORT, DEFAULT_MOONRAKER_PORT,
@@ -21,7 +21,7 @@ from components.moonraker import (
MOONRAKER_DB_BACKUP_DIR, MOONRAKER_DB_BACKUP_DIR,
) )
from components.moonraker.moonraker import Moonraker from components.moonraker.moonraker import Moonraker
from components.webui_client import MAINSAIL_DIR from components.webui_client import MAINSAIL_DIR, ClientData
from components.webui_client.client_utils import enable_mainsail_remotemode from components.webui_client.client_utils import enable_mainsail_remotemode
from core.backup_manager.backup_manager import BackupManager from core.backup_manager.backup_manager import BackupManager
from core.config_manager.config_manager import ConfigManager from core.config_manager.config_manager import ConfigManager
@@ -50,7 +50,9 @@ def get_moonraker_status() -> Dict[
def create_example_moonraker_conf( def create_example_moonraker_conf(
instance: Moonraker, ports_map: Dict[str, int] instance: Moonraker,
ports_map: Dict[str, int],
clients: Optional[List[ClientData]] = None,
) -> None: ) -> None:
Logger.print_status(f"Creating example moonraker.conf in '{instance.cfg_dir}'") Logger.print_status(f"Creating example moonraker.conf in '{instance.cfg_dir}'")
if instance.cfg_file.is_file(): if instance.cfg_file.is_file():
@@ -94,6 +96,36 @@ def create_example_moonraker_conf(
cm.set_value("server", "klippy_uds_address", str(uds)) cm.set_value("server", "klippy_uds_address", str(uds))
cm.set_value("authorization", "trusted_clients", trusted_clients) cm.set_value("authorization", "trusted_clients", trusted_clients)
# add existing client and client configs in the update section
if clients is not None and len(clients) > 0:
for c in clients:
# client part
c_section = f"update_manager {c.get('name')}"
c_options = [
("type", "web"),
("channel", "stable"),
("repo", c.get("mr_conf_repo")),
("path", c.get("mr_conf_path")),
]
cm.config.add_section(section=c_section)
for option in c_options:
cm.config.set(c_section, option[0], option[1])
# client config part
c_config = c.get("client_config")
if c_config.get("dir").exists():
c_config_section = f"update_manager {c_config.get('name')}"
c_config_options = [
("type", "git_repo"),
("primary_branch", "master"),
("path", c_config.get("mr_conf_path")),
("origin", c_config.get("mr_conf_origin")),
("managed_services", "klipper"),
]
cm.config.add_section(section=c_config_section)
for option in c_config_options:
cm.config.set(c_config_section, option[0], option[1])
cm.write_config() cm.write_config()
Logger.print_ok(f"Example moonraker.conf created in '{instance.cfg_dir}'") Logger.print_ok(f"Example moonraker.conf created in '{instance.cfg_dir}'")

View File

@@ -12,7 +12,7 @@
import shutil import shutil
import subprocess import subprocess
from pathlib import Path from pathlib import Path
from typing import List, get_args from typing import List
from kiauh import KIAUH_CFG from kiauh import KIAUH_CFG
from components.klipper.klipper import Klipper from components.klipper.klipper import Klipper
@@ -21,8 +21,8 @@ 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 ( from components.webui_client.client_utils import (
load_client_data, load_client_data,
backup_client_config_data, backup_client_config_data, config_for_other_client_exist,
) )
from core.config_manager.config_manager import ConfigManager from core.config_manager.config_manager import ConfigManager
from core.instance_manager.instance_manager import InstanceManager from core.instance_manager.instance_manager import InstanceManager
@@ -40,7 +40,7 @@ def install_client_config(client_name: ClientName) -> None:
client_config: ClientConfigData = client.get("client_config") client_config: ClientConfigData = client.get("client_config")
d_name = client_config.get("display_name") d_name = client_config.get("display_name")
if check_existing_client_config_install(client_name): if config_for_other_client_exist(client_name):
Logger.print_info("Another Client-Config is already installed! Skipped ...") Logger.print_info("Another Client-Config is already installed! Skipped ...")
return return
@@ -80,21 +80,6 @@ def install_client_config(client_name: ClientName) -> None:
Logger.print_ok(f"{d_name} installation complete!", start="\n") Logger.print_ok(f"{d_name} installation complete!", start="\n")
def check_existing_client_config_install(client_name: ClientName) -> bool:
# check if any other client-configs are present
# as they can conflict each other, or are at least
# redundant to have, so we skip the installation
client_list = list(get_args(ClientName))
client_list.remove(client_name)
for c in client_list:
c_data: ClientData = load_client_data(c)
c_config_data: ClientConfigData = c_data.get("client_config")
if c_config_data.get("dir").exists():
return True
return False
def download_client_config(client_config: ClientConfigData) -> None: def download_client_config(client_config: ClientConfigData) -> None:
try: try:
Logger.print_status(f"Downloading {client_config.get('display_name')} ...") Logger.print_status(f"Downloading {client_config.get('display_name')} ...")

View File

@@ -21,7 +21,6 @@ from components.webui_client import (
from components.moonraker.moonraker import Moonraker from components.moonraker.moonraker import Moonraker
from components.webui_client.client_config.client_config_setup import ( from components.webui_client.client_config.client_config_setup import (
install_client_config, install_client_config,
check_existing_client_config_install,
) )
from components.webui_client.client_dialogs import ( from components.webui_client.client_dialogs import (
print_moonraker_not_found_dialog, print_moonraker_not_found_dialog,
@@ -33,8 +32,8 @@ from components.webui_client.client_utils import (
restore_mainsail_config_json, restore_mainsail_config_json,
enable_mainsail_remotemode, enable_mainsail_remotemode,
symlink_webui_nginx_log, symlink_webui_nginx_log,
load_client_data, load_client_data, config_for_other_client_exist,
) )
from core.config_manager.config_manager import ConfigManager from core.config_manager.config_manager import ConfigManager
from core.instance_manager.instance_manager import InstanceManager from core.instance_manager.instance_manager import InstanceManager
from kiauh import KIAUH_CFG from kiauh import KIAUH_CFG
@@ -100,7 +99,7 @@ def install_client(client_name: ClientName) -> None:
if ( if (
kl_instances kl_instances
and not client_config.get("dir").exists() and not client_config.get("dir").exists()
and not check_existing_client_config_install(client.get("name")) and not config_for_other_client_exist(client_to_ignore=client.get("name"))
): ):
print_install_client_config_dialog(client) print_install_client_config_dialog(client)
question = f"Download the recommended {client_config.get('display_name')}?" question = f"Download the recommended {client_config.get('display_name')}?"

View File

@@ -13,7 +13,7 @@ import json
import shutil import shutil
from json import JSONDecodeError from json import JSONDecodeError
from pathlib import Path from pathlib import Path
from typing import List, Optional, Dict, Literal, Union from typing import List, Optional, Dict, Literal, Union, get_args
import urllib.request import urllib.request
@@ -43,7 +43,7 @@ from components.webui_client import (
from core.backup_manager.backup_manager import BackupManager from core.backup_manager.backup_manager import BackupManager
from core.repo_manager.repo_manager import RepoManager from core.repo_manager.repo_manager import RepoManager
from utils import NGINX_SITES_AVAILABLE, NGINX_CONFD from utils import NGINX_SITES_AVAILABLE, NGINX_CONFD
from utils.common import get_install_status_webui, get_install_status_common from utils.common import get_install_status_webui
from utils.constants import COLOR_CYAN, RESET_FORMAT, COLOR_YELLOW from utils.constants import COLOR_CYAN, RESET_FORMAT, COLOR_YELLOW
from utils.logger import Logger from utils.logger import Logger
@@ -235,3 +235,41 @@ def backup_client_config_data(client: ClientData) -> None:
target = client_config.get("backup_dir") target = client_config.get("backup_dir")
bm = BackupManager() bm = BackupManager()
bm.backup_directory(name, source, target) bm.backup_directory(name, source, target)
def get_existing_clients() -> List[ClientData]:
clients = list(get_args(ClientName))
installed_clients: List[ClientData] = []
for c in clients:
c_data: ClientData = load_client_data(c)
if c_data.get("dir").exists():
installed_clients.append(c_data)
return installed_clients
def get_existing_client_config() -> List[ClientData]:
clients = list(get_args(ClientName))
installed_client_configs: List[ClientData] = []
for c in clients:
c_data: ClientData = load_client_data(c)
c_config_data: ClientConfigData = c_data.get("client_config")
if c_config_data.get("dir").exists():
installed_client_configs.append(c_data)
return installed_client_configs
def config_for_other_client_exist(client_to_ignore: ClientName) -> bool:
"""
Check if any other client configs are present on the system.
It is usually not harmful, but chances are they can conflict each other.
Multiple client configs are, at least, redundant to have them installed
:param client_to_ignore: The client name to ignore for the check
:return: True, if other client configs were found, else False
"""
clients = set([c["name"] for c in get_existing_client_config()])
clients = clients - {client_to_ignore}
return True if len(clients) > 0 else False

View File

@@ -1,7 +1,11 @@
[mcu] [mcu]
serial: /dev/serial/by-id/<your-mcu-id> serial: /dev/serial/by-id/<your-mcu-id>
[virtual_sdcard]
path: %GCODES_DIR%
on_error_gcode: CANCEL_PRINT
[printer] [printer]
kinematics: none kinematics: none
max_velocity: 1000 max_velocity: 1000
max_accel: 1000 max_accel: 1000

View File

@@ -1,7 +1,7 @@
#!/usr/bin/env bash #!/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 # # This file is part of KIAUH - Klipper Installation And Update Helper #
# https://github.com/dw-0/kiauh # # https://github.com/dw-0/kiauh #
@@ -33,23 +33,25 @@ function backup_before_update() {
function backup_config_dir() { function backup_config_dir() {
check_for_backup_dir check_for_backup_dir
local current_date instance_names config_pathes local current_date config_pathes
config_pathes=$(get_config_folders) config_pathes=$(get_config_folders)
readarray -t -d" " instance_names < <(get_multi_instance_names)
if [[ -n "${config_pathes}" ]]; then if [[ -n "${config_pathes}" ]]; then
current_date=$(get_date) current_date=$(get_date)
status_msg "Timestamp: ${current_date}" status_msg "Timestamp: ${current_date}"
local i=0 folder local i=0 folder folder_name target_dir
for folder in ${config_pathes}; do for folder in ${config_pathes}; do
local folder_name="${instance_names[${i}]}"
status_msg "Create backup of ${folder} ..." status_msg "Create backup of ${folder} ..."
mkdir -p "${BACKUP_DIR}/configs/${current_date}/${folder_name}"
cp -r "${folder}" "${_}" folder_name=$(echo "${folder}" | rev | cut -d"/" -f2 | rev)
ok_msg "Backup created in:\n${BACKUP_DIR}/configs/${current_date}/${folder_name}" target_dir="${BACKUP_DIR}/configs/${current_date}/${folder_name}"
mkdir -p "${target_dir}"
cp -r "${folder}" "${target_dir}"
i=$(( i + 1 )) i=$(( i + 1 ))
ok_msg "Backup created in:\n${target_dir}"
done done
else else
ok_msg "No config directory found! Skipping backup ..." ok_msg "No config directory found! Skipping backup ..."
@@ -61,20 +63,22 @@ function backup_moonraker_database() {
local current_date db_pathes local current_date db_pathes
db_pathes=$(get_instance_folder_path "database") db_pathes=$(get_instance_folder_path "database")
readarray -t -d" " instance_names < <(get_multi_instance_names)
if [[ -n ${db_pathes} ]]; then if [[ -n ${db_pathes} ]]; then
current_date=$(get_date) current_date=$(get_date)
status_msg "Timestamp: ${current_date}" status_msg "Timestamp: ${current_date}"
local i=0 database local i=0 database folder_name target_dir
for database in ${db_pathes}; do for database in ${db_pathes}; do
local folder_name="${instance_names[${i}]}"
status_msg "Create backup of ${database} ..." status_msg "Create backup of ${database} ..."
mkdir -p "${BACKUP_DIR}/moonraker_databases/${current_date}/${folder_name}"
cp -r "${database}" "${_}" folder_name=$(echo "${database}" | rev | cut -d"/" -f2 | rev)
ok_msg "Backup created in:\n${BACKUP_DIR}/moonraker_databases/${current_date}/${folder_name}" target_dir="${BACKUP_DIR}/moonraker_databases/${current_date}/${folder_name}"
mkdir -p "${target_dir}"
cp -r "${database}" "${target_dir}"
i=$(( i + 1 )) i=$(( i + 1 ))
ok_msg "Backup created in:\n${target_dir}"
done done
else else
print_error "No Moonraker database found! Skipping backup ..." 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!" print_error "Can't back up MoonrakerTelegramBot directory!\n Not found!"
fi 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
}

View File

@@ -1,7 +1,7 @@
#!/usr/bin/env bash #!/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 # # This file is part of KIAUH - Klipper Installation And Update Helper #
# https://github.com/dw-0/kiauh # # https://github.com/dw-0/kiauh #

View File

@@ -1,7 +1,7 @@
#!/usr/bin/env bash #!/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 # # This file is part of KIAUH - Klipper Installation And Update Helper #
# https://github.com/dw-0/kiauh # # https://github.com/dw-0/kiauh #
@@ -52,16 +52,57 @@ function init_flash_process() {
esac esac
done 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 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}" select_mcu_id "${method}"
} }
#================================================# #================================================#
#=================== STEP 2 =====================# #=================== 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() { function select_mcu_connection() {
top_border top_border
echo -e "| ${yellow}Make sure that the controller board is connected now!${white} |" echo -e "| ${yellow}Make sure that the controller board is connected now!${white} |"
@@ -112,7 +153,6 @@ function print_detected_mcu_to_screen() {
fi fi
for mcu in "${mcu_list[@]}"; do for mcu in "${mcu_list[@]}"; do
mcu=$(echo "${mcu}" | rev | cut -d"/" -f1 | rev)
echo -e " ● MCU #${i}: ${cyan}${mcu}${white}" echo -e " ● MCU #${i}: ${cyan}${mcu}${white}"
i=$(( i + 1 )) i=$(( i + 1 ))
done done
@@ -120,7 +160,7 @@ function print_detected_mcu_to_screen() {
} }
#================================================# #================================================#
#=================== STEP 3 =====================# #=================== STEP 4 =====================#
#================================================# #================================================#
function select_mcu_id() { function select_mcu_id() {
local i=0 sel_index=0 method=${1} local i=0 sel_index=0 method=${1}
@@ -195,7 +235,7 @@ function start_flash_mcu() {
local device=${1} local device=${1}
do_action_service "stop" "klipper" do_action_service "stop" "klipper"
if make flash FLASH_DEVICE="${device}"; then if make ${flash_command} FLASH_DEVICE="${device}"; then
ok_msg "Flashing successfull!" ok_msg "Flashing successfull!"
else else
warn_msg "Flashing failed!" warn_msg "Flashing failed!"
@@ -387,6 +427,36 @@ function show_flash_method_help() {
done 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() { function show_mcu_connection_help() {
top_border top_border
echo -e "| ~~~~~~~~ < ? > Help: Flash MCU < ? > ~~~~~~~~ |" echo -e "| ~~~~~~~~ < ? > Help: Flash MCU < ? > ~~~~~~~~ |"

View File

@@ -1,7 +1,7 @@
#!/usr/bin/env bash #!/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 # # This file is part of KIAUH - Klipper Installation And Update Helper #
# https://github.com/dw-0/kiauh # # https://github.com/dw-0/kiauh #

View File

@@ -1,7 +1,7 @@
#!/usr/bin/env bash #!/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 # # This file is part of KIAUH - Klipper Installation And Update Helper #
# https://github.com/dw-0/kiauh # # https://github.com/dw-0/kiauh #

View File

@@ -1,7 +1,7 @@
#!/usr/bin/env bash #!/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 # # This file is part of KIAUH - Klipper Installation And Update Helper #
# https://github.com/dw-0/kiauh # # https://github.com/dw-0/kiauh #

View File

@@ -1,7 +1,7 @@
#!/usr/bin/env bash #!/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 # # This file is part of KIAUH - Klipper Installation And Update Helper #
# https://github.com/dw-0/kiauh # # 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 ### finalizing the setup with writing instance names to the kiauh.ini
set_multi_instance_names set_multi_instance_names
mask_disrupting_services
print_confirm "${confirm}" && return print_confirm "${confirm}" && return
} }
@@ -333,6 +334,7 @@ function create_klipper_service() {
local printer_data local printer_data
local cfg_dir local cfg_dir
local gcodes_dir
local cfg local cfg
local log local log
local klippy_serial local klippy_serial
@@ -345,6 +347,7 @@ function create_klipper_service() {
printer_data="${HOME}/${instance_name}_data" printer_data="${HOME}/${instance_name}_data"
cfg_dir="${printer_data}/config" cfg_dir="${printer_data}/config"
gcodes_dir="${printer_data}/gcodes"
cfg="${cfg_dir}/printer.cfg" cfg="${cfg_dir}/printer.cfg"
log="${printer_data}/logs/klippy.log" log="${printer_data}/logs/klippy.log"
klippy_serial="${printer_data}/comms/klippy.serial" klippy_serial="${printer_data}/comms/klippy.serial"
@@ -375,18 +378,20 @@ function create_klipper_service() {
fi fi
if [[ ! -f ${cfg} ]]; then if [[ ! -f ${cfg} ]]; then
write_example_printer_cfg "${cfg}" write_example_printer_cfg "${cfg}" "${gcodes_dir}"
fi fi
} }
function write_example_printer_cfg() { function write_example_printer_cfg() {
local cfg=${1} local cfg=${1}
local gcodes_dir=${2}
local cfg_template local cfg_template
cfg_template="${KIAUH_SRCDIR}/resources/example.printer.cfg" cfg_template="${KIAUH_SRCDIR}/resources/example.printer.cfg"
status_msg "Creating minimal example printer.cfg ..." status_msg "Creating minimal example printer.cfg ..."
if cp "${cfg_template}" "${cfg}"; then if cp "${cfg_template}" "${cfg}"; then
sed -i "s|%GCODES_DIR%|${gcodes_dir}|" "${cfg}"
ok_msg "Minimal example printer.cfg created!" ok_msg "Minimal example printer.cfg created!"
else else
error_msg "Couldn't create minimal example printer.cfg!" 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) version=$("${KLIPPY_ENV}"/bin/python --version 2>&1 | cut -d" " -f2 | cut -d"." -f1)
echo "${version}" 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!"
}

View File

@@ -1,7 +1,7 @@
#!/usr/bin/env bash #!/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 # # This file is part of KIAUH - Klipper Installation And Update Helper #
# https://github.com/dw-0/kiauh # # 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) old_md5=$(md5sum "${KLIPPERSCREEN_DIR}/scripts/KlipperScreen-requirements.txt" | cut -d " " -f1)
do_action_service "stop" "KlipperScreen" do_action_service "stop" "KlipperScreen"
backup_before_update "klipperscreen"
cd "${KLIPPERSCREEN_DIR}" cd "${KLIPPERSCREEN_DIR}"
git pull origin master -q && ok_msg "Fetch successfull!" git pull origin master -q && ok_msg "Fetch successfull!"
git checkout -f master && ok_msg "Checkout successfull" git checkout -f master && ok_msg "Checkout successfull"

View File

@@ -1,7 +1,7 @@
#!/usr/bin/env bash #!/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 # # This file is part of KIAUH - Klipper Installation And Update Helper #
# https://github.com/dw-0/kiauh # # https://github.com/dw-0/kiauh #

View File

@@ -1,7 +1,7 @@
#!/usr/bin/env bash #!/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 # # This file is part of KIAUH - Klipper Installation And Update Helper #
# https://github.com/dw-0/kiauh # # https://github.com/dw-0/kiauh #

View File

@@ -1,7 +1,7 @@
#!/usr/bin/env bash #!/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 # # This file is part of KIAUH - Klipper Installation And Update Helper #
# https://github.com/dw-0/kiauh # # https://github.com/dw-0/kiauh #
@@ -61,8 +61,8 @@ function mobileraker_setup() {
exit 1 exit 1
fi fi
status_msg "Installing Mobileraker's companion ..." status_msg "Starting installer of Mobileraker's companion ..."
if "${MOBILERAKER_DIR}"/scripts/install-mobileraker-companion.sh; then if "${MOBILERAKER_DIR}"/scripts/install.sh; then
ok_msg "Mobileraker's companion successfully installed!" ok_msg "Mobileraker's companion successfully installed!"
else else
print_error "Mobileraker's companion installation failed!" print_error "Mobileraker's companion installation failed!"
@@ -233,7 +233,7 @@ primary_branch:main
managed_services: mobileraker managed_services: mobileraker
env: ${HOME}/mobileraker-env/bin/python env: ${HOME}/mobileraker-env/bin/python
requirements: scripts/mobileraker-requirements.txt requirements: scripts/mobileraker-requirements.txt
install_script: scripts/install-mobileraker-companion.sh install_script: scripts/install.sh
MOONRAKER_CONF MOONRAKER_CONF
fi fi

View File

@@ -1,7 +1,7 @@
#!/usr/bin/env bash #!/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 # # This file is part of KIAUH - Klipper Installation And Update Helper #
# https://github.com/dw-0/kiauh # # https://github.com/dw-0/kiauh #

View File

@@ -1,7 +1,7 @@
#!/usr/bin/env bash #!/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 # # This file is part of KIAUH - Klipper Installation And Update Helper #
# https://github.com/dw-0/kiauh # # https://github.com/dw-0/kiauh #

View File

@@ -1,7 +1,7 @@
#!/usr/bin/env bash #!/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 # # This file is part of KIAUH - Klipper Installation And Update Helper #
# https://github.com/dw-0/kiauh # # https://github.com/dw-0/kiauh #

View File

@@ -1,7 +1,7 @@
#!/usr/bin/env bash #!/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 # # This file is part of KIAUH - Klipper Installation And Update Helper #
# https://github.com/dw-0/kiauh # # https://github.com/dw-0/kiauh #
@@ -63,7 +63,7 @@ function obico_server_url_prompt() {
} }
function moonraker_obico_setup_dialog() { function moonraker_obico_setup_dialog() {
status_msg "Initializing Moonraker-obico installation ..." status_msg "Initializing Obico installation ..."
local moonraker_count local moonraker_count
local moonraker_names local moonraker_names
@@ -73,7 +73,7 @@ function moonraker_obico_setup_dialog() {
if (( moonraker_count == 0 )); then if (( moonraker_count == 0 )); then
### return early if moonraker is not installed ### return early if moonraker is not installed
local error="Moonraker not installed! Please install Moonraker first!" 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 print_error "${error}" && return
elif (( moonraker_count > 1 )); then elif (( moonraker_count > 1 )); then
# moonraker_names is valid only in case of multi-instance # 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 if (( allowed_moonraker_obico_count == 0 && moonraker_count > 0 )) && [[ $(get_moonraker_obico_status) != "Not linked!" ]]; then
local yn local yn
while true; do 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 "It is safe to run the install again to repair any issues."
echo "" 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 read -p "${cyan}###### ${question} (Y/n):${white} " yn
case "${yn}" in case "${yn}" in
Y|y|Yes|yes|"") Y|y|Yes|yes|"")
@@ -101,7 +101,7 @@ function moonraker_obico_setup_dialog() {
break;; break;;
N|n|No|no) N|n|No|no)
select_msg "No" select_msg "No"
abort_msg "Exiting Obico for Klipper installation...\n" abort_msg "Exiting Obico installation...\n"
return;; return;;
*) *)
error_msg "Invalid Input!";; error_msg "Invalid Input!";;
@@ -126,31 +126,30 @@ function moonraker_obico_setup_dialog() {
done done
blank_line blank_line
if (( existing_moonraker_obico_count > 0 )); then 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 for svc in ${moonraker_obico_services}; do
printf "|${cyan}%-57s${white}|\n" " ● moonraker-obco-$(get_instance_name "${svc}")" printf "|${cyan}%-57s${white}|\n" " ● moonraker-obco-$(get_instance_name "${svc}")"
done done
fi fi
blank_line blank_line
echo -e "| The setup will apply the same names to |" echo -e "| The setup will apply the same names to Obico! |"
echo -e "| Moonraker-obico! |"
blank_line blank_line
echo -e "| Please select the number of Moonraker-obico instances |" echo -e "| Please select the number of Obico instances |"
echo -e "| to install. Usually one Moonraker-obico instance per |" echo -e "| to install. Usually one Obico instance per |"
echo -e "| Moonraker instance is required, but you may not |" 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. |" echo -e "| Moonraker instances. |"
bottom_border bottom_border
### ask for amount of instances ### ask for amount of instances
local re="^[1-9][0-9]*$" local re="^[1-9][0-9]*$"
while [[ ! ${new_moonraker_obico_count} =~ ${re} || ${new_moonraker_obico_count} -gt ${allowed_moonraker_obico_count} ]]; do 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 ### break if input is valid
[[ ${new_moonraker_obico_count} =~ ${re} && ${new_moonraker_obico_count} -le ${allowed_moonraker_obico_count} ]] && break [[ ${new_moonraker_obico_count} =~ ${re} && ${new_moonraker_obico_count} -le ${allowed_moonraker_obico_count} ]] && break
### conditional error messages ### conditional error messages
[[ ! ${new_moonraker_obico_count} =~ ${re} ]] && error_msg "Input not a number" [[ ! ${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}" done && select_msg "${new_moonraker_obico_count}"
else else
log_error "Internal error. moonraker_count of '${moonraker_count}' not equal or grather than one!" 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 ### Step 2: Confirm instance amount
local yn local yn
while true; do while true; do
(( new_moonraker_obico_count == 1 )) && local question="Install Moonraker-obico?" (( new_moonraker_obico_count == 1 )) && local question="Install Obico?"
(( new_moonraker_obico_count > 1 )) && local question="Install ${new_moonraker_obico_count} Moonraker-obico instances?" (( new_moonraker_obico_count > 1 )) && local question="Install ${new_moonraker_obico_count} Obico instances?"
read -p "${cyan}###### ${question} (Y/n):${white} " yn read -p "${cyan}###### ${question} (Y/n):${white} " yn
case "${yn}" in case "${yn}" in
Y|y|Yes|yes|"") Y|y|Yes|yes|"")
@@ -169,7 +168,7 @@ function moonraker_obico_setup_dialog() {
break;; break;;
N|n|No|no) N|n|No|no)
select_msg "No" select_msg "No"
abort_msg "Exiting Moonraker-obico setup ...\n" abort_msg "Exiting Obico setup ...\n"
return;; return;;
*) *)
error_msg "Invalid Input!";; error_msg "Invalid Input!";;
@@ -191,8 +190,8 @@ function moonraker_obico_setup_dialog() {
fi fi
done done
(( new_moonraker_obico_count > 1 )) && status_msg "Installing ${new_moonraker_obico_count} Moonraker-obico instances ..." (( new_moonraker_obico_count > 1 )) && status_msg "Installing ${new_moonraker_obico_count} Obico instances ..."
(( new_moonraker_obico_count == 1 )) && status_msg "Installing Moonraker-obico ..." (( new_moonraker_obico_count == 1 )) && status_msg "Installing Obico ..."
### Step 5: Clone the moonraker-obico repo ### Step 5: Clone the moonraker-obico repo
clone_moonraker_obico "${MOONRAKER_OBICO_REPO}" clone_moonraker_obico "${MOONRAKER_OBICO_REPO}"
@@ -244,17 +243,16 @@ function moonraker_obico_setup_dialog() {
if (( ${#not_linked_instances[@]} > 0 )); then if (( ${#not_linked_instances[@]} > 0 )); then
top_border top_border
if (( moonraker_count == 1 )); then 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 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 for i in "${not_linked_instances[@]}"; do
printf "|${cyan}%-57s${white}|\n" " ● moonraker-obico-${moonraker_names[${i}]}" printf "|${cyan}%-57s${white}|\n" " ● moonraker-obico-${moonraker_names[${i}]}"
done done
fi fi
blank_line blank_line
echo -e "| To link to your Obico Server account, you need to |" echo -e "| It will take only 10 seconds to link printer to Obico.|"
echo -e "| obtain the 6-digit verification code in the Obico |" echo -e "| For more information, visit: |"
echo -e "| mobile or web app. For more information, visit: |"
echo -e "| https://www.obico.io/docs/user-guides/klipper-setup/ |" echo -e "| https://www.obico.io/docs/user-guides/klipper-setup/ |"
blank_line blank_line
echo -e "| If you don't want to link the printer now, you can |" echo -e "| If you don't want to link the printer now, you can |"
@@ -272,7 +270,7 @@ function moonraker_obico_setup_dialog() {
break;; break;;
N|n|No|no) N|n|No|no)
select_msg "No" select_msg "No"
abort_msg "Exiting Moonraker-obico setup ...\n" abort_msg "Exiting Obico setup ...\n"
return;; return;;
*) *)
error_msg "Invalid Input!";; error_msg "Invalid Input!";;
@@ -295,13 +293,13 @@ function moonraker_obico_setup_dialog() {
function clone_moonraker_obico() { function clone_moonraker_obico() {
local repo=${1} local repo=${1}
status_msg "Cloning Moonraker-obico from ${repo} ..." status_msg "Cloning Obico from ${repo} ..."
### force remove existing Moonraker-obico dir ### force remove existing Obico dir
[[ -d "${MOONRAKER_OBICO_DIR}" ]] && rm -rf "${MOONRAKER_OBICO_DIR}" [[ -d "${MOONRAKER_OBICO_DIR}" ]] && rm -rf "${MOONRAKER_OBICO_DIR}"
cd "${HOME}" || exit 1 cd "${HOME}" || exit 1
if ! git clone "${repo}" "${MOONRAKER_OBICO_DIR}"; then 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 exit 1
fi fi
} }
@@ -316,7 +314,7 @@ function moonraker_obico_install() {
function remove_moonraker_obico_systemd() { function remove_moonraker_obico_systemd() {
[[ -z $(moonraker_obico_systemd) ]] && return [[ -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 for service in $(moonraker_obico_systemd | cut -d"/" -f5); do
status_msg "Removing ${service} ..." status_msg "Removing ${service} ..."
@@ -329,7 +327,7 @@ function remove_moonraker_obico_systemd() {
### reloading units ### reloading units
sudo systemctl daemon-reload sudo systemctl daemon-reload
sudo systemctl reset-failed sudo systemctl reset-failed
ok_msg "Moonraker-obico Services removed!" ok_msg "Obico Services removed!"
} }
function remove_moonraker_obico_logs() { function remove_moonraker_obico_logs() {
@@ -361,7 +359,7 @@ function remove_legacy_moonraker_obico_logs() {
function remove_moonraker_obico_dir() { function remove_moonraker_obico_dir() {
[[ ! -d ${MOONRAKER_OBICO_DIR} ]] && return [[ ! -d ${MOONRAKER_OBICO_DIR} ]] && return
status_msg "Removing Moonraker-obico directory ..." status_msg "Removing Obico directory ..."
rm -rf "${MOONRAKER_OBICO_DIR}" rm -rf "${MOONRAKER_OBICO_DIR}"
ok_msg "Directory removed!" ok_msg "Directory removed!"
} }
@@ -380,7 +378,7 @@ function remove_moonraker_obico() {
remove_moonraker_obico_dir remove_moonraker_obico_dir
remove_moonraker_obico_env remove_moonraker_obico_env
print_confirm "Moonraker-obico was successfully removed!" print_confirm "Obico was successfully removed!"
return return
} }
@@ -394,7 +392,7 @@ function update_moonraker_obico() {
if [[ ! -d ${MOONRAKER_OBICO_DIR} ]]; then if [[ ! -d ${MOONRAKER_OBICO_DIR} ]]; then
clone_moonraker_obico "${MOONRAKER_OBICO_REPO}" clone_moonraker_obico "${MOONRAKER_OBICO_REPO}"
else else
status_msg "Updating Moonraker-obico ..." status_msg "Updating Obico ..."
cd "${MOONRAKER_OBICO_DIR}" && git pull cd "${MOONRAKER_OBICO_DIR}" && git pull
fi fi

View File

@@ -1,7 +1,7 @@
#!/usr/bin/env bash #!/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 # # This file is part of KIAUH - Klipper Installation And Update Helper #
# https://github.com/dw-0/kiauh # # https://github.com/dw-0/kiauh #

View File

@@ -1,7 +1,7 @@
#!/usr/bin/env bash #!/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 # # This file is part of KIAUH - Klipper Installation And Update Helper #
# https://github.com/dw-0/kiauh # # https://github.com/dw-0/kiauh #

View File

@@ -1,7 +1,7 @@
#!/usr/bin/env bash #!/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 # # This file is part of KIAUH - Klipper Installation And Update Helper #
# https://github.com/dw-0/kiauh # # https://github.com/dw-0/kiauh #

View File

@@ -1,7 +1,7 @@
#!/usr/bin/env bash #!/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 # # This file is part of KIAUH - Klipper Installation And Update Helper #
# https://github.com/dw-0/kiauh # # https://github.com/dw-0/kiauh #

View File

@@ -1,7 +1,7 @@
#!/usr/bin/env bash #!/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 # # This file is part of KIAUH - Klipper Installation And Update Helper #
# https://github.com/dw-0/kiauh # # https://github.com/dw-0/kiauh #
@@ -77,10 +77,12 @@ function change_klipper_repo_menu() {
error_msg "Invalid command!";; error_msg "Invalid command!";;
esac esac
done done
break
else else
status_msg "Set custom Klipper repository to:\n ● Repository: ${repos[${option}]}\n ● Branch: ${branches[${option}]}" status_msg "Set custom Klipper repository to:\n ● Repository: ${repos[${option}]}\n ● Branch: ${branches[${option}]}"
set_custom_klipper_repo "${repos[${option}]}" "${branches[${option}]}" set_custom_klipper_repo "${repos[${option}]}" "${branches[${option}]}"
ok_msg "This repo will now be used for new Klipper installations!\n" ok_msg "This repo will now be used for new Klipper installations!\n"
break
fi fi
elif [[ ${option} =~ ${back} ]]; then elif [[ ${option} =~ ${back} ]]; then

View File

@@ -1,7 +1,7 @@
#!/usr/bin/env bash #!/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 # # This file is part of KIAUH - Klipper Installation And Update Helper #
# https://github.com/dw-0/kiauh # # https://github.com/dw-0/kiauh #

View File

@@ -1,7 +1,7 @@
#!/usr/bin/env bash #!/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 # # This file is part of KIAUH - Klipper Installation And Update Helper #
# https://github.com/dw-0/kiauh # # https://github.com/dw-0/kiauh #
@@ -25,7 +25,7 @@ function backup_ui() {
echo -e "| | |" echo -e "| | |"
echo -e "| Klipper Webinterface: | Other: |" echo -e "| Klipper Webinterface: | Other: |"
echo -e "| 5) [Mainsail] | 9) [Telegram Bot] |" echo -e "| 5) [Mainsail] | 9) [Telegram Bot] |"
echo -e "| 6) [Fluidd] | |" echo -e "| 6) [Fluidd] | 10) [OctoEverywhere] |"
back_footer back_footer
} }
@@ -54,6 +54,8 @@ function backup_menu() {
do_action "backup_octoprint" "backup_ui";; do_action "backup_octoprint" "backup_ui";;
9) 9)
do_action "backup_telegram_bot" "backup_ui";; do_action "backup_telegram_bot" "backup_ui";;
10)
do_action "backup_octoeverywhere" "backup_ui";;
B|b) B|b)
clear; main_menu; break;; clear; main_menu; break;;
*) *)

View File

@@ -1,7 +1,7 @@
#!/usr/bin/env bash #!/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 # # This file is part of KIAUH - Klipper Installation And Update Helper #
# https://github.com/dw-0/kiauh # # https://github.com/dw-0/kiauh #

View File

@@ -1,7 +1,7 @@
#!/usr/bin/env bash #!/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 # # This file is part of KIAUH - Klipper Installation And Update Helper #
# https://github.com/dw-0/kiauh # # https://github.com/dw-0/kiauh #
@@ -35,7 +35,7 @@ function install_ui() {
} }
function install_menu() { 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 print_header
install_ui install_ui

View File

@@ -1,7 +1,7 @@
#!/usr/bin/env bash #!/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 # # This file is part of KIAUH - Klipper Installation And Update Helper #
# https://github.com/dw-0/kiauh # # https://github.com/dw-0/kiauh #
@@ -57,7 +57,7 @@ function print_status() {
elif [[ ${status} == "Incomplete!" ]]; then elif [[ ${status} == "Incomplete!" ]]; then
status="${yellow}${status}${white}" status="${yellow}${status}${white}"
elif [[ ${status} == "Not linked!" ]]; then 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}" status="${yellow}${status}${white}"
else else
status="${green}${status}${white}" status="${green}${status}${white}"

View File

@@ -1,7 +1,7 @@
#!/usr/bin/env bash #!/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 # # This file is part of KIAUH - Klipper Installation And Update Helper #
# https://github.com/dw-0/kiauh # # https://github.com/dw-0/kiauh #

View File

@@ -1,7 +1,7 @@
#!/usr/bin/env bash #!/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 # # This file is part of KIAUH - Klipper Installation And Update Helper #
# https://github.com/dw-0/kiauh # # https://github.com/dw-0/kiauh #

View File

@@ -1,7 +1,7 @@
#!/usr/bin/env bash #!/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 # # This file is part of KIAUH - Klipper Installation And Update Helper #
# https://github.com/dw-0/kiauh # # https://github.com/dw-0/kiauh #
@@ -41,7 +41,7 @@ function update_ui() {
} }
function update_menu() { 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" do_action "" "update_ui"
local action local action

View File

@@ -1,7 +1,7 @@
#!/usr/bin/env bash #!/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 # # This file is part of KIAUH - Klipper Installation And Update Helper #
# https://github.com/dw-0/kiauh # # https://github.com/dw-0/kiauh #

View File

@@ -1,7 +1,7 @@
#!/usr/bin/env bash #!/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 # # This file is part of KIAUH - Klipper Installation And Update Helper #
# https://github.com/dw-0/kiauh # # https://github.com/dw-0/kiauh #