From 12919c7140ee21582e76c7a0e34d2bbc82ca5fab Mon Sep 17 00:00:00 2001 From: dw-0 Date: Sat, 30 Aug 2025 22:02:12 +0200 Subject: [PATCH 01/14] feat(extension): add website and repo metadata for extensions, update links formatting in menu Signed-off-by: Dominik Willner --- kiauh/extensions/extensions_menu.py | 4 +-- .../extensions/gcode_shell_cmd/metadata.json | 3 ++- kiauh/extensions/klipper_backup/metadata.json | 2 ++ .../mainsail_theme_installer/metadata.json | 4 ++- kiauh/extensions/mobileraker/metadata.json | 1 + kiauh/extensions/obico/metadata.json | 2 ++ kiauh/extensions/octoapp/metadata.json | 1 + kiauh/extensions/octoeverywhere/metadata.json | 2 ++ kiauh/extensions/pretty_gcode/metadata.json | 1 + kiauh/extensions/simply_print/metadata.json | 25 +++++++++++-------- kiauh/extensions/spoolman/metadata.json | 1 + kiauh/extensions/telegram_bot/metadata.json | 2 +- 12 files changed, 32 insertions(+), 16 deletions(-) diff --git a/kiauh/extensions/extensions_menu.py b/kiauh/extensions/extensions_menu.py index 84fc019..cfc539f 100644 --- a/kiauh/extensions/extensions_menu.py +++ b/kiauh/extensions/extensions_menu.py @@ -150,9 +150,9 @@ class ExtensionSubmenu(BaseMenu): if website or repo: links_lines: List[str] = ["Links:"] if website: - links_lines.append(f"- Website: {website}") + links_lines.append(f"● {website}") if repo: - links_lines.append(f"- GitHub: {repo}") + links_lines.append(f"● {repo}") links_text = Logger.format_content( links_lines, diff --git a/kiauh/extensions/gcode_shell_cmd/metadata.json b/kiauh/extensions/gcode_shell_cmd/metadata.json index 7d7ccdc..efdc2cc 100644 --- a/kiauh/extensions/gcode_shell_cmd/metadata.json +++ b/kiauh/extensions/gcode_shell_cmd/metadata.json @@ -4,6 +4,7 @@ "module": "gcode_shell_cmd_extension", "maintained_by": "dw-0", "display_name": "G-Code Shell Command", - "description": ["Run a shell commands from gcode."] + "description": ["Run a shell commands from gcode."], + "updates": false } } diff --git a/kiauh/extensions/klipper_backup/metadata.json b/kiauh/extensions/klipper_backup/metadata.json index 68f215d..85f6926 100644 --- a/kiauh/extensions/klipper_backup/metadata.json +++ b/kiauh/extensions/klipper_backup/metadata.json @@ -5,6 +5,8 @@ "maintained_by": "Staubgeborener", "display_name": "Klipper-Backup", "description": ["Backup all your Klipper files to GitHub"], + "website": "https://klipperbackup.xyz", + "repo": "https://github.com/Staubgeborener/klipper-backup", "updates": true } } diff --git a/kiauh/extensions/mainsail_theme_installer/metadata.json b/kiauh/extensions/mainsail_theme_installer/metadata.json index ffb802a..fc01274 100644 --- a/kiauh/extensions/mainsail_theme_installer/metadata.json +++ b/kiauh/extensions/mainsail_theme_installer/metadata.json @@ -4,6 +4,8 @@ "module": "mainsail_theme_installer_extension", "maintained_by": "dw-0", "display_name": "Mainsail Theme Installer", - "description": ["Install Mainsail Themes maintained by the Mainsail community."] + "description": ["Install Mainsail Themes maintained by the Mainsail community."], + "website": "https://docs.mainsail.xyz/theming/themes", + "updates": false } } diff --git a/kiauh/extensions/mobileraker/metadata.json b/kiauh/extensions/mobileraker/metadata.json index 42aa311..0a4969a 100644 --- a/kiauh/extensions/mobileraker/metadata.json +++ b/kiauh/extensions/mobileraker/metadata.json @@ -7,6 +7,7 @@ "description": [ "Companion for Mobileraker, enabling push notification for Klipper using Moonraker." ], + "repo": "https://github.com/Clon1998/mobileraker_companion", "updates": true } } diff --git a/kiauh/extensions/obico/metadata.json b/kiauh/extensions/obico/metadata.json index cdf5753..0a26fdb 100644 --- a/kiauh/extensions/obico/metadata.json +++ b/kiauh/extensions/obico/metadata.json @@ -11,6 +11,8 @@ "- 25FPS High-Def Webcam Streaming", "- Free 4.9-Star Mobile App" ], + "website": "https://obico.io", + "repo": "github.com/TheSpaghettiDetective/moonraker-obico", "updates": true } } diff --git a/kiauh/extensions/octoapp/metadata.json b/kiauh/extensions/octoapp/metadata.json index 4660ab8..6f1b9ba 100644 --- a/kiauh/extensions/octoapp/metadata.json +++ b/kiauh/extensions/octoapp/metadata.json @@ -12,6 +12,7 @@ "- Live Gcode preview", "- And much much more!" ], + "repo": "https://github.com/crysxd/OctoApp-Plugin", "updates": true } } diff --git a/kiauh/extensions/octoeverywhere/metadata.json b/kiauh/extensions/octoeverywhere/metadata.json index 212688d..42fecd7 100644 --- a/kiauh/extensions/octoeverywhere/metadata.json +++ b/kiauh/extensions/octoeverywhere/metadata.json @@ -11,6 +11,8 @@ "- Real-time Notifications", "- Live Streaming, and More!" ], + "website": "https://octoeverywhere.com", + "repo": "github.com/QuinnDamerell/OctoPrint-OctoEverywhere", "updates": true } } diff --git a/kiauh/extensions/pretty_gcode/metadata.json b/kiauh/extensions/pretty_gcode/metadata.json index 0470f01..6959558 100644 --- a/kiauh/extensions/pretty_gcode/metadata.json +++ b/kiauh/extensions/pretty_gcode/metadata.json @@ -5,6 +5,7 @@ "maintained_by": "Kragrathea", "display_name": "PrettyGCode for Klipper", "description": ["3D G-Code viewer for Klipper"], + "repo": "https://github.com/Kragrathea/pgcode", "updates": true } } diff --git a/kiauh/extensions/simply_print/metadata.json b/kiauh/extensions/simply_print/metadata.json index 74213f1..2091b5d 100644 --- a/kiauh/extensions/simply_print/metadata.json +++ b/kiauh/extensions/simply_print/metadata.json @@ -1,13 +1,16 @@ { - "metadata": { - "index": 10, - "module": "simply_print_extension", - "maintained_by": "dw-0", - "display_name": "SimplyPrint", - "description": [ - "3D Printer Cloud Management Software.", - "\n\n", - "3D printing doesn't have to be a complicated, analog, SD card-filled experience; step into the future of modern 3D printing" - ] - } + "metadata": { + "index": 10, + "module": "simply_print_extension", + "maintained_by": "dw-0", + "display_name": "SimplyPrint", + "description": [ + "3D Printer Cloud Management Software.", + "\n\n", + "3D printing doesn't have to be a complicated, analog, SD card-filled experience; step into the future of modern 3D printing" + ], + "website": "https://simplyprint.io", + "repo": "https://github.com/SimplyPrint", + "updates": false + } } diff --git a/kiauh/extensions/spoolman/metadata.json b/kiauh/extensions/spoolman/metadata.json index 6d6160f..c569835 100644 --- a/kiauh/extensions/spoolman/metadata.json +++ b/kiauh/extensions/spoolman/metadata.json @@ -13,6 +13,7 @@ "\n\n", "Note: This extension installs Spoolman using Docker. Docker must be installed on your system before installing Spoolman." ], + "repo": "https://github.com/Donkie/Spoolman", "updates": true } } diff --git a/kiauh/extensions/telegram_bot/metadata.json b/kiauh/extensions/telegram_bot/metadata.json index 3ffadc7..342d3fb 100644 --- a/kiauh/extensions/telegram_bot/metadata.json +++ b/kiauh/extensions/telegram_bot/metadata.json @@ -5,7 +5,7 @@ "maintained_by": "nlef", "display_name": "Moonraker Telegram Bot", "description": ["Control your printer with the Telegram messenger app."], - "project_url": "https://github.com/nlef/moonraker-telegram-bot", + "repo": "https://github.com/nlef/moonraker-telegram-bot", "updates": true } } From 195b7fa926ec4480f3b700438ee3e9e696731f93 Mon Sep 17 00:00:00 2001 From: Oleg Gurev Date: Sun, 31 Aug 2025 12:30:16 +0300 Subject: [PATCH 02/14] fix: add moonraker-hmi and moonraker-telegram-bot to the blacklist (#720) * Add moonraker-hmi and moonraker-telegram-bot to the blacklist of moonraker service detection function * fix: add "hmi" to SUFFIX_BLACKLIST to prevent instance name conflicts Signed-off-by: Dominik Willner --------- Signed-off-by: Dominik Willner Co-authored-by: dw-0 --- kiauh/core/instance_manager/base_instance.py | 5 +++-- scripts/moonraker.sh | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/kiauh/core/instance_manager/base_instance.py b/kiauh/core/instance_manager/base_instance.py index 06f2a27..18af206 100644 --- a/kiauh/core/instance_manager/base_instance.py +++ b/kiauh/core/instance_manager/base_instance.py @@ -16,8 +16,9 @@ from typing import List from utils.fs_utils import get_data_dir -SUFFIX_BLACKLIST: List[str] = ["None", "mcu", "obico", "bambu", "companion"] - +# suffixes that are not allowed to be used for instances +# because they would cause conflicts with other components or are reserved +SUFFIX_BLACKLIST: List[str] = ["None", "mcu", "obico", "bambu", "companion", "hmi"] @dataclass(repr=True) class BaseInstance: diff --git a/scripts/moonraker.sh b/scripts/moonraker.sh index 7c4d8bd..4f2e49d 100644 --- a/scripts/moonraker.sh +++ b/scripts/moonraker.sh @@ -27,7 +27,7 @@ function moonraker_systemd() { ### # any moonraker client that uses "moonraker" in its own name must be blacklisted using # this variable, otherwise they will be falsely recognized as moonraker instances - blacklist="obico" + blacklist="obico|hmi|telegram-bot" ignore="${SYSTEMD}/moonraker-(${blacklist}).service" match="${SYSTEMD}/moonraker(-[0-9a-zA-Z]+)?.service" From 89b48168f40db73042fcd090293fc102a5454fd3 Mon Sep 17 00:00:00 2001 From: dw-0 Date: Sat, 6 Sep 2025 13:12:20 +0200 Subject: [PATCH 03/14] fix: do not drop SAVE_CONFIG block when editing and writing config files (#723) Squashed 'kiauh/core/submodules/simple_config_parser/' changes from 4a6e5f2..f5eee99 f5eee99 feat: add support for parsing and handling `SAVE_CONFIG` blocks (#4) 8170583 refactor(api)!: `getval` now returns a string, `getvals` returns list of strings git-subtree-dir: kiauh/core/submodules/simple_config_parser git-subtree-split: f5eee99b0f04717c6bbf30c1256d70ad019223d5 --- .../submodules/simple_config_parser/README.md | 1 + .../src/simple_config_parser/constants.py | 3 + .../simple_config_parser.py | 32 ++++- .../tests/assets/test_config_4.cfg | 116 ++++++++++++++++++ .../test_data/matching_data.txt | 22 ++++ .../test_data/non_matching_data.txt | 6 + .../test_match_save_config_content.py | 37 ++++++ .../test_data/matching_data.txt | 6 + .../test_data/non_matching_data.txt | 13 ++ .../test_match_save_config_start.py | 37 ++++++ .../tests/public_api/conftest.py | 2 +- 11 files changed, 269 insertions(+), 6 deletions(-) create mode 100644 kiauh/core/submodules/simple_config_parser/tests/assets/test_config_4.cfg create mode 100644 kiauh/core/submodules/simple_config_parser/tests/line_matching/match_save_config_content/test_data/matching_data.txt create mode 100644 kiauh/core/submodules/simple_config_parser/tests/line_matching/match_save_config_content/test_data/non_matching_data.txt create mode 100644 kiauh/core/submodules/simple_config_parser/tests/line_matching/match_save_config_content/test_match_save_config_content.py create mode 100644 kiauh/core/submodules/simple_config_parser/tests/line_matching/match_save_config_start/test_data/matching_data.txt create mode 100644 kiauh/core/submodules/simple_config_parser/tests/line_matching/match_save_config_start/test_data/non_matching_data.txt create mode 100644 kiauh/core/submodules/simple_config_parser/tests/line_matching/match_save_config_start/test_match_save_config_start.py diff --git a/kiauh/core/submodules/simple_config_parser/README.md b/kiauh/core/submodules/simple_config_parser/README.md index c04af42..b84b6c7 100644 --- a/kiauh/core/submodules/simple_config_parser/README.md +++ b/kiauh/core/submodules/simple_config_parser/README.md @@ -12,6 +12,7 @@ Specialized for handling Klipper style config files. - Option Block: A line starting with a word, followed by a `:` or `=` and a newline - Comment: A line starting with a `#` or `;` - Blank: A line containing only whitespace characters +- SaveConfig: Klippers auto-generated SAVE_CONFIG section that can be found at the very end of the config file --- diff --git a/kiauh/core/submodules/simple_config_parser/src/simple_config_parser/constants.py b/kiauh/core/submodules/simple_config_parser/src/simple_config_parser/constants.py index 5afe9af..db9ecb3 100644 --- a/kiauh/core/submodules/simple_config_parser/src/simple_config_parser/constants.py +++ b/kiauh/core/submodules/simple_config_parser/src/simple_config_parser/constants.py @@ -49,6 +49,9 @@ LINE_COMMENT_RE = re.compile(r"^\s*[#;].*") # - the line MUST contain only whitespace characters EMPTY_LINE_RE = re.compile(r"^\s*$") +SAVE_CONFIG_START_RE = re.compile(r"^#\*# <-+ SAVE_CONFIG -+>$") +SAVE_CONFIG_CONTENT_RE = re.compile(r"^#\*#.*$") + BOOLEAN_STATES = { "1": True, "yes": True, diff --git a/kiauh/core/submodules/simple_config_parser/src/simple_config_parser/simple_config_parser.py b/kiauh/core/submodules/simple_config_parser/src/simple_config_parser/simple_config_parser.py index 01d9374..4084779 100644 --- a/kiauh/core/submodules/simple_config_parser/src/simple_config_parser/simple_config_parser.py +++ b/kiauh/core/submodules/simple_config_parser/src/simple_config_parser/simple_config_parser.py @@ -18,7 +18,7 @@ from ..simple_config_parser.constants import ( LINE_COMMENT_RE, OPTION_RE, OPTIONS_BLOCK_START_RE, - SECTION_RE, LineType, INDENT, + SECTION_RE, LineType, INDENT, SAVE_CONFIG_START_RE, SAVE_CONFIG_CONTENT_RE, ) _UNSET = object() @@ -61,25 +61,34 @@ class SimpleConfigParser: def __init__(self) -> None: self.header: List[str] = [] + self.save_config_block: List[str] = [] self.config: Dict = {} self.current_section: str | None = None self.current_opt_block: str | None = None self.in_option_block: bool = False def _match_section(self, line: str) -> bool: - """Wheter or not the given line matches the definition of a section""" + """Whether the given line matches the definition of a section""" return SECTION_RE.match(line) is not None def _match_option(self, line: str) -> bool: - """Wheter or not the given line matches the definition of an option""" + """Whether the given line matches the definition of an option""" return OPTION_RE.match(line) is not None def _match_options_block_start(self, line: str) -> bool: - """Wheter or not the given line matches the definition of a multiline option""" + """Whether the given line matches the definition of a multiline option""" return OPTIONS_BLOCK_START_RE.match(line) is not None + def _match_save_config_start(self, line: str) -> bool: + """Whether the given line matches the definition of a save config start""" + return SAVE_CONFIG_START_RE.match(line) is not None + + def _match_save_config_content(self, line: str) -> bool: + """Whether the given line matches the definition of a save config content""" + return SAVE_CONFIG_CONTENT_RE.match(line) is not None + def _match_line_comment(self, line: str) -> bool: - """Wheter or not the given line matches the definition of a comment""" + """Whether the given line matches the definition of a comment""" return LINE_COMMENT_RE.match(line) is not None def _match_empty_line(self, line: str) -> bool: @@ -124,6 +133,14 @@ class SimpleConfigParser: element["value"].append(line.strip()) # indentation is removed break + elif self._match_save_config_start(line): + self.current_opt_block = None + self.save_config_block.append(line) + + elif self._match_save_config_content(line): + self.current_opt_block = None + self.save_config_block.append(line) + elif self._match_empty_line(line) or self._match_line_comment(line): self.current_opt_block = None @@ -185,6 +202,11 @@ class SimpleConfigParser: if not last_line.endswith("\n"): f.write("\n") + if self.save_config_block: + for line in self.save_config_block: + f.write(line) + f.write("\n") + def get_sections(self) -> List[str]: """Return a list of all section names, but exclude any section starting with '#_'""" return list( diff --git a/kiauh/core/submodules/simple_config_parser/tests/assets/test_config_4.cfg b/kiauh/core/submodules/simple_config_parser/tests/assets/test_config_4.cfg new file mode 100644 index 0000000..04cf0c7 --- /dev/null +++ b/kiauh/core/submodules/simple_config_parser/tests/assets/test_config_4.cfg @@ -0,0 +1,116 @@ +# a comment at the very top +# should be treated as the file header + +# up to the first section, including all blank lines + +[section_1] +option_1: value_1 +option_1_1: True # this is a boolean +option_1_2: 5 ; this is an integer +option_1_3: 1.123 #;this is a float + +[section_2] ; comment +option_2: value_2 + +; comment + +[section_3] +option_3: value_3 # comment + +[section_4] +# comment +option_4: value_4 + +[section number 5] +#option_5: value_5 +option_5 = this.is.value-5 +multi_option: + # these are multi-line values + value_5_1 + value_5_2 ; here is a comment + value_5_3 +option_5_1: value_5_1 + +[gcode_macro M117] +rename_existing: M117.1 +gcode: + {% if rawparams %} + {% set escaped_msg = rawparams.split(';', 1)[0].split('\x23', 1)[0]|replace('"', '\\"') %} + SET_DISPLAY_TEXT MSG="{escaped_msg}" + RESPOND TYPE=command MSG="{escaped_msg}" + {% else %} + SET_DISPLAY_TEXT + {% endif %} + +# SDCard 'looping' (aka Marlin M808 commands) support +# +# Support SDCard looping +[sdcard_loop] +[gcode_macro M486] +gcode: + # Parameters known to M486 are as follows: + # [C] Cancel the current object + # [P] Cancel the object with the given index + # [S] Set the index of the current object. + # If the object with the given index has been canceled, this will cause + # the firmware to skip to the next object. The value -1 is used to + # indicate something that isn’t an object and shouldn’t be skipped. + # [T] Reset the state and set the number of objects + # [U] Un-cancel the object with the given index. This command will be + # ignored if the object has already been skipped + + {% if 'exclude_object' not in printer %} + {action_raise_error("[exclude_object] is not enabled")} + {% endif %} + + {% if 'T' in params %} + EXCLUDE_OBJECT RESET=1 + + {% for i in range(params.T | int) %} + EXCLUDE_OBJECT_DEFINE NAME={i} + {% endfor %} + {% endif %} + + {% if 'C' in params %} + EXCLUDE_OBJECT CURRENT=1 + {% endif %} + + {% if 'P' in params %} + EXCLUDE_OBJECT NAME={params.P} + {% endif %} + + {% if 'S' in params %} + {% if params.S == '-1' %} + {% if printer.exclude_object.current_object %} + EXCLUDE_OBJECT_END NAME={printer.exclude_object.current_object} + {% endif %} + {% else %} + EXCLUDE_OBJECT_START NAME={params.S} + {% endif %} + {% endif %} + + {% if 'U' in params %} + EXCLUDE_OBJECT RESET=1 NAME={params.U} + {% endif %} + +#*# <---------------------- SAVE_CONFIG ----------------------> +#*# DO NOT EDIT THIS BLOCK OR BELOW. The contents are auto-generated. +#*# +#*# [bed_mesh default] +#*# version = 1 +#*# points = +#*# -0.152500, -0.133125, -0.113125, -0.159375, -0.232500 +#*# -0.095000, -0.078750, -0.068125, -0.133125, -0.235000 +#*# -0.092500, -0.040625, 0.004375, -0.077500, -0.193125 +#*# -0.073750, 0.023750, 0.085625, 0.026875, -0.085000 +#*# -0.140625, 0.038125, 0.126250, 0.097500, 0.003750 +#*# tension = 0.2 +#*# min_x = 26.0 +#*# algo = bicubic +#*# y_count = 5 +#*# mesh_y_pps = 2 +#*# min_y = 5.0 +#*# x_count = 5 +#*# max_y = 174.0 +#*# mesh_x_pps = 2 +#*# max_x = 194.0 diff --git a/kiauh/core/submodules/simple_config_parser/tests/line_matching/match_save_config_content/test_data/matching_data.txt b/kiauh/core/submodules/simple_config_parser/tests/line_matching/match_save_config_content/test_data/matching_data.txt new file mode 100644 index 0000000..0839d60 --- /dev/null +++ b/kiauh/core/submodules/simple_config_parser/tests/line_matching/match_save_config_content/test_data/matching_data.txt @@ -0,0 +1,22 @@ +#*# any content +#*# +#*# DO NOT EDIT THIS BLOCK OR BELOW. The contents are auto-generated. +#*# +#*# [bed_mesh default] +#*# version = 1 +#*# points = +#*# -0.152500, -0.133125, -0.113125, -0.159375, -0.232500 +#*# -0.095000, -0.078750, -0.068125, -0.133125, -0.235000 +#*# -0.092500, -0.040625, 0.004375, -0.077500, -0.193125 +#*# -0.073750, 0.023750, 0.085625, 0.026875, -0.085000 +#*# -0.140625, 0.038125, 0.126250, 0.097500, 0.003750 +#*# tension = 0.2 +#*# min_x = 26.0 +#*# algo = bicubic +#*# y_count = 5 +#*# mesh_y_pps = 2 +#*# min_y = 5.0 +#*# x_count = 5 +#*# max_y = 174.0 +#*# mesh_x_pps = 2 +#*# max_x = 194.0 diff --git a/kiauh/core/submodules/simple_config_parser/tests/line_matching/match_save_config_content/test_data/non_matching_data.txt b/kiauh/core/submodules/simple_config_parser/tests/line_matching/match_save_config_content/test_data/non_matching_data.txt new file mode 100644 index 0000000..a97d893 --- /dev/null +++ b/kiauh/core/submodules/simple_config_parser/tests/line_matching/match_save_config_content/test_data/non_matching_data.txt @@ -0,0 +1,6 @@ + #*# leading space prevents match +random +*# not starting with hash-star-hash +# *# spaced out +<- SAVE_CONFIG -> +;#*# semicolon first diff --git a/kiauh/core/submodules/simple_config_parser/tests/line_matching/match_save_config_content/test_match_save_config_content.py b/kiauh/core/submodules/simple_config_parser/tests/line_matching/match_save_config_content/test_match_save_config_content.py new file mode 100644 index 0000000..7677266 --- /dev/null +++ b/kiauh/core/submodules/simple_config_parser/tests/line_matching/match_save_config_content/test_match_save_config_content.py @@ -0,0 +1,37 @@ +# ======================================================================= # +# Copyright (C) 2024 Dominik Willner # +# # +# https://github.com/dw-0/simple-config-parser # +# # +# This file may be distributed under the terms of the GNU GPLv3 license # +# ======================================================================= # + +from pathlib import Path + +import pytest + +from src.simple_config_parser.simple_config_parser import SimpleConfigParser +from tests.utils import load_testdata_from_file + +BASE_DIR = Path(__file__).parent.joinpath("test_data") +MATCHING_TEST_DATA_PATH = BASE_DIR.joinpath("matching_data.txt") +NON_MATCHING_TEST_DATA_PATH = BASE_DIR.joinpath("non_matching_data.txt") + + +@pytest.fixture +def parser(): + return SimpleConfigParser() + + +def test_matching_lines(parser): + """Alle Zeilen in matching_data.txt sollen als Save-Config-Content erkannt werden.""" + matching_lines = load_testdata_from_file(MATCHING_TEST_DATA_PATH) + for line in matching_lines: + assert parser._match_save_config_content(line) is True, f"Line should be a save config content: {line!r}" + + +def test_non_matching_lines(parser): + """Alle Zeilen in non_matching_data.txt sollen NICHT als Save-Config-Content erkannt werden.""" + non_matching_lines = load_testdata_from_file(NON_MATCHING_TEST_DATA_PATH) + for line in non_matching_lines: + assert parser._match_save_config_content(line) is False, f"Line should not be a save config content: {line!r}" diff --git a/kiauh/core/submodules/simple_config_parser/tests/line_matching/match_save_config_start/test_data/matching_data.txt b/kiauh/core/submodules/simple_config_parser/tests/line_matching/match_save_config_start/test_data/matching_data.txt new file mode 100644 index 0000000..b2516e3 --- /dev/null +++ b/kiauh/core/submodules/simple_config_parser/tests/line_matching/match_save_config_start/test_data/matching_data.txt @@ -0,0 +1,6 @@ +#*# <- SAVE_CONFIG -> +#*# <---- SAVE_CONFIG ----> +#*# <------------------- SAVE_CONFIG -------------------> +#*# <---------------------- SAVE_CONFIG ----------------------> +#*# <----- SAVE_CONFIG -> +#*# <- SAVE_CONFIG -----------------> diff --git a/kiauh/core/submodules/simple_config_parser/tests/line_matching/match_save_config_start/test_data/non_matching_data.txt b/kiauh/core/submodules/simple_config_parser/tests/line_matching/match_save_config_start/test_data/non_matching_data.txt new file mode 100644 index 0000000..59b2841 --- /dev/null +++ b/kiauh/core/submodules/simple_config_parser/tests/line_matching/match_save_config_start/test_data/non_matching_data.txt @@ -0,0 +1,13 @@ +#*#<- SAVE_CONFIG -> +#*# <-SAVE_CONFIG -> +#*# <- SAVE_CONFIG-> +#*# <- SAVE_CONFIG -> extra +#*# SAVE_CONFIG ----> +#*# < SAVE_CONFIG > +# *# <- SAVE_CONFIG -> +<- SAVE_CONFIG -> +random text + #*# <---------------------- SAVE_CONFIG ----------------------> +#*# <---------------------- SAVE_CONFIG ----------------------> #*# +#*# <--------------------------------------------> +#*# SAVE_CONFIG diff --git a/kiauh/core/submodules/simple_config_parser/tests/line_matching/match_save_config_start/test_match_save_config_start.py b/kiauh/core/submodules/simple_config_parser/tests/line_matching/match_save_config_start/test_match_save_config_start.py new file mode 100644 index 0000000..3a85237 --- /dev/null +++ b/kiauh/core/submodules/simple_config_parser/tests/line_matching/match_save_config_start/test_match_save_config_start.py @@ -0,0 +1,37 @@ +# ======================================================================= # +# Copyright (C) 2024 Dominik Willner # +# # +# https://github.com/dw-0/simple-config-parser # +# # +# This file may be distributed under the terms of the GNU GPLv3 license # +# ======================================================================= # + +from pathlib import Path + +import pytest + +from src.simple_config_parser.simple_config_parser import SimpleConfigParser +from tests.utils import load_testdata_from_file + +BASE_DIR = Path(__file__).parent.joinpath("test_data") +MATCHING_TEST_DATA_PATH = BASE_DIR.joinpath("matching_data.txt") +NON_MATCHING_TEST_DATA_PATH = BASE_DIR.joinpath("non_matching_data.txt") + + +@pytest.fixture +def parser(): + return SimpleConfigParser() + + +def test_matching_lines(parser): + """Test that all lines in the matching data file are correctly identified as save config start lines.""" + matching_lines = load_testdata_from_file(MATCHING_TEST_DATA_PATH) + for line in matching_lines: + assert parser._match_save_config_start(line) is True, f"Line should be a save config start: {line!r}" + + +def test_non_matching_lines(parser): + """Test that all lines in the non-matching data file are correctly identified as not save config start lines.""" + non_matching_lines = load_testdata_from_file(NON_MATCHING_TEST_DATA_PATH) + for line in non_matching_lines: + assert parser._match_save_config_start(line) is False, f"Line should not be a save config start: {line!r}" diff --git a/kiauh/core/submodules/simple_config_parser/tests/public_api/conftest.py b/kiauh/core/submodules/simple_config_parser/tests/public_api/conftest.py index 7c932c6..fdd77fa 100644 --- a/kiauh/core/submodules/simple_config_parser/tests/public_api/conftest.py +++ b/kiauh/core/submodules/simple_config_parser/tests/public_api/conftest.py @@ -13,7 +13,7 @@ from src.simple_config_parser.simple_config_parser import SimpleConfigParser from tests.utils import load_testdata_from_file BASE_DIR = Path(__file__).parent.parent.joinpath("assets") -CONFIG_FILES = ["test_config_1.cfg", "test_config_2.cfg", "test_config_3.cfg"] +CONFIG_FILES = ["test_config_1.cfg", "test_config_2.cfg", "test_config_3.cfg", "test_config_4.cfg"] @pytest.fixture(params=CONFIG_FILES) From 81ac102644979a0f9a28d42449bf77ac56fe226e Mon Sep 17 00:00:00 2001 From: dw-0 Date: Sat, 20 Sep 2025 15:17:37 +0200 Subject: [PATCH 04/14] fix(v5): add back example file for custom Klipper repository management --- .gitignore | 1 + klipper_repos.txt.example | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+) create mode 100644 klipper_repos.txt.example diff --git a/.gitignore b/.gitignore index b3e84e1..2dbafd8 100644 --- a/.gitignore +++ b/.gitignore @@ -10,3 +10,4 @@ __pycache__ *.code-workspace *.iml kiauh.cfg +klipper_repos.txt diff --git a/klipper_repos.txt.example b/klipper_repos.txt.example new file mode 100644 index 0000000..6cc3393 --- /dev/null +++ b/klipper_repos.txt.example @@ -0,0 +1,18 @@ +# This file acts as an example file. +# +# 1) Make a copy of this file and rename it to 'klipper_repos.txt' +# 2) Add your custom Klipper repository to the bottom of that copy +# 3) Save the file +# +# Back in KIAUH you can now go into -> [Settings] and use action '2' to set a different Klipper repository +# +# Make sure to always separate the repository and the branch with a ','. +# , -> https://github.com/Klipper3d/klipper,master +# If you omit a branch, it will always default to 'master' +# +# You are allowed to omit the 'https://github.com/' part of the repository URL +# Down below are now a few examples of what is considered as valid: +https://github.com/Klipper3d/klipper,master +https://github.com/Klipper3d/klipper +Klipper3d/klipper,master +Klipper3d/klipper From 1ed1e0fc4c0c0922e4c3420ddb8c608e1b110e7d Mon Sep 17 00:00:00 2001 From: dw-0 Date: Sat, 27 Sep 2025 18:42:39 +0200 Subject: [PATCH 05/14] chore(dev): replace pyright with mypy and configure mypy rules --- pyproject.toml | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 350b332..002b70d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -2,7 +2,7 @@ requires-python = ">=3.8" [project.optional-dependencies] -dev=["ruff", "pyright"] +dev=["ruff", "mypy"] [tool.ruff] required-version = ">=0.9.10" @@ -20,3 +20,14 @@ quote-style = "double" [tool.ruff.lint] extend-select = ["I"] + +[tool.mypy] +python_version = "3.8" +platform = "linux" +# strict = true # TODO: enable this once everything is else is handled +check_untyped_defs = true +ignore_missing_imports = true +warn_redundant_casts = true +warn_unused_ignores = true +warn_return_any = true +warn_unreachable = true From aff63665de8fb71e88641733b2805362b1b0132c Mon Sep 17 00:00:00 2001 From: dw-0 Date: Sun, 28 Sep 2025 09:41:07 +0200 Subject: [PATCH 06/14] refactor: replace backup_manager with backup_service --- kiauh/components/crowsnest/__init__.py | 2 - kiauh/components/crowsnest/crowsnest.py | 13 +- kiauh/components/klipper/__init__.py | 3 - kiauh/components/klipper/klipper_utils.py | 17 ++- kiauh/components/klipperscreen/__init__.py | 2 - .../components/klipperscreen/klipperscreen.py | 21 ++-- kiauh/components/moonraker/__init__.py | 4 - kiauh/components/moonraker/utils/utils.py | 30 +++-- kiauh/components/webui_client/base_data.py | 2 - .../components/webui_client/client_remove.py | 17 ++- kiauh/components/webui_client/client_utils.py | 47 +++++--- kiauh/components/webui_client/fluidd_data.py | 3 - .../components/webui_client/mainsail_data.py | 3 - kiauh/core/backup_manager/__init__.py | 12 -- kiauh/core/backup_manager/backup_manager.py | 108 ----------------- kiauh/core/constants.py | 3 - kiauh/core/services/backup_service.py | 111 ++++++++++++++++++ kiauh/core/settings/kiauh_settings.py | 6 +- .../gcode_shell_cmd_extension.py | 13 +- kiauh/extensions/mobileraker/__init__.py | 2 - .../mobileraker/mobileraker_extension.py | 21 ++-- .../extensions/spoolman/spoolman_extension.py | 17 ++- kiauh/procedures/switch_repo.py | 36 +++--- kiauh/utils/common.py | 15 +-- 24 files changed, 252 insertions(+), 256 deletions(-) delete mode 100644 kiauh/core/backup_manager/__init__.py delete mode 100644 kiauh/core/backup_manager/backup_manager.py create mode 100644 kiauh/core/services/backup_service.py diff --git a/kiauh/components/crowsnest/__init__.py b/kiauh/components/crowsnest/__init__.py index 01a0230..7f545ee 100644 --- a/kiauh/components/crowsnest/__init__.py +++ b/kiauh/components/crowsnest/__init__.py @@ -9,7 +9,6 @@ from pathlib import Path -from core.backup_manager import BACKUP_ROOT_DIR from core.constants import SYSTEMD # repo @@ -20,7 +19,6 @@ CROWSNEST_SERVICE_NAME = "crowsnest.service" # directories CROWSNEST_DIR = Path.home().joinpath("crowsnest") -CROWSNEST_BACKUP_DIR = BACKUP_ROOT_DIR.joinpath("crowsnest-backups") # files CROWSNEST_MULTI_CONFIG = CROWSNEST_DIR.joinpath("tools/.config") diff --git a/kiauh/components/crowsnest/crowsnest.py b/kiauh/components/crowsnest/crowsnest.py index 516f63f..1fa9a5e 100644 --- a/kiauh/components/crowsnest/crowsnest.py +++ b/kiauh/components/crowsnest/crowsnest.py @@ -15,7 +15,6 @@ from subprocess import CalledProcessError, run from typing import List from components.crowsnest import ( - CROWSNEST_BACKUP_DIR, CROWSNEST_BIN_FILE, CROWSNEST_DIR, CROWSNEST_INSTALL_SCRIPT, @@ -26,8 +25,8 @@ from components.crowsnest import ( CROWSNEST_SERVICE_NAME, ) from components.klipper.klipper import Klipper -from core.backup_manager.backup_manager import BackupManager from core.logger import DialogType, Logger +from core.services.backup_service import BackupService from core.settings.kiauh_settings import KiauhSettings from core.types.component_status import ComponentStatus from utils.common import ( @@ -127,11 +126,11 @@ def update_crowsnest() -> None: settings = KiauhSettings() if settings.kiauh.backup_before_update: - bm = BackupManager() - bm.backup_directory( - CROWSNEST_DIR.name, - source=CROWSNEST_DIR, - target=CROWSNEST_BACKUP_DIR, + svc = BackupService() + svc.backup_directory( + source_path=CROWSNEST_DIR, + target_path="crowsnest", + backup_name="crowsnest", ) git_pull_wrapper(CROWSNEST_DIR) diff --git a/kiauh/components/klipper/__init__.py b/kiauh/components/klipper/__init__.py index 22efb95..f5bc5ae 100644 --- a/kiauh/components/klipper/__init__.py +++ b/kiauh/components/klipper/__init__.py @@ -9,8 +9,6 @@ from pathlib import Path -from core.backup_manager import BACKUP_ROOT_DIR - MODULE_PATH = Path(__file__).resolve().parent KLIPPER_REPO_URL = "https://github.com/Klipper3d/klipper.git" @@ -27,7 +25,6 @@ KLIPPER_SERVICE_NAME = "klipper.service" KLIPPER_DIR = Path.home().joinpath("klipper") KLIPPER_KCONFIGS_DIR = Path.home().joinpath("klipper-kconfigs") KLIPPER_ENV_DIR = Path.home().joinpath("klippy-env") -KLIPPER_BACKUP_DIR = BACKUP_ROOT_DIR.joinpath("klipper-backups") # files KLIPPER_REQ_FILE = KLIPPER_DIR.joinpath("scripts/klippy-requirements.txt") diff --git a/kiauh/components/klipper/klipper_utils.py b/kiauh/components/klipper/klipper_utils.py index 6c75c68..a67d683 100644 --- a/kiauh/components/klipper/klipper_utils.py +++ b/kiauh/components/klipper/klipper_utils.py @@ -16,7 +16,6 @@ from subprocess import CalledProcessError, run from typing import Dict, List from components.klipper import ( - KLIPPER_BACKUP_DIR, KLIPPER_DIR, KLIPPER_ENV_DIR, KLIPPER_INSTALL_SCRIPT, @@ -31,10 +30,10 @@ from components.webui_client.base_data import BaseWebClient from components.webui_client.client_config.client_config_setup import ( create_client_config_symlink, ) -from core.backup_manager.backup_manager import BackupManager from core.constants import CURRENT_USER from core.instance_manager.base_instance import SUFFIX_BLACKLIST from core.logger import DialogType, Logger +from core.services.backup_service import BackupService from core.submodules.simple_config_parser.src.simple_config_parser.simple_config_parser import ( SimpleConfigParser, ) @@ -198,9 +197,17 @@ def create_example_printer_cfg( def backup_klipper_dir() -> None: - bm = BackupManager() - bm.backup_directory("klipper", source=KLIPPER_DIR, target=KLIPPER_BACKUP_DIR) - bm.backup_directory("klippy-env", source=KLIPPER_ENV_DIR, target=KLIPPER_BACKUP_DIR) + svc = BackupService() + svc.backup_directory( + source_path=KLIPPER_DIR, + backup_name="klipper", + target_path="klipper", + ) + svc.backup_directory( + source_path=KLIPPER_ENV_DIR, + backup_name="klippy-env", + target_path="klipper", + ) def install_klipper_packages() -> None: diff --git a/kiauh/components/klipperscreen/__init__.py b/kiauh/components/klipperscreen/__init__.py index c8333bb..8640b8a 100644 --- a/kiauh/components/klipperscreen/__init__.py +++ b/kiauh/components/klipperscreen/__init__.py @@ -8,7 +8,6 @@ # ======================================================================= # from pathlib import Path -from core.backup_manager import BACKUP_ROOT_DIR from core.constants import SYSTEMD # repo @@ -22,7 +21,6 @@ KLIPPERSCREEN_LOG_NAME = "KlipperScreen.log" # directories KLIPPERSCREEN_DIR = Path.home().joinpath("KlipperScreen") KLIPPERSCREEN_ENV_DIR = Path.home().joinpath(".KlipperScreen-env") -KLIPPERSCREEN_BACKUP_DIR = BACKUP_ROOT_DIR.joinpath("klipperscreen-backups") # files KLIPPERSCREEN_REQ_FILE = KLIPPERSCREEN_DIR.joinpath( diff --git a/kiauh/components/klipperscreen/klipperscreen.py b/kiauh/components/klipperscreen/klipperscreen.py index a73f87a..8fe461c 100644 --- a/kiauh/components/klipperscreen/klipperscreen.py +++ b/kiauh/components/klipperscreen/klipperscreen.py @@ -13,7 +13,6 @@ from typing import List from components.klipper.klipper import Klipper from components.klipperscreen import ( - KLIPPERSCREEN_BACKUP_DIR, KLIPPERSCREEN_DIR, KLIPPERSCREEN_ENV_DIR, KLIPPERSCREEN_INSTALL_SCRIPT, @@ -25,10 +24,10 @@ from components.klipperscreen import ( KLIPPERSCREEN_UPDATER_SECTION_NAME, ) from components.moonraker.moonraker import Moonraker -from core.backup_manager.backup_manager import BackupManager from core.constants import SYSTEMD from core.instance_manager.instance_manager import InstanceManager from core.logger import DialogType, Logger +from core.services.backup_service import BackupService from core.settings.kiauh_settings import KiauhSettings from core.types.component_status import ComponentStatus from utils.common import ( @@ -193,14 +192,14 @@ def remove_klipperscreen() -> None: def backup_klipperscreen_dir() -> None: - bm = BackupManager() - bm.backup_directory( - KLIPPERSCREEN_DIR.name, - source=KLIPPERSCREEN_DIR, - target=KLIPPERSCREEN_BACKUP_DIR, + svc = BackupService() + svc.backup_directory( + source_path=KLIPPERSCREEN_DIR, + backup_name="KlipperScreen", + target_path="KlipperScreen", ) - bm.backup_directory( - KLIPPERSCREEN_ENV_DIR.name, - source=KLIPPERSCREEN_ENV_DIR, - target=KLIPPERSCREEN_BACKUP_DIR, + svc.backup_directory( + source_path=KLIPPERSCREEN_ENV_DIR, + backup_name="KlipperScreen-env", + target_path="KlipperScreen", ) diff --git a/kiauh/components/moonraker/__init__.py b/kiauh/components/moonraker/__init__.py index 79bdf99..50b98c6 100644 --- a/kiauh/components/moonraker/__init__.py +++ b/kiauh/components/moonraker/__init__.py @@ -9,8 +9,6 @@ from pathlib import Path -from core.backup_manager import BACKUP_ROOT_DIR - MODULE_PATH = Path(__file__).resolve().parent MOONRAKER_REPO_URL = "https://github.com/Arksine/moonraker.git" @@ -25,8 +23,6 @@ MOONRAKER_ENV_FILE_NAME = "moonraker.env" # directories MOONRAKER_DIR = Path.home().joinpath("moonraker") MOONRAKER_ENV_DIR = Path.home().joinpath("moonraker-env") -MOONRAKER_BACKUP_DIR = BACKUP_ROOT_DIR.joinpath("moonraker-backups") -MOONRAKER_DB_BACKUP_DIR = BACKUP_ROOT_DIR.joinpath("moonraker-db-backups") # files MOONRAKER_INSTALL_SCRIPT = MOONRAKER_DIR.joinpath("scripts/install-moonraker.sh") diff --git a/kiauh/components/moonraker/utils/utils.py b/kiauh/components/moonraker/utils/utils.py index 55b9cea..8aa36f7 100644 --- a/kiauh/components/moonraker/utils/utils.py +++ b/kiauh/components/moonraker/utils/utils.py @@ -14,8 +14,6 @@ from typing import Dict, List, Optional from components.moonraker import ( MODULE_PATH, - MOONRAKER_BACKUP_DIR, - MOONRAKER_DB_BACKUP_DIR, MOONRAKER_DEFAULT_PORT, MOONRAKER_DEPS_JSON_FILE, MOONRAKER_DIR, @@ -25,8 +23,8 @@ from components.moonraker import ( from components.moonraker.moonraker import Moonraker from components.moonraker.utils.sysdeps_parser import SysDepsParser from components.webui_client.base_data import BaseWebClient -from core.backup_manager.backup_manager import BackupManager from core.logger import Logger +from core.services.backup_service import BackupService from core.submodules.simple_config_parser.src.simple_config_parser.simple_config_parser import ( SimpleConfigParser, ) @@ -168,21 +166,31 @@ def create_example_moonraker_conf( def backup_moonraker_dir() -> None: - bm = BackupManager() - bm.backup_directory("moonraker", source=MOONRAKER_DIR, target=MOONRAKER_BACKUP_DIR) - bm.backup_directory( - "moonraker-env", source=MOONRAKER_ENV_DIR, target=MOONRAKER_BACKUP_DIR + svc = BackupService() + svc.backup_directory( + source_path=MOONRAKER_DIR, backup_name="moonraker", target_path="moonraker" + ) + svc.backup_directory( + source_path=MOONRAKER_ENV_DIR, + backup_name="moonraker-env", + target_path="moonraker", ) def backup_moonraker_db_dir() -> None: instances: List[Moonraker] = get_instances(Moonraker) - bm = BackupManager() + svc = BackupService() + + if not instances: + Logger.print_info("Unable to find directory to backup!") + Logger.print_info("Are there no Moonraker instances installed?") + return for instance in instances: - name = f"database-{instance.data_dir.name}" - bm.backup_directory( - name, source=instance.db_dir, target=MOONRAKER_DB_BACKUP_DIR + svc.backup_directory( + source_path=instance.db_dir, + target_path=f"{instance.data_dir.name}", + backup_name="database", ) diff --git a/kiauh/components/webui_client/base_data.py b/kiauh/components/webui_client/base_data.py index b53edb7..cbf2554 100644 --- a/kiauh/components/webui_client/base_data.py +++ b/kiauh/components/webui_client/base_data.py @@ -34,7 +34,6 @@ class BaseWebClient(ABC): display_name: str client_dir: Path config_file: Path - backup_dir: Path repo_path: str download_url: str nginx_config: Path @@ -52,6 +51,5 @@ class BaseWebClientConfig(ABC): display_name: str config_filename: str config_dir: Path - backup_dir: Path repo_url: str config_section: str diff --git a/kiauh/components/webui_client/client_remove.py b/kiauh/components/webui_client/client_remove.py index 471b3a0..3c8ea00 100644 --- a/kiauh/components/webui_client/client_remove.py +++ b/kiauh/components/webui_client/client_remove.py @@ -16,9 +16,9 @@ from components.webui_client.base_data import ( from components.webui_client.client_config.client_config_remove import ( run_client_config_removal, ) -from core.backup_manager.backup_manager import BackupManager from core.constants import NGINX_SITES_AVAILABLE, NGINX_SITES_ENABLED from core.logger import Logger +from core.services.backup_service import BackupService from core.services.message_service import Message from core.types.color import Color from utils.config_utils import remove_config_section @@ -43,8 +43,19 @@ def run_client_removal( kl_instances: List[Klipper] = get_instances(Klipper) if backup_config: - bm = BackupManager() - if bm.backup_file(client.config_file): + version = "" + src = client.client_dir + if src.joinpath(".version").exists(): + with open(src.joinpath(".version"), "r") as v: + version = v.readlines()[0] + + svc = BackupService() + target_path = svc.backup_root.joinpath(f"{client.client_dir.name}_{version}") + success = svc.backup_file( + source_path=client.config_file, + target_path=target_path, + ) + if success: completion_msg.text.append(f"● {client.config_file.name} backup created") if remove_client: diff --git a/kiauh/components/webui_client/client_utils.py b/kiauh/components/webui_client/client_utils.py index 6b2d595..aea56a4 100644 --- a/kiauh/components/webui_client/client_utils.py +++ b/kiauh/components/webui_client/client_utils.py @@ -24,13 +24,13 @@ from components.webui_client.base_data import ( from components.webui_client.client_dialogs import print_client_port_select_dialog from components.webui_client.fluidd_data import FluiddData from components.webui_client.mainsail_data import MainsailData -from core.backup_manager.backup_manager import BackupManager from core.constants import ( NGINX_CONFD, NGINX_SITES_AVAILABLE, NGINX_SITES_ENABLED, ) from core.logger import Logger +from core.services.backup_service import BackupService from core.settings.kiauh_settings import KiauhSettings, WebUiSettings from core.submodules.simple_config_parser.src.simple_config_parser.simple_config_parser import ( SimpleConfigParser, @@ -118,7 +118,7 @@ def enable_mainsail_remotemode() -> None: c_json = MainsailData().client_dir.joinpath("config.json") with open(c_json, "r") as f: config_data = json.load(f) - + if config_data["instancesDB"] == "browser" or config_data["instancesDB"] == "json": Logger.print_info("Remote mode already configured. Skipped ...") return @@ -175,26 +175,39 @@ def get_remote_client_version(client: BaseWebClient) -> str | None: def backup_client_data(client: BaseWebClient) -> None: - name = client.name + version = "" src = client.client_dir - dest = client.backup_dir + if src.joinpath(".version").exists(): + with open(src.joinpath(".version"), "r") as v: + version = v.readlines()[0] - with open(src.joinpath(".version"), "r") as v: - version = v.readlines()[0] - - bm = BackupManager() - bm.backup_directory(f"{name}-{version}", src, dest) - bm.backup_file(client.config_file, dest) - bm.backup_file(NGINX_SITES_AVAILABLE.joinpath(name), dest) + svc = BackupService() + target_path = svc.backup_root.joinpath(f"{client.client_dir.name}_{version}") + svc.backup_directory( + source_path=client.client_dir, + target_path=target_path, + backup_name=client.name, + ) + svc.backup_file( + source_path=client.config_file, + target_path=target_path, + ) def backup_client_config_data(client: BaseWebClient) -> None: - client_config = client.client_config - name = client_config.name - source = client_config.config_dir - target = client_config.backup_dir - bm = BackupManager() - bm.backup_directory(name, source, target) + version = "" + src = client.client_dir + if src.joinpath(".version").exists(): + with open(src.joinpath(".version"), "r") as v: + version = v.readlines()[0] + + svc = BackupService() + target_path = svc.backup_root.joinpath(f"{client.client_dir.name}_{version}") + svc.backup_directory( + source_path=client.client_config.config_dir, + target_path=target_path, + backup_name=client.client_config.name, + ) def get_existing_clients() -> List[BaseWebClient]: diff --git a/kiauh/components/webui_client/fluidd_data.py b/kiauh/components/webui_client/fluidd_data.py index 8958995..f2f6ee2 100644 --- a/kiauh/components/webui_client/fluidd_data.py +++ b/kiauh/components/webui_client/fluidd_data.py @@ -18,7 +18,6 @@ from components.webui_client.base_data import ( WebClientConfigType, WebClientType, ) -from core.backup_manager import BACKUP_ROOT_DIR from core.constants import NGINX_SITES_AVAILABLE @@ -30,7 +29,6 @@ class FluiddConfigWeb(BaseWebClientConfig): config_dir: Path = Path.home().joinpath("fluidd-config") config_filename: str = "fluidd.cfg" config_section: str = f"include {config_filename}" - backup_dir: Path = BACKUP_ROOT_DIR.joinpath("fluidd-config-backups") repo_url: str = "https://github.com/fluidd-core/fluidd-config.git" @@ -43,7 +41,6 @@ class FluiddData(BaseWebClient): display_name: str = name.capitalize() client_dir: Path = Path.home().joinpath("fluidd") config_file: Path = client_dir.joinpath("config.json") - backup_dir: Path = BACKUP_ROOT_DIR.joinpath("fluidd-backups") repo_path: str = "fluidd-core/fluidd" nginx_config: Path = NGINX_SITES_AVAILABLE.joinpath("fluidd") nginx_access_log: Path = Path("/var/log/nginx/fluidd-access.log") diff --git a/kiauh/components/webui_client/mainsail_data.py b/kiauh/components/webui_client/mainsail_data.py index 2323746..bfb5062 100644 --- a/kiauh/components/webui_client/mainsail_data.py +++ b/kiauh/components/webui_client/mainsail_data.py @@ -18,7 +18,6 @@ from components.webui_client.base_data import ( WebClientConfigType, WebClientType, ) -from core.backup_manager import BACKUP_ROOT_DIR from core.constants import NGINX_SITES_AVAILABLE @@ -30,7 +29,6 @@ class MainsailConfigWeb(BaseWebClientConfig): config_dir: Path = Path.home().joinpath("mainsail-config") config_filename: str = "mainsail.cfg" config_section: str = f"include {config_filename}" - backup_dir: Path = BACKUP_ROOT_DIR.joinpath("mainsail-config-backups") repo_url: str = "https://github.com/mainsail-crew/mainsail-config.git" @@ -43,7 +41,6 @@ class MainsailData(BaseWebClient): display_name: str = name.capitalize() client_dir: Path = Path.home().joinpath("mainsail") config_file: Path = client_dir.joinpath("config.json") - backup_dir: Path = BACKUP_ROOT_DIR.joinpath("mainsail-backups") repo_path: str = "mainsail-crew/mainsail" nginx_config: Path = NGINX_SITES_AVAILABLE.joinpath("mainsail") nginx_access_log: Path = Path("/var/log/nginx/mainsail-access.log") diff --git a/kiauh/core/backup_manager/__init__.py b/kiauh/core/backup_manager/__init__.py deleted file mode 100644 index 0e9e8e8..0000000 --- a/kiauh/core/backup_manager/__init__.py +++ /dev/null @@ -1,12 +0,0 @@ -# ======================================================================= # -# Copyright (C) 2020 - 2025 Dominik Willner # -# # -# 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 # -# ======================================================================= # - -from pathlib import Path - -BACKUP_ROOT_DIR = Path.home().joinpath("kiauh-backups") diff --git a/kiauh/core/backup_manager/backup_manager.py b/kiauh/core/backup_manager/backup_manager.py deleted file mode 100644 index 0497898..0000000 --- a/kiauh/core/backup_manager/backup_manager.py +++ /dev/null @@ -1,108 +0,0 @@ -# ======================================================================= # -# Copyright (C) 2020 - 2025 Dominik Willner # -# # -# 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 # -# ======================================================================= # -from __future__ import annotations - -import shutil -from pathlib import Path -from typing import List - -from core.backup_manager import BACKUP_ROOT_DIR -from core.logger import Logger -from utils.common import get_current_date - - -class BackupManagerException(Exception): - pass - - -# noinspection PyUnusedLocal -# noinspection PyMethodMayBeStatic -class BackupManager: - def __init__(self, backup_root_dir: Path = BACKUP_ROOT_DIR): - self._backup_root_dir: Path = backup_root_dir - self._ignore_folders: List[str] = [] - - @property - def backup_root_dir(self) -> Path: - return self._backup_root_dir - - @backup_root_dir.setter - def backup_root_dir(self, value: Path): - self._backup_root_dir = value - - @property - def ignore_folders(self) -> List[str]: - return self._ignore_folders - - @ignore_folders.setter - def ignore_folders(self, value: List[str]): - self._ignore_folders = value - - def backup_file( - self, file: Path, target: Path | None = None, custom_filename=None - ) -> bool: - Logger.print_status(f"Creating backup of {file} ...") - - if not file.exists(): - Logger.print_info("File does not exist! Skipping ...") - return False - - target = self.backup_root_dir if target is None else target - - if Path(file).is_file(): - date = get_current_date().get("date") - time = get_current_date().get("time") - filename = f"{file.stem}-{date}-{time}{file.suffix}" - filename = custom_filename if custom_filename is not None else filename - try: - Path(target).mkdir(exist_ok=True) - shutil.copyfile(file, target.joinpath(filename)) - Logger.print_ok("Backup successful!") - return True - except OSError as e: - Logger.print_error(f"Unable to backup '{file}':\n{e}") - return False - else: - Logger.print_info(f"File '{file}' not found ...") - return False - - def backup_directory( - self, name: str, source: Path, target: Path | None = None - ) -> Path | None: - Logger.print_status(f"Creating backup of {name} in {target} ...") - - if source is None or not Path(source).exists(): - Logger.print_info("Source directory does not exist! Skipping ...") - return None - - target = self.backup_root_dir if target is None else target - try: - date = get_current_date().get("date") - time = get_current_date().get("time") - backup_target = target.joinpath(f"{name.lower()}-{date}-{time}") - shutil.copytree( - source, - backup_target, - ignore=self.ignore_folders_func, - ignore_dangling_symlinks=True, - ) - Logger.print_ok("Backup successful!") - - return backup_target - - except OSError as e: - Logger.print_error(f"Unable to backup directory '{source}':\n{e}") - raise BackupManagerException(f"Unable to backup directory '{source}':\n{e}") - - def ignore_folders_func(self, dirpath, filenames) -> List[str]: - return ( - [f for f in filenames if f in self._ignore_folders] - if self._ignore_folders - else [] - ) diff --git a/kiauh/core/constants.py b/kiauh/core/constants.py index f9ccba2..9a9224a 100644 --- a/kiauh/core/constants.py +++ b/kiauh/core/constants.py @@ -11,8 +11,6 @@ import os import pwd from pathlib import Path -from core.backup_manager import BACKUP_ROOT_DIR - # global dependencies GLOBAL_DEPS = ["git", "wget", "curl", "unzip", "dfu-util", "python3-virtualenv"] @@ -24,7 +22,6 @@ CURRENT_USER = pwd.getpwuid(os.getuid())[0] # dirs SYSTEMD = Path("/etc/systemd/system") -PRINTER_DATA_BACKUP_DIR = BACKUP_ROOT_DIR.joinpath("printer-data-backups") NGINX_SITES_AVAILABLE = Path("/etc/nginx/sites-available") NGINX_SITES_ENABLED = Path("/etc/nginx/sites-enabled") NGINX_CONFD = Path("/etc/nginx/conf.d") diff --git a/kiauh/core/services/backup_service.py b/kiauh/core/services/backup_service.py new file mode 100644 index 0000000..08aa330 --- /dev/null +++ b/kiauh/core/services/backup_service.py @@ -0,0 +1,111 @@ +# ======================================================================= # +# Copyright (C) 2020 - 2025 Dominik Willner # +# # +# 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 # +# ======================================================================= # +from __future__ import annotations + +import shutil +from datetime import datetime +from pathlib import Path +from typing import Optional + +from core.logger import Logger + + +class BackupService: + def __init__(self): + self._backup_root = Path.home().joinpath("kiauh_backups") + + @property + def backup_root(self) -> Path: + return self._backup_root + + def backup_file( + self, + source_path: Path, + target_path: Optional[Path | str] = None, + target_name: Optional[str] = None, + ) -> bool: + source_path = Path(source_path) + + Logger.print_status(f"Creating backup of {source_path} ...") + + if not source_path.exists(): + Logger.print_info( + f"File '{source_path}' does not exist! Skipping backup..." + ) + return False + + if not source_path.is_file(): + Logger.print_info(f"'{source_path}' is not a file! Skipping backup...") + return False + + try: + self._backup_root.mkdir(parents=True, exist_ok=True) + + timestamp = datetime.now().strftime("%Y%m%d-%H%M%S") + filename = ( + target_name or f"{source_path.stem}_{timestamp}{source_path.suffix}" + ) + if target_path is not None: + backup_path = self._backup_root.joinpath(target_path, filename) + else: + backup_path = self._backup_root.joinpath(filename) + + backup_path.mkdir(parents=True, exist_ok=True) + shutil.copy2(source_path, backup_path) + + Logger.print_ok( + f"Successfully backed up '{source_path}' to '{backup_path}'" + ) + return True + + except Exception as e: + Logger.print_error(f"Failed to backup '{source_path}': {e}") + return False + + def backup_directory( + self, + source_path: Path, + backup_name: str, + target_path: Optional[Path | str] = None, + ) -> Optional[Path]: + source_path = Path(source_path) + + Logger.print_status(f"Creating backup of {source_path} ...") + + if not source_path.exists(): + Logger.print_info( + f"Directory '{source_path}' does not exist! Skipping backup..." + ) + return None + + if not source_path.is_dir(): + Logger.print_info(f"'{source_path}' is not a directory! Skipping backup...") + return None + + try: + self._backup_root.mkdir(parents=True, exist_ok=True) + + timestamp = datetime.now().strftime("%Y%m%d-%H%M%S") + backup_dir_name = f"{backup_name}_{timestamp}" + + if target_path is not None: + backup_path = self._backup_root.joinpath(target_path, backup_dir_name) + else: + backup_path = self._backup_root.joinpath(backup_dir_name) + + shutil.copytree(source_path, backup_path) + + Logger.print_ok( + f"Successfully backed up '{source_path}' to '{backup_path}'" + ) + return backup_path + + except Exception as e: + Logger.print_error(f"Failed to backup directory '{source_path}': {e}") + return None diff --git a/kiauh/core/settings/kiauh_settings.py b/kiauh/core/settings/kiauh_settings.py index 1d4fadf..e002e56 100644 --- a/kiauh/core/settings/kiauh_settings.py +++ b/kiauh/core/settings/kiauh_settings.py @@ -14,8 +14,8 @@ from typing import Any, Callable, List, TypeVar from components.klipper import KLIPPER_REPO_URL from components.moonraker import MOONRAKER_REPO_URL -from core.backup_manager.backup_manager import BackupManager from core.logger import DialogType, Logger +from core.services.backup_service import BackupService from core.submodules.simple_config_parser.src.simple_config_parser.simple_config_parser import ( SimpleConfigParser, ) @@ -374,8 +374,8 @@ class KiauhSettings: kill() def _migrate_repo_config(self) -> None: - bm = BackupManager() - if not bm.backup_file(CUSTOM_CFG): + svc = BackupService() + if not svc.backup_file(CUSTOM_CFG): Logger.print_dialog( DialogType.ERROR, [ diff --git a/kiauh/extensions/gcode_shell_cmd/gcode_shell_cmd_extension.py b/kiauh/extensions/gcode_shell_cmd/gcode_shell_cmd_extension.py index 511aef0..2f57762 100644 --- a/kiauh/extensions/gcode_shell_cmd/gcode_shell_cmd_extension.py +++ b/kiauh/extensions/gcode_shell_cmd/gcode_shell_cmd_extension.py @@ -9,12 +9,13 @@ import os import shutil +from datetime import datetime from typing import List from components.klipper.klipper import Klipper -from core.backup_manager.backup_manager import BackupManager from core.instance_manager.instance_manager import InstanceManager from core.logger import Logger +from core.services.backup_service import BackupService from core.submodules.simple_config_parser.src.simple_config_parser.simple_config_parser import ( SimpleConfigParser, ) @@ -109,11 +110,13 @@ class GcodeShellCmdExtension(BaseExtension): Logger.warn(f"Unable to create example config: {e}") # backup each printer.cfg before modification - bm = BackupManager() + svc = BackupService() + timestamp = datetime.now().strftime("%Y%m%d-%H%M%S") for instance in instances: - bm.backup_file( - instance.cfg_file, - custom_filename=f"{instance.suffix}.printer.cfg", + svc.backup_file( + source_path=instance.cfg_file, + target_path=f"{instance.data_dir.name}/config_{timestamp}", + target_name=instance.cfg_file.name, ) # add section to printer.cfg if not already defined diff --git a/kiauh/extensions/mobileraker/__init__.py b/kiauh/extensions/mobileraker/__init__.py index 8241381..2169512 100644 --- a/kiauh/extensions/mobileraker/__init__.py +++ b/kiauh/extensions/mobileraker/__init__.py @@ -9,7 +9,6 @@ from pathlib import Path -from core.backup_manager import BACKUP_ROOT_DIR from core.constants import SYSTEMD # repo @@ -23,7 +22,6 @@ MOBILERAKER_LOG_NAME = "mobileraker.log" # directories MOBILERAKER_DIR = Path.home().joinpath("mobileraker_companion") MOBILERAKER_ENV_DIR = Path.home().joinpath("mobileraker-env") -MOBILERAKER_BACKUP_DIR = BACKUP_ROOT_DIR.joinpath("mobileraker-backups") # files MOBILERAKER_INSTALL_SCRIPT = MOBILERAKER_DIR.joinpath("scripts/install.sh") diff --git a/kiauh/extensions/mobileraker/mobileraker_extension.py b/kiauh/extensions/mobileraker/mobileraker_extension.py index a584105..5dd7ebe 100644 --- a/kiauh/extensions/mobileraker/mobileraker_extension.py +++ b/kiauh/extensions/mobileraker/mobileraker_extension.py @@ -13,13 +13,12 @@ from typing import List from components.klipper.klipper import Klipper from components.moonraker.moonraker import Moonraker -from core.backup_manager.backup_manager import BackupManager from core.instance_manager.instance_manager import InstanceManager from core.logger import DialogType, Logger +from core.services.backup_service import BackupService from core.settings.kiauh_settings import KiauhSettings from extensions.base_extension import BaseExtension from extensions.mobileraker import ( - MOBILERAKER_BACKUP_DIR, MOBILERAKER_DIR, MOBILERAKER_ENV_DIR, MOBILERAKER_INSTALL_SCRIPT, @@ -179,14 +178,14 @@ class MobilerakerExtension(BaseExtension): ) def _backup_mobileraker_dir(self) -> None: - bm = BackupManager() - bm.backup_directory( - MOBILERAKER_DIR.name, - source=MOBILERAKER_DIR, - target=MOBILERAKER_BACKUP_DIR, + svc = BackupService() + svc.backup_directory( + source_path=MOBILERAKER_DIR, + backup_name="mobileraker", + target_path="mobileraker", ) - bm.backup_directory( - MOBILERAKER_ENV_DIR.name, - source=MOBILERAKER_ENV_DIR, - target=MOBILERAKER_BACKUP_DIR, + svc.backup_directory( + source_path=MOBILERAKER_ENV_DIR, + backup_name="mobileraker-env", + target_path="mobileraker", ) diff --git a/kiauh/extensions/spoolman/spoolman_extension.py b/kiauh/extensions/spoolman/spoolman_extension.py index 8360928..42aa521 100644 --- a/kiauh/extensions/spoolman/spoolman_extension.py +++ b/kiauh/extensions/spoolman/spoolman_extension.py @@ -15,9 +15,9 @@ from components.moonraker.moonraker import Moonraker from components.moonraker.services.moonraker_instance_service import ( MoonrakerInstanceService, ) -from core.backup_manager.backup_manager import BackupManager from core.instance_manager.instance_manager import InstanceManager from core.logger import DialogType, Logger +from core.services.backup_service import BackupService from extensions.base_extension import BaseExtension from extensions.spoolman import ( SPOOLMAN_COMPOSE_FILE, @@ -123,16 +123,15 @@ class SpoolmanExtension(BaseExtension): "Failed to remove Spoolman image! Please remove it manually." ) - # backup Spoolman directory to ~/spoolman_data- before removing it try: - bm = BackupManager() - result = bm.backup_directory( - f"{SPOOLMAN_DIR.name}_data", - source=SPOOLMAN_DIR, - target=SPOOLMAN_DIR.parent, + svc = BackupService() + success = svc.backup_directory( + source_path=SPOOLMAN_DIR, + backup_name="spoolman", + target_path="spoolman", ) - if result: - Logger.print_ok(f"Spoolman data backed up to {result}") + if success: + Logger.print_ok(f"Spoolman data backed up to {success}") Logger.print_status("Removing Spoolman directory...") if run_remove_routines(SPOOLMAN_DIR): Logger.print_ok("Spoolman directory removed!") diff --git a/kiauh/procedures/switch_repo.py b/kiauh/procedures/switch_repo.py index 920e440..e7fbdfd 100644 --- a/kiauh/procedures/switch_repo.py +++ b/kiauh/procedures/switch_repo.py @@ -13,7 +13,6 @@ from pathlib import Path from typing import Literal from components.klipper import ( - KLIPPER_BACKUP_DIR, KLIPPER_DIR, KLIPPER_ENV_DIR, KLIPPER_REQ_FILE, @@ -21,7 +20,6 @@ from components.klipper import ( from components.klipper.klipper import Klipper from components.klipper.klipper_utils import install_klipper_packages from components.moonraker import ( - MOONRAKER_BACKUP_DIR, MOONRAKER_DIR, MOONRAKER_ENV_DIR, MOONRAKER_REQ_FILE, @@ -30,10 +28,10 @@ from components.moonraker.moonraker import Moonraker from components.moonraker.services.moonraker_setup_service import ( install_moonraker_packages, ) -from core.backup_manager.backup_manager import BackupManager, BackupManagerException from core.instance_manager.instance_manager import InstanceManager from core.logger import Logger -from utils.git_utils import GitException, get_repo_name, git_clone_wrapper +from core.services.backup_service import BackupService +from utils.git_utils import GitException, git_clone_wrapper from utils.instance_utils import get_instances from utils.sys_utils import ( VenvCreationFailedException, @@ -52,7 +50,6 @@ def run_switch_repo_routine( repo_dir: Path = KLIPPER_DIR if name == "klipper" else MOONRAKER_DIR env_dir: Path = KLIPPER_ENV_DIR if name == "klipper" else MOONRAKER_ENV_DIR req_file = KLIPPER_REQ_FILE if name == "klipper" else MOONRAKER_REQ_FILE - backup_dir: Path = KLIPPER_BACKUP_DIR if name == "klipper" else MOONRAKER_BACKUP_DIR _type = Klipper if name == "klipper" else Moonraker # step 1: stop all instances @@ -64,19 +61,17 @@ def run_switch_repo_routine( env_dir_backup_path: Path | None = None try: - # step 2: backup old repo and env - org, _ = get_repo_name(repo_dir) - backup_dir = backup_dir.joinpath(org) - bm = BackupManager() - repo_dir_backup_path = bm.backup_directory( - repo_dir.name, - repo_dir, - backup_dir, + svc = BackupService() + svc.backup_directory( + source_path=repo_dir, + backup_name=name, + target_path=name, ) - env_dir_backup_path = bm.backup_directory( - env_dir.name, - env_dir, - backup_dir, + env_backup_name: str = f"{name if name == 'moonraker' else 'klippy'}-env" + svc.backup_directory( + source_path=env_dir, + backup_name=env_backup_name, + target_path=name, ) if not (repo_url or branch): @@ -101,10 +96,6 @@ def run_switch_repo_routine( Logger.print_ok(f"Switched to {repo_url} at branch {branch}!") - except BackupManagerException as e: - Logger.print_error(f"Error during backup of repository: {e}") - raise RepoSwitchFailedException(e) - except (GitException, VenvCreationFailedException) as e: # if something goes wrong during cloning or recreating the virtualenv, # we restore the backup of the repo and env @@ -122,6 +113,9 @@ def run_switch_repo_routine( Logger.print_error(f"Something went wrong: {e}") return + except Exception as e: + raise RepoSwitchFailedException(e) + Logger.print_status(f"Restarting all {_type.__name__} instances ...") InstanceManager.start_all(instances) diff --git a/kiauh/utils/common.py b/kiauh/utils/common.py index 6ad2037..48c3591 100644 --- a/kiauh/utils/common.py +++ b/kiauh/utils/common.py @@ -18,9 +18,9 @@ from components.klipper.klipper import Klipper from components.moonraker.moonraker import Moonraker from core.constants import ( GLOBAL_DEPS, - PRINTER_DATA_BACKUP_DIR, ) from core.logger import DialogType, Logger +from core.services.backup_service import BackupService from core.types.color import Color from core.types.component_status import ComponentStatus, StatusCode from utils.git_utils import ( @@ -152,11 +152,8 @@ def get_install_status( def backup_printer_config_dir() -> None: - # local import to prevent circular import - from core.backup_manager.backup_manager import BackupManager - instances: List[Klipper] = get_instances(Klipper) - bm = BackupManager() + svc = BackupService() if not instances: Logger.print_info("Unable to find directory to backup!") @@ -164,10 +161,10 @@ def backup_printer_config_dir() -> None: return for instance in instances: - bm.backup_directory( - instance.data_dir.name, - source=instance.base.cfg_dir, - target=PRINTER_DATA_BACKUP_DIR, + svc.backup_directory( + source_path=instance.base.cfg_dir, + target_path=f"{instance.data_dir.name}", + backup_name="config", ) From 6cee0252eef8f600fb132cd1db223f38579c392b Mon Sep 17 00:00:00 2001 From: dw-0 Date: Mon, 29 Sep 2025 20:29:38 +0200 Subject: [PATCH 07/14] feat(moonraker): sync moonraker changes to SysDepsParser https://github.com/Arksine/moonraker/commit/206fd4828d34aae5fd6aa95f8dfb31eb1fbb7df1 https://github.com/Arksine/moonraker/commit/72b89d905ee66b621ea3c4c633541e181822b448 --- .../moonraker/utils/sysdeps_parser.py | 6 +++++ scripts/moonraker.sh | 25 +++++++++++++++---- 2 files changed, 26 insertions(+), 5 deletions(-) diff --git a/kiauh/components/moonraker/utils/sysdeps_parser.py b/kiauh/components/moonraker/utils/sysdeps_parser.py index 15dad17..eae2a71 100644 --- a/kiauh/components/moonraker/utils/sysdeps_parser.py +++ b/kiauh/components/moonraker/utils/sysdeps_parser.py @@ -61,6 +61,9 @@ class SysDepsParser: version = distro_info.get("distro_version") if version: self.distro_version = _convert_version(version) + self.vendor: str = "" + if pathlib.Path("/etc/rpi-issue").is_file(): + self.vendor = "raspberry-pi" def _parse_spec(self, full_spec: str) -> str | None: parts = full_spec.split(";", maxsplit=1) @@ -109,6 +112,9 @@ class SysDepsParser: elif req_var == "distro_id": left_op: str | Tuple[int | str, ...] = self.distro_id right_op = dep_parts[2].strip().strip("\"'") + elif req_var == "vendor": + left_op = self.vendor + right_op = dep_parts[2].strip().strip("\"'") elif req_var == "distro_version": if not self.distro_version: logging.info( diff --git a/scripts/moonraker.sh b/scripts/moonraker.sh index 4f2e49d..70692bd 100644 --- a/scripts/moonraker.sh +++ b/scripts/moonraker.sh @@ -153,11 +153,20 @@ import shlex import re import pathlib import logging -import json from typing import Tuple, Dict, List, Any def _get_distro_info() -> Dict[str, Any]: + try: + import distro + except ModuleNotFoundError: + pass + else: + return dict( + distro_id=distro.id(), + distro_version=distro.version(), + aliases=distro.like().split() + ) release_file = pathlib.Path("/etc/os-release") release_info: Dict[str, str] = {} with release_file.open("r") as f: @@ -193,6 +202,9 @@ class SysDepsParser: version = distro_info.get("distro_version") if version: self.distro_version = _convert_version(version) + self.vendor: str = "" + if pathlib.Path("/etc/rpi-issue").is_file(): + self.vendor = "raspberry-pi" def _parse_spec(self, full_spec: str) -> str | None: parts = full_spec.split(";", maxsplit=1) @@ -237,6 +249,9 @@ class SysDepsParser: elif req_var == "distro_id": left_op: str | Tuple[int | str, ...] = self.distro_id right_op = dep_parts[2].strip().strip("\"'") + elif req_var == "vendor": + left_op = self.vendor + right_op = dep_parts[2].strip().strip("\"'") elif req_var == "distro_version": if not self.distro_version: logging.info( @@ -305,12 +320,12 @@ system_deps = { "python3-virtualenv", "python3-dev", "libopenjp2-7", "libsodium-dev", "zlib1g-dev", "libjpeg-dev", "packagekit", "wireless-tools; distro_id != 'ubuntu' or distro_version <= '24.04'", - "iw; distro_id == 'ubuntu' and distro_version >= '24.10'", "curl", - "build-essential" + "iw; distro_id == 'ubuntu' and distro_version >= '24.10'", + "python3-libcamera; vendor == 'raspberry-pi' and distro_version >= '11'", + "curl", "build-essential" ], } -system_deps_json = pathlib.Path("$package_json") -system_deps = json.loads(system_deps_json.read_bytes()) +# *** SYSTEM DEPENDENCIES END *** parser = SysDepsParser() pkgs = parser.parse_dependencies(system_deps) if pkgs: From 5b68710b2339fe8ee4d695eb18d6ed9ff8bc45a7 Mon Sep 17 00:00:00 2001 From: dw-0 Date: Mon, 29 Sep 2025 21:18:01 +0200 Subject: [PATCH 08/14] feat(backup): add specific backup methods for Klipper and Moonraker configs --- kiauh/core/services/backup_service.py | 48 ++++++++++++++++++++++++--- 1 file changed, 43 insertions(+), 5 deletions(-) diff --git a/kiauh/core/services/backup_service.py b/kiauh/core/services/backup_service.py index 08aa330..637d0d6 100644 --- a/kiauh/core/services/backup_service.py +++ b/kiauh/core/services/backup_service.py @@ -11,9 +11,12 @@ from __future__ import annotations import shutil from datetime import datetime from pathlib import Path -from typing import Optional +from typing import List, Optional +from components.klipper.klipper import Klipper +from components.moonraker.moonraker import Moonraker from core.logger import Logger +from utils.instance_utils import get_instances class BackupService: @@ -24,6 +27,14 @@ class BackupService: def backup_root(self) -> Path: return self._backup_root + @property + def timestamp(self) -> str: + return datetime.now().strftime("%Y%m%d-%H%M%S") + + ################################################ + # GENERIC BACKUP METHODS + ################################################ + def backup_file( self, source_path: Path, @@ -47,9 +58,9 @@ class BackupService: try: self._backup_root.mkdir(parents=True, exist_ok=True) - timestamp = datetime.now().strftime("%Y%m%d-%H%M%S") filename = ( - target_name or f"{source_path.stem}_{timestamp}{source_path.suffix}" + target_name + or f"{source_path.stem}_{self.timestamp}{source_path.suffix}" ) if target_path is not None: backup_path = self._backup_root.joinpath(target_path, filename) @@ -91,8 +102,7 @@ class BackupService: try: self._backup_root.mkdir(parents=True, exist_ok=True) - timestamp = datetime.now().strftime("%Y%m%d-%H%M%S") - backup_dir_name = f"{backup_name}_{timestamp}" + backup_dir_name = f"{backup_name}_{self.timestamp}" if target_path is not None: backup_path = self._backup_root.joinpath(target_path, backup_dir_name) @@ -109,3 +119,31 @@ class BackupService: except Exception as e: Logger.print_error(f"Failed to backup directory '{source_path}': {e}") return None + + ################################################ + # SPECIFIC BACKUP METHODS + ################################################ + + def backup_printer_cfg(self): + klipper_instances: List[Klipper] = get_instances(Klipper) + for instance in klipper_instances: + target_path: Path = self._backup_root.joinpath( + instance.data_dir.name, f"config_{self.timestamp}" + ) + self.backup_file( + source_path=instance.cfg_file, + target_path=target_path, + target_name=instance.cfg_file.name, + ) + + def backup_moonraker_conf(self): + moonraker_instances: List[Moonraker] = get_instances(Moonraker) + for instance in moonraker_instances: + target_path: Path = self._backup_root.joinpath( + instance.data_dir.name, f"config_{self.timestamp}" + ) + self.backup_file( + source_path=instance.cfg_file, + target_path=target_path, + target_name=instance.cfg_file.name, + ) From 8a8afc60eed59c4f61cb5afb2f353ba43119b1e8 Mon Sep 17 00:00:00 2001 From: dw-0 Date: Tue, 30 Sep 2025 20:36:42 +0200 Subject: [PATCH 09/14] feat(backup): integrate backup functionality into multiple extensions and config management --- kiauh/components/klipperscreen/klipperscreen.py | 2 ++ .../webui_client/client_config/client_config_remove.py | 3 +++ kiauh/components/webui_client/client_remove.py | 1 + kiauh/extensions/mobileraker/mobileraker_extension.py | 2 ++ kiauh/extensions/obico/moonraker_obico_extension.py | 9 ++++++++- kiauh/extensions/octoapp/octoapp_extension.py | 2 ++ .../octoeverywhere/octoeverywhere_extension.py | 2 ++ kiauh/extensions/spoolman/spoolman_extension.py | 2 ++ .../telegram_bot/moonraker_telegram_bot_extension.py | 3 +++ kiauh/utils/config_utils.py | 4 ++-- 10 files changed, 27 insertions(+), 3 deletions(-) diff --git a/kiauh/components/klipperscreen/klipperscreen.py b/kiauh/components/klipperscreen/klipperscreen.py index 8fe461c..b62a3f5 100644 --- a/kiauh/components/klipperscreen/klipperscreen.py +++ b/kiauh/components/klipperscreen/klipperscreen.py @@ -96,6 +96,7 @@ def install_klipperscreen() -> None: def patch_klipperscreen_update_manager(instances: List[Moonraker]) -> None: + BackupService().backup_moonraker_conf() add_config_section( section=KLIPPERSCREEN_UPDATER_SECTION_NAME, instances=instances, @@ -182,6 +183,7 @@ def remove_klipperscreen() -> None: mr_instances: List[Moonraker] = get_instances(Moonraker) if mr_instances: Logger.print_status("Removing KlipperScreen from update manager ...") + BackupService().backup_moonraker_conf() remove_config_section("update_manager KlipperScreen", mr_instances) Logger.print_ok("KlipperScreen successfully removed from update manager!") diff --git a/kiauh/components/webui_client/client_config/client_config_remove.py b/kiauh/components/webui_client/client_config/client_config_remove.py index 75a1d8b..351c950 100644 --- a/kiauh/components/webui_client/client_config/client_config_remove.py +++ b/kiauh/components/webui_client/client_config/client_config_remove.py @@ -16,6 +16,7 @@ from components.webui_client.base_data import BaseWebClientConfig from core.logger import Logger from core.services.message_service import Message from core.types.color import Color +from utils.common import backup_printer_config_dir from utils.config_utils import remove_config_section from utils.fs_utils import run_remove_routines from utils.instance_type import InstanceType @@ -35,6 +36,8 @@ def run_client_config_removal( if run_remove_routines(client_config.config_dir): completion_msg.text.append(f"● {client_config.display_name} removed") + backup_printer_config_dir() + completion_msg = remove_moonraker_config_section( completion_msg, client_config, mr_instances ) diff --git a/kiauh/components/webui_client/client_remove.py b/kiauh/components/webui_client/client_remove.py index 3c8ea00..4d64779 100644 --- a/kiauh/components/webui_client/client_remove.py +++ b/kiauh/components/webui_client/client_remove.py @@ -67,6 +67,7 @@ def run_client_removal( if remove_client_nginx_logs(client, kl_instances): completion_msg.text.append("● NGINX logs removed") + BackupService().backup_moonraker_conf() section = f"update_manager {client_name}" handled_instances: List[Moonraker] = remove_config_section( section, mr_instances diff --git a/kiauh/extensions/mobileraker/mobileraker_extension.py b/kiauh/extensions/mobileraker/mobileraker_extension.py index 5dd7ebe..2615d57 100644 --- a/kiauh/extensions/mobileraker/mobileraker_extension.py +++ b/kiauh/extensions/mobileraker/mobileraker_extension.py @@ -151,6 +151,7 @@ class MobilerakerExtension(BaseExtension): Logger.print_status( "Removing Mobileraker's companion from update manager ..." ) + BackupService().backup_moonraker_conf() remove_config_section(MOBILERAKER_UPDATER_SECTION_NAME, mr_instances) Logger.print_ok( "Mobileraker's companion successfully removed from update manager!" @@ -162,6 +163,7 @@ class MobilerakerExtension(BaseExtension): Logger.print_error(f"Error removing Mobileraker's companion:\n{e}") def _patch_mobileraker_update_manager(self, instances: List[Moonraker]) -> None: + BackupService().backup_moonraker_conf() add_config_section( section=MOBILERAKER_UPDATER_SECTION_NAME, instances=instances, diff --git a/kiauh/extensions/obico/moonraker_obico_extension.py b/kiauh/extensions/obico/moonraker_obico_extension.py index 82f92b2..986b153 100644 --- a/kiauh/extensions/obico/moonraker_obico_extension.py +++ b/kiauh/extensions/obico/moonraker_obico_extension.py @@ -31,7 +31,11 @@ from extensions.obico import ( from extensions.obico.moonraker_obico import ( MoonrakerObico, ) -from utils.common import check_install_dependencies, moonraker_exists +from utils.common import ( + backup_printer_config_dir, + check_install_dependencies, + moonraker_exists, +) from utils.config_utils import ( add_config_section, remove_config_section, @@ -119,6 +123,8 @@ class ObicoExtension(BaseExtension): cmd_sysctl_manage("daemon-reload") + backup_printer_config_dir() + # add to klippers config self._patch_printer_cfg(kl_instances) InstanceManager.restart_all(kl_instances) @@ -165,6 +171,7 @@ class ObicoExtension(BaseExtension): self._remove_obico_instances(ob_instances) self._remove_obico_dir() self._remove_obico_env() + backup_printer_config_dir() remove_config_section(f"include {OBICO_MACROS_CFG_NAME}", kl_instances) remove_config_section(f"include {OBICO_UPDATE_CFG_NAME}", mr_instances) Logger.print_dialog( diff --git a/kiauh/extensions/octoapp/octoapp_extension.py b/kiauh/extensions/octoapp/octoapp_extension.py index ff20c52..642b9d7 100644 --- a/kiauh/extensions/octoapp/octoapp_extension.py +++ b/kiauh/extensions/octoapp/octoapp_extension.py @@ -13,6 +13,7 @@ from components.klipper.klipper import Klipper from components.moonraker.moonraker import Moonraker from core.instance_manager.instance_manager import InstanceManager from core.logger import DialogType, Logger +from core.services.backup_service import BackupService from extensions.base_extension import BaseExtension from extensions.octoapp import ( OA_DEPS_JSON_FILE, @@ -133,6 +134,7 @@ class OctoappExtension(BaseExtension): self._remove_OA_store_dirs() self._remove_OA_dir() self._remove_OA_env() + BackupService().backup_moonraker_conf() remove_config_section(f"include {OA_SYS_CFG_NAME}", mr_instances) run_remove_routines(OA_INSTALLER_LOG_FILE) Logger.print_dialog( diff --git a/kiauh/extensions/octoeverywhere/octoeverywhere_extension.py b/kiauh/extensions/octoeverywhere/octoeverywhere_extension.py index 2907923..ae1433f 100644 --- a/kiauh/extensions/octoeverywhere/octoeverywhere_extension.py +++ b/kiauh/extensions/octoeverywhere/octoeverywhere_extension.py @@ -12,6 +12,7 @@ from typing import List from components.moonraker.moonraker import Moonraker from core.instance_manager.instance_manager import InstanceManager from core.logger import DialogType, Logger +from core.services.backup_service import BackupService from extensions.base_extension import BaseExtension from extensions.octoeverywhere import ( OE_DEPS_JSON_FILE, @@ -133,6 +134,7 @@ class OctoeverywhereExtension(BaseExtension): self._remove_oe_instances(ob_instances) self._remove_oe_dir() self._remove_oe_env() + BackupService().backup_moonraker_conf() remove_config_section(f"include {OE_SYS_CFG_NAME}", mr_instances) run_remove_routines(OE_INSTALLER_LOG_FILE) Logger.print_dialog( diff --git a/kiauh/extensions/spoolman/spoolman_extension.py b/kiauh/extensions/spoolman/spoolman_extension.py index 42aa521..072e5bb 100644 --- a/kiauh/extensions/spoolman/spoolman_extension.py +++ b/kiauh/extensions/spoolman/spoolman_extension.py @@ -100,6 +100,7 @@ class SpoolmanExtension(BaseExtension): mr_instances: List[Moonraker] = mrsvc.get_all_instances() Logger.print_status("Removing Spoolman configuration from moonraker.conf...") + BackupService().backup_moonraker_conf() remove_config_section("spoolman", mr_instances) Logger.print_status("Removing Spoolman from moonraker.asvc...") @@ -289,6 +290,7 @@ class SpoolmanExtension(BaseExtension): mrsvc.load_instances() mr_instances = mrsvc.get_all_instances() + BackupService().backup_moonraker_conf() # noinspection HttpUrlsUsage add_config_section( section="spoolman", diff --git a/kiauh/extensions/telegram_bot/moonraker_telegram_bot_extension.py b/kiauh/extensions/telegram_bot/moonraker_telegram_bot_extension.py index 458b3e8..ed45be5 100644 --- a/kiauh/extensions/telegram_bot/moonraker_telegram_bot_extension.py +++ b/kiauh/extensions/telegram_bot/moonraker_telegram_bot_extension.py @@ -13,6 +13,7 @@ from typing import List from components.moonraker.moonraker import Moonraker from core.instance_manager.instance_manager import InstanceManager from core.logger import DialogType, Logger +from core.services.backup_service import BackupService from extensions.base_extension import BaseExtension from extensions.telegram_bot import TG_BOT_REPO, TG_BOT_REQ_FILE from extensions.telegram_bot.moonraker_telegram_bot import ( @@ -105,6 +106,7 @@ class TelegramBotExtension(BaseExtension): cmd_sysctl_manage("daemon-reload") # add to moonraker update manager + BackupService().backup_moonraker_conf() self._patch_bot_update_manager(mr_instances) # restart moonraker @@ -150,6 +152,7 @@ class TelegramBotExtension(BaseExtension): self._remove_bot_instances(tb_instances) self._remove_bot_dir() self._remove_bot_env() + BackupService().backup_moonraker_conf() remove_config_section("update_manager moonraker-telegram-bot", mr_instances) self._delete_bot_logs(tb_instances) except Exception as e: diff --git a/kiauh/utils/config_utils.py b/kiauh/utils/config_utils.py index 42eabbe..cddfa16 100644 --- a/kiauh/utils/config_utils.py +++ b/kiauh/utils/config_utils.py @@ -73,7 +73,7 @@ def add_config_section_at_top(section: str, instances: List[InstanceType]) -> No tmp.writelines(org_content) cfg_file.unlink() - shutil.move(tmp_cfg_path, cfg_file) + shutil.move(tmp_cfg_path.as_posix(), cfg_file) Logger.print_ok("OK!") @@ -81,7 +81,7 @@ def add_config_section_at_top(section: str, instances: List[InstanceType]) -> No def remove_config_section( section: str, instances: List[InstanceType] ) -> List[InstanceType]: - removed_from: List[instances] = [] + removed_from: List[InstanceType] = [] for instance in instances: cfg_file = instance.cfg_file Logger.print_status(f"Remove section '[{section}]' from '{cfg_file}' ...") From 03c0d46a2ea8a3e63a80bc4331e2707996617914 Mon Sep 17 00:00:00 2001 From: dw-0 Date: Tue, 30 Sep 2025 20:54:50 +0200 Subject: [PATCH 10/14] feat(backup): add fallback to search printer data directories in home directory if no instances found --- kiauh/components/moonraker/utils/utils.py | 28 +++++++++++++++++++++-- kiauh/utils/common.py | 28 +++++++++++++++++++++-- 2 files changed, 52 insertions(+), 4 deletions(-) diff --git a/kiauh/components/moonraker/utils/utils.py b/kiauh/components/moonraker/utils/utils.py index 8aa36f7..e01cf88 100644 --- a/kiauh/components/moonraker/utils/utils.py +++ b/kiauh/components/moonraker/utils/utils.py @@ -182,8 +182,32 @@ def backup_moonraker_db_dir() -> None: svc = BackupService() if not instances: - Logger.print_info("Unable to find directory to backup!") - Logger.print_info("Are there no Moonraker instances installed?") + # fallback: search for printer data directories in the user's home directory + Logger.print_info("No Moonraker instances found via systemd services.") + Logger.print_info( + "Attempting to find printer data directories in home directory..." + ) + + home_dir = Path.home() + printer_data_dirs = [] + + for pattern in ["printer_data", "printer_*_data"]: + for data_dir in home_dir.glob(pattern): + if data_dir.is_dir(): + printer_data_dirs.append(data_dir) + + if not printer_data_dirs: + Logger.print_info("Unable to find directory to backup!") + Logger.print_info("No printer data directories found in home directory.") + return + + for data_dir in printer_data_dirs: + svc.backup_directory( + source_path=data_dir.joinpath("database"), + target_path=data_dir.name, + backup_name="database", + ) + return for instance in instances: diff --git a/kiauh/utils/common.py b/kiauh/utils/common.py index 48c3591..c08e4c7 100644 --- a/kiauh/utils/common.py +++ b/kiauh/utils/common.py @@ -156,8 +156,32 @@ def backup_printer_config_dir() -> None: svc = BackupService() if not instances: - Logger.print_info("Unable to find directory to backup!") - Logger.print_info("Are there no Klipper instances installed?") + # fallback: search for printer data directories in the user's home directory + Logger.print_info("No Klipper instances found via systemd services.") + Logger.print_info( + "Attempting to find printer data directories in home directory..." + ) + + home_dir = Path.home() + printer_data_dirs = [] + + for pattern in ["printer_data", "printer_*_data"]: + for data_dir in home_dir.glob(pattern): + if data_dir.is_dir(): + printer_data_dirs.append(data_dir) + + if not printer_data_dirs: + Logger.print_info("Unable to find directory to backup!") + Logger.print_info("No printer data directories found in home directory.") + return + + for data_dir in printer_data_dirs: + svc.backup_directory( + source_path=data_dir.joinpath("config"), + target_path=data_dir.name, + backup_name="config", + ) + return for instance in instances: From 9168ad88a6fb690875e12345b111167ea947758c Mon Sep 17 00:00:00 2001 From: dw-0 Date: Tue, 30 Sep 2025 21:11:48 +0200 Subject: [PATCH 11/14] refactor(backup): migrate `backup_printer_config_dir` to `BackupService` and update references accordingly --- .../client_config/client_config_remove.py | 4 +- .../client_config/client_config_setup.py | 4 +- kiauh/components/webui_client/client_setup.py | 5 ++- kiauh/core/menus/backup_menu.py | 4 +- kiauh/core/services/backup_service.py | 40 +++++++++++++++++ .../obico/moonraker_obico_extension.py | 6 +-- .../simply_print/simply_print_extension.py | 7 +-- kiauh/utils/common.py | 43 ------------------- 8 files changed, 56 insertions(+), 57 deletions(-) diff --git a/kiauh/components/webui_client/client_config/client_config_remove.py b/kiauh/components/webui_client/client_config/client_config_remove.py index 351c950..4c7ae89 100644 --- a/kiauh/components/webui_client/client_config/client_config_remove.py +++ b/kiauh/components/webui_client/client_config/client_config_remove.py @@ -14,9 +14,9 @@ from components.klipper.klipper import Klipper from components.moonraker.moonraker import Moonraker from components.webui_client.base_data import BaseWebClientConfig from core.logger import Logger +from core.services.backup_service import BackupService from core.services.message_service import Message from core.types.color import Color -from utils.common import backup_printer_config_dir from utils.config_utils import remove_config_section from utils.fs_utils import run_remove_routines from utils.instance_type import InstanceType @@ -36,7 +36,7 @@ def run_client_config_removal( if run_remove_routines(client_config.config_dir): completion_msg.text.append(f"● {client_config.display_name} removed") - backup_printer_config_dir() + BackupService().backup_printer_config_dir() completion_msg = remove_moonraker_config_section( completion_msg, client_config, mr_instances diff --git a/kiauh/components/webui_client/client_config/client_config_setup.py b/kiauh/components/webui_client/client_config/client_config_setup.py index 9d31fdb..1037a72 100644 --- a/kiauh/components/webui_client/client_config/client_config_setup.py +++ b/kiauh/components/webui_client/client_config/client_config_setup.py @@ -25,8 +25,8 @@ from components.webui_client.client_utils import ( ) from core.instance_manager.instance_manager import InstanceManager from core.logger import Logger +from core.services.backup_service import BackupService from core.settings.kiauh_settings import KiauhSettings -from utils.common import backup_printer_config_dir from utils.config_utils import add_config_section, add_config_section_at_top from utils.fs_utils import create_symlink from utils.git_utils import git_clone_wrapper, git_pull_wrapper @@ -57,7 +57,7 @@ def install_client_config(client_data: BaseWebClient, cfg_backup=True) -> None: create_client_config_symlink(client_config, kl_instances) if cfg_backup: - backup_printer_config_dir() + BackupService().backup_printer_config_dir() add_config_section( section=f"update_manager {client_config.name}", diff --git a/kiauh/components/webui_client/client_setup.py b/kiauh/components/webui_client/client_setup.py index 36eb194..e5d7ca7 100644 --- a/kiauh/components/webui_client/client_setup.py +++ b/kiauh/components/webui_client/client_setup.py @@ -37,9 +37,10 @@ from components.webui_client.client_utils import ( ) from core.instance_manager.instance_manager import InstanceManager from core.logger import DialogType, Logger +from core.services.backup_service import BackupService from core.settings.kiauh_settings import KiauhSettings from core.types.color import Color -from utils.common import backup_printer_config_dir, check_install_dependencies +from utils.common import check_install_dependencies from utils.config_utils import add_config_section from utils.fs_utils import unzip from utils.input_utils import get_confirm @@ -97,7 +98,7 @@ def install_client( if enable_remotemode and client.client == WebClientType.MAINSAIL: enable_mainsail_remotemode() - backup_printer_config_dir() + BackupService().backup_printer_config_dir() add_config_section( section=f"update_manager {client.name}", instances=mr_instances, diff --git a/kiauh/core/menus/backup_menu.py b/kiauh/core/menus/backup_menu.py index a9d7500..7cd5a03 100644 --- a/kiauh/core/menus/backup_menu.py +++ b/kiauh/core/menus/backup_menu.py @@ -25,8 +25,8 @@ from components.webui_client.fluidd_data import FluiddData from components.webui_client.mainsail_data import MainsailData from core.menus import Option from core.menus.base_menu import BaseMenu +from core.services.backup_service import BackupService from core.types.color import Color -from utils.common import backup_printer_config_dir # noinspection PyUnusedLocal @@ -86,7 +86,7 @@ class BackupMenu(BaseMenu): backup_moonraker_dir() def backup_printer_config(self, **kwargs) -> None: - backup_printer_config_dir() + BackupService().backup_printer_config_dir() def backup_moonraker_db(self, **kwargs) -> None: backup_moonraker_db_dir() diff --git a/kiauh/core/services/backup_service.py b/kiauh/core/services/backup_service.py index 637d0d6..c48e401 100644 --- a/kiauh/core/services/backup_service.py +++ b/kiauh/core/services/backup_service.py @@ -147,3 +147,43 @@ class BackupService: target_path=target_path, target_name=instance.cfg_file.name, ) + + def backup_printer_config_dir(self) -> None: + instances: List[Klipper] = get_instances(Klipper) + if not instances: + # fallback: search for printer data directories in the user's home directory + Logger.print_info("No Klipper instances found via systemd services.") + Logger.print_info( + "Attempting to find printer data directories in home directory..." + ) + + home_dir = Path.home() + printer_data_dirs = [] + + for pattern in ["printer_data", "printer_*_data"]: + for data_dir in home_dir.glob(pattern): + if data_dir.is_dir(): + printer_data_dirs.append(data_dir) + + if not printer_data_dirs: + Logger.print_info("Unable to find directory to backup!") + Logger.print_info( + "No printer data directories found in home directory." + ) + return + + for data_dir in printer_data_dirs: + self.backup_directory( + source_path=data_dir.joinpath("config"), + target_path=data_dir.name, + backup_name="config", + ) + + return + + for instance in instances: + self.backup_directory( + source_path=instance.base.cfg_dir, + target_path=f"{instance.data_dir.name}", + backup_name="config", + ) diff --git a/kiauh/extensions/obico/moonraker_obico_extension.py b/kiauh/extensions/obico/moonraker_obico_extension.py index 986b153..bf2b20d 100644 --- a/kiauh/extensions/obico/moonraker_obico_extension.py +++ b/kiauh/extensions/obico/moonraker_obico_extension.py @@ -14,6 +14,7 @@ from components.moonraker.moonraker import Moonraker from core.instance_manager.base_instance import SUFFIX_BLACKLIST from core.instance_manager.instance_manager import InstanceManager from core.logger import DialogType, Logger +from core.services.backup_service import BackupService from core.submodules.simple_config_parser.src.simple_config_parser.simple_config_parser import ( SimpleConfigParser, ) @@ -32,7 +33,6 @@ from extensions.obico.moonraker_obico import ( MoonrakerObico, ) from utils.common import ( - backup_printer_config_dir, check_install_dependencies, moonraker_exists, ) @@ -123,7 +123,7 @@ class ObicoExtension(BaseExtension): cmd_sysctl_manage("daemon-reload") - backup_printer_config_dir() + BackupService().backup_printer_config_dir() # add to klippers config self._patch_printer_cfg(kl_instances) @@ -171,7 +171,7 @@ class ObicoExtension(BaseExtension): self._remove_obico_instances(ob_instances) self._remove_obico_dir() self._remove_obico_env() - backup_printer_config_dir() + BackupService().backup_printer_config_dir() remove_config_section(f"include {OBICO_MACROS_CFG_NAME}", kl_instances) remove_config_section(f"include {OBICO_UPDATE_CFG_NAME}", mr_instances) Logger.print_dialog( diff --git a/kiauh/extensions/simply_print/simply_print_extension.py b/kiauh/extensions/simply_print/simply_print_extension.py index 495e098..aa83a76 100644 --- a/kiauh/extensions/simply_print/simply_print_extension.py +++ b/kiauh/extensions/simply_print/simply_print_extension.py @@ -11,11 +11,12 @@ from typing import List from components.moonraker.moonraker import Moonraker from core.instance_manager.instance_manager import InstanceManager from core.logger import DialogType, Logger +from core.services.backup_service import BackupService from core.submodules.simple_config_parser.src.simple_config_parser.simple_config_parser import ( SimpleConfigParser, ) from extensions.base_extension import BaseExtension -from utils.common import backup_printer_config_dir, moonraker_exists +from utils.common import moonraker_exists from utils.input_utils import get_confirm @@ -112,10 +113,10 @@ class SimplyPrintExtension(BaseExtension): continue if is_install and not scp.has_section("simplyprint"): - backup_printer_config_dir() + BackupService().backup_printer_config_dir() scp.add_section(section) elif not is_install and scp.has_section("simplyprint"): - backup_printer_config_dir() + BackupService().backup_printer_config_dir() scp.remove_section(section) scp.write_file(moonraker.cfg_file) patched_files.append(moonraker.cfg_file) diff --git a/kiauh/utils/common.py b/kiauh/utils/common.py index c08e4c7..99db882 100644 --- a/kiauh/utils/common.py +++ b/kiauh/utils/common.py @@ -14,13 +14,11 @@ from datetime import datetime from pathlib import Path from typing import Dict, List, Literal, Set -from components.klipper.klipper import Klipper from components.moonraker.moonraker import Moonraker from core.constants import ( GLOBAL_DEPS, ) from core.logger import DialogType, Logger -from core.services.backup_service import BackupService from core.types.color import Color from core.types.component_status import ComponentStatus, StatusCode from utils.git_utils import ( @@ -151,47 +149,6 @@ def get_install_status( ) -def backup_printer_config_dir() -> None: - instances: List[Klipper] = get_instances(Klipper) - svc = BackupService() - - if not instances: - # fallback: search for printer data directories in the user's home directory - Logger.print_info("No Klipper instances found via systemd services.") - Logger.print_info( - "Attempting to find printer data directories in home directory..." - ) - - home_dir = Path.home() - printer_data_dirs = [] - - for pattern in ["printer_data", "printer_*_data"]: - for data_dir in home_dir.glob(pattern): - if data_dir.is_dir(): - printer_data_dirs.append(data_dir) - - if not printer_data_dirs: - Logger.print_info("Unable to find directory to backup!") - Logger.print_info("No printer data directories found in home directory.") - return - - for data_dir in printer_data_dirs: - svc.backup_directory( - source_path=data_dir.joinpath("config"), - target_path=data_dir.name, - backup_name="config", - ) - - return - - for instance in instances: - svc.backup_directory( - source_path=instance.base.cfg_dir, - target_path=f"{instance.data_dir.name}", - backup_name="config", - ) - - def moonraker_exists(name: str = "") -> List[Moonraker]: """ Helper method to check if a Moonraker instance exists From 8851bd68f846013e930d2f85db4dcece4997aded Mon Sep 17 00:00:00 2001 From: dw-0 Date: Sun, 5 Oct 2025 17:20:30 +0200 Subject: [PATCH 12/14] feat(ui): update messaging for KIAUH v6 to reflect RC.2 status and encourage migration from v5 --- kiauh.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/kiauh.sh b/kiauh.sh index 7aec82d..1e4bc9c 100755 --- a/kiauh.sh +++ b/kiauh.sh @@ -123,19 +123,19 @@ function main() { launch_kiauh_v6 else top_border - echo -e "| ${green}KIAUH v6.0.0-alpha1 is available now!${white} |" + echo -e "| ${green}KIAUH v6.0.0-rc.2 is available now!${white} |" hr echo -e "| View Changelog: ${magenta}https://git.io/JnmlX${white} |" blank_line echo -e "| KIAUH v6 was completely rewritten from the ground up. |" echo -e "| It's based on Python 3.8 and has many improvements. |" blank_line - echo -e "| ${yellow}NOTE: Version 6 is still in alpha, so bugs may occur!${white} |" - echo -e "| ${yellow}Yet, your feedback and bug reports are very much${white} |" - echo -e "| ${yellow}appreciated and will help finalize the release.${white} |" + echo -e "| ${yellow}NOTE: Version 6 is still not final yet, but most bugs${white} |" + echo -e "| ${yellow}should be fixed by now. Still, if you encounter any${white} |" + echo -e "| ${yellow}issues, please report them so they can get fixed.${white} |" hr echo -e "| Would you like to try out KIAUH v6? |" - echo -e "| 1) Yes |" + echo -e "| 1) Yes (recommended - v5 is sunsetting soon) |" echo -e "| 2) No |" echo -e "| 3) Yes, remember my choice for next time |" echo -e "| 4) No, remember my choice for next time |" From 3317114780d4df59de1a725c0990741b07241a0a Mon Sep 17 00:00:00 2001 From: dw-0 Date: Sat, 11 Oct 2025 16:38:08 +0200 Subject: [PATCH 13/14] =?UTF-8?q?refactor(kiauh):=20remove=20legacy=20scri?= =?UTF-8?q?pts,=20configurations,=20and=20assets=20af=E2=80=A6=20(#729)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit refactor(kiauh): remove legacy scripts, configurations, and assets after migration to Python-based KIAUH v6 --- .shellcheckrc | 15 - kiauh.py | 15 - kiauh.sh | 121 +--- kiauh/main.py | 4 + klipper_repos.txt.example | 18 - pyrightconfig.json | 6 - resources/autocommit.sh | 65 -- resources/common_vars.conf | 6 - resources/example.printer.cfg | 11 - resources/fluidd | 96 --- resources/gcode_shell_command.py | 94 --- resources/klipper.env | 1 - resources/klipper.service | 18 - resources/mainsail | 96 --- resources/mjpg-streamer/webcam.txt | 79 --- resources/mjpg-streamer/webcamd | 303 --------- resources/mjpg-streamer/webcamd.service | 15 - resources/moonraker-telegram-bot.env | 1 - resources/moonraker-telegram-bot.service | 16 - resources/moonraker.conf | 31 - resources/moonraker.env | 1 - resources/moonraker.service | 19 - resources/screenshots/kiauh.png | Bin 18243 -> 0 bytes resources/screenshots/rpi_imager1.png | Bin 50472 -> 0 bytes resources/screenshots/rpi_imager2.png | Bin 59876 -> 0 bytes resources/shell_command.cfg | 7 - resources/upstreams.conf | 25 - scripts/backup.sh | 231 ------- scripts/crowsnest.sh | 235 ------- scripts/flash_klipper.sh | 494 -------------- scripts/fluidd.sh | 510 -------------- scripts/gcode_shell_command.sh | 123 ---- scripts/globals.sh | 95 --- scripts/klipper.sh | 664 ------------------ scripts/klipperscreen.sh | 237 ------- scripts/mainsail.sh | 690 ------------------- scripts/mjpg-streamer.sh | 193 ------ scripts/mobileraker.sh | 247 ------- scripts/moonraker-telegram-bot.sh | 542 --------------- scripts/moonraker.sh | 824 ----------------------- scripts/nginx.sh | 360 ---------- scripts/obico.sh | 489 -------------- scripts/octoapp.sh | 369 ---------- scripts/octoeverywhere.sh | 385 ----------- scripts/octoprint.sh | 416 ------------ scripts/pretty_gcode.sh | 127 ---- scripts/rollback.sh | 85 --- scripts/spoolman.sh | 281 -------- scripts/switch_klipper_repo.sh | 144 ---- scripts/ui/advanced_menu.sh | 69 -- scripts/ui/backup_menu.sh | 69 -- scripts/ui/general_ui.sh | 70 -- scripts/ui/install_menu.sh | 88 --- scripts/ui/main_menu.sh | 142 ---- scripts/ui/remove_menu.sh | 88 --- scripts/ui/settings_menu.sh | 166 ----- scripts/ui/update_menu.sh | 172 ----- scripts/upload_log.sh | 125 ---- scripts/utilities.sh | 778 --------------------- 59 files changed, 41 insertions(+), 10530 deletions(-) delete mode 100644 .shellcheckrc delete mode 100644 kiauh.py delete mode 100644 klipper_repos.txt.example delete mode 100644 pyrightconfig.json delete mode 100755 resources/autocommit.sh delete mode 100644 resources/common_vars.conf delete mode 100644 resources/example.printer.cfg delete mode 100644 resources/fluidd delete mode 100755 resources/gcode_shell_command.py delete mode 100644 resources/klipper.env delete mode 100644 resources/klipper.service delete mode 100644 resources/mainsail delete mode 100644 resources/mjpg-streamer/webcam.txt delete mode 100644 resources/mjpg-streamer/webcamd delete mode 100644 resources/mjpg-streamer/webcamd.service delete mode 100644 resources/moonraker-telegram-bot.env delete mode 100644 resources/moonraker-telegram-bot.service delete mode 100644 resources/moonraker.conf delete mode 100644 resources/moonraker.env delete mode 100644 resources/moonraker.service delete mode 100644 resources/screenshots/kiauh.png delete mode 100644 resources/screenshots/rpi_imager1.png delete mode 100644 resources/screenshots/rpi_imager2.png delete mode 100644 resources/shell_command.cfg delete mode 100644 resources/upstreams.conf delete mode 100755 scripts/backup.sh delete mode 100644 scripts/crowsnest.sh delete mode 100644 scripts/flash_klipper.sh delete mode 100644 scripts/fluidd.sh delete mode 100644 scripts/gcode_shell_command.sh delete mode 100644 scripts/globals.sh delete mode 100644 scripts/klipper.sh delete mode 100644 scripts/klipperscreen.sh delete mode 100644 scripts/mainsail.sh delete mode 100644 scripts/mjpg-streamer.sh delete mode 100644 scripts/mobileraker.sh delete mode 100644 scripts/moonraker-telegram-bot.sh delete mode 100644 scripts/moonraker.sh delete mode 100644 scripts/nginx.sh delete mode 100644 scripts/obico.sh delete mode 100644 scripts/octoapp.sh delete mode 100644 scripts/octoeverywhere.sh delete mode 100644 scripts/octoprint.sh delete mode 100644 scripts/pretty_gcode.sh delete mode 100755 scripts/rollback.sh delete mode 100644 scripts/spoolman.sh delete mode 100644 scripts/switch_klipper_repo.sh delete mode 100755 scripts/ui/advanced_menu.sh delete mode 100755 scripts/ui/backup_menu.sh delete mode 100755 scripts/ui/general_ui.sh delete mode 100755 scripts/ui/install_menu.sh delete mode 100755 scripts/ui/main_menu.sh delete mode 100755 scripts/ui/remove_menu.sh delete mode 100755 scripts/ui/settings_menu.sh delete mode 100755 scripts/ui/update_menu.sh delete mode 100755 scripts/upload_log.sh delete mode 100644 scripts/utilities.sh diff --git a/.shellcheckrc b/.shellcheckrc deleted file mode 100644 index faf9529..0000000 --- a/.shellcheckrc +++ /dev/null @@ -1,15 +0,0 @@ -source=scripts - -enable=avoid-nullary-conditions -enable=deprecate-which -enable=quote-safe-variables -enable=require-variable-braces -enable=require-double-brackets - -# SC2162: `read` without `-r` will mangle backslashes. -# https://github.com/koalaman/shellcheck/wiki/SC2162 -disable=SC2162 - -# SC2164: Use `cd ... || exit` in case `cd` fails -# https://github.com/koalaman/shellcheck/wiki/SC2164 -disable=SC2164 diff --git a/kiauh.py b/kiauh.py deleted file mode 100644 index 6f99540..0000000 --- a/kiauh.py +++ /dev/null @@ -1,15 +0,0 @@ -#!/usr/bin/env python3 - -# ======================================================================= # -# Copyright (C) 2020 - 2025 Dominik Willner # -# # -# 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 # -# ======================================================================= # - -from kiauh.main import main - -if __name__ == "__main__": - main() diff --git a/kiauh.sh b/kiauh.sh index 1e4bc9c..8942de3 100755 --- a/kiauh.sh +++ b/kiauh.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash #=======================================================================# -# Copyright (C) 2020 - 2024 Dominik Willner # +# Copyright (C) 2020 - 2025 Dominik Willner # # # # This file is part of KIAUH - Klipper Installation And Update Helper # # https://github.com/dw-0/kiauh # @@ -15,11 +15,6 @@ clear -x # make sure we have the correct permissions while running the script umask 022 -### sourcing all additional scripts -KIAUH_SRCDIR="$(dirname -- "$(readlink -f "${BASH_SOURCE[0]}")")" -for script in "${KIAUH_SRCDIR}/scripts/"*.sh; do . "${script}"; done -for script in "${KIAUH_SRCDIR}/scripts/ui/"*.sh; do . "${script}"; done - #===================================================# #=================== UPDATE KIAUH ==================# #===================================================# @@ -57,15 +52,6 @@ function kiauh_update_avail() { fi } -function save_startup_version() { - local launch_version - - echo "${1}" - - sed -i "/^version_to_launch=/d" "${INI_FILE}" - sed -i '$a'"version_to_launch=${1}" "${INI_FILE}" -} - function kiauh_update_dialog() { [[ ! $(kiauh_update_avail) == "true" ]] && return top_border @@ -93,85 +79,52 @@ function kiauh_update_dialog() { done } -function launch_kiauh_v5() { - main_menu -} - -function launch_kiauh_v6() { - local entrypoint - - if ! command -v python3 &>/dev/null || [[ $(python3 -V | cut -d " " -f2 | cut -d "." -f2) -lt 8 ]]; then - echo "Python 3.8 or higher is not installed!" - echo "Please install Python 3.8 or higher and try again." +function check_euid() { + if [[ ${EUID} -eq 0 ]]; then + echo -e "${red}" + top_border + echo -e "| !!! THIS SCRIPT MUST NOT RUN AS ROOT !!! |" + echo -e "| |" + echo -e "| It will ask for credentials as needed. |" + bottom_border + echo -e "${white}" exit 1 fi +} - entrypoint=$(dirname "$(readlink -f "${BASH_SOURCE[0]}")") - - export PYTHONPATH="${entrypoint}" - - clear -x - python3 "${entrypoint}/kiauh.py" +function check_if_ratos() { + if [[ -n $(which ratos) ]]; then + echo -e "${red}" + top_border + echo -e "| !!! RatOS 2.1 or greater detected !!! |" + echo -e "| |" + echo -e "| KIAUH does currently not support RatOS. |" + echo -e "| If you have any questions, please ask for help on the |" + echo -e "| RatRig Community Discord: https://discord.gg/ratrig |" + bottom_border + echo -e "${white}" + exit 1 + fi } function main() { - read_kiauh_ini "${FUNCNAME[0]}" + local entrypoint - if [[ ${version_to_launch} -eq 5 ]]; then - launch_kiauh_v5 - elif [[ ${version_to_launch} -eq 6 ]]; then - launch_kiauh_v6 - else - top_border - echo -e "| ${green}KIAUH v6.0.0-rc.2 is available now!${white} |" - hr - echo -e "| View Changelog: ${magenta}https://git.io/JnmlX${white} |" - blank_line - echo -e "| KIAUH v6 was completely rewritten from the ground up. |" - echo -e "| It's based on Python 3.8 and has many improvements. |" - blank_line - echo -e "| ${yellow}NOTE: Version 6 is still not final yet, but most bugs${white} |" - echo -e "| ${yellow}should be fixed by now. Still, if you encounter any${white} |" - echo -e "| ${yellow}issues, please report them so they can get fixed.${white} |" - hr - echo -e "| Would you like to try out KIAUH v6? |" - echo -e "| 1) Yes (recommended - v5 is sunsetting soon) |" - echo -e "| 2) No |" - echo -e "| 3) Yes, remember my choice for next time |" - echo -e "| 4) No, remember my choice for next time |" - quit_footer - while true; do - read -p "${cyan}###### Select action:${white} " -e input - case "${input}" in - 1) - launch_kiauh_v6 - break;; - 2) - launch_kiauh_v5 - break;; - 3) - save_startup_version 6 - launch_kiauh_v6 - break;; - 4) - save_startup_version 5 - launch_kiauh_v5 - break;; - Q|q) - echo -e "${green}###### Happy printing! ######${white}"; echo - exit 0;; - *) - error_msg "Invalid Input!\n";; - esac - done && input="" - fi + if ! command -v python3 &>/dev/null || [[ $(python3 -V | cut -d " " -f2 | cut -d "." -f2) -lt 8 ]]; then + echo "Python 3.8 or higher is not installed!" + echo "Please install Python 3.8 or higher and try again." + exit 1 + fi + + entrypoint=$(dirname "$(readlink -f "${BASH_SOURCE[0]}")") + + export PYTHONPATH="${entrypoint}" + + clear -x + python3 "${entrypoint}/kiauh/main.py" } check_if_ratos check_euid -init_logfile -set_globals kiauh_update_dialog -read_kiauh_ini -init_ini main diff --git a/kiauh/main.py b/kiauh/main.py index 06512ea..a28b0ff 100644 --- a/kiauh/main.py +++ b/kiauh/main.py @@ -27,3 +27,7 @@ def main() -> None: MainMenu().run() except KeyboardInterrupt: Logger.print_ok("\nHappy printing!\n", prefix=False) + + +if __name__ == "__main__": + main() diff --git a/klipper_repos.txt.example b/klipper_repos.txt.example deleted file mode 100644 index 6cc3393..0000000 --- a/klipper_repos.txt.example +++ /dev/null @@ -1,18 +0,0 @@ -# This file acts as an example file. -# -# 1) Make a copy of this file and rename it to 'klipper_repos.txt' -# 2) Add your custom Klipper repository to the bottom of that copy -# 3) Save the file -# -# Back in KIAUH you can now go into -> [Settings] and use action '2' to set a different Klipper repository -# -# Make sure to always separate the repository and the branch with a ','. -# , -> https://github.com/Klipper3d/klipper,master -# If you omit a branch, it will always default to 'master' -# -# You are allowed to omit the 'https://github.com/' part of the repository URL -# Down below are now a few examples of what is considered as valid: -https://github.com/Klipper3d/klipper,master -https://github.com/Klipper3d/klipper -Klipper3d/klipper,master -Klipper3d/klipper diff --git a/pyrightconfig.json b/pyrightconfig.json deleted file mode 100644 index b76cb57..0000000 --- a/pyrightconfig.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "pythonVersion": "3.8", - "pythonPlatform": "Linux", - "typeCheckingMode": "standard", - "venvPath": "./.kiauh-env" -} diff --git a/resources/autocommit.sh b/resources/autocommit.sh deleted file mode 100755 index b870a22..0000000 --- a/resources/autocommit.sh +++ /dev/null @@ -1,65 +0,0 @@ -#!/usr/bin/env bash - -##################################################################### -### Please set the paths accordingly. In case you don't have all ### -### the listed folders, just keep that line commented out. ### -##################################################################### -### Path to your config folder you want to back up -#config_folder=~/klipper_config - -### Path to your Klipper folder, by default that is '~/klipper' -#klipper_folder=~/klipper - -### Path to your Moonraker folder, by default that is '~/moonraker' -#moonraker_folder=~/moonraker - -### Path to your Mainsail folder, by default that is '~/mainsail' -#mainsail_folder=~/mainsail - -### Path to your Fluidd folder, by default that is '~/fluidd' -#fluidd_folder=~/fluidd - -##################################################################### -##################################################################### - - -##################################################################### -################ !!! DO NOT EDIT BELOW THIS LINE !!! ################ -##################################################################### -grab_version() { - local klipper_commit moonraker_commit - local mainsail_ver fluidd_ver - - if [[ -n ${klipper_folder} ]]; then - cd "${klipper_folder}" - klipper_commit=$(git rev-parse --short=7 HEAD) - m1="Klipper on commit: ${klipper_commit}" - fi - if [[ -n ${moonraker_folder} ]]; then - cd "${moonraker_folder}" - moonraker_commit=$(git rev-parse --short=7 HEAD) - m2="Moonraker on commit: ${moonraker_commit}" - fi - if [[ -n ${mainsail_folder} ]]; then - mainsail_ver=$(head -n 1 "${mainsail_folder}/.version") - m3="Mainsail version: ${mainsail_ver}" - fi - if [[ -n ${fluidd_folder} ]]; then - fluidd_ver=$(head -n 1 "${fluidd_folder}/.version") - m4="Fluidd version: ${fluidd_ver}" - fi -} - -push_config() { - local current_date - - cd "${config_folder}" || exit 1 - git pull - git add . - current_date=$(date +"%Y-%m-%d %T") - git commit -m "Autocommit from ${current_date}" -m "${m1}" -m "${m2}" -m "${m3}" -m "${m4}" - git push -} - -grab_version -push_config diff --git a/resources/common_vars.conf b/resources/common_vars.conf deleted file mode 100644 index 9c3f85e..0000000 --- a/resources/common_vars.conf +++ /dev/null @@ -1,6 +0,0 @@ -# /etc/nginx/conf.d/common_vars.conf - -map $http_upgrade $connection_upgrade { - default upgrade; - '' close; -} \ No newline at end of file diff --git a/resources/example.printer.cfg b/resources/example.printer.cfg deleted file mode 100644 index 88fe7df..0000000 --- a/resources/example.printer.cfg +++ /dev/null @@ -1,11 +0,0 @@ -[mcu] -serial: /dev/serial/by-id/ - -[virtual_sdcard] -path: %GCODES_DIR% -on_error_gcode: CANCEL_PRINT - -[printer] -kinematics: none -max_velocity: 1000 -max_accel: 1000 diff --git a/resources/fluidd b/resources/fluidd deleted file mode 100644 index 468fad4..0000000 --- a/resources/fluidd +++ /dev/null @@ -1,96 +0,0 @@ -# /etc/nginx/sites-available/fluidd - -server { - listen 80; - - access_log /var/log/nginx/fluidd-access.log; - error_log /var/log/nginx/fluidd-error.log; - - # disable this section on smaller hardware like a pi zero - gzip on; - gzip_vary on; - gzip_proxied any; - gzip_proxied expired no-cache no-store private auth; - gzip_comp_level 4; - gzip_buffers 16 8k; - gzip_http_version 1.1; - gzip_types text/plain text/css text/xml text/javascript application/javascript application/x-javascript application/json application/xml; - - # web_path from fluidd static files - root /home/pi/fluidd; - - index index.html; - server_name _; - - # disable max upload size checks - client_max_body_size 0; - - # disable proxy request buffering - proxy_request_buffering off; - - location / { - try_files $uri $uri/ /index.html; - } - - location = /index.html { - add_header Cache-Control "no-store, no-cache, must-revalidate"; - } - - location /websocket { - proxy_pass http://apiserver/websocket; - proxy_http_version 1.1; - proxy_set_header Upgrade $http_upgrade; - proxy_set_header Connection $connection_upgrade; - proxy_set_header Host $http_host; - proxy_set_header X-Real-IP $remote_addr; - proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - proxy_read_timeout 86400; - } - - location ~ ^/(printer|api|access|machine|server)/ { - proxy_pass http://apiserver$request_uri; - proxy_http_version 1.1; - proxy_set_header Upgrade $http_upgrade; - proxy_set_header Host $http_host; - proxy_set_header X-Real-IP $remote_addr; - proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - proxy_set_header X-Scheme $scheme; - proxy_read_timeout 600; - } - - location /webcam/ { - postpone_output 0; - proxy_buffering off; - proxy_ignore_headers X-Accel-Buffering; - access_log off; - error_log off; - proxy_pass http://mjpgstreamer1/; - } - - location /webcam2/ { - postpone_output 0; - proxy_buffering off; - proxy_ignore_headers X-Accel-Buffering; - access_log off; - error_log off; - proxy_pass http://mjpgstreamer2/; - } - - location /webcam3/ { - postpone_output 0; - proxy_buffering off; - proxy_ignore_headers X-Accel-Buffering; - access_log off; - error_log off; - proxy_pass http://mjpgstreamer3/; - } - - location /webcam4/ { - postpone_output 0; - proxy_buffering off; - proxy_ignore_headers X-Accel-Buffering; - access_log off; - error_log off; - proxy_pass http://mjpgstreamer4/; - } -} diff --git a/resources/gcode_shell_command.py b/resources/gcode_shell_command.py deleted file mode 100755 index 3f316e6..0000000 --- a/resources/gcode_shell_command.py +++ /dev/null @@ -1,94 +0,0 @@ -# Run a shell command via gcode -# -# Copyright (C) 2019 Eric Callahan -# -# This file may be distributed under the terms of the GNU GPLv3 license. -import os -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") - cmd = os.path.expanduser(cmd) - self.command = shlex.split(cmd) - 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, - self.cmd_RUN_SHELL_COMMAND, - desc=self.cmd_RUN_SHELL_COMMAND_help, - ) - - def _process_output(self, eventime): - if self.proc_fd is None: - return - try: - data = os.read(self.proc_fd, 4096) - except Exception: - pass - data = self.partial_output + data.decode() - if "\n" not in data: - self.partial_output = data - return - elif data[-1] != "\n": - split = data.rfind("\n") + 1 - self.partial_output = data[split:] - data = data[:split] - else: - self.partial_output = "" - 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 = shlex.split(gcode_params) - reactor = self.printer.get_reactor() - try: - proc = subprocess.Popen( - self.command + gcode_params, - stdout=subprocess.PIPE, - stderr=subprocess.STDOUT, - ) - except Exception: - 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() - self.gcode.respond_info("Running Command {%s}...:" % (self.name)) - hdl = reactor.register_fd(self.proc_fd, self._process_output) - eventtime = reactor.monotonic() - endtime = eventtime + self.timeout - complete = False - while eventtime < endtime: - eventtime = reactor.pause(eventtime + 0.05) - if proc.poll() is not None: - complete = True - break - if not complete: - proc.terminate() - if self.verbose: - if self.partial_output: - self.gcode.respond_info(self.partial_output) - self.partial_output = "" - if complete: - msg = "Command {%s} finished\n" % (self.name) - else: - msg = "Command {%s} timed out" % (self.name) - self.gcode.respond_info(msg) - reactor.unregister_fd(hdl) - self.proc_fd = None - - -def load_config_prefix(config): - return ShellCommand(config) diff --git a/resources/klipper.env b/resources/klipper.env deleted file mode 100644 index 6ab13d6..0000000 --- a/resources/klipper.env +++ /dev/null @@ -1 +0,0 @@ -KLIPPER_ARGS="%KLIPPER_DIR%/klippy/klippy.py %CFG% -I %PRINTER% -l %LOG% -a %UDS%" \ No newline at end of file diff --git a/resources/klipper.service b/resources/klipper.service deleted file mode 100644 index b41788f..0000000 --- a/resources/klipper.service +++ /dev/null @@ -1,18 +0,0 @@ -[Unit] -Description=Klipper 3D Printer Firmware SV1 -Documentation=https://www.klipper3d.org/ -After=network-online.target -Wants=udev.target - -[Install] -WantedBy=multi-user.target - -[Service] -Type=simple -User=%USER% -RemainAfterExit=yes -WorkingDirectory=%KLIPPER_DIR% -EnvironmentFile=%ENV_FILE% -ExecStart=%ENV%/bin/python $KLIPPER_ARGS -Restart=always -RestartSec=10 diff --git a/resources/mainsail b/resources/mainsail deleted file mode 100644 index 6d63b07..0000000 --- a/resources/mainsail +++ /dev/null @@ -1,96 +0,0 @@ -# /etc/nginx/sites-available/mainsail - -server { - listen 80; - - access_log /var/log/nginx/mainsail-access.log; - error_log /var/log/nginx/mainsail-error.log; - - # disable this section on smaller hardware like a pi zero - gzip on; - gzip_vary on; - gzip_proxied any; - gzip_proxied expired no-cache no-store private auth; - gzip_comp_level 4; - gzip_buffers 16 8k; - gzip_http_version 1.1; - gzip_types text/plain text/css text/xml text/javascript application/javascript application/x-javascript application/json application/xml; - - # web_path from mainsail static files - root /home/pi/mainsail; - - index index.html; - server_name _; - - # disable max upload size checks - client_max_body_size 0; - - # disable proxy request buffering - proxy_request_buffering off; - - location / { - try_files $uri $uri/ /index.html; - } - - location = /index.html { - add_header Cache-Control "no-store, no-cache, must-revalidate"; - } - - location /websocket { - proxy_pass http://apiserver/websocket; - proxy_http_version 1.1; - proxy_set_header Upgrade $http_upgrade; - proxy_set_header Connection $connection_upgrade; - proxy_set_header Host $http_host; - proxy_set_header X-Real-IP $remote_addr; - proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - proxy_read_timeout 86400; - } - - location ~ ^/(printer|api|access|machine|server)/ { - proxy_pass http://apiserver$request_uri; - proxy_http_version 1.1; - proxy_set_header Upgrade $http_upgrade; - proxy_set_header Host $http_host; - proxy_set_header X-Real-IP $remote_addr; - proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - proxy_set_header X-Scheme $scheme; - proxy_read_timeout 600; - } - - location /webcam/ { - postpone_output 0; - proxy_buffering off; - proxy_ignore_headers X-Accel-Buffering; - access_log off; - error_log off; - proxy_pass http://mjpgstreamer1/; - } - - location /webcam2/ { - postpone_output 0; - proxy_buffering off; - proxy_ignore_headers X-Accel-Buffering; - access_log off; - error_log off; - proxy_pass http://mjpgstreamer2/; - } - - location /webcam3/ { - postpone_output 0; - proxy_buffering off; - proxy_ignore_headers X-Accel-Buffering; - access_log off; - error_log off; - proxy_pass http://mjpgstreamer3/; - } - - location /webcam4/ { - postpone_output 0; - proxy_buffering off; - proxy_ignore_headers X-Accel-Buffering; - access_log off; - error_log off; - proxy_pass http://mjpgstreamer4/; - } -} diff --git a/resources/mjpg-streamer/webcam.txt b/resources/mjpg-streamer/webcam.txt deleted file mode 100644 index e8bd44c..0000000 --- a/resources/mjpg-streamer/webcam.txt +++ /dev/null @@ -1,79 +0,0 @@ -### Windows users: To edit this file use Notepad++, VSCode, Atom or SublimeText. -### Do not use Notepad or WordPad. - -### MacOSX users: If you use Textedit to edit this file make sure to use -### "plain text format" and "disable smart quotes" in "Textedit > Preferences" - -### Configure which camera to use -# -# Available options are: -# - auto: tries first usb webcam, if that's not available tries raspi cam -# - usb: only tries usb webcam -# - raspi: only tries raspi cam -# -# Defaults to auto -# -#camera="auto" - -### Additional options to supply to MJPG Streamer for the USB camera -# -# See https://faq.octoprint.org/mjpg-streamer-config for available options -# -# Defaults to a resolution of 640x480 px and a framerate of 10 fps -# -#camera_usb_options="-r 640x480 -f 10" - -### Additional webcam devices known to cause problems with -f -# -# Apparently there a some devices out there that with the current -# mjpg_streamer release do not support the -f parameter (for specifying -# the capturing framerate) and will just refuse to output an image if it -# is supplied. -# -# The webcam daemon will detect those devices by their USB Vendor and Product -# ID and remove the -f parameter from the options provided to mjpg_streamer. -# -# By default, this is done for the following devices: -# Logitech C170 (046d:082b) -# GEMBIRD (1908:2310) -# Genius F100 (0458:708c) -# Cubeternet GL-UPC822 UVC WebCam (1e4e:0102) -# -# Using the following option it is possible to add additional devices. If -# your webcam happens to show above symptoms, try determining your cam's -# vendor and product id via lsusb, activating the line below by removing # and -# adding it, e.g. for two broken cameras "aabb:ccdd" and "aabb:eeff" -# -# additional_brokenfps_usb_devices=("aabb:ccdd" "aabb:eeff") -# -# -#additional_brokenfps_usb_devices=() - -### Additional options to supply to MJPG Streamer for the RasPi Cam -# -# See https://faq.octoprint.org/mjpg-streamer-config for available options -# -# Defaults to 10fps -# -#camera_raspi_options="-fps 10" - -### Configuration of camera HTTP output -# -# Usually you should NOT need to change this at all! Only touch if you -# know what you are doing and what the parameters mean. -# -# Below settings are used in the mjpg-streamer call like this: -# -# -o "output_http.so -w $camera_http_webroot $camera_http_options" -# -# Current working directory is the mjpg-streamer base directory. -# -#camera_http_webroot="./www-mainsail" -#camera_http_options="-n" - -### EXPERIMENTAL -# Support for different streamer types. -# -# Available options: -# mjpeg [default] - stable MJPG-streamer -#camera_streamer=mjpeg diff --git a/resources/mjpg-streamer/webcamd b/resources/mjpg-streamer/webcamd deleted file mode 100644 index 7d3dbed..0000000 --- a/resources/mjpg-streamer/webcamd +++ /dev/null @@ -1,303 +0,0 @@ -#!/bin/bash - -######################################################################## -### DO NOT EDIT THIS FILE TO CHANGE THE CONFIG!!! ### -### ---------------------------------------------------------------- ### -### There is no need to edit this file for changing resolution, ### -### frame rates or any other mjpg-streamer parameters. Please edit ### -### /home/pi/klipper_config/webcam.txt instead - that's what it's ### -### there for! You can even do this with your Pi powered down by ### -### directly accessing the file when using the SD card as thumb ### -### drive in your regular computer. ### -######################################################################## - -MJPGSTREAMER_HOME=/home/pi/mjpg-streamer -MJPGSTREAMER_INPUT_USB="input_uvc.so" -MJPGSTREAMER_INPUT_RASPICAM="input_raspicam.so" - -brokenfps_usb_devices=("046d:082b" "1908:2310" "0458:708c" "1e4e:0102" "0471:0311" "038f:6001" "046d:0804" "046d:0825" "046d:0994" "0ac8:3450") - -config_dir="/home/pi/klipper_config" - -echo "Starting up webcamDaemon..." -echo "" - -cfg_files=() -#cfg_files+=/boot/mainsail.txt -if [[ -d ${config_dir} ]]; then - cfg_files+=( `ls ${config_dir}/webcam*.txt` ) -fi - -array_camera_config=() -array_camera=() -array_camera_usb_options=() -array_camera_usb_device=() -array_camera_raspi_options=() -array_camera_http_webroot=() -array_camera_http_options=() -array_additional_brokenfps_usb_devices=() -array_camera_device=() -array_assigned_device=() - -echo "--- Configuration: ----------------------------" -for cfg_file in ${cfg_files[@]}; do - # init configuration - DO NOT EDIT, USE /home/pi/klipper_config/webcam*.txt INSTEAD! - camera="auto" - camera_usb_options="-r 640x480 -f 10" - camera_raspi_options="-fps 10" - camera_http_webroot="./www-mjpgstreamer" - camera_http_options="-n" - additional_brokenfps_usb_devices=() - - if [[ -e ${cfg_file} ]]; then - source "$cfg_file" - fi - usb_options="$camera_usb_options" - - # if webcam device is explicitly given in /home/pi/klipper_config/webcam*.txt, save the path of the device - # to a variable and remove its parameter from usb_options - extracted_device=`echo $usb_options | sed 's@.*-d \(/dev/\(video[0-9]\+\|v4l/[^ ]*\)\).*@\1@'` - if [ "$extracted_device" != "$usb_options" ] - then - # the camera options refer to a device, save it in a variable - # replace video device parameter with empty string and strip extra whitespace - usb_options=`echo $usb_options | sed 's/\-d \/dev\/\(video[0-9]\+\|v4l\/[^ ]*\)//g' | awk '$1=$1'` - else - extracted_device="" - fi - - # echo configuration - echo "cfg_file: $cfg_file" - echo "camera: $camera" - echo "usb options: $camera_usb_options" - echo "raspi options: $camera_raspi_options" - echo "http options: -w $camera_http_webroot $camera_http_options" - echo "" - echo "Explicitly USB device: $extracted_device" - echo "-----------------------------------------------" - echo "" - - array_camera_config+=( $cfg_file ) - array_camera+=( $camera ) - array_camera_usb_options+=("$usb_options") - array_camera_usb_device+=("$extracted_device") - array_camera_raspi_options+=("$camera_raspi_options") - array_camera_http_webroot+=("$camera_http_webroot") - array_camera_http_options+=("$camera_http_options") - array_camera_brokenfps_usb_devices+=("${brokenfps_usb_devices[*]} ${additional_brokenfps_usb_devices[*]}") - array_camera_device+=("") -done - -# check if array contains a string -function containsString() { - local e match="$1" - shift - for e; do [[ "$e" == "$match" ]] && return 0; done - return 1 -} - -# cleans up when the script receives a SIGINT or SIGTERM -function cleanup() { - # make sure that all child processed die when we die - local pids=$(jobs -pr) - [ -n "$pids" ] && kill $pids - exit 0 -} - -# says goodbye when the script shuts down -function goodbye() { - # say goodbye - echo "" - echo "Goodbye..." - echo "" -} - -# runs MJPG Streamer, using the provided input plugin + configuration -function runMjpgStreamer { - input=$1 - - # There are problems with 0x000137ab firmware on VL805 (Raspberry Pi 4}). - # Try to autodetect offending firmware and temporarily fix the issue - # by changing power management mode - echo "Checking for VL805 (Raspberry Pi 4)..." - if [[ -f /usr/bin/vl805 ]]; then - VL805_VERSION=$(/usr/bin/vl805) - VL805_VERSION=${VL805_VERSION#*: } - echo " - version 0x${VL805_VERSION} detected" - case "$VL805_VERSION" in - 00013701) - echo " - nothing to be done. It shouldn't cause USB problems." - ;; - 000137ab) - echo -e " - \e[31mThis version is known to cause problems with USB cameras.\e[39m" - echo -e " You may want to downgrade to 0x0013701." - echo -e " - [FIXING] Trying the setpci -s 01:00.0 0xD4.B=0x41 hack to mitigate the" - echo -e " issue. It disables ASPM L1 on the VL805. Your board may (or may not) get" - echo -e " slightly hotter. For details see:" - echo -e " https://www.raspberrypi.org/forums/viewtopic.php?f=28&t=244421" - setpci -s 01:00.0 0xD4.B=0x41 - ;; - *) - echo " - unknown firmware version. Doing nothing." - ;; - esac - else - echo " - It seems that you don't have VL805 (Raspberry Pi 4)." - echo " There should be no problems with USB (a.k.a. select() timeout)" - fi - - pushd $MJPGSTREAMER_HOME > /dev/null 2>&1 - echo Running ./mjpg_streamer -o "output_http.so -w $camera_http_webroot $camera_http_options" -i "$input" - LD_LIBRARY_PATH=. ./mjpg_streamer -o "output_http.so -w $camera_http_webroot $camera_http_options" -i "$input" & - sleep 1 & - sleep_pid=$! - wait ${sleep_pid} - popd > /dev/null 2>&1 -} - -# starts up the RasPiCam -function startRaspi { - logger -s "Starting Raspberry Pi camera" - runMjpgStreamer "$MJPGSTREAMER_INPUT_RASPICAM $camera_raspi_options" -} - -# starts up the USB webcam -function startUsb { - options="$usb_options" - device="video0" - - # check for parameter and set the device if it is given as a parameter - input=$1 - if [[ -n $input ]]; then - device=`basename "$input"` - fi - - # add video device into options - options="$options -d /dev/$device" - - uevent_file="/sys/class/video4linux/$device/device/uevent" - if [ -e $uevent_file ]; then - # let's see what kind of webcam we have here, fetch vid and pid... - product=`cat $uevent_file | grep PRODUCT | cut -d"=" -f2` - vid=`echo $product | cut -d"/" -f1` - pid=`echo $product | cut -d"/" -f2` - vidpid=`printf "%04x:%04x" "0x$vid" "0x$pid"` - - # ... then look if it is in our list of known broken-fps-devices and if so remove - # the -f parameter from the options (if it's in there, else that's just a no-op) - for identifier in ${brokenfps_usb_devices[@]}; - do - if [ "$vidpid" = "$identifier" ]; then - echo - echo "Camera model $vidpid is known to not work with -f parameter, stripping it out" - echo - options=`echo $options | sed -e "s/\(\s\+\|^\)-f\s\+[0-9]\+//g"` - fi - done - fi - - logger -s "Starting USB webcam" - runMjpgStreamer "$MJPGSTREAMER_INPUT_USB $options" -} - -# make sure our cleanup function gets called when we receive SIGINT, SIGTERM -trap "cleanup" SIGINT SIGTERM -# say goodbye when we EXIT -trap "goodbye" EXIT - -# we need this to prevent the later calls to vcgencmd from blocking -# I have no idea why, but that's how it is... -vcgencmd version > /dev/null 2>&1 - -# keep mjpg streamer running if some camera is attached -while true; do - - # get list of usb video devices into an array - video_devices=($(find /dev -regextype sed -regex '\/dev/video[0-9]\+' | sort -nk1.11 2> /dev/null)) - - # add list of raspi camera into an array - if [ "`vcgencmd get_camera`" = "supported=1 detected=1" ]; then - video_devices+=( "raspi" ) - fi - - echo "Found video devices:" - printf '%s\n' "${video_devices[@]}" - - for scan_mode in "usb" "usb-auto" "raspi" "auto"; do - camera=$scan_mode - if [[ "usb-auto" == "$scan_mode" ]]; then - camera="usb" - fi - for ((i=0;i<${#array_camera[@]};i++)); do - if [[ -z ${array_camera_device[${i}]} ]] && [[ $camera == ${array_camera[${i}]} ]]; then - camera_config="${array_camera_config[${i}]}" - usb_options="${array_camera_usb_options[${i}]}" - camera_usb_device="${array_camera_usb_device[${i}]}" - camera_raspi_options="${array_camera_raspi_options[${i}]}" - camera_http_webroot="${array_camera_http_webroot[${i}]}" - camera_http_options="${array_camera_http_options[${i}]}" - brokenfps_usb_devices="${array_camera_brokenfps_usb_devices[${i}]}" - if [[ ${camera_usb_device} ]] && { [[ "usb" == ${scan_mode} ]] || [[ "auto" == ${scan_mode} ]]; }; then - # usb device is explicitly set in options - usb_device_path=`readlink -f ${camera_usb_device}` - if containsString "$usb_device_path" "${array_camera_device[@]}"; then - if [[ "auto" != ${scan_mode} ]]; then - array_camera_device[${i}]="alredy_in_use" - echo "config file='$camera_config':Video device already in use." - continue - fi - elif containsString "$usb_device_path" "${video_devices[@]}"; then - array_camera_device[${i}]="$usb_device_path" - # explicitly set usb device was found in video_devices array, start usb with the found device - echo "config file='$camera_config':USB device was set in options and found in devices, start MJPG-streamer with the configured USB video device: $usb_device_path" - startUsb "$usb_device_path" - continue - fi - elif [[ -z ${camera_usb_device} ]] && { [[ "usb-auto" == ${scan_mode} ]] || [[ "auto" == ${scan_mode} ]]; }; then - for video_device in "${video_devices[@]}"; do - if [[ "raspi" != "$video_device" ]]; then - if containsString "$video_device" "${array_camera_device[@]}"; then - : #already in use - else - array_camera_device[${i}]="$video_device" - # device is not set explicitly in options, start usb with first found usb camera as the device - echo "config file='$camera_config':USB device was not set in options, start MJPG-streamer with the first found video device: ${video_device}" - startUsb "${video_device}" - break - fi - fi - done - if [[ -n ${array_camera_device[${i}]} ]]; then - continue - fi - fi - if [[ "raspi" == ${scan_mode} ]] || [[ "auto" == ${scan_mode} ]]; then - video_device="raspi" - if containsString "$video_device" "${array_camera_device[@]}"; then - if [[ "auto" != ${scan_mode} ]]; then - array_camera_device[${i}]="alredy_in_use" - echo "config file='$camera_config':RasPiCam device already in use." - fi - elif containsString "$video_device" "${video_devices[@]}"; then - array_camera_device[${i}]="$video_device" - echo "config file='$camera_config':Start MJPG-streamer with video device: ${video_device}" - startRaspi - sleep 30 & - sleep_pid=$! - wait ${sleep_pid} - fi - fi - fi - done - done - array_assigned_device=( ${array_camera_device[*]} ) - if [[ ${#array_camera[@]} -eq ${#array_assigned_device[@]} ]]; then - echo "Done bring up all configured video device" - exit 0 - else - echo "Scan again in two minutes" - sleep 120 & - sleep_pid=$! - wait ${sleep_pid} - fi -done diff --git a/resources/mjpg-streamer/webcamd.service b/resources/mjpg-streamer/webcamd.service deleted file mode 100644 index da19c63..0000000 --- a/resources/mjpg-streamer/webcamd.service +++ /dev/null @@ -1,15 +0,0 @@ -[Unit] -Description=Starts mjpg-streamer on startup -After=network.target - -[Install] -WantedBy=multi-user.target - -[Service] -Type=forking -User=%USER% -WorkingDirectory=/usr/local/bin -StandardOutput=append:/var/log/webcamd.log -StandardError=append:/var/log/webcamd.log -ExecStart=/usr/local/bin/webcamd -Restart=always \ No newline at end of file diff --git a/resources/moonraker-telegram-bot.env b/resources/moonraker-telegram-bot.env deleted file mode 100644 index 280f165..0000000 --- a/resources/moonraker-telegram-bot.env +++ /dev/null @@ -1 +0,0 @@ -TELEGRAM_BOT_ARGS="%TELEGRAM_BOT_DIR%/bot/main.py -c %CFG% -l %LOG%" \ No newline at end of file diff --git a/resources/moonraker-telegram-bot.service b/resources/moonraker-telegram-bot.service deleted file mode 100644 index 567481d..0000000 --- a/resources/moonraker-telegram-bot.service +++ /dev/null @@ -1,16 +0,0 @@ -[Unit] -Description=Moonraker Telegram Bot SV1 %INST% -Documentation=https://github.com/nlef/moonraker-telegram-bot/wiki -After=network-online.target - -[Install] -WantedBy=multi-user.target - -[Service] -Type=simple -User=%USER% -WorkingDirectory=%TELEGRAM_BOT_DIR% -EnvironmentFile=%ENV_FILE% -ExecStart=%ENV%/bin/python $TELEGRAM_BOT_ARGS -Restart=always -RestartSec=10 diff --git a/resources/moonraker.conf b/resources/moonraker.conf deleted file mode 100644 index 8fa0c86..0000000 --- a/resources/moonraker.conf +++ /dev/null @@ -1,31 +0,0 @@ -[server] -host: 0.0.0.0 -port: %PORT% -klippy_uds_address: %UDS% - -[authorization] -trusted_clients: - %LAN% - 10.0.0.0/8 - 127.0.0.0/8 - 169.254.0.0/16 - 172.16.0.0/12 - 192.168.0.0/16 - FE80::/10 - ::1/128 -cors_domains: - *.lan - *.local - *.internal - *://localhost - *://localhost:* - *://my.mainsail.xyz - *://app.fluidd.xyz - -[octoprint_compat] - -[history] - -[update_manager] -channel: dev -refresh_interval: 168 diff --git a/resources/moonraker.env b/resources/moonraker.env deleted file mode 100644 index bca6af5..0000000 --- a/resources/moonraker.env +++ /dev/null @@ -1 +0,0 @@ -MOONRAKER_ARGS="%MOONRAKER_DIR%/moonraker/moonraker.py -d %PRINTER_DATA%" \ No newline at end of file diff --git a/resources/moonraker.service b/resources/moonraker.service deleted file mode 100644 index 7bfe8e2..0000000 --- a/resources/moonraker.service +++ /dev/null @@ -1,19 +0,0 @@ -[Unit] -Description=API Server for Klipper SV1 %INST% -Documentation=https://moonraker.readthedocs.io/ -Requires=network-online.target -After=network-online.target - -[Install] -WantedBy=multi-user.target - -[Service] -Type=simple -User=%USER% -SupplementaryGroups=moonraker-admin -RemainAfterExit=yes -WorkingDirectory=%MOONRAKER_DIR% -EnvironmentFile=%ENV_FILE% -ExecStart=%ENV%/bin/python $MOONRAKER_ARGS -Restart=always -RestartSec=10 \ No newline at end of file diff --git a/resources/screenshots/kiauh.png b/resources/screenshots/kiauh.png deleted file mode 100644 index dadb5e2c9e8b06fd6b3f214617b6f21be070d3b2..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 18243 zcmbTd1z23cvMxHfy9T%5?(S|OgNNYm?(P8++}#O~;1b*+1b26Lce^Wl@3Y^z@11+@ z`5xal%$ha5s;jH3{;KM!icnFOK|v%y1c5*(aqKP{hN*(Ae74h0Ms* z+|o{n;;f~Eg3QuHh(eP~iB-u#!qmc2*2~FM)k|5;*vs0O&xArmm`u=vA0S|B>S9Rd zVQXXO%a-#@q;C$|1}x#Nr=M2#l?Z2 zg~i?7o!Om(+1|;Vg^iDokA;<;g`J%V7{TQ1Y3E|-!DQ!5`5zP{O`VOMEFD}d?d{0^ zQZzKOcXbh>09gI!8f+c@P1er&UvdH@#^Pb|%XS)A1+*H!g#Z-s_*fVw}R(2+KZZ$S;elBi)RxSosHhxyte-2f$H?cJH{Le!< znAmvKSXuemc=$Q_{)(C-kLOK*=Z$!{IQfh@*qC^E4SAUi**Hy^_;`4^ znGDVN%(%@Ac?|hXx&LGS4^EbVVHw)||EBZT-2N&AzpSM*uvMP_vIkXD$A4YfSd#ri z2lx$*|LV37h4J4_H8r95*KN!HLIVG@75tN|yM-x0^uO8ee-3lDH*;|}bTSn)2c-3X zQ6`rE6YI`~ZvQ>w|Ff<8|1$nxD&PNzadr-7_Wx`L|9r^U!qCp#6u?Oqioc6t`3orj z+!B`m_ip{;yZ;0}|1lguw7-}C#!}$JztPy#4j}CWVC{FP!442ej9pGrOwA+nB+LC5 ziF($($lmbq($L9EF*;-%)ipJwp_G?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6TL^? vOmGITL-Tf}=6h#eGurP{g|{$PJ5cDg1H4%a`R2R-5@UAqtVyAfW7z)zyz^Ql diff --git a/resources/shell_command.cfg b/resources/shell_command.cfg deleted file mode 100644 index 34e7581..0000000 --- a/resources/shell_command.cfg +++ /dev/null @@ -1,7 +0,0 @@ -[gcode_shell_command hello_world] -command: echo hello world -timeout: 2. -verbose: True -[gcode_macro HELLO_WORLD] -gcode: - RUN_SHELL_COMMAND CMD=hello_world \ No newline at end of file diff --git a/resources/upstreams.conf b/resources/upstreams.conf deleted file mode 100644 index d04e04a..0000000 --- a/resources/upstreams.conf +++ /dev/null @@ -1,25 +0,0 @@ -# /etc/nginx/conf.d/upstreams.conf -upstream apiserver { - ip_hash; - server 127.0.0.1:7125; -} - -upstream mjpgstreamer1 { - ip_hash; - server 127.0.0.1:8080; -} - -upstream mjpgstreamer2 { - ip_hash; - server 127.0.0.1:8081; -} - -upstream mjpgstreamer3 { - ip_hash; - server 127.0.0.1:8082; -} - -upstream mjpgstreamer4 { - ip_hash; - server 127.0.0.1:8083; -} \ No newline at end of file diff --git a/scripts/backup.sh b/scripts/backup.sh deleted file mode 100755 index 1716963..0000000 --- a/scripts/backup.sh +++ /dev/null @@ -1,231 +0,0 @@ -#!/usr/bin/env bash - -#=======================================================================# -# Copyright (C) 2020 - 2024 Dominik Willner # -# # -# 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 # -#=======================================================================# - -set -e - -function get_date() { - local current_date - current_date=$(date +"%y%m%d-%H%M") - echo "${current_date}" -} - -function check_for_backup_dir() { - [[ -d ${BACKUP_DIR} ]] && return - - status_msg "Create KIAUH backup directory ..." - mkdir -p "${BACKUP_DIR}" && ok_msg "Directory created!" -} - -function backup_before_update() { - read_kiauh_ini "${FUNCNAME[0]}" - local state="${backup_before_update}" - [[ ${state} = "false" ]] && return - backup_"${1}" -} - -function backup_config_dir() { - check_for_backup_dir - local current_date config_pathes - - config_pathes=$(get_config_folders) - - if [[ -n "${config_pathes}" ]]; then - current_date=$(get_date) - status_msg "Timestamp: ${current_date}" - - local i=0 folder folder_name target_dir - for folder in ${config_pathes}; do - if [[ -d ${folder} ]]; then - status_msg "Create backup of ${folder} ..." - - 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}" - fi - done - else - ok_msg "No config directory found! Skipping backup ..." - fi -} - -function backup_moonraker_database() { - check_for_backup_dir - local current_date db_pathes - - db_pathes=$(get_instance_folder_path "database") - - if [[ -n ${db_pathes} ]]; then - current_date=$(get_date) - status_msg "Timestamp: ${current_date}" - - local i=0 database folder_name target_dir - for database in ${db_pathes}; do - status_msg "Create backup of ${database} ..." - - 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 ..." - fi -} - -function backup_klipper() { - local current_date - - if [[ -d ${KLIPPER_DIR} && -d ${KLIPPY_ENV} ]]; then - status_msg "Creating Klipper backup ..." - check_for_backup_dir - current_date=$(get_date) - status_msg "Timestamp: ${current_date}" - mkdir -p "${BACKUP_DIR}/klipper-backups/${current_date}" - cp -r "${KLIPPER_DIR}" "${_}" && cp -r "${KLIPPY_ENV}" "${_}" - print_confirm "Klipper backup complete!" - else - print_error "Can't back up 'klipper' and/or 'klipper-env' directory! Not found!" - fi -} - -function backup_mainsail() { - local current_date - - if [[ -d ${MAINSAIL_DIR} ]]; then - status_msg "Creating Mainsail backup ..." - check_for_backup_dir - current_date=$(get_date) - status_msg "Timestamp: ${current_date}" - mkdir -p "${BACKUP_DIR}/mainsail-backups/${current_date}" - cp -r "${MAINSAIL_DIR}" "${_}" - print_confirm "Mainsail backup complete!" - else - print_error "Can't back up 'mainsail' directory! Not found!" - fi -} - -function backup_fluidd() { - local current_date - - if [[ -d ${FLUIDD_DIR} ]]; then - status_msg "Creating Fluidd backup ..." - check_for_backup_dir - current_date=$(get_date) - status_msg "Timestamp: ${current_date}" - mkdir -p "${BACKUP_DIR}/fluidd-backups/${current_date}" - cp -r "${FLUIDD_DIR}" "${_}" - print_confirm "Fluidd backup complete!" - else - print_error "Can't back up 'fluidd' directory! Not found!" - fi -} - -function backup_moonraker() { - local current_date - - if [[ -d ${MOONRAKER_DIR} && -d ${MOONRAKER_ENV} ]]; then - status_msg "Creating Moonraker backup ..." - check_for_backup_dir - current_date=$(get_date) - status_msg "Timestamp: ${current_date}" - mkdir -p "${BACKUP_DIR}/moonraker-backups/${current_date}" - cp -r "${MOONRAKER_DIR}" "${_}" && cp -r "${MOONRAKER_ENV}" "${_}" - print_confirm "Moonraker backup complete!" - else - print_error "Can't back up moonraker and/or moonraker-env directory! Not found!" - fi -} - -function backup_octoprint() { - local current_date - - if [[ -d ${OCTOPRINT_DIR} && -d ${OCTOPRINT_CFG_DIR} ]]; then - status_msg "Creating OctoPrint backup ..." - check_for_backup_dir - current_date=$(get_date) - status_msg "Timestamp: ${current_date}" - mkdir -p "${BACKUP_DIR}/octoprint-backups/${current_date}" - cp -r "${OCTOPRINT_DIR}" "${_}" && cp -r "${OCTOPRINT_CFG_DIR}" "${_}" - print_confirm " OctoPrint backup complete!" - else - print_error "Can't back up OctoPrint and/or .octoprint directory!\n Not found!" - fi -} - -function backup_klipperscreen() { - local current_date - if [[ -d ${KLIPPERSCREEN_DIR} ]] ; then - status_msg "Creating KlipperScreen backup ..." - check_for_backup_dir - current_date=$(get_date) - status_msg "Timestamp: ${current_date}" - mkdir -p "${BACKUP_DIR}/klipperscreen-backups/${current_date}" - cp -r "${KLIPPERSCREEN_DIR}" "${_}" - print_confirm "KlipperScreen backup complete!" - else - print_error "Can't back up KlipperScreen directory!\n Not found!" - fi -} - -function backup_telegram_bot() { - local current_date - - if [[ -d ${TELEGRAM_BOT_DIR} ]] ; then - status_msg "Creating MoonrakerTelegramBot backup ..." - check_for_backup_dir - current_date=$(get_date) - status_msg "Timestamp: ${current_date}" - mkdir -p "${BACKUP_DIR}/MoonrakerTelegramBot-backups/${current_date}" - cp -r "${TELEGRAM_BOT_DIR}" "${_}" - print_confirm "MoonrakerTelegramBot backup complete!" - else - 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 -} - -function backup_spoolman() { - local current_date - - if [[ -d ${SPOOLMAN_DIR} ]] ; then - status_msg "Creating Spoolman backup ..." - check_for_backup_dir - current_date=$(get_date) - status_msg "Timestamp: ${current_date}" - mkdir -p "${BACKUP_DIR}/Spoolman-backups/${current_date}" - cp -r "${SPOOLMAN_DIR}" "${_}" && cp -r "${SPOOLMAN_DB_DIR}/spoolman.db" "${_}" - print_confirm "Spoolman backup complete!" - else - print_error "Can't back up Spoolman directory!\n Not found!" - fi -} diff --git a/scripts/crowsnest.sh b/scripts/crowsnest.sh deleted file mode 100644 index 788468f..0000000 --- a/scripts/crowsnest.sh +++ /dev/null @@ -1,235 +0,0 @@ -#!/usr/bin/env bash - -#=======================================================================# -# Copyright (C) 2020 - 2024 Dominik Willner # -# # -# 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 # -#=======================================================================# - -#=======================================================================# -# Crowsnest Installer brought to you by KwadFan # -# Copyright (C) 2022 KwadFan # -# https://github.com/KwadFan/crowsnest # -#=======================================================================# - -# Error Handling -set -e - -# Helper messages - -function multi_instance_message(){ - echo -e "Crowsnest is NOT designed to support multi instances." - echo -e "A workaround for this is to choose the most used instance as a 'master'" - echo -e "Use this instance to set up your 'crowsnest.conf' and steering it's service.\n" - echo -e "Found the following instances:\n" - for i in ${1}; do - select_msg "${i}" - done - echo -e "\nLaunching crowsnest's configuration tool ..." - continue_config -} - -# Helper funcs -function clone_crowsnest(){ - $(command -v git) clone "${CROWSNEST_REPO}" -b master "${CROWSNEST_DIR}" -} - -function check_multi_instance(){ - local -a instances - readarray -t instances < <(find "${HOME}" -regex "${HOME}/[a-zA-Z0-9_]+_data/*" -printf "%P\n" 2> /dev/null | sort) - if [[ "${#instances[@]}" -gt 1 ]]; then - status_msg "Multi instance install detected ..." - multi_instance_message "${instances[*]}" - if [[ -d "${HOME}/crowsnest" ]]; then - pushd "${HOME}/crowsnest" &> /dev/null || exit 1 - if ! make config ;then - error_msg "Something went wrong! Please try again..." - if [[ -f "tools/.config" ]]; then - rm -f tools/.config - fi - exit 1 - fi - if [[ ! -f "tools/.config" ]]; then - log_error "failure while generating .config" - error_msg "Generating .config failed, installation aborted" - exit 1 - fi - popd &> /dev/null || exit 1 - fi - fi -} - -function continue_config() { - local reply - while true; do - read -erp "${cyan}###### Continue with configuration? (y/N):${white} " reply - case "${reply}" in - Y|y|Yes|yes) - select_msg "Yes" - break;; - N|n|No|no|"") - select_msg "No" - warn_msg "Installation aborted by user ... Exiting!" - exit 1;; - *) - error_msg "Invalid Input!\n";; - esac - done - return 0 -} - -# Install func -function install_crowsnest(){ - - # Step 1: jump to home directory - pushd "${HOME}" &> /dev/null || exit 1 - - # Step 2: Clone crowsnest repo - status_msg "Cloning 'crowsnest' repository ..." - if [[ ! -d "${HOME}/crowsnest" && -z "$(ls -A "${HOME}/crowsnest" 2> /dev/null)" ]]; then - clone_crowsnest - else - ok_msg "crowsnest repository already exists ..." - fi - - # Step 3: Install dependencies - dependency_check git make - - # Step 4: Check for Multi Instance - check_multi_instance - - # Step 5: Launch crowsnest installer - pushd "${HOME}/crowsnest" &> /dev/null || exit 1 - title_msg "Installer will prompt you for sudo password!" - status_msg "Launching crowsnest installer ..." - if ! sudo make install; then - error_msg "Something went wrong! Please try again..." - exit 1 - fi - - # Step 5: Leave directory (twice due two pushd) - popd &> /dev/null || exit 1 - popd &> /dev/null || exit 1 -} - -# Remove func -function remove_crowsnest(){ - if [[ -d "${CROWSNEST_DIR}" ]]; then - pushd "${HOME}/crowsnest" &> /dev/null || exit 1 - title_msg "Uninstaller will prompt you for sudo password!" - status_msg "Launching crowsnest uninstaller ..." - - if ! make uninstall; then - error_msg "Something went wrong! Please try again..." - exit 1 - fi - - status_msg "Removing crowsnest directory ..." - rm -rf "${CROWSNEST_DIR}" - ok_msg "Directory removed!" - fi - - print_confirm "Crowsnest successfully removed!" -} - -# Status funcs -get_crowsnest_status(){ - local -a files - local env_file - env_file="$(grep "EnvironmentFile" /etc/systemd/system/crowsnest.service 2>/dev/null | cut -d "=" -f2)" - files=( - "${CROWSNEST_DIR}" - "/usr/local/bin/crowsnest" - "/etc/logrotate.d/crowsnest" - "/etc/systemd/system/crowsnest.service" - "${env_file}" - ) - local count - count=0 - - for file in "${files[@]}"; do - [[ -e "${file}" ]] && count=$(( count +1 )) - done - if [[ "${count}" -eq "${#files[*]}" ]]; then - echo "Installed" - elif [[ "${count}" -gt 0 ]]; then - echo "Incomplete!" - else - echo "Not installed!" - fi -} - -# Update funcs -# Shameless stolen from KlipperScreen.sh -function get_local_crowsnest_commit() { - [[ ! -d ${CROWSNEST_DIR} || ! -d "${CROWSNEST_DIR}/.git" ]] && return - - local commit - cd "${CROWSNEST_DIR}" - commit="$(git describe HEAD --always --tags | cut -d "-" -f 1,2)" - echo "${commit}" -} - -function get_remote_crowsnest_commit() { - [[ ! -d ${CROWSNEST_DIR} || ! -d "${CROWSNEST_DIR}/.git" ]] && return - - local commit - cd "${CROWSNEST_DIR}" && git fetch origin -q - commit=$(git describe origin/master --always --tags | cut -d "-" -f 1,2) - echo "${commit}" -} - -function compare_crowsnest_versions() { - local versions local_ver remote_ver - local_ver="$(get_local_crowsnest_commit)" - remote_ver="$(get_remote_crowsnest_commit)" - - if [[ ${local_ver} != "${remote_ver}" ]]; then - versions="${yellow}$(printf " %-14s" "${local_ver}")${white}" - versions+="|${green}$(printf " %-13s" "${remote_ver}")${white}" - # add moonraker to application_updates_available in kiauh.ini - add_to_application_updates "crowsnest" - else - versions="${green}$(printf " %-14s" "${local_ver}")${white}" - versions+="|${green}$(printf " %-13s" "${remote_ver}")${white}" - fi - - echo "${versions}" -} - -function install_crowsnest_dependencies() { - local packages log_name="Crowsnest" - local install_script="${CROWSNEST_DIR}/tools/install.sh" - - ### read PKGLIST from official install-script - status_msg "Reading dependencies..." - # shellcheck disable=SC2016 - packages="$(grep "PKGLIST=" "${install_script}" | cut -d'"' -f2 | sed 's/\${PKGLIST}//g' | tr -d '\n')" - - echo "${cyan}${packages}${white}" | tr '[:space:]' '\n' - read -r -a packages <<< "${packages}" - - ### Update system package lists if stale - update_system_package_lists - - ### Install required packages - install_system_packages "${log_name}" "packages[@]" -} - -function update_crowsnest() { - do_action_service "stop" "crowsnest" - - if [[ ! -d ${CROWSNEST_DIR} ]]; then - clone_crowsnest - else - status_msg "Updating Crowsnest ..." - cd "${CROWSNEST_DIR}" && git pull - ### read PKGLIST and install possible new dependencies - install_crowsnest_dependencies - fi - ok_msg "Update complete!" - do_action_service "restart" "crowsnest" -} diff --git a/scripts/flash_klipper.sh b/scripts/flash_klipper.sh deleted file mode 100644 index 4fd4f45..0000000 --- a/scripts/flash_klipper.sh +++ /dev/null @@ -1,494 +0,0 @@ -#!/usr/bin/env bash - -#=======================================================================# -# Copyright (C) 2020 - 2024 Dominik Willner # -# # -# 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 # -#=======================================================================# - -set -e - -function init_flash_process() { - ### step 1: check for required userhgroups (tty & dialout) - check_usergroups - - top_border - echo -e "| ~~~~~~~~~~~~ [ Flash MCU ] ~~~~~~~~~~~~ |" - hr - echo -e "| Please select the flashing method to flash your MCU. |" - echo -e "| Make sure to only select a method your MCU supports. |" - echo -e "| Not all MCUs support both methods! |" - hr - blank_line - echo -e "| 1) Regular flashing method |" - echo -e "| 2) Updating via SD-Card Update |" - blank_line - back_help_footer - - local choice method - while true; do - read -p "${cyan}###### Please select:${white} " choice - case "${choice}" in - 1) - select_msg "Regular flashing method" - method="regular" - break;; - 2) - select_msg "SD-Card Update" - method="sdcard" - break;; - B|b) - advanced_menu - break;; - H|h) - clear && print_header - show_flash_method_help - break;; - *) - error_msg "Invalid command!";; - esac - done - - ### 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 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} |" - hr - blank_line - echo -e "| How is the controller board connected to the host? |" - echo -e "| 1) USB |" - echo -e "| 2) UART |" - echo -e "| 3) USB (DFU mode) |" - blank_line - back_help_footer - - local choice - while true; do - read -p "${cyan}###### Connection method:${white} " choice - case "${choice}" in - 1) - status_msg "Identifying MCU connected via USB ...\n" - get_usb_id || true # continue even after exit code 1 - break;; - 2) - status_msg "Identifying MCU possibly connected via UART ...\n" - get_uart_id || true # continue even after exit code 1 - break;; - 3) - status_msg "Identifying MCU connected via USB in DFU mode ...\n" - get_dfu_id || true # continue even after exit code 1 - break;; - B|b) - advanced_menu - break;; - H|h) - clear && print_header - show_mcu_connection_help - break;; - *) - error_msg "Invalid command!";; - esac - done -} - -function print_detected_mcu_to_screen() { - local i=1 - - if (( ${#mcu_list[@]} < 1 )); then - print_error "No MCU found!\n MCU either not connected or not detected!" - return - fi - - for mcu in "${mcu_list[@]}"; do - echo -e " ● MCU #${i}: ${cyan}${mcu}${white}" - i=$(( i + 1 )) - done - echo -} - -#================================================# -#=================== STEP 4 =====================# -#================================================# -function select_mcu_id() { - local i=0 sel_index=0 method=${1} - - if (( ${#mcu_list[@]} < 1 )); then - print_error "No MCU found!\n MCU either not connected or not detected!" - return - fi - - top_border - echo -e "| ${red}!!! ATTENTION !!!${white} |" - hr - echo -e "| Make sure, to select the correct MCU! |" - echo -e "| ${red}ONLY flash a firmware created for the respective MCU!${white} |" - bottom_border - echo -e "${cyan}###### List of available MCU:${white}" - - ### list all mcus - for mcu in "${mcu_list[@]}"; do - i=$(( i + 1 )) - mcu=$(echo "${mcu}" | rev | cut -d"/" -f1 | rev) - echo -e " ● MCU #${i}: ${cyan}${mcu}${white}" - done - - ### verify user input - local regex="^[1-9]+$" - while [[ ! ${sel_index} =~ ${regex} ]] || [[ ${sel_index} -gt ${i} ]]; do - echo - read -p "${cyan}###### Select MCU to flash:${white} " sel_index - - if [[ ! ${sel_index} =~ ${regex} ]]; then - error_msg "Invalid input!" - elif [[ ${sel_index} -lt 1 ]] || [[ ${sel_index} -gt ${i} ]]; then - error_msg "Please select a number between 1 and ${i}!" - fi - - local mcu_index=$(( sel_index - 1 )) - local selected_mcu_id="${mcu_list[${mcu_index}]}" - done - - ### confirm selection - local yn - while true; do - echo -e "\n###### You selected:\n ● MCU #${sel_index}: ${selected_mcu_id}\n" - read -p "${cyan}###### Continue? (Y/n):${white} " yn - case "${yn}" in - Y|y|Yes|yes|"") - select_msg "Yes" - status_msg "Flashing ${selected_mcu_id} ..." - if [[ ${method} == "regular" ]]; then - log_info "Flashing device '${selected_mcu_id}' with method '${method}'" - start_flash_mcu "${selected_mcu_id}" - elif [[ ${method} == "sdcard" ]]; then - log_info "Flashing device '${selected_mcu_id}' with method '${method}'" - start_flash_sd "${selected_mcu_id}" - else - print_error "No flash method set! Aborting..." - log_error "No flash method set!" - return - fi - break;; - N|n|No|no) - select_msg "No" - break;; - *) - error_msg "Invalid command!";; - esac - done -} - -function start_flash_mcu() { - local device=${1} - do_action_service "stop" "klipper" - - if make ${flash_command} FLASH_DEVICE="${device}"; then - ok_msg "Flashing successfull!" - else - warn_msg "Flashing failed!" - warn_msg "Please read the console output above!" - fi - - do_action_service "start" "klipper" -} - -function start_flash_sd() { - local i=0 board_list=() device=${1} - local flash_script="${KLIPPER_DIR}/scripts/flash-sdcard.sh" - - ### write each supported board to the array to make it selectable - for board in $("${flash_script}" -l | tail -n +2); do - board_list+=("${board}") - done - - top_border - echo -e "| Please select the type of board that corresponds to |" - echo -e "| the currently selected MCU ID you chose before. |" - blank_line - echo -e "| The following boards are currently supported: |" - hr - ### display all supported boards to the user - for board in "${board_list[@]}"; do - if [[ ${i} -lt 10 ]]; then - printf "| ${i}) %-50s|\n" "${board_list[${i}]}" - else - printf "| ${i}) %-49s|\n" "${board_list[${i}]}" - fi - i=$(( i + 1 )) - done - quit_footer - - ### make the user select one of the boards - local choice - while true; do - read -p "${cyan}###### Please select board type:${white} " choice - if [[ ${choice} = "q" || ${choice} = "Q" ]]; then - clear && advanced_menu && break - elif [[ ${choice} -le ${#board_list[@]} ]]; then - local selected_board="${board_list[${choice}]}" - break - else - clear && print_header - error_msg "Invalid choice!" - flash_mcu_sd - fi - done - - while true; do - echo - top_border - echo -e "| If your board is flashed with firmware that connects |" - echo -e "| at a custom baud rate, please change it now. |" - blank_line - echo -e "| If you are unsure, stick to the default 250000! |" - bottom_border - - local baud_rate regex="^[0-9]+$" - echo -e "${cyan}###### Please set the baud rate:${white} " - while [[ ! ${baud_rate} =~ ${regex} ]]; do - read -e -i "250000" -e baud_rate - local selected_baud_rate=${baud_rate} - break - done - break - done - - ###flash process - do_action_service "stop" "klipper" - if "${flash_script}" -b "${selected_baud_rate}" "${device}" "${selected_board}"; then - print_confirm "Flashing successfull!" - log_info "Flash successfull!" - else - print_error "Flashing failed!\n Please read the console output above!" - log_error "Flash failed!" - fi - do_action_service "start" "klipper" -} - -function build_fw() { - local python_version - - if [[ ! -d ${KLIPPER_DIR} || ! -d ${KLIPPY_ENV} ]]; then - print_error "Klipper not found!\n Cannot build firmware without Klipper!" - return - fi - - python_version=$(get_klipper_python_ver) - - cd "${KLIPPER_DIR}" - status_msg "Initializing firmware build ..." - local dep=(build-essential dpkg-dev make) - dependency_check "${dep[@]}" - - make clean - - status_msg "Building firmware ..." - if (( python_version == 3 )); then - make PYTHON=python3 menuconfig - make PYTHON=python3 - elif (( python_version == 2 )); then - make PYTHON=python2 menuconfig - make PYTHON=python2 - else - warn_msg "Error reading Python version!" - return 1 - fi - - ok_msg "Firmware built!" -} - -#================================================# -#=================== HELPERS ====================# -#================================================# - -function get_usb_id() { - unset mcu_list - sleep 1 - mcus=$(find /dev/serial/by-id/* 2>/dev/null) - - for mcu in ${mcus}; do - mcu_list+=("${mcu}") - done -} - -function get_uart_id() { - unset mcu_list - sleep 1 - mcus=$(find /dev -maxdepth 1 -regextype posix-extended -regex "^\/dev\/tty(AMA0|S0)$" 2>/dev/null) - - for mcu in ${mcus}; do - mcu_list+=("${mcu}") - done -} - -function get_dfu_id() { - unset mcu_list - sleep 1 - mcus=$(lsusb | grep "DFU" | cut -d " " -f 6 2>/dev/null) - - for mcu in ${mcus}; do - mcu_list+=("${mcu}") - done -} - -function show_flash_method_help() { - top_border - echo -e "| ~~~~~~~~ < ? > Help: Flash MCU < ? > ~~~~~~~~ |" - hr - echo -e "| ${cyan}Regular flashing method:${white} |" - echo -e "| The default method to flash controller boards which |" - echo -e "| are connected and updated over USB and not by placing |" - echo -e "| a compiled firmware file onto an internal SD-Card. |" - blank_line - echo -e "| Common controllers that get flashed that way are: |" - echo -e "| - Arduino Mega 2560 |" - echo -e "| - Fysetc F6 / S6 (used without a Display + SD-Slot) |" - blank_line - echo -e "| ${cyan}Updating via SD-Card Update:${white} |" - echo -e "| Many popular controller boards ship with a bootloader |" - echo -e "| capable of updating the firmware via SD-Card. |" - echo -e "| Choose this method if your controller board supports |" - echo -e "| this way of updating. This method ONLY works for up- |" - echo -e "| grading firmware. The initial flashing procedure must |" - echo -e "| be done manually per the instructions that apply to |" - echo -e "| your controller board. |" - blank_line - echo -e "| Common controllers that can be flashed that way are: |" - echo -e "| - BigTreeTech SKR 1.3 / 1.4 (Turbo) / E3 / Mini E3 |" - echo -e "| - Fysetc F6 / S6 (used with a Display + SD-Slot) |" - echo -e "| - Fysetc Spider |" - blank_line - back_footer - - local choice - while true; do - read -p "${cyan}###### Please select:${white} " choice - case "${choice}" in - B|b) - clear && print_header - init_flash_process - break;; - *) - error_msg "Invalid command!";; - esac - 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 < ? > ~~~~~~~~ |" - hr - echo -e "| ${cyan}USB:${white} |" - echo -e "| Selecting USB as the connection method will scan the |" - echo -e "| USB ports for connected controller boards. This will |" - echo -e "| be similar to the 'ls /dev/serial/by-id/*' command |" - echo -e "| suggested by the official Klipper documentation for |" - echo -e "| determining successfull USB connections! |" - blank_line - echo -e "| ${cyan}UART:${white} |" - echo -e "| Selecting UART as the connection method will list all |" - echo -e "| possible UART serial ports. Note: This method ALWAYS |" - echo -e "| returns something as it seems impossible to determine |" - echo -e "| if a valid Klipper controller board is connected or |" - echo -e "| not. Because of that, you ${red}MUST${white} know which UART serial |" - echo -e "| port your controller board is connected to when using |" - echo -e "| this connection method. |" - 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_mcu_connection - break;; - *) - error_msg "Invalid command!";; - esac - done -} diff --git a/scripts/fluidd.sh b/scripts/fluidd.sh deleted file mode 100644 index 35620be..0000000 --- a/scripts/fluidd.sh +++ /dev/null @@ -1,510 +0,0 @@ -#!/usr/bin/env bash - -#=======================================================================# -# Copyright (C) 2020 - 2024 Dominik Willner # -# # -# 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 # -#=======================================================================# - -set -e - -#===================================================# -#================== INSTALL FLUIDD =================# -#===================================================# - -function install_fluidd() { - if [[ -z $(moonraker_systemd) ]]; then - local error="Moonraker not installed! It's recommended to install Moonraker first!" - print_error "${error}" - while true; do - local yn - read -p "${cyan}###### Proceed to install Fluidd without installing Moonraker? (y/N):${white} " yn - case "${yn}" in - Y|y|Yes|yes) - select_msg "Yes" - break;; - N|n|No|no|"") - select_msg "No" - abort_msg "Exiting Fluidd setup ...\n" - return;; - *) - error_msg "Invalid Input!";; - esac - done - fi - - ### checking dependencies - local dep=(wget nginx unzip) - dependency_check "${dep[@]}" - ### detect conflicting Haproxy and Apache2 installations - detect_conflicting_packages - - status_msg "Initializing Fluidd installation ..." - ### first, we create a backup of the full klipper_config dir - safety first! - backup_config_dir - - ### check for other enabled web interfaces - unset SET_LISTEN_PORT - detect_enabled_sites - - ### check if another site already listens to port 80 - fluidd_port_check - - ### download fluidd - download_fluidd - - ### ask user to install the recommended webinterface macros - install_fluidd_macros - - ### create /etc/nginx/conf.d/upstreams.conf - set_upstream_nginx_cfg - ### create /etc/nginx/sites-available/ - set_nginx_cfg "fluidd" - ### nginx on ubuntu 21 and above needs special permissions to access the files - set_nginx_permissions - - ### symlink nginx log - symlink_webui_nginx_log "fluidd" - - ### add fluidd to the update manager in moonraker.conf - patch_fluidd_update_manager - - fetch_webui_ports #WIP - - ### confirm message - print_confirm "Fluidd has been set up!" -} - -function install_fluidd_macros() { - local yn - while true; do - echo - top_border - echo -e "| It is recommended to use special macros in order to |" - echo -e "| have Fluidd fully functional and working. |" - blank_line - echo -e "| The recommended macros for Fluidd can be found here: |" - echo -e "| https://github.com/fluidd-core/fluidd-config |" - blank_line - echo -e "| If you already use these macros skip this step. |" - echo -e "| Otherwise you should consider to answer with 'yes' to |" - echo -e "| download the recommended macros. |" - bottom_border - read -p "${cyan}###### Download the recommended macros? (Y/n):${white} " yn - case "${yn}" in - Y|y|Yes|yes|"") - select_msg "Yes" - download_fluidd_macros - break;; - N|n|No|no) - select_msg "No" - break;; - *) - print_error "Invalid command!";; - esac - done - return -} - -function download_fluidd_macros() { - local ms_cfg_repo path configs regex line gcode_dir - - ms_cfg_repo="https://github.com/fluidd-core/fluidd-config.git" - regex="${HOME//\//\\/}\/([A-Za-z0-9_]+)\/config\/printer\.cfg" - configs=$(find "${HOME}" -maxdepth 3 -regextype posix-extended -regex "${regex}" | sort) - - if [[ -z ${configs} ]]; then - print_error "No printer.cfg found! Installation of Macros will be skipped ..." - log_error "execution stopped! reason: no printer.cfg found" - return - fi - - status_msg "Cloning fluidd-config ..." - [[ -d "${HOME}/fluidd-config" ]] && rm -rf "${HOME}/fluidd-config" - if git clone --recurse-submodules "${ms_cfg_repo}" "${HOME}/fluidd-config"; then - for config in ${configs}; do - path=$(echo "${config}" | rev | cut -d"/" -f2- | rev) - - if [[ -e "${path}/fluidd.cfg" && ! -h "${path}/fluidd.cfg" ]]; then - warn_msg "Attention! Existing fluidd.cfg detected!" - warn_msg "The file will be renamed to 'fluidd.bak.cfg' to be able to continue with the installation." - if ! mv "${path}/fluidd.cfg" "${path}/fluidd.bak.cfg"; then - error_msg "Renaming fluidd.cfg failed! Aborting installation ..." - return - fi - fi - - if [[ -h "${path}/fluidd.cfg" ]]; then - warn_msg "Recreating symlink in ${path} ..." - rm -rf "${path}/fluidd.cfg" - fi - - if ! ln -sf "${HOME}/fluidd-config/client.cfg" "${path}/fluidd.cfg"; then - error_msg "Creating symlink failed! Aborting installation ..." - return - fi - - if ! grep -Eq "^\[include fluidd.cfg\]$" "${path}/printer.cfg"; then - log_info "${path}/printer.cfg" - sed -i "1 i [include fluidd.cfg]" "${path}/printer.cfg" - fi - - line=$(($(grep -n "\[include fluidd.cfg\]" "${path}/printer.cfg" | tail -1 | cut -d: -f1) + 1)) - gcode_dir=${path/config/gcodes} - if ! grep -Eq "^\[virtual_sdcard\]$" "${path}/printer.cfg"; then - log_info "${path}/printer.cfg" - sed -i "${line} i \[virtual_sdcard]\npath: ${gcode_dir}\non_error_gcode: CANCEL_PRINT\n" "${path}/printer.cfg" - fi - done - else - print_error "Cloning failed! Aborting installation ..." - log_error "execution stopped! reason: cloning failed" - return - fi - - patch_fluidd_config_update_manager - - ok_msg "Done!" -} - -function download_fluidd() { - local url - url=$(get_fluidd_download_url) - - status_msg "Downloading Fluidd from ${url} ..." - - if [[ -d ${FLUIDD_DIR} ]]; then - rm -rf "${FLUIDD_DIR}" - fi - - mkdir "${FLUIDD_DIR}" && cd "${FLUIDD_DIR}" - - if wget "${url}"; then - ok_msg "Download complete!" - status_msg "Extracting archive ..." - unzip -q -o ./*.zip && ok_msg "Done!" - status_msg "Remove downloaded archive ..." - rm -rf ./*.zip && ok_msg "Done!" - else - print_error "Downloading Fluidd from\n ${url}\n failed!" - exit 1 - fi -} - -#===================================================# -#================== REMOVE FLUIDD ==================# -#===================================================# - -function remove_fluidd_dir() { - [[ ! -d ${FLUIDD_DIR} ]] && return - - status_msg "Removing Fluidd directory ..." - rm -rf "${FLUIDD_DIR}" && ok_msg "Directory removed!" -} - -function remove_fluidd_nginx_config() { - if [[ -e "/etc/nginx/sites-available/fluidd" ]]; then - status_msg "Removing Fluidd configuration for Nginx ..." - sudo rm "/etc/nginx/sites-available/fluidd" && ok_msg "File removed!" - fi - if [[ -L "/etc/nginx/sites-enabled/fluidd" ]]; then - status_msg "Removing Fluidd Symlink for Nginx ..." - sudo rm "/etc/nginx/sites-enabled/fluidd" && ok_msg "File removed!" - fi -} - -function remove_fluidd_logs() { - local files - files=$(find /var/log/nginx -name "fluidd*" 2> /dev/null | sort) - - if [[ -n ${files} ]]; then - for file in ${files}; do - status_msg "Removing ${file} ..." - sudo rm -f "${file}" - ok_msg "${file} removed!" - done - fi -} - -function remove_fluidd_log_symlinks() { - local files regex - - regex="${HOME//\//\\/}\/([A-Za-z0-9_]+)\/logs\/fluidd-.*" - files=$(find "${HOME}" -maxdepth 3 -regextype posix-extended -regex "${regex}" 2> /dev/null | sort) - - if [[ -n ${files} ]]; then - for file in ${files}; do - status_msg "Removing ${file} ..." - rm -f "${file}" - ok_msg "${file} removed!" - done - fi -} - -function remove_legacy_fluidd_log_symlinks() { - local files - files=$(find "${HOME}/klipper_logs" -name "fluidd*" 2> /dev/null | sort) - - if [[ -n ${files} ]]; then - for file in ${files}; do - status_msg "Removing ${file} ..." - rm -f "${file}" - ok_msg "${file} removed!" - done - fi -} - -function remove_fluidd_config() { - if [[ -d "${HOME}/fluidd-config" ]]; then - status_msg "Removing ${HOME}/fluidd-config ..." - rm -rf "${HOME}/fluidd-config" - ok_msg "${HOME}/fluidd-config removed!" - print_confirm "Fluidd-Config successfully removed!" - fi -} - -function remove_fluidd() { - remove_fluidd_dir - remove_fluidd_nginx_config - remove_fluidd_logs - remove_fluidd_log_symlinks - remove_legacy_fluidd_log_symlinks - - ### remove fluidd_port from ~/.kiauh.ini - sed -i "/^fluidd_port=/d" "${INI_FILE}" - - print_confirm "Fluidd successfully removed!" -} - -#===================================================# -#================== UPDATE FLUIDD ==================# -#===================================================# - -function update_fluidd() { - backup_before_update "fluidd" - status_msg "Updating Fluidd ..." - download_fluidd - match_nginx_configs - symlink_webui_nginx_log "fluidd" - print_confirm "Fluidd successfully updated!" -} - -#===================================================# -#================== FLUIDD STATUS ==================# -#===================================================# - -function get_fluidd_status() { - local status - local data_arr=("${FLUIDD_DIR}" "${NGINX_SA}/fluidd" "${NGINX_SE}/fluidd") - - ### count+1 for each found data-item from array - local filecount=0 - for data in "${data_arr[@]}"; do - [[ -e ${data} ]] && filecount=$(( filecount + 1 )) - done - - if (( filecount == ${#data_arr[*]} )); then - status="Installed!" - elif (( filecount == 0 )); then - status="Not installed!" - else - status="Incomplete!" - fi - echo "${status}" -} - -function get_local_fluidd_version() { - local versionfile="${FLUIDD_DIR}/.version" - local relinfofile="${FLUIDD_DIR}/release_info.json" - local version - - if [[ -f ${relinfofile} ]]; then - version=$(grep -o '"version":"[^"]*' "${relinfofile}" | grep -o '[^"]*$') - elif [[ -f ${versionfile} ]]; then - version=$(head -n 1 "${versionfile}") - fi - - echo "${version}" -} - -function get_remote_fluidd_version() { - [[ ! $(dpkg-query -f'${Status}' --show curl 2>/dev/null) = *\ installed ]] && return - - local tags - tags=$(curl -s "https://api.github.com/repos/fluidd-core/fluidd/tags" | grep "name" | cut -d'"' -f4) - echo "${tags}" | head -1 -} - -function compare_fluidd_versions() { - local versions local_ver remote_ver - local_ver="$(get_local_fluidd_version)" - remote_ver="$(get_remote_fluidd_version)" - - if [[ ${local_ver} != "${remote_ver}" && ${local_ver} != "" ]]; then - versions="${yellow}$(printf " %-14s" "${local_ver}")${white}" - versions+="|${green}$(printf " %-13s" "${remote_ver}")${white}" - # add moonraker to application_updates_available in kiauh.ini - add_to_application_updates "fluidd" - else - versions="${green}$(printf " %-14s" "${local_ver}")${white}" - versions+="|${green}$(printf " %-13s" "${remote_ver}")${white}" - fi - - echo "${versions}" -} - -#================================================# -#=================== HELPERS ====================# -#================================================# - -function get_fluidd_download_url() { - local releases_by_tag tags tag unstable_url url - - ### latest stable download url - url="https://github.com/fluidd-core/fluidd/releases/latest/download/fluidd.zip" - - read_kiauh_ini "${FUNCNAME[0]}" - if [[ ${fluidd_install_unstable} == "true" ]]; then - releases_by_tag="https://api.github.com/repos/fluidd-core/fluidd/tags" - tags=$(curl -s "${releases_by_tag}" | grep "name" | cut -d'"' -f4) - tag=$(echo "${tags}" | head -1) - - ### latest unstable download url including pre-releases (alpha, beta, rc) - unstable_url="https://github.com/fluidd-core/fluidd/releases/download/${tag}/fluidd.zip" - - if [[ ${unstable_url} == *"download//"* ]]; then - warn_msg "Download URL broken! Falling back to URL of latest stable release!" - else - url=${unstable_url} - fi - fi - - echo "${url}" -} - -function fluidd_port_check() { - if [[ ${FLUIDD_ENABLED} == "false" ]]; then - - if [[ ${SITE_ENABLED} == "true" ]]; then - status_msg "Detected other enabled interfaces:" - - [[ ${MAINSAIL_ENABLED} == "true" ]] && \ - echo " ${cyan}● Mainsail - Port: ${MAINSAIL_PORT}${white}" - - if [[ ${MAINSAIL_PORT} == "80" ]]; then - PORT_80_BLOCKED="true" - select_fluidd_port - fi - else - DEFAULT_PORT=$(grep listen "${KIAUH_SRCDIR}/resources/fluidd" | head -1 | sed 's/^\s*//' | cut -d" " -f2 | cut -d";" -f1) - SET_LISTEN_PORT=${DEFAULT_PORT} - fi - SET_NGINX_CFG="true" - - else - SET_NGINX_CFG="false" - fi -} - -function select_fluidd_port() { - if [[ ${PORT_80_BLOCKED} == "true" ]]; then - echo - top_border - echo -e "| ${red}!!!WARNING!!!${white} |" - echo -e "| ${red}You need to choose a different port for Fluidd!${white} |" - echo -e "| ${red}The following web interface is listening at port 80:${white} |" - blank_line - [[ ${MAINSAIL_PORT} == "80" ]] && echo "| ● Mainsail |" - blank_line - echo -e "| Make sure you don't choose a port which was already |" - echo -e "| assigned to another webinterface! |" - blank_line - echo -e "| Be aware: there is ${red}NO${white} sanity check for the following |" - echo -e "| input. So make sure to choose a valid port! |" - bottom_border - - local new_port re="^[0-9]+$" - while true; do - read -p "${cyan}Please enter a new Port:${white} " new_port - if [[ ${new_port} =~ ${re} && ${new_port} != "${MAINSAIL_PORT}" ]]; then - select_msg "Setting port ${new_port} for Fluidd!" - SET_LISTEN_PORT=${new_port} - break - else - if [[ ! ${new_port} =~ ${re} ]]; then - error_msg "Invalid input!" - else - error_msg "Port already taken! Select a different one!" - fi - fi - done - fi -} - -function patch_fluidd_update_manager() { - local patched moonraker_configs regex - regex="${HOME//\//\\/}\/([A-Za-z0-9_]+)\/config\/moonraker\.conf" - moonraker_configs=$(find "${HOME}" -maxdepth 3 -type f -regextype posix-extended -regex "${regex}" | sort) - - patched="false" - for conf in ${moonraker_configs}; do - if ! grep -Eq "^\[update_manager fluidd\]\s*$" "${conf}"; then - ### add new line to conf if it doesn't end with one - [[ $(tail -c1 "${conf}" | wc -l) -eq 0 ]] && echo "" >> "${conf}" - - ### add Fluidds update manager section to moonraker.conf - status_msg "Adding Fluidd to update manager in file:\n ${conf}" - /bin/sh -c "cat >> ${conf}" << MOONRAKER_CONF - -[update_manager fluidd] -type: web -channel: stable -repo: fluidd-core/fluidd -path: ~/fluidd -MOONRAKER_CONF - - fi - - patched="true" - done - - if [[ ${patched} == "true" ]]; then - do_action_service "restart" "moonraker" - fi -} - -function patch_fluidd_config_update_manager() { - local patched moonraker_configs regex - regex="${HOME//\//\\/}\/([A-Za-z0-9_]+)\/config\/moonraker\.conf" - moonraker_configs=$(find "${HOME}" -maxdepth 3 -type f -regextype posix-extended -regex "${regex}" | sort) - - patched="false" - for conf in ${moonraker_configs}; do - if ! grep -Eq "^\[update_manager fluidd-config\]\s*$" "${conf}"; then - ### add new line to conf if it doesn't end with one - [[ $(tail -c1 "${conf}" | wc -l) -eq 0 ]] && echo "" >> "${conf}" - - ### add Fluidds update manager section to moonraker.conf - status_msg "Adding Fluidd-Config to update manager in file:\n ${conf}" - /bin/sh -c "cat >> ${conf}" << MOONRAKER_CONF - -[update_manager fluidd-config] -type: git_repo -primary_branch: master -path: ~/fluidd-config -origin: https://github.com/fluidd-core/fluidd-config.git -managed_services: klipper -MOONRAKER_CONF - - fi - - patched="true" - done - - if [[ ${patched} == "true" ]]; then - do_action_service "restart" "moonraker" - fi -} diff --git a/scripts/gcode_shell_command.sh b/scripts/gcode_shell_command.sh deleted file mode 100644 index ff804d3..0000000 --- a/scripts/gcode_shell_command.sh +++ /dev/null @@ -1,123 +0,0 @@ -#!/usr/bin/env bash - -#=======================================================================# -# Copyright (C) 2020 - 2024 Dominik Willner # -# # -# 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 # -#=======================================================================# - -set -e - -#=================================================# -#======== INSTALL GCODE_SHELL_COMMAND.PY =========# -#=================================================# - -function setup_gcode_shell_command() { - top_border - echo -e "| You are about to install the 'G-Code Shell Command' |" - echo -e "| extension. Please make sure to read the instructions |" - echo -e "| before you continue and remember that potential risks |" - echo -e "| can be involved after installing this extension! |" - blank_line - echo -e "| ${red}You accept that you are doing this on your own risk!${white} |" - bottom_border - - local yn - while true; do - read -p "${cyan}###### Do you want to continue? (Y/n):${white} " yn - case "${yn}" in - Y|y|Yes|yes|"") - select_msg "Yes" - - if [[ ! -d "${KLIPPER_DIR}/klippy/extras" ]]; then - print_error "Folder ~/klipper/klippy/extras not found!\n Klipper not installed yet?" - return - fi - - status_msg "Installing gcode shell command extension ..." - - if [[ ! -f "${KLIPPER_DIR}/klippy/extras/gcode_shell_command.py" ]]; then - install_gcode_shell_command - else - echo; warn_msg "File 'gcode_shell_command.py' already exists in the destination location!" - - while true; do - read -p "${cyan}###### Do you want to overwrite it? (Y/n):${white} " yn - case "${yn}" in - Y|y|Yes|yes|"") - select_msg "Yes" - rm -f "${KLIPPER_DIR}/klippy/extras/gcode_shell_command.py" - install_gcode_shell_command - break;; - N|n|No|no) - select_msg "No" - break;; - *) - error_msg "Invalid Input!";; - esac - done - fi - return;; - N|n|No|no) - select_msg "No" - return;; - *) - error_msg "Invalid Input!";; - esac - done -} - -function install_gcode_shell_command() { - do_action_service "stop" "klipper" - status_msg "Copy 'gcode_shell_command.py' to '${KLIPPER_DIR}/klippy/extras' ..." - - if cp "${KIAUH_SRCDIR}/resources/gcode_shell_command.py" "${KLIPPER_DIR}/klippy/extras"; then - ok_msg "Done!" - else - error_msg "Cannot copy file to target destination...Exiting!" - return 1 - fi - - local yn - while true; do - echo - read -p "${cyan}###### Create an example shell command? (Y/n):${white} " yn - case "${yn}" in - Y|y|Yes|yes|"") - select_msg "Yes" - create_example_shell_command - break;; - N|n|No|no) - select_msg "No" - break;; - esac - done - - do_action_service "restart" "klipper" - print_confirm "Shell command extension installed!" - return -} - -function create_example_shell_command() { - ### create a backup of the config folder - backup_config_dir - - local configs regex path - regex="${HOME//\//\\/}\/([A-Za-z0-9_]+)\/config\/printer\.cfg" - configs=$(find "${HOME}" -maxdepth 3 -regextype posix-extended -regex "${regex}" | sort) - - for cfg in ${configs}; do - path=$(echo "${cfg}" | rev | cut -d"/" -f2- | rev) - - if [[ ! -f "${path}/shell_command.cfg" ]]; then - status_msg "Copy shell_command.cfg to ${path} ..." - cp "${KIAUH_SRCDIR}/resources/shell_command.cfg" "${path}" - ok_msg "${path}/shell_command.cfg created!" - ### write include to the very first line of the printer.cfg - sed -i "1 i [include shell_command.cfg]" "${cfg}" - fi - done -} diff --git a/scripts/globals.sh b/scripts/globals.sh deleted file mode 100644 index 8690469..0000000 --- a/scripts/globals.sh +++ /dev/null @@ -1,95 +0,0 @@ -#!/usr/bin/env bash - -#=======================================================================# -# Copyright (C) 2020 - 2024 Dominik Willner # -# # -# 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 # -#=======================================================================# - -# shellcheck disable=SC2034 -set -e - -function set_globals() { - #=================== SYSTEM ===================# - SYSTEMD="/etc/systemd/system" - INITD="/etc/init.d" - ETCDEF="/etc/default" - - #=================== KIAUH ====================# - green=$(echo -en "\e[92m") - yellow=$(echo -en "\e[93m") - magenta=$(echo -en "\e[35m") - red=$(echo -en "\e[91m") - cyan=$(echo -en "\e[96m") - white=$(echo -en "\e[39m") - INI_FILE="${HOME}/.kiauh.ini" - LOGFILE="/tmp/kiauh.log" - RESOURCES="${KIAUH_SRCDIR}/resources" - BACKUP_DIR="${HOME}/kiauh-backups" - - #================== KLIPPER ===================# - KLIPPY_ENV="${HOME}/klippy-env" - KLIPPER_DIR="${HOME}/klipper" - KLIPPER_REPO="https://github.com/Klipper3d/klipper.git" - - #================= MOONRAKER ==================# - MOONRAKER_ENV="${HOME}/moonraker-env" - MOONRAKER_DIR="${HOME}/moonraker" - MOONRAKER_REPO="https://github.com/Arksine/moonraker.git" - - #================= MAINSAIL ===================# - MAINSAIL_DIR="${HOME}/mainsail" - - #================== FLUIDD ====================# - FLUIDD_DIR="${HOME}/fluidd" - - #=============== KLIPPERSCREEN ================# - KLIPPERSCREEN_ENV="${HOME}/.KlipperScreen-env" - KLIPPERSCREEN_DIR="${HOME}/KlipperScreen" - KLIPPERSCREEN_REPO="https://github.com/jordanruthe/KlipperScreen.git" - - #========== MOONRAKER-TELEGRAM-BOT ============# - TELEGRAM_BOT_ENV="${HOME}/moonraker-telegram-bot-env" - TELEGRAM_BOT_DIR="${HOME}/moonraker-telegram-bot" - TELEGRAM_BOT_REPO="https://github.com/nlef/moonraker-telegram-bot.git" - - #=============== PRETTY-GCODE =================# - PGC_DIR="${HOME}/pgcode" - PGC_REPO="https://github.com/Kragrathea/pgcode" - - #================== NGINX =====================# - NGINX_SA="/etc/nginx/sites-available" - NGINX_SE="/etc/nginx/sites-enabled" - NGINX_CONFD="/etc/nginx/conf.d" - - #=============== MOONRAKER-OBICO ================# - MOONRAKER_OBICO_DIR="${HOME}/moonraker-obico" - MOONRAKER_OBICO_REPO="https://github.com/TheSpaghettiDetective/moonraker-obico.git" - - #=============== OCTOEVERYWHERE ================# - OCTOEVERYWHERE_ENV="${HOME}/octoeverywhere-env" - OCTOEVERYWHERE_DIR="${HOME}/octoeverywhere" - OCTOEVERYWHERE_REPO="https://github.com/QuinnDamerell/OctoPrint-OctoEverywhere.git" - - #=============== Crowsnest ================# - CROWSNEST_DIR="${HOME}/crowsnest" - CROWSNEST_REPO="https://github.com/mainsail-crew/crowsnest.git" - - #=============== Mobileraker ================# - MOBILERAKER_ENV="${HOME}/mobileraker-env" - MOBILERAKER_DIR="${HOME}/mobileraker_companion" - MOBILERAKER_REPO="https://github.com/Clon1998/mobileraker_companion.git" - - #=============== OCTOAPP ================# - OCTOAPP_ENV="${HOME}/octoapp-env" - OCTOAPP_DIR="${HOME}/octoapp" - OCTOAPP_REPO="https://github.com/crysxd/OctoApp-Plugin.git" - - #=============== Spoolman ================# - SPOOLMAN_DIR="${HOME}/Spoolman" - SPOOLMAN_DB_DIR="${HOME}/.local/share/spoolman" - SPOOLMAN_REPO="https://api.github.com/repos/Donkie/Spoolman/releases/latest" -} diff --git a/scripts/klipper.sh b/scripts/klipper.sh deleted file mode 100644 index a7eef70..0000000 --- a/scripts/klipper.sh +++ /dev/null @@ -1,664 +0,0 @@ -#!/usr/bin/env bash - -#=======================================================================# -# Copyright (C) 2020 - 2024 Dominik Willner # -# # -# 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 # -#=======================================================================# - -set -e - -#TODO (multi instance): -# if the klipper installer is started another time while other klipper -# instances are detected, ask if new instances should be added - -#=================================================# -#================ INSTALL KLIPPER ================# -#=================================================# - -### -# this function detects all installed klipper -# systemd instances and returns their absolute path -function klipper_systemd() { - local services - local blacklist - local ignore - local match - - ### - # any service that uses "klipper" in its own name but isn't a full klipper service must be blacklisted using - # this variable, otherwise they will be falsely recognized as klipper instances. E.g. "klipper-mcu.service" - # is not a klipper service, but related to klippers linux mcu, which also requires its own service file, hence - # it must be blacklisted. - blacklist="mcu" - - ignore="${SYSTEMD}/klipper-(${blacklist}).service" - match="${SYSTEMD}/klipper(-[0-9a-zA-Z]+)?.service" - - services=$(find "${SYSTEMD}" -maxdepth 1 -regextype awk ! -regex "${ignore}" -regex "${match}" | sort) - echo "${services}" -} - -function start_klipper_setup() { - local klipper_systemd_services - local python_version - local instance_count - local instance_names - local use_custom_names - local input - local regex - local blacklist - local error - - status_msg "Initializing Klipper installation ...\n" - - ### return early if klipper already exists - klipper_systemd_services=$(klipper_systemd) - - if [[ -n ${klipper_systemd_services} ]]; then - error="At least one Klipper service is already installed:" - - for s in ${klipper_systemd_services}; do - log_info "Found Klipper service: ${s}" - error="${error}\n ➔ ${s}" - done - fi - [[ -n ${error} ]] && print_error "${error}" && return - - ### user selection for python version - print_dialog_user_select_python_version - while true; do - read -p "${cyan}###### Select Python version:${white} " -i "1" -e input - case "${input}" in - 1) - select_msg "Python 3.x\n" - python_version=3 - break;; - 2) - select_msg "Python 2.7\n" - python_version=2 - break;; - B|b) - clear; install_menu; break;; - *) - error_msg "Invalid Input!\n";; - esac - done && input="" - - ### user selection for instance count - print_dialog_user_select_instance_count - regex="^[1-9][0-9]*$" - while [[ ! ${input} =~ ${regex} ]]; do - read -p "${cyan}###### Number of Klipper instances to set up:${white} " -i "1" -e input - - if [[ ${input} =~ ${regex} ]]; then - instance_count="${input}" - select_msg "Instance count: ${instance_count}\n" - break - elif [[ ${input} == "B" || ${input} == "b" ]]; then - install_menu - else - error_msg "Invalid Input!\n" - fi - done && input="" - - ### user selection for custom names - use_custom_names="false" - if (( instance_count > 1 )); then - print_dialog_user_select_custom_name_bool - while true; do - read -p "${cyan}###### Assign custom names? (y/N):${white} " input - case "${input}" in - Y|y|Yes|yes) - select_msg "Yes\n" - use_custom_names="true" - break;; - N|n|No|no|"") - select_msg "No\n" - break;; - B|b) - clear; install_menu; break;; - *) - error_msg "Invalid Input!\n";; - esac - done && input="" - else - instance_names+=("printer") - fi - - ### user selection for setting the actual custom names - shopt -s nocasematch - if (( instance_count > 1 )) && [[ ${use_custom_names} == "true" ]]; then - local i - - i=1 - regex="^[0-9a-zA-Z]+$" - blacklist="mcu" - while [[ ! ${input} =~ ${regex} || ${input} =~ ${blacklist} || ${i} -le ${instance_count} ]]; do - read -p "${cyan}###### Name for instance #${i}:${white} " input - - if [[ ${input} =~ ${blacklist} ]]; then - error_msg "Name not allowed! You are trying to use a reserved name." - elif [[ ${input} =~ ${regex} && ! ${input} =~ ${blacklist} ]]; then - select_msg "Name: ${input}\n" - if [[ ${input} =~ ^[0-9]+$ ]]; then - instance_names+=("printer_${input}") - else - instance_names+=("${input}") - fi - i=$(( i + 1 )) - else - error_msg "Invalid Input!\n" - fi - done && input="" - elif (( instance_count > 1 )) && [[ ${use_custom_names} == "false" ]]; then - for (( i=1; i <= instance_count; i++ )); do - instance_names+=("printer_${i}") - done - fi - shopt -u nocasematch - - (( instance_count > 1 )) && status_msg "Installing ${instance_count} Klipper instances ..." - (( instance_count == 1 )) && status_msg "Installing single Klipper instance ..." - - run_klipper_setup "${python_version}" "${instance_names[@]}" -} - -function print_dialog_user_select_python_version() { - top_border - echo -e "| Please select your preferred Python version. | " - echo -e "| The recommended version is Python 3.x. | " - hr - echo -e "| 1) [Python 3.x] (recommended) | " - echo -e "| 2) [Python 2.7] ${yellow}(legacy)${white} | " - back_footer -} - -function print_dialog_user_select_instance_count() { - top_border - echo -e "| Please select the number of Klipper instances to set |" - echo -e "| up. The number of Klipper instances will determine |" - echo -e "| the amount of printers you can run from this host. |" - blank_line - echo -e "| ${yellow}WARNING:${white} |" - echo -e "| ${yellow}Setting up too many instances may crash your system.${white} |" - back_footer -} - -function print_dialog_user_select_custom_name_bool() { - top_border - echo -e "| You can now assign a custom name to each instance. |" - echo -e "| If skipped, each instance will get an index assigned |" - echo -e "| in ascending order, starting at index '1'. |" - blank_line - echo -e "| Info: |" - echo -e "| Only alphanumeric characters for names are allowed! |" - back_footer -} - -function run_klipper_setup() { - read_kiauh_ini "${FUNCNAME[0]}" - - local python_version=${1} - local instance_names - local confirm - local custom_repo - local custom_branch - local dep - - shift 1 - read -r -a instance_names <<< "${@}" - - custom_repo="${custom_klipper_repo}" - custom_branch="${custom_klipper_repo_branch}" - dep=(git) - - ### checking dependencies - dependency_check "${dep[@]}" - - ### step 1: clone klipper - clone_klipper "${custom_repo}" "${custom_branch}" - - ### step 2: install klipper dependencies and create python virtualenv - install_klipper_packages "${python_version}" - create_klipper_virtualenv "${python_version}" - - ### step 3: create klipper instances - for instance in "${instance_names[@]}"; do - create_klipper_service "${instance}" - done - - ### step 4: enable and start all instances - do_action_service "enable" "klipper" - do_action_service "start" "klipper" - - ### step 5: check for dialout group membership - check_usergroups - - ### confirm message - (( ${#instance_names[@]} == 1 )) && confirm="Klipper has been set up!" - (( ${#instance_names[@]} > 1 )) && confirm="${#instance_names[@]} Klipper instances have been set up!" - - ### finalizing the setup with writing instance names to the kiauh.ini - set_multi_instance_names - mask_disrupting_services - - print_confirm "${confirm}" && return -} - -function clone_klipper() { - local repo=${1} branch=${2} - - [[ -z ${repo} ]] && repo="${KLIPPER_REPO}" - repo=$(echo "${repo}" | sed -r "s/^(http|https):\/\/github\.com\///i; s/\.git$//") - repo="https://github.com/${repo}" - - [[ -z ${branch} ]] && branch="master" - - ### force remove existing klipper dir and clone into fresh klipper dir - [[ -d ${KLIPPER_DIR} ]] && rm -rf "${KLIPPER_DIR}" - - status_msg "Cloning Klipper from ${repo} ..." - - cd "${HOME}" || exit 1 - if git clone "${repo}" "${KLIPPER_DIR}"; then - cd "${KLIPPER_DIR}" && git checkout "${branch}" - else - print_error "Cloning Klipper from\n ${repo}\n failed!" - exit 1 - fi -} - -function create_klipper_virtualenv() { - local python_version="${1}" - - [[ -d ${KLIPPY_ENV} ]] && rm -rf "${KLIPPY_ENV}" - - status_msg "Installing $("python${python_version}" -V) virtual environment..." - - if virtualenv -p "python${python_version}" "${KLIPPY_ENV}"; then - "${KLIPPY_ENV}"/bin/pip install -r "${KLIPPER_DIR}"/scripts/klippy-requirements.txt - else - log_error "failure while creating python3 klippy-env" - error_msg "Creation of Klipper virtualenv failed!" - exit 1 - fi -} - -### -# extracts the required packages from the -# install-debian.sh script and installs them -# -# @param {string}: python_version - klipper-env python version -# -function install_klipper_packages() { - local packages log_name="Klipper" python_version="${1}" - local install_script="${KLIPPER_DIR}/scripts/install-debian.sh" - - status_msg "Reading dependencies..." - # shellcheck disable=SC2016 - packages=$(grep "PKGLIST=" "${install_script}" | cut -d'"' -f2 | sed 's/\${PKGLIST}//g' | tr -d '\n') - ### add dfu-util for octopi-images - packages+=" dfu-util" - ### add pkg-config for rp2040 build - packages+=" pkg-config" - ### add dbus requirement for DietPi distro - [[ -e "/boot/dietpi/.version" ]] && packages+=" dbus" - - if (( python_version == 3 )); then - ### replace python-dev with python3-dev if python3 was selected - packages="${packages//python-dev/python3-dev}" - elif (( python_version == 2 )); then - ### package name 'python-dev' is deprecated (-> no installation candidate) on more modern linux distros - packages="${packages//python-dev/python2-dev}" - else - log_error "Internal Error: missing parameter 'python_version' during function call of ${FUNCNAME[0]}" - error_msg "Internal Error: missing parameter 'python_version' during function call of ${FUNCNAME[0]}" - exit 1 - fi - - echo "${cyan}${packages}${white}" | tr '[:space:]' '\n' - read -r -a packages <<< "${packages}" - - ### Update system package lists if stale - update_system_package_lists - - ### Install required packages - install_system_packages "${log_name}" "packages[@]" -} - -function create_klipper_service() { - local instance_name=${1} - - local printer_data - local cfg_dir - local gcodes_dir - local cfg - local log - local klippy_serial - local klippy_socket - local env_file - local service - local service_template - local env_template - local suffix - - 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" - klippy_socket="${printer_data}/comms/klippy.sock" - env_file="${printer_data}/systemd/klipper.env" - - if [[ ${instance_name} == "printer" ]]; then - suffix="${instance_name//printer/}" - else - suffix="-${instance_name//printer_/}" - fi - - create_required_folders "${printer_data}" - - service_template="${KIAUH_SRCDIR}/resources/klipper.service" - env_template="${KIAUH_SRCDIR}/resources/klipper.env" - service="${SYSTEMD}/klipper${suffix}.service" - - if [[ ! -f ${service} ]]; then - status_msg "Create Klipper service file ..." - - sudo cp "${service_template}" "${service}" - sudo cp "${env_template}" "${env_file}" - sudo sed -i "s|%USER%|${USER}|g; s|%KLIPPER_DIR%|${KLIPPER_DIR}|; s|%ENV%|${KLIPPY_ENV}|; s|%ENV_FILE%|${env_file}|" "${service}" - sudo sed -i "s|%USER%|${USER}|; s|%KLIPPER_DIR%|${KLIPPER_DIR}|; s|%LOG%|${log}|; s|%CFG%|${cfg}|; s|%PRINTER%|${klippy_serial}|; s|%UDS%|${klippy_socket}|" "${env_file}" - - ok_msg "Klipper service file created!" - fi - - if [[ ! -f ${cfg} ]]; then - 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!" - fi -} - -#================================================# -#================ REMOVE KLIPPER ================# -#================================================# - -function remove_klipper_service() { - [[ -z $(klipper_systemd) ]] && return - - status_msg "Removing Klipper services ..." - - for service in $(klipper_systemd | cut -d"/" -f5); do - status_msg "Removing ${service} ..." - sudo systemctl stop "${service}" - sudo systemctl disable "${service}" - sudo rm -f "${SYSTEMD}/${service}" - sudo systemctl daemon-reload - sudo systemctl reset-failed - done - - ok_msg "All Klipper services removed!" -} - -function find_instance_files() { - local target_folder=${1} - local target_name=${2} - local files - - readarray -t files < <(find "${HOME}" -regex "${HOME}/[A-Za-z0-9_]+_data/${target_folder}/${target_name}" | sort) - - echo -e "${files[@]}" -} - -function find_legacy_klipper_logs() { - local files - local regex="klippy(-[0-9a-zA-Z]+)?\.log(.*)?" - - readarray -t files < <(find "${HOME}/klipper_logs" -maxdepth 1 -regextype posix-extended -regex "${HOME}/klipper_logs/${regex}" 2> /dev/null | sort) - echo -e "${files[@]}" -} - -function find_legacy_klipper_uds() { - local files - - readarray -t files < <(find /tmp -maxdepth 1 -regextype posix-extended -regex "/tmp/klippy_uds(-[0-9a-zA-Z]+)?" | sort) - echo -e "${files[@]}" -} - -function find_legacy_klipper_printer() { - local files - - readarray -t files < <(find /tmp -maxdepth 1 -regextype posix-extended -regex "/tmp/printer(-[0-9a-zA-Z]+)?" | sort) - echo -e "${files[@]}" -} - -function remove_klipper_dir() { - [[ ! -d ${KLIPPER_DIR} ]] && return - - status_msg "Removing Klipper directory ..." - rm -rf "${KLIPPER_DIR}" - ok_msg "Directory removed!" -} - -function remove_klipper_env() { - [[ ! -d ${KLIPPY_ENV} ]] && return - - status_msg "Removing klippy-env directory ..." - rm -rf "${KLIPPY_ENV}" - ok_msg "Directory removed!" -} - -### -# takes in a string of space separated absolute -# filepaths and removes those files one after another -# -function remove_files() { - local files - read -r -a files <<< "${@}" - - if (( ${#files[@]} > 0 )); then - for file in "${files[@]}"; do - status_msg "Removing ${file} ..." - rm -f "${file}" - ok_msg "${file} removed!" - done - fi -} - -function remove_klipper() { - remove_klipper_service - remove_files "$(find_instance_files "systemd" "klipper.env")" - remove_files "$(find_instance_files "logs" "klippy.log.*")" - remove_files "$(find_instance_files "comms" "klippy.sock")" - remove_files "$(find_instance_files "comms" "klippy.serial")" - - remove_files "$(find_legacy_klipper_logs)" - remove_files "$(find_legacy_klipper_uds)" - remove_files "$(find_legacy_klipper_printer)" - - remove_klipper_dir - remove_klipper_env - - print_confirm "Klipper was successfully removed!" && return -} - -#================================================# -#================ UPDATE KLIPPER ================# -#================================================# - -### -# stops klipper, performs a git pull, installs -# possible new dependencies, then restarts klipper -# -function update_klipper() { - read_kiauh_ini "${FUNCNAME[0]}" - - local py_ver - local custom_repo="${custom_klipper_repo}" - local custom_branch="${custom_klipper_repo_branch}" - - py_ver=$(get_klipper_python_ver) - - do_action_service "stop" "klipper" - - if [[ ! -d ${KLIPPER_DIR} ]]; then - clone_klipper "${custom_repo}" "${custom_branch}" - else - backup_before_update "klipper" - - status_msg "Updating Klipper ..." - cd "${KLIPPER_DIR}" && git pull - ### read PKGLIST and install possible new dependencies - install_klipper_packages "${py_ver}" - ### install possible new python dependencies - "${KLIPPY_ENV}"/bin/pip install -r "${KLIPPER_DIR}/scripts/klippy-requirements.txt" - fi - - ok_msg "Update complete!" - do_action_service "restart" "klipper" -} - -#================================================# -#================ KLIPPER STATUS ================# -#================================================# - -function get_klipper_status() { - local sf_count status py_ver - sf_count="$(klipper_systemd | wc -w)" - - py_ver=$(get_klipper_python_ver) - - ### remove the "SERVICE" entry from the data array if a klipper service is installed - local data_arr=(SERVICE "${KLIPPER_DIR}" "${KLIPPY_ENV}") - (( sf_count > 0 )) && unset "data_arr[0]" - - ### count+1 for each found data-item from array - local filecount=0 - for data in "${data_arr[@]}"; do - [[ -e ${data} ]] && filecount=$(( filecount + 1 )) - done - - if (( filecount == ${#data_arr[*]} )); then - if (( py_ver == 3 )); then - status="Installed: ${sf_count}(py${py_ver})" - else - status="Installed: ${sf_count}" - fi - elif (( filecount == 0 )); then - status="Not installed!" - else - status="Incomplete!" - fi - - echo "${status}" -} - -function get_local_klipper_commit() { - [[ ! -d ${KLIPPER_DIR} || ! -d "${KLIPPER_DIR}/.git" ]] && return - - local commit - cd "${KLIPPER_DIR}" - commit="$(git describe HEAD --always --tags | cut -d "-" -f 1,2)" - echo "${commit}" -} - -function get_remote_klipper_commit() { - [[ ! -d ${KLIPPER_DIR} || ! -d "${KLIPPER_DIR}/.git" ]] && return - - local commit - local branch - - read_kiauh_ini "${FUNCNAME[0]}" - branch="${custom_klipper_repo_branch}" - [[ -z ${branch} ]] && branch="master" - - cd "${KLIPPER_DIR}" && git fetch origin -q - commit=$(git describe "origin/${branch}" --always --tags | cut -d "-" -f 1,2) - echo "${commit}" -} - -function compare_klipper_versions() { - local versions local_ver remote_ver - local_ver="$(get_local_klipper_commit)" - remote_ver="$(get_remote_klipper_commit)" - - if [[ ${local_ver} != "${remote_ver}" ]]; then - versions="${yellow}$(printf " %-14s" "${local_ver}")${white}" - versions+="|${green}$(printf " %-13s" "${remote_ver}")${white}" - # add klipper to application_updates_available in kiauh.ini - add_to_application_updates "klipper" - else - versions="${green}$(printf " %-14s" "${local_ver}")${white}" - versions+="|${green}$(printf " %-13s" "${remote_ver}")${white}" - fi - - echo "${versions}" -} - -#================================================# -#=================== HELPERS ====================# -#================================================# - -### -# reads the python version from the klipper virtual environment -# -# @output: writes the python major version to STDOUT -# -function get_klipper_python_ver() { - [[ ! -d ${KLIPPY_ENV} ]] && return - - local version - 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!" -} diff --git a/scripts/klipperscreen.sh b/scripts/klipperscreen.sh deleted file mode 100644 index fd0cc29..0000000 --- a/scripts/klipperscreen.sh +++ /dev/null @@ -1,237 +0,0 @@ -#!/usr/bin/env bash - -#=======================================================================# -# Copyright (C) 2020 - 2024 Dominik Willner # -# # -# 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 # -#=======================================================================# - -set -e - -#===================================================# -#============== INSTALL KLIPPERSCREEN ==============# -#===================================================# - -function klipperscreen_systemd() { - local services - services=$(find "${SYSTEMD}" -maxdepth 1 -regextype posix-extended -regex "${SYSTEMD}/KlipperScreen.service") - echo "${services}" -} - -function install_klipperscreen() { - ### return early if python version check fails - if [[ $(python3_check) == "false" ]]; then - local error="Versioncheck failed! Python 3.7 or newer required!\n" - error="${error} Please upgrade Python." - print_error "${error}" && return - fi - - ### first, we create a backup of the full klipper_config dir - safety first! - backup_config_dir - - ### install KlipperScreen - klipperscreen_setup - - ### add klipperscreen to the update manager in moonraker.conf - patch_klipperscreen_update_manager - - do_action_service "restart" "KlipperScreen" -} - -function klipperscreen_setup() { - local dep=(wget curl unzip dfu-util) - dependency_check "${dep[@]}" - status_msg "Cloning KlipperScreen from ${KLIPPERSCREEN_REPO} ..." - - # force remove existing KlipperScreen dir - [[ -d ${KLIPPERSCREEN_DIR} ]] && rm -rf "${KLIPPERSCREEN_DIR}" - - # clone into fresh KlipperScreen dir - cd "${HOME}" || exit 1 - if ! git clone "${KLIPPERSCREEN_REPO}" "${KLIPPERSCREEN_DIR}"; then - print_error "Cloning KlipperScreen from\n ${KLIPPERSCREEN_REPO}\n failed!" - exit 1 - fi - - status_msg "Installing KlipperScreen ..." - if "${KLIPPERSCREEN_DIR}"/scripts/KlipperScreen-install.sh; then - ok_msg "KlipperScreen successfully installed!" - else - print_error "KlipperScreen installation failed!" - exit 1 - fi -} - -#===================================================# -#=============== REMOVE KLIPPERSCREEN ==============# -#===================================================# - -function remove_klipperscreen() { - ### remove KlipperScreen dir - if [[ -d ${KLIPPERSCREEN_DIR} ]]; then - status_msg "Removing KlipperScreen directory ..." - rm -rf "${KLIPPERSCREEN_DIR}" && ok_msg "Directory removed!" - fi - - ### remove KlipperScreen VENV dir - if [[ -d ${KLIPPERSCREEN_ENV} ]]; then - status_msg "Removing KlipperScreen VENV directory ..." - rm -rf "${KLIPPERSCREEN_ENV}" && ok_msg "Directory removed!" - fi - - ### remove KlipperScreen service - if [[ -e "${SYSTEMD}/KlipperScreen.service" ]]; then - status_msg "Removing KlipperScreen service ..." - do_action_service "stop" "KlipperScreen" - do_action_service "disable" "KlipperScreen" - sudo rm -f "${SYSTEMD}/KlipperScreen.service" - - ###reloading units - sudo systemctl daemon-reload - sudo systemctl reset-failed - ok_msg "KlipperScreen Service removed!" - fi - - ### remove KlipperScreen log - if [[ -e "/tmp/KlipperScreen.log" ]]; then - status_msg "Removing KlipperScreen log file ..." - rm -f "/tmp/KlipperScreen.log" && ok_msg "File removed!" - fi - - ### remove KlipperScreen log symlink in config dir - if [[ -e "${KLIPPER_CONFIG}/KlipperScreen.log" ]]; then - status_msg "Removing KlipperScreen log symlink ..." - rm -f "${KLIPPER_CONFIG}/KlipperScreen.log" && ok_msg "File removed!" - fi - - print_confirm "KlipperScreen successfully removed!" -} - -#===================================================# -#=============== UPDATE KLIPPERSCREEN ==============# -#===================================================# - -function update_klipperscreen() { - local old_md5 - 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" - - if [[ $(md5sum "${KLIPPERSCREEN_DIR}/scripts/KlipperScreen-requirements.txt" | cut -d " " -f1) != "${old_md5}" ]]; then - status_msg "New dependencies detected..." - "${KLIPPERSCREEN_ENV}"/bin/pip install -r "${KLIPPERSCREEN_DIR}/scripts/KlipperScreen-requirements.txt" - ok_msg "Dependencies have been installed!" - fi - - ok_msg "Update complete!" - do_action_service "start" "KlipperScreen" -} - -#===================================================# -#=============== KLIPPERSCREEN STATUS ==============# -#===================================================# - -function get_klipperscreen_status() { - local sf_count status - sf_count="$(klipperscreen_systemd | wc -w)" - - ### remove the "SERVICE" entry from the data array if a moonraker service is installed - local data_arr=(SERVICE "${KLIPPERSCREEN_DIR}" "${KLIPPERSCREEN_ENV}") - (( sf_count > 0 )) && unset "data_arr[0]" - - ### count+1 for each found data-item from array - local filecount=0 - for data in "${data_arr[@]}"; do - [[ -e ${data} ]] && filecount=$(( filecount + 1 )) - done - - if (( filecount == ${#data_arr[*]} )); then - status="Installed!" - elif (( filecount == 0 )); then - status="Not installed!" - else - status="Incomplete!" - fi - echo "${status}" -} - -function get_local_klipperscreen_commit() { - [[ ! -d ${KLIPPERSCREEN_DIR} || ! -d "${KLIPPERSCREEN_DIR}/.git" ]] && return - - local commit - cd "${KLIPPERSCREEN_DIR}" - commit="$(git describe HEAD --always --tags | cut -d "-" -f 1,2)" - echo "${commit}" -} - -function get_remote_klipperscreen_commit() { - [[ ! -d ${KLIPPERSCREEN_DIR} || ! -d "${KLIPPERSCREEN_DIR}/.git" ]] && return - - local commit - cd "${KLIPPERSCREEN_DIR}" && git fetch origin -q - commit=$(git describe origin/master --always --tags | cut -d "-" -f 1,2) - echo "${commit}" -} - -function compare_klipperscreen_versions() { - local versions local_ver remote_ver - local_ver="$(get_local_klipperscreen_commit)" - remote_ver="$(get_remote_klipperscreen_commit)" - - if [[ ${local_ver} != "${remote_ver}" ]]; then - versions="${yellow}$(printf " %-14s" "${local_ver}")${white}" - versions+="|${green}$(printf " %-13s" "${remote_ver}")${white}" - # add moonraker to application_updates_available in kiauh.ini - add_to_application_updates "klipperscreen" - else - versions="${green}$(printf " %-14s" "${local_ver}")${white}" - versions+="|${green}$(printf " %-13s" "${remote_ver}")${white}" - fi - - echo "${versions}" -} - -#================================================# -#=================== HELPERS ====================# -#================================================# - -function patch_klipperscreen_update_manager() { - local patched="false" - local moonraker_configs - moonraker_configs=$(find "${KLIPPER_CONFIG}" -type f -name "moonraker.conf" | sort) - - for conf in ${moonraker_configs}; do - if ! grep -Eq "^\[update_manager KlipperScreen\]\s*$" "${conf}"; then - ### add new line to conf if it doesn't end with one - [[ $(tail -c1 "${conf}" | wc -l) -eq 0 ]] && echo "" >> "${conf}" - - ### add KlipperScreens update manager section to moonraker.conf - status_msg "Adding KlipperScreen to update manager in file:\n ${conf}" - /bin/sh -c "cat >> ${conf}" << MOONRAKER_CONF - -[update_manager KlipperScreen] -type: git_repo -path: ${HOME}/KlipperScreen -origin: https://github.com/jordanruthe/KlipperScreen.git -env: ${HOME}/.KlipperScreen-env/bin/python -requirements: scripts/KlipperScreen-requirements.txt -install_script: scripts/KlipperScreen-install.sh -MOONRAKER_CONF - - fi - - patched="true" - done - - if [[ ${patched} == "true" ]]; then - do_action_service "restart" "moonraker" - fi -} diff --git a/scripts/mainsail.sh b/scripts/mainsail.sh deleted file mode 100644 index 73ea7a5..0000000 --- a/scripts/mainsail.sh +++ /dev/null @@ -1,690 +0,0 @@ -#!/usr/bin/env bash - -#=======================================================================# -# Copyright (C) 2020 - 2024 Dominik Willner # -# # -# 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 # -#=======================================================================# - -set -e - -#===================================================# -#================= INSTALL MAINSAIL ================# -#===================================================# - -function install_mainsail() { - if [[ -z $(moonraker_systemd) ]]; then - local error="Moonraker not installed! It's recommended to install Moonraker first!" - print_error "${error}" - while true; do - local yn - read -p "${cyan}###### Proceed to install Mainsail without installing Moonraker? (y/N):${white} " yn - case "${yn}" in - Y|y|Yes|yes) - select_msg "Yes" - break;; - N|n|No|no|"") - select_msg "No" - abort_msg "Exiting Mainsail setup ...\n" - return;; - *) - error_msg "Invalid Input!";; - esac - done - fi - - ### checking dependencies - local dep=(wget nginx unzip) - dependency_check "${dep[@]}" - ### detect conflicting Haproxy and Apache2 installations - detect_conflicting_packages - - status_msg "Initializing Mainsail installation ..." - ### first, we create a backup of the full klipper_config dir - safety first! - backup_config_dir - - ### check for other enabled web interfaces - unset SET_LISTEN_PORT - detect_enabled_sites - - ### check if another site already listens to port 80 - mainsail_port_check - - ### download mainsail - download_mainsail - - ### ask user to install the recommended webinterface macros - install_mainsail_macros - - ### create /etc/nginx/conf.d/upstreams.conf - set_upstream_nginx_cfg - ### create /etc/nginx/sites-available/ - set_nginx_cfg "mainsail" - ### nginx on ubuntu 21 and above needs special permissions to access the files - set_nginx_permissions - - ### symlink nginx log - symlink_webui_nginx_log "mainsail" - - ### add mainsail to the update manager in moonraker.conf - patch_mainsail_update_manager - - fetch_webui_ports #WIP - - ### confirm message - print_confirm "Mainsail has been set up!" -} - -function install_mainsail_macros() { - local yn - while true; do - echo - top_border - echo -e "| It is recommended to use special macros in order to |" - echo -e "| have Mainsail fully functional and working. |" - blank_line - echo -e "| The recommended macros for Mainsail can be seen here: |" - echo -e "| https://github.com/mainsail-crew/mainsail-config |" - blank_line - echo -e "| If you already use these macros skip this step. |" - echo -e "| Otherwise you should consider to answer with 'yes' to |" - echo -e "| download the recommended macros. |" - bottom_border - read -p "${cyan}###### Download the recommended macros? (Y/n):${white} " yn - case "${yn}" in - Y|y|Yes|yes|"") - select_msg "Yes" - download_mainsail_macros - break;; - N|n|No|no) - select_msg "No" - break;; - *) - print_error "Invalid command!";; - esac - done - return -} - -function download_mainsail_macros() { - local ms_cfg_repo path configs regex line gcode_dir - - ms_cfg_repo="https://github.com/mainsail-crew/mainsail-config.git" - regex="${HOME//\//\\/}\/([A-Za-z0-9_]+)\/config\/printer\.cfg" - configs=$(find "${HOME}" -maxdepth 3 -regextype posix-extended -regex "${regex}" | sort) - - if [[ -z ${configs} ]]; then - print_error "No printer.cfg found! Installation of Macros will be skipped ..." - log_error "execution stopped! reason: no printer.cfg found" - return - fi - - status_msg "Cloning mainsail-config ..." - [[ -d "${HOME}/mainsail-config" ]] && rm -rf "${HOME}/mainsail-config" - if git clone "${ms_cfg_repo}" "${HOME}/mainsail-config"; then - for config in ${configs}; do - path=$(echo "${config}" | rev | cut -d"/" -f2- | rev) - - if [[ -e "${path}/mainsail.cfg" && ! -h "${path}/mainsail.cfg" ]]; then - warn_msg "Attention! Existing mainsail.cfg detected!" - warn_msg "The file will be renamed to 'mainsail.bak.cfg' to be able to continue with the installation." - if ! mv "${path}/mainsail.cfg" "${path}/mainsail.bak.cfg"; then - error_msg "Renaming mainsail.cfg failed! Aborting installation ..." - return - fi - fi - - if [[ -h "${path}/mainsail.cfg" ]]; then - warn_msg "Recreating symlink in ${path} ..." - rm -rf "${path}/mainsail.cfg" - fi - - if ! ln -sf "${HOME}/mainsail-config/client.cfg" "${path}/mainsail.cfg"; then - error_msg "Creating symlink failed! Aborting installation ..." - return - fi - - if ! grep -Eq "^\[include mainsail.cfg\]$" "${path}/printer.cfg"; then - log_info "${path}/printer.cfg" - sed -i "1 i [include mainsail.cfg]" "${path}/printer.cfg" - fi - - line=$(($(grep -n "\[include mainsail.cfg\]" "${path}/printer.cfg" | tail -1 | cut -d: -f1) + 1)) - gcode_dir=${path/config/gcodes} - if ! grep -Eq "^\[virtual_sdcard\]$" "${path}/printer.cfg"; then - log_info "${path}/printer.cfg" - sed -i "${line} i \[virtual_sdcard]\npath: ${gcode_dir}\non_error_gcode: CANCEL_PRINT\n" "${path}/printer.cfg" - fi - done - else - print_error "Cloning failed! Aborting installation ..." - log_error "execution stopped! reason: cloning failed" - return - fi - - patch_mainsail_config_update_manager - - ok_msg "Done!" -} - -function download_mainsail() { - local services - local url - url=$(get_mainsail_download_url) - - status_msg "Downloading Mainsail from ${url} ..." - - if [[ -d ${MAINSAIL_DIR} ]]; then - rm -rf "${MAINSAIL_DIR}" - fi - - mkdir "${MAINSAIL_DIR}" && cd "${MAINSAIL_DIR}" - - if wget "${url}"; then - ok_msg "Download complete!" - status_msg "Extracting archive ..." - unzip -q -o ./*.zip && ok_msg "Done!" - status_msg "Remove downloaded archive ..." - rm -rf ./*.zip && ok_msg "Done!" - else - print_error "Downloading Mainsail from\n ${url}\n failed!" - exit 1 - fi - - ### check for moonraker multi-instance and if no-instance or multi-instance was found, enable mainsails remoteMode - services=$(moonraker_systemd) - if [[ ( -z "${services}" ) || ( $(echo "${services}" | wc -w) -gt 1 ) ]]; then - enable_mainsail_remotemode - fi -} - -#===================================================# -#================= REMOVE MAINSAIL =================# -#===================================================# - -function remove_mainsail_dir() { - [[ ! -d ${MAINSAIL_DIR} ]] && return - - status_msg "Removing Mainsail directory ..." - rm -rf "${MAINSAIL_DIR}" && ok_msg "Directory removed!" -} - -function remove_mainsail_nginx_config() { - if [[ -e "/etc/nginx/sites-available/mainsail" ]]; then - status_msg "Removing Mainsail configuration for Nginx ..." - sudo rm "/etc/nginx/sites-available/mainsail" && ok_msg "File removed!" - fi - if [[ -L "/etc/nginx/sites-enabled/mainsail" ]]; then - status_msg "Removing Mainsail Symlink for Nginx ..." - sudo rm "/etc/nginx/sites-enabled/mainsail" && ok_msg "File removed!" - fi -} - -function remove_mainsail_logs() { - local files - files=$(find /var/log/nginx -name "mainsail*" 2> /dev/null | sort) - - if [[ -n ${files} ]]; then - for file in ${files}; do - status_msg "Removing ${file} ..." - sudo rm -f "${file}" - ok_msg "${file} removed!" - done - fi -} - -function remove_mainsail_log_symlinks() { - local files regex - - regex="${HOME//\//\\/}\/([A-Za-z0-9_]+)\/logs\/mainsail-.*" - files=$(find "${HOME}" -maxdepth 3 -regextype posix-extended -regex "${regex}" 2> /dev/null | sort) - - if [[ -n ${files} ]]; then - for file in ${files}; do - status_msg "Removing ${file} ..." - rm -f "${file}" - ok_msg "${file} removed!" - done - fi -} - -function remove_legacy_mainsail_log_symlinks() { - local files - files=$(find "${HOME}/klipper_logs" -name "mainsail*" 2> /dev/null | sort) - - if [[ -n ${files} ]]; then - for file in ${files}; do - status_msg "Removing ${file} ..." - rm -f "${file}" - ok_msg "${file} removed!" - done - fi -} - -function remove_mainsail_config() { - if [[ -d "${HOME}/mainsail-config" ]]; then - status_msg "Removing ${HOME}/mainsail-config ..." - rm -rf "${HOME}/mainsail-config" - ok_msg "${HOME}/mainsail-config removed!" - print_confirm "Mainsail-Config successfully removed!" - fi -} - -function remove_mainsail() { - remove_mainsail_dir - remove_mainsail_nginx_config - remove_mainsail_logs - remove_mainsail_log_symlinks - remove_legacy_mainsail_log_symlinks - - ### remove mainsail_port from ~/.kiauh.ini - sed -i "/^mainsail_port=/d" "${INI_FILE}" - - print_confirm "Mainsail successfully removed!" -} - -#===================================================# -#================= UPDATE MAINSAIL =================# -#===================================================# - -function update_mainsail() { - backup_before_update "mainsail" - status_msg "Updating Mainsail ..." - download_mainsail - match_nginx_configs - symlink_webui_nginx_log "mainsail" - print_confirm "Mainsail successfully updated!" -} - -#===================================================# -#================= MAINSAIL STATUS =================# -#===================================================# - -function get_mainsail_status() { - local status - local data_arr=("${MAINSAIL_DIR}" "${NGINX_SA}/mainsail" "${NGINX_SE}/mainsail") - - ### count+1 for each found data-item from array - local filecount=0 - for data in "${data_arr[@]}"; do - [[ -e ${data} ]] && filecount=$(( filecount + 1 )) - done - - if (( filecount == ${#data_arr[*]} )); then - status="Installed!" - elif (( filecount == 0 )); then - status="Not installed!" - else - status="Incomplete!" - fi - echo "${status}" -} - -function get_local_mainsail_version() { - local versionfile="${MAINSAIL_DIR}/.version" - local relinfofile="${MAINSAIL_DIR}/release_info.json" - local version - - if [[ -f ${relinfofile} ]]; then - version=$(grep -o '"version":"[^"]*' "${relinfofile}" | grep -o '[^"]*$') - elif [[ -f ${versionfile} ]]; then - version=$(head -n 1 "${versionfile}") - fi - - echo "${version}" -} - -function get_remote_mainsail_version() { - [[ ! $(dpkg-query -f'${Status}' --show curl 2>/dev/null) = *\ installed ]] && return - - local tags - tags=$(curl -s "https://api.github.com/repos/mainsail-crew/mainsail/tags" | grep "name" | cut -d'"' -f4) - echo "${tags}" | head -1 -} - -function compare_mainsail_versions() { - local versions local_ver remote_ver - local_ver="$(get_local_mainsail_version)" - remote_ver="$(get_remote_mainsail_version)" - - if [[ ${local_ver} != "${remote_ver}" && ${local_ver} != "" ]]; then - versions="${yellow}$(printf " %-14s" "${local_ver}")${white}" - versions+="|${green}$(printf " %-13s" "${remote_ver}")${white}" - # add moonraker to application_updates_available in kiauh.ini - add_to_application_updates "mainsail" - else - versions="${green}$(printf " %-14s" "${local_ver}")${white}" - versions+="|${green}$(printf " %-13s" "${remote_ver}")${white}" - fi - - echo "${versions}" -} - -#================================================# -#=========== MAINSAIL THEME INSTALLER ===========# -#================================================# - -function print_theme_list() { - local i=0 theme_list=${1} - - while IFS="," read -r col1 col2 col3 col4; do - if [[ ${col1} != "name" ]]; then - printf "| ${i}) %-51s|\n" "[${col1}]" - fi - i=$(( i + 1 )) - done <<< "${theme_list}" -} - -function ms_theme_installer_menu() { - local theme_list theme_author theme_repo theme_name theme_note theme_url - local theme_csv_url="https://raw.githubusercontent.com/mainsail-crew/gb-docs/main/_data/themes.csv" - theme_list=$(curl -s -L "${theme_csv_url}") - - top_border - echo -e "| ${red}~~~~~~~~ [ Mainsail Theme Installer ] ~~~~~~~${white} |" - hr - echo -e "| ${cyan}A preview of each Mainsail theme can be found here:${white} |" - echo -e "| https://docs.mainsail.xyz/theming/themes |" - blank_line - echo -e "| ${yellow}Important note:${white} |" - echo -e "| Installing a theme from this menu will overwrite an |" - echo -e "| already installed theme or modified custom.css file! |" - hr - print_theme_list "${theme_list}" - echo -e "| |" - echo -e "| R) [Remove Theme] |" - back_footer - - while IFS="," read -r col1 col2 col3 col4; do - theme_name+=("${col1}") - theme_note+=("${col2}") - theme_author+=("${col3}") - theme_repo+=("${col4}") - done <<< "${theme_list}" - - local option - while true; do - read -p "${cyan}Install theme:${white} " option - if (( option > 0 && option < ${#theme_name[@]} )); then - theme_url="https://github.com/${theme_author[${option}]}/${theme_repo[${option}]}" - ms_theme_install "${theme_url}" "${theme_name[${option}]}" "${theme_note[${option}]}" - break - elif [[ ${option} == "R" || ${option} == "r" ]]; then - ms_theme_delete - break - elif [[ ${option} == "B" || ${option} == "b" ]]; then - advanced_menu - break - else - error_msg "Invalid command!" - fi - done - ms_theme_installer_menu -} - -function ms_theme_install() { - read_kiauh_ini "${FUNCNAME[0]}" - - local theme_url - local theme_name - local theme_note - theme_url=${1} - theme_name=${2} - theme_note=${3} - - local folder_arr - local folder_names="${multi_instance_names}" - local target_folders=() - - IFS=',' read -r -a folder_arr <<< "${folder_names}" - - ### build theme target folder array - if (( ${#folder_arr[@]} > 1 )); then - for folder in "${folder_arr[@]}"; do - ### instance names/identifier of only numbers need to be prefixed with 'printer_' - if [[ ${folder} =~ ^[0-9]+$ ]]; then - target_folders+=("${HOME}/printer_${folder}_data/config") - else - target_folders+=("${HOME}/${folder}_data/config") - fi - done - else - target_folders+=("${HOME}/printer_data/config") - fi - - if (( ${#target_folders[@]} > 1 )); then - top_border - echo -e "| Please select the printer you want to apply the theme |" - echo -e "| installation to: |" - for (( i=0; i < ${#target_folders[@]}; i++ )); do - folder=$(echo "${target_folders[${i}]}" | rev | cut -d "/" -f2 | cut -d"_" -f2- | rev) - printf "|${cyan}%-55s${white}|\n" " ${i}) ${folder}" - done - bottom_border - - local target re="^[0-9]*$" - while true; do - read -p "${cyan}###### Select printer:${white} " target - ### break while loop if input is valid, else display error - [[ ${target} =~ ${re} && ${target} -lt ${#target_folders[@]} ]] && break - error_msg "Invalid command!" - done - fi - - [[ -d "${target_folders[${target}]}/.theme" ]] && rm -rf "${target_folders[${target}]}/.theme" - - status_msg "Installing '${theme_name}' to ${target_folders[${target}]} ..." - cd "${target_folders[${target}]}" - - if git clone "${theme_url}" ".theme"; then - ok_msg "Theme installation complete!" - [[ -n ${theme_note} ]] && echo "${yellow}###### Theme Info: ${theme_note}${white}" - ok_msg "Please remember to delete your browser cache!\n" - else - error_msg "Theme installation failed!\n" - fi -} - -function ms_theme_delete() { - local regex theme_folders target_folders=() - - regex="${HOME//\//\\/}\/([A-Za-z0-9_]+)\/config\/\.theme" - theme_folders=$(find "${HOME}" -maxdepth 3 -type d -regextype posix-extended -regex "${regex}" | sort) -# theme_folders=$(find "${KLIPPER_CONFIG}" -mindepth 1 -type d -name ".theme" | sort) - - ### build target folder array - for folder in ${theme_folders}; do - target_folders+=("${folder}") - done - - if (( ${#target_folders[@]} == 0 )); then - status_msg "No Themes installed!\n" - return - elif (( ${#target_folders[@]} > 1 )); then - top_border - echo -e "| Please select the printer you want to remove the |" - echo -e "| theme installation from. |" - for (( i=0; i < ${#target_folders[@]}; i++ )); do - folder=$(echo "${target_folders[${i}]}" | rev | cut -d "/" -f2 | rev) - printf "|${cyan}%-55s${white}|\n" " ${i}) ${folder}" - done - bottom_border - - local target re="^[0-9]*$" - while true; do - read -p "${cyan}###### Select printer:${white} " target - ### break while loop if input is valid, else display error - [[ ${target} =~ ${re} && ${target} -lt ${#target_folders[@]} ]] && break - error_msg "Invalid command!" - done - fi - - status_msg "Removing ${target_folders[${target}]} ..." - rm -rf "${target_folders[${target}]}" && ok_msg "Theme removed!\n" - - return -} - -#================================================# -#=================== HELPERS ====================# -#================================================# - -function get_mainsail_download_url() { - local releases_by_tag tags tag unstable_url url - - ### latest stable download url - url="https://github.com/mainsail-crew/mainsail/releases/latest/download/mainsail.zip" - - read_kiauh_ini "${FUNCNAME[0]}" - if [[ ${mainsail_install_unstable} == "true" ]]; then - releases_by_tag="https://api.github.com/repos/mainsail-crew/mainsail/tags" - tags=$(curl -s "${releases_by_tag}" | grep "name" | cut -d'"' -f4) - tag=$(echo "${tags}" | head -1) - - ### latest unstable download url including pre-releases (alpha, beta, rc) - unstable_url="https://github.com/mainsail-crew/mainsail/releases/download/${tag}/mainsail.zip" - - if [[ ${unstable_url} == *"download//"* ]]; then - warn_msg "Download URL broken! Falling back to URL of latest stable release!" - else - url=${unstable_url} - fi - fi - - echo "${url}" -} - -function mainsail_port_check() { - if [[ ${MAINSAIL_ENABLED} == "false" ]]; then - - if [[ ${SITE_ENABLED} == "true" ]]; then - status_msg "Detected other enabled interfaces:" - - [[ ${FLUIDD_ENABLED} == "true" ]] && \ - echo -e " ${cyan}● Fluidd - Port: ${FLUIDD_PORT}${white}" - - if [[ ${FLUIDD_PORT} == "80" ]]; then - PORT_80_BLOCKED="true" - select_mainsail_port - fi - else - DEFAULT_PORT=$(grep listen "${KIAUH_SRCDIR}/resources/mainsail" | head -1 | sed 's/^\s*//' | cut -d" " -f2 | cut -d";" -f1) - SET_LISTEN_PORT=${DEFAULT_PORT} - fi - SET_NGINX_CFG="true" - - else - SET_NGINX_CFG="false" - fi -} - -function select_mainsail_port() { - if [[ ${PORT_80_BLOCKED} == "true" ]]; then - echo - top_border - echo -e "| ${red}!!!WARNING!!!${white} |" - echo -e "| ${red}You need to choose a different port for Mainsail!${white} |" - echo -e "| ${red}The following web interface is listening at port 80:${white} |" - blank_line - [[ ${FLUIDD_PORT} == "80" ]] && echo "| ● Fluidd |" - blank_line - echo -e "| Make sure you don't choose a port which was already |" - echo -e "| assigned to another webinterface! |" - blank_line - echo -e "| Be aware: there is ${red}NO${white} sanity check for the following |" - echo -e "| input. So make sure to choose a valid port! |" - bottom_border - - local new_port re="^[0-9]+$" - while true; do - read -p "${cyan}Please enter a new Port:${white} " new_port - if [[ ${new_port} =~ ${re} && ${new_port} != "${FLUIDD_PORT}" ]]; then - select_msg "Setting port ${new_port} for Mainsail!" - SET_LISTEN_PORT=${new_port} - break - else - if [[ ! ${new_port} =~ ${re} ]]; then - error_msg "Invalid input!" - else - error_msg "Port already taken! Select a different one!" - fi - fi - done - fi -} - -function enable_mainsail_remotemode() { - [[ ! -f "${MAINSAIL_DIR}/config.json" ]] && return - - status_msg "Setting instance storage location to 'browser' ..." - sed -i 's|"instancesDB": "moonraker"|"instancesDB": "browser"|' "${MAINSAIL_DIR}/config.json" - ok_msg "Done!" -} - -function patch_mainsail_update_manager() { - local patched moonraker_configs regex - regex="${HOME//\//\\/}\/([A-Za-z0-9_]+)\/config\/moonraker\.conf" - moonraker_configs=$(find "${HOME}" -maxdepth 3 -type f -regextype posix-extended -regex "${regex}" | sort) - - patched="false" - for conf in ${moonraker_configs}; do - if ! grep -Eq "^\[update_manager mainsail\]\s*$" "${conf}"; then - ### add new line to conf if it doesn't end with one - [[ $(tail -c1 "${conf}" | wc -l) -eq 0 ]] && echo "" >> "${conf}" - - ### add Mainsails update manager section to moonraker.conf - status_msg "Adding Mainsail to update manager in file:\n ${conf}" - /bin/sh -c "cat >> ${conf}" << MOONRAKER_CONF - -[update_manager mainsail] -type: web -channel: stable -repo: mainsail-crew/mainsail -path: ~/mainsail -MOONRAKER_CONF - - fi - - patched="true" - done - - if [[ ${patched} == "true" ]]; then - do_action_service "restart" "moonraker" - fi -} - -function patch_mainsail_config_update_manager() { - local patched moonraker_configs regex - regex="${HOME//\//\\/}\/([A-Za-z0-9_]+)\/config\/moonraker\.conf" - moonraker_configs=$(find "${HOME}" -maxdepth 3 -type f -regextype posix-extended -regex "${regex}" | sort) - - patched="false" - for conf in ${moonraker_configs}; do - if ! grep -Eq "^\[update_manager mainsail-config\]\s*$" "${conf}"; then - ### add new line to conf if it doesn't end with one - [[ $(tail -c1 "${conf}" | wc -l) -eq 0 ]] && echo "" >> "${conf}" - - ### add Mainsails update manager section to moonraker.conf - status_msg "Adding Mainsail-Config to update manager in file:\n ${conf}" - /bin/sh -c "cat >> ${conf}" << MOONRAKER_CONF - -[update_manager mainsail-config] -type: git_repo -primary_branch: master -path: ~/mainsail-config -origin: https://github.com/mainsail-crew/mainsail-config.git -managed_services: klipper -MOONRAKER_CONF - - fi - - patched="true" - done - - if [[ ${patched} == "true" ]]; then - do_action_service "restart" "moonraker" - fi -} diff --git a/scripts/mjpg-streamer.sh b/scripts/mjpg-streamer.sh deleted file mode 100644 index 26168dc..0000000 --- a/scripts/mjpg-streamer.sh +++ /dev/null @@ -1,193 +0,0 @@ -#!/usr/bin/env bash - -#=======================================================================# -# Copyright (C) 2020 - 2024 Dominik Willner # -# # -# 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 # -#=======================================================================# - -set -e - -#=================================================# -#============= INSTALL MJPG-STREAMER =============# -#=================================================# - -function install_mjpg-streamer() { - local webcamd="${KIAUH_SRCDIR}/resources/mjpg-streamer/webcamd" - local webcam_txt="${KIAUH_SRCDIR}/resources/mjpg-streamer/webcam.txt" - local service="${KIAUH_SRCDIR}/resources/mjpg-streamer/webcamd.service" - local repo="https://github.com/jacksonliam/mjpg-streamer.git" - - ### return early if webcamd.service already exists - if [[ -f "${SYSTEMD}/webcamd.service" ]]; then - print_error "Looks like MJPG-streamer is already installed!\n Please remove it first before you try to re-install it!" - return - fi - - status_msg "Initializing MJPG-Streamer installation ..." - - ### check and install dependencies if missing - local dep=(git cmake build-essential imagemagick libv4l-dev ffmpeg) - if apt-cache search libjpeg62-turbo-dev | grep -Eq "^libjpeg62-turbo-dev "; then - dep+=(libjpeg62-turbo-dev) - elif apt-cache search libjpeg8-dev | grep -Eq "^libjpeg8-dev "; then - dep+=(libjpeg8-dev) - fi - - dependency_check "${dep[@]}" - - ### step 1: clone mjpg-streamer - status_msg "Cloning MJPG-Streamer from ${repo} ..." - [[ -d "${HOME}/mjpg-streamer" ]] && rm -rf "${HOME}/mjpg-streamer" - - cd "${HOME}" || exit 1 - if ! git clone "${repo}" "${HOME}/mjpg-streamer"; then - print_error "Cloning MJPG-Streamer from\n ${repo}\n failed!" - exit 1 - fi - ok_msg "Cloning complete!" - - ### step 2: compiling mjpg-streamer - status_msg "Compiling MJPG-Streamer ..." - cd "${HOME}/mjpg-streamer/mjpg-streamer-experimental" - if ! make; then - print_error "Compiling MJPG-Streamer failed!" - exit 1 - fi - ok_msg "Compiling complete!" - - #step 3: install mjpg-streamer - status_msg "Installing MJPG-Streamer ..." - cd "${HOME}/mjpg-streamer" && mv mjpg-streamer-experimental/* . - mkdir www-mjpgstreamer - - cat <> ./www-mjpgstreamer/index.html - -mjpg_streamer test page - -

Snapshot

-

Refresh the page to refresh the snapshot

-Snapshot -

Stream

-Stream - - -EOT - - sudo cp "${webcamd}" "/usr/local/bin/webcamd" - sudo sed -i "/^config_dir=/ s|=.*|=${KLIPPER_CONFIG}|" /usr/local/bin/webcamd - sudo sed -i "/MJPGSTREAMER_HOME/ s/pi/${USER}/" /usr/local/bin/webcamd - sudo chmod +x /usr/local/bin/webcamd - - ### step 4: create webcam.txt config file - [[ ! -d ${KLIPPER_CONFIG} ]] && mkdir -p "${KLIPPER_CONFIG}" - if [[ ! -f "${KLIPPER_CONFIG}/webcam.txt" ]]; then - status_msg "Creating webcam.txt config file ..." - cp "${webcam_txt}" "${KLIPPER_CONFIG}/webcam.txt" - ok_msg "Done!" - fi - - ### step 5: create systemd service - status_msg "Creating MJPG-Streamer service ..." - sudo cp "${service}" "${SYSTEMD}/webcamd.service" - sudo sed -i "s|%USER%|${USER}|" "${SYSTEMD}/webcamd.service" - ok_msg "MJPG-Streamer service created!" - - ### step 6: enabling and starting mjpg-streamer service - status_msg "Starting MJPG-Streamer service, please wait ..." - sudo systemctl enable webcamd.service - if sudo systemctl start webcamd.service; then - ok_msg "MJPG-Streamer service started!" - else - status_msg "MJPG-Streamer service couldn't be started! No webcam connected?\n###### You need to manually restart the service once your webcam is set up correctly." - fi - - ### step 6.1: create webcamd.log symlink - [[ ! -d ${KLIPPER_LOGS} ]] && mkdir -p "${KLIPPER_LOGS}" - if [[ -f "/var/log/webcamd.log" && ! -L "${KLIPPER_LOGS}/webcamd.log" ]]; then - ln -s "/var/log/webcamd.log" "${KLIPPER_LOGS}/webcamd.log" - fi - - ### step 6.2: add webcamd.log logrotate - if [[ ! -f "/etc/logrotate.d/webcamd" ]]; then - status_msg "Create logrotate rule ..." - sudo /bin/sh -c "cat > /etc/logrotate.d/webcamd" << EOF -/var/log/webcamd.log -{ - rotate 2 - weekly - maxsize 32M - missingok - notifempty - compress - delaycompress - sharedscripts -} -EOF - ok_msg "Done!" - fi - - ### step 7: check if user is in group "video" - local usergroup_changed="false" - if ! groups "${USER}" | grep -q "video"; then - status_msg "Adding user '${USER}' to group 'video' ..." - sudo usermod -a -G video "${USER}" && ok_msg "Done!" - usergroup_changed="true" - fi - - ### confirm message - local confirm_msg="MJPG-Streamer has been set up!" - if [[ ${usergroup_changed} == "true" ]]; then - confirm_msg="${confirm_msg}\n ${yellow}INFO: Your User was added to a new group!${green}" - confirm_msg="${confirm_msg}\n ${yellow}You need to relog/restart for the group to be applied!${green}" - fi - - print_confirm "${confirm_msg}" - - ### print webcam ip adress/url - local ip - ip=$(hostname -I | cut -d" " -f1) - local cam_url="http://${ip}:8080/?action=stream" - local cam_url_alt="http://${ip}/webcam/?action=stream" - echo -e " ${cyan}● Webcam URL:${white} ${cam_url}" - echo -e " ${cyan}● Webcam URL:${white} ${cam_url_alt}" - echo -} - -#=================================================# -#============== REMOVE MJPG-STREAMER =============# -#=================================================# - -function remove_mjpg-streamer() { - ### remove MJPG-Streamer service - if [[ -e "${SYSTEMD}/webcamd.service" ]]; then - status_msg "Removing MJPG-Streamer service ..." - sudo systemctl stop webcamd && sudo systemctl disable webcamd - sudo rm -f "${SYSTEMD}/webcamd.service" - ###reloading units - sudo systemctl daemon-reload - sudo systemctl reset-failed - ok_msg "MJPG-Streamer Service removed!" - fi - - ### remove webcamd from /usr/local/bin - if [[ -e "/usr/local/bin/webcamd" ]]; then - sudo rm -f "/usr/local/bin/webcamd" - fi - - ### remove MJPG-Streamer directory - if [[ -d "${HOME}/mjpg-streamer" ]]; then - status_msg "Removing MJPG-Streamer directory ..." - rm -rf "${HOME}/mjpg-streamer" - ok_msg "MJPG-Streamer directory removed!" - fi - - ### remove webcamd log and symlink - [[ -f "/var/log/webcamd.log" ]] && sudo rm -f "/var/log/webcamd.log" - [[ -L "${KLIPPER_LOGS}/webcamd.log" ]] && rm -f "${KLIPPER_LOGS}/webcamd.log" - - print_confirm "MJPG-Streamer successfully removed!" -} diff --git a/scripts/mobileraker.sh b/scripts/mobileraker.sh deleted file mode 100644 index 0f4c554..0000000 --- a/scripts/mobileraker.sh +++ /dev/null @@ -1,247 +0,0 @@ -#!/usr/bin/env bash - -#=======================================================================# -# Copyright (C) 2020 - 2024 Dominik Willner # -# # -# 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 # -#=======================================================================# - -# -# This file is written and maintained by Patrick Schmidt author of Mobileraker -# It is based of the kliperscreen.sh install script! - - -set -e - -#===================================================# -#========== INSTALL MOBILERAKER COMPANION ==========# -#===================================================# - -function mobileraker_systemd() { - local services - services=$(find "${SYSTEMD}" -maxdepth 1 -regextype posix-extended -regex "${SYSTEMD}/mobileraker.service") - echo "${services}" -} - -function install_mobileraker() { - ### return early if python version check fails - if [[ $(python3_check) == "false" ]]; then - local error="Versioncheck failed! Python 3.7 or newer required!\n" - error="${error} Please upgrade Python." - print_error "${error}" && return - fi - - ### first, we create a backup of the full klipper_config dir - safety first! - backup_config_dir - - ### install Mobileraker's Companion - mobileraker_setup - - ### add Mobileraker's Companion to the update manager in moonraker.conf - patch_mobileraker_update_manager - - do_action_service "restart" "mobileraker" -} - -function mobileraker_setup() { - local dep=(wget curl unzip dfu-util) - dependency_check "${dep[@]}" - status_msg "Cloning Mobileraker's companion from ${MOBILERAKER_REPO} ..." - - # force remove existing Mobileraker's companion dir - [[ -d ${MOBILERAKER_DIR} ]] && rm -rf "${MOBILERAKER_DIR}" - - # clone into fresh Mobileraker's companion dir - cd "${HOME}" || exit 1 - if ! git clone "${MOBILERAKER_REPO}" "${MOBILERAKER_DIR}"; then - print_error "Cloning mobileraker's companion from\n ${MOBILERAKER_REPO}\n failed!" - exit 1 - fi - - 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!" - exit 1 - fi -} - -#===================================================# -#=========== REMOVE MOBILERAKER COMPANION ==========# -#===================================================# - -function remove_mobileraker() { - ### remove Mobileraker's companion dir - if [[ -d ${MOBILERAKER_DIR} ]]; then - status_msg "Removing Mobileraker's companion directory ..." - rm -rf "${MOBILERAKER_DIR}" && ok_msg "Directory removed!" - fi - - ### remove Mobileraker's companion VENV dir - if [[ -d ${MOBILERAKER_ENV} ]]; then - status_msg "Removing Mobileraker's companion VENV directory ..." - rm -rf "${MOBILERAKER_ENV}" && ok_msg "Directory removed!" - fi - - ### remove Mobileraker's companion service - if [[ -e "${SYSTEMD}/mobileraker.service" ]]; then - status_msg "Removing mobileraker service ..." - do_action_service "stop" "mobileraker" - do_action_service "disable" "mobileraker" - sudo rm -f "${SYSTEMD}/mobileraker.service" - - ###reloading units - sudo systemctl daemon-reload - sudo systemctl reset-failed - ok_msg "Mobileraker's companion Service removed!" - fi - - - remove_mobileraker_logs - - print_confirm "Mobileraker's companion successfully removed!" -} - -function remove_mobileraker_logs() { - local files regex="${HOME//\//\\/}\/([A-Za-z0-9_]+)\/logs\/mobileraker\.log.*" - files=$(find "${HOME}" -maxdepth 3 -regextype posix-extended -regex "${regex}" | sort) - - if [[ -n ${files} ]]; then - for file in ${files}; do - status_msg "Removing ${file} ..." - rm -f "${file}" - ok_msg "${file} removed!" - done - fi -} - -#===================================================# -#=========== UPDATE MOBILERAKER COMPANION ==========# -#===================================================# - -function update_mobileraker() { - local old_md5 - old_md5=$(md5sum "${MOBILERAKER_DIR}/scripts/mobileraker-requirements.txt" | cut -d " " -f1) - - do_action_service "stop" "mobileraker" - cd "${MOBILERAKER_DIR}" - git pull origin main -q && ok_msg "Fetch successfull!" - git checkout -f main && ok_msg "Checkout successfull" - - if [[ $(md5sum "${MOBILERAKER_DIR}/scripts/mobileraker-requirements.txt" | cut -d " " -f1) != "${old_md5}" ]]; then - status_msg "New dependencies detected..." - "${MOBILERAKER_ENV}"/bin/pip install -r "${MOBILERAKER_DIR}/scripts/mobileraker-requirements.txt" - ok_msg "Dependencies have been installed!" - fi - - ok_msg "Update complete!" - do_action_service "start" "mobileraker" -} - -#===================================================# -#=========== MOBILERAKER COMPANION STATUS ==========# -#===================================================# - -function get_mobileraker_status() { - local sf_count status - sf_count="$(mobileraker_systemd | wc -w)" - - ### remove the "SERVICE" entry from the data array if a moonraker service is installed - local data_arr=(SERVICE "${MOBILERAKER_DIR}" "${MOBILERAKER_ENV}") - (( sf_count > 0 )) && unset "data_arr[0]" - - ### count+1 for each found data-item from array - local filecount=0 - for data in "${data_arr[@]}"; do - [[ -e ${data} ]] && filecount=$(( filecount + 1 )) - done - - if (( filecount == ${#data_arr[*]} )); then - status="Installed!" - elif (( filecount == 0 )); then - status="Not installed!" - else - status="Incomplete!" - fi - echo "${status}" -} - -function get_local_mobileraker_commit() { - [[ ! -d ${MOBILERAKER_DIR} || ! -d "${MOBILERAKER_DIR}/.git" ]] && return - - local commit - cd "${MOBILERAKER_DIR}" - commit="$(git describe HEAD --always --tags | cut -d "-" -f 1,2)" - echo "${commit}" -} - -function get_remote_mobileraker_commit() { - [[ ! -d ${MOBILERAKER_DIR} || ! -d "${MOBILERAKER_DIR}/.git" ]] && return - - local commit - cd "${MOBILERAKER_DIR}" && git fetch origin -q - commit=$(git describe origin/main --always --tags | cut -d "-" -f 1,2) - echo "${commit}" -} - -function compare_mobileraker_versions() { - local versions local_ver remote_ver - local_ver="$(get_local_mobileraker_commit)" - remote_ver="$(get_remote_mobileraker_commit)" - - if [[ ${local_ver} != "${remote_ver}" ]]; then - versions="${yellow}$(printf " %-14s" "${local_ver}")${white}" - versions+="|${green}$(printf " %-13s" "${remote_ver}")${white}" - # add moonraker to application_updates_available in kiauh.ini - add_to_application_updates "mobileraker" - else - versions="${green}$(printf " %-14s" "${local_ver}")${white}" - versions+="|${green}$(printf " %-13s" "${remote_ver}")${white}" - fi - - echo "${versions}" -} - -#================================================# -#=================== HELPERS ====================# -#================================================# - -function patch_mobileraker_update_manager() { - local patched moonraker_configs regex - regex="${HOME//\//\\/}\/([A-Za-z0-9_]+)\/config\/moonraker\.conf" - moonraker_configs=$(find "${HOME}" -maxdepth 3 -type f -regextype posix-extended -regex "${regex}" | sort) - - patched="false" - for conf in ${moonraker_configs}; do - if ! grep -Eq "^\[update_manager mobileraker\]\s*$" "${conf}"; then - ### add new line to conf if it doesn't end with one - [[ $(tail -c1 "${conf}" | wc -l) -eq 0 ]] && echo "" >> "${conf}" - - ### add Mobileraker's Companion update manager section to moonraker.conf - status_msg "Adding Mobileraker's Companion to update manager in file:\n ${conf}" - /bin/sh -c "cat >> ${conf}" << MOONRAKER_CONF - -[update_manager mobileraker] -type: git_repo -path: ${HOME}/mobileraker_companion -origin: https://github.com/Clon1998/mobileraker_companion.git -primary_branch:main -managed_services: mobileraker -env: ${HOME}/mobileraker-env/bin/python -requirements: scripts/mobileraker-requirements.txt -install_script: scripts/install.sh -MOONRAKER_CONF - - fi - - patched="true" - done - - if [[ ${patched} == "true" ]]; then - do_action_service "restart" "moonraker" - fi -} diff --git a/scripts/moonraker-telegram-bot.sh b/scripts/moonraker-telegram-bot.sh deleted file mode 100644 index 06cf22b..0000000 --- a/scripts/moonraker-telegram-bot.sh +++ /dev/null @@ -1,542 +0,0 @@ -#!/usr/bin/env bash - -#=======================================================================# -# Copyright (C) 2020 - 2024 Dominik Willner # -# # -# 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 # -#=======================================================================# - -set -e - -#===================================================# -#========== INSTALL MOONRAKERTELEGRAMBOT ===========# -#===================================================# - -function telegram_bot_systemd() { - local services - services=$(find "${SYSTEMD}" -maxdepth 1 -regextype posix-extended -regex "${SYSTEMD}/moonraker-telegram-bot(-[0-9a-zA-Z]+)?.service" | sort) - echo "${services}" -} - -function telegram_bot_setup_dialog() { - ### return early if moonraker is not installed - local moonraker_services - moonraker_services=$(moonraker_systemd) - - if [[ -z ${moonraker_services} ]]; then - local error="Moonraker not installed! Please install Moonraker first!" - print_error "${error}" && return - fi - - status_msg "Initializing Telegram Bot installation ..." - ### first, we create a backup of the full klipper_config dir - safety first! - backup_config_dir - - local moonraker_count user_input=() moonraker_names=() - moonraker_count=$(echo "${moonraker_services}" | wc -w ) - for service in ${moonraker_services}; do - moonraker_names+=( "$(get_instance_name "${service}")" ) - done - - local telegram_bot_count - if (( moonraker_count == 1 )); then - ok_msg "Moonraker installation found!\n" - telegram_bot_count=1 - elif (( moonraker_count > 1 )); then - top_border - printf "|${green}%-55s${white}|\n" " ${moonraker_count} Moonraker instances found!" - for name in "${moonraker_names[@]}"; do - printf "|${cyan}%-57s${white}|\n" " ● ${name}" - done - blank_line - echo -e "| The setup will apply the same names to Telegram Bot! |" - blank_line - echo -e "| Please select the number of Telegram Bot instances to |" - echo -e "| install. Usually one Telegram Bot instance per |" - echo -e "| Moonraker instance is required, but you may not |" - echo -e "| install more Telegram Bot instances than available |" - echo -e "| Moonraker instances. |" - bottom_border - - ### ask for amount of instances - local re="^[1-9][0-9]*$" - while [[ ! ${telegram_bot_count} =~ ${re} || ${telegram_bot_count} -gt ${moonraker_count} ]]; do - read -p "${cyan}###### Number of Telegram Bot instances to set up:${white} " -i "${moonraker_count}" -e telegram_bot_count - ### break if input is valid - [[ ${telegram_bot_count} =~ ${re} && ${telegram_bot_count} -le ${moonraker_count} ]] && break - ### conditional error messages - [[ ! ${telegram_bot_count} =~ ${re} ]] && error_msg "Input not a number" - (( telegram_bot_count > moonraker_count )) && error_msg "Number of Telegram Bot instances larger than existing Moonraker instances" - done && select_msg "${telegram_bot_count}" - else - log_error "Internal error. moonraker_count of '${moonraker_count}' not equal or grather than one!" - return 1 - fi - - user_input+=("${telegram_bot_count}") - - ### confirm instance amount - local yn - while true; do - (( telegram_bot_count == 1 )) && local question="Install Telegram Bot?" - (( telegram_bot_count > 1 )) && local question="Install ${telegram_bot_count} Telegram Bot instances?" - read -p "${cyan}###### ${question} (Y/n):${white} " yn - case "${yn}" in - Y|y|Yes|yes|"") - select_msg "Yes" - break;; - N|n|No|no) - select_msg "No" - abort_msg "Exiting Telegram Bot setup ...\n" - return;; - *) - error_msg "Invalid Input!";; - esac - done - - ### write existing klipper names into user_input array to use them as names for moonraker - if (( moonraker_count > 1 )); then - for name in "${moonraker_names[@]}"; do - user_input+=("${name}") - done - fi - - (( telegram_bot_count > 1 )) && status_msg "Installing ${telegram_bot_count} Telegram Bot instances ..." - (( telegram_bot_count == 1 )) && status_msg "Installing Telegram Bot ..." - telegram_bot_setup "${user_input[@]}" -} - -function install_telegram_bot_dependencies() { - local packages log_name="Telegram Bot" - local install_script="${TELEGRAM_BOT_DIR}/scripts/install.sh" - - ### read PKGLIST from official install-script - status_msg "Reading dependencies..." - # shellcheck disable=SC2016 - packages="$(grep "PKGLIST=" "${install_script}" | cut -d'"' -f2 | sed 's/\${PKGLIST}//g' | tr -d '\n')" - - echo "${cyan}${packages}${white}" | tr '[:space:]' '\n' - read -r -a packages <<< "${packages}" - - ### Update system package lists if stale - update_system_package_lists - - ### Install required packages - install_system_packages "${log_name}" "packages[@]" -} - -function create_telegram_bot_virtualenv() { - status_msg "Installing python virtual environment..." - ### always create a clean virtualenv - [[ -d ${TELEGRAM_BOT_ENV} ]] && rm -rf "${TELEGRAM_BOT_ENV}" - if virtualenv -p /usr/bin/python3 --system-site-packages "${TELEGRAM_BOT_ENV}"; then - "${TELEGRAM_BOT_ENV}"/bin/pip install -r "${TELEGRAM_BOT_DIR}/scripts/requirements.txt" - else - log_error "failure while creating python3 moonraker-telegram-bot-env" - error_msg "Creation of Moonraker Telegram Bot virtualenv failed!" - exit 1 - fi -} - -function telegram_bot_setup() { - local instance_arr=("${@}") - ### checking dependencies - local dep=(git virtualenv) - dependency_check "${dep[@]}" - - ### step 1: clone telegram bot - clone_telegram_bot "${TELEGRAM_BOT_REPO}" - - ### step 2: install telegram bot dependencies and create python virtualenv - status_msg "Installing dependencies ..." - install_telegram_bot_dependencies - create_telegram_bot_virtualenv - - ### step 3: create telegram.conf - create_telegram_conf "${instance_arr[@]}" - - ### step 4: create telegram bot instances - create_telegram_bot_service "${instance_arr[@]}" - - ### step 5: add telegram-bot to the update manager in moonraker.conf - patch_telegram_bot_update_manager - - ### step 6: enable and start all instances - do_action_service "enable" "moonraker-telegram-bot" - do_action_service "start" "moonraker-telegram-bot" - - ### confirm message - local confirm="" - (( instance_arr[0] == 1 )) && confirm="Telegram Bot has been set up!" - (( instance_arr[0] > 1 )) && confirm="${instance_arr[0]} Telegram Bot instances have been set up!" - print_confirm "${confirm}" && return -} - -function clone_telegram_bot() { - local repo=${1} - - status_msg "Cloning Moonraker-Telegram-Bot from ${repo} ..." - ### force remove existing Moonraker-Telegram-Bot dir - [[ -d ${repo} ]] && rm -rf "${TELEGRAM_BOT_DIR}" - - cd "${HOME}" || exit 1 - if ! git clone "${repo}" "${TELEGRAM_BOT_DIR}"; then - print_error "Cloning Moonraker-Telegram-Bot from\n ${repo}\n failed!" - exit 1 - fi -} - -function create_telegram_conf() { - local input=("${@}") - local telegram_bot_count=${input[0]} && unset "input[0]" - local names=("${input[@]}") && unset "input[@]" - local printer_data log_dir cfg cfg_dir - - if (( telegram_bot_count == 1 )); then - printer_data="${HOME}/printer_data" - log_dir="${printer_data}/logs" - cfg_dir="${printer_data}/config" - cfg="${cfg_dir}/telegram.conf" - - ### create required folder structure - create_required_folders "${printer_data}" - - ### write single instance config - write_telegram_conf "${cfg_dir}" "${cfg}" - - elif (( telegram_bot_count > 1 )); then - local j=0 re="^[1-9][0-9]*$" - - for (( i=1; i <= telegram_bot_count; i++ )); do - - printer_data="${HOME}/${names[${j}]}_data" - ### prefix instance name with "printer_" if it is only a number - [[ ${names[j]} =~ ${re} ]] && printer_data="${HOME}/printer_${names[${j}]}_data" - - - cfg_dir="${printer_data}/config" - cfg="${cfg_dir}/telegram.conf" - log_dir="${printer_data}/logs" - - ### create required folder structure - create_required_folders "${printer_data}" - - ### write multi instance config - write_telegram_conf "${cfg_dir}" "${cfg}" - - j=$(( j + 1 )) - done && unset j - - else - return 1 - fi -} - -function write_telegram_conf() { - local cfg_dir=${1} cfg=${2} - local conf_template="${TELEGRAM_BOT_DIR}/scripts/base_install_template" - - if [[ ! -f ${cfg} ]]; then - status_msg "Creating telegram.conf in ${cfg_dir} ..." - cp "${conf_template}" "${cfg}" - ok_msg "telegram.conf created!" - else - ok_msg "File '${cfg}' already exists! Skipping..." - fi -} - -function create_telegram_bot_service() { - local input=("${@}") - local instances=${input[0]} && unset "input[0]" - local names=("${input[@]}") && unset "input[@]" - local printer_data cfg_dir cfg log service env_file - - if (( instances == 1 )); then - printer_data="${HOME}/printer_data" - cfg_dir="${printer_data}/config" - cfg="${cfg_dir}/telegram.conf" - log="${printer_data}/logs/telegram.log" - service="${SYSTEMD}/moonraker-telegram-bot.service" - env_file="${printer_data}/systemd/moonraker-telegram-bot.env" - - ### create required folder structure - create_required_folders "${printer_data}" - - ### write single instance service - write_telegram_bot_service "" "${cfg}" "${log}" "${service}" "${env_file}" - ok_msg "Telegram Bot instance created!" - - elif (( instances > 1 )); then - local j=0 re="^[1-9][0-9]*$" - - for (( i=1; i <= instances; i++ )); do - ### overwrite config folder if name is only a number - if [[ ${names[j]} =~ ${re} ]]; then - printer_data="${HOME}/printer_${names[${j}]}_data" - else - printer_data="${HOME}/${names[${j}]}_data" - fi - - cfg_dir="${printer_data}/config" - cfg="${cfg_dir}/telegram.conf" - log="${printer_data}/logs/telegram.log" - service="${SYSTEMD}/moonraker-telegram-bot-${names[${j}]}.service" - env_file="${printer_data}/systemd/moonraker-telegram-bot.env" - - ### create required folder structure - create_required_folders "${printer_data}" - - ### write multi instance service - if write_telegram_bot_service "${names[${j}]}" "${cfg}" "${log}" "${service}" "${env_file}"; then - ok_msg "Telegram Bot instance moonraker-telegram-bot-${names[${j}]} created!" - else - error_msg "An error occured during creation of instance moonraker-telegram-bot-${names[${j}]}!" - fi - - j=$(( j + 1 )) - done && unset j - - else - return 1 - fi -} - -function write_telegram_bot_service() { - local i=${1} cfg=${2} log=${3} service=${4} env_file=${5} - local service_template="${KIAUH_SRCDIR}/resources/moonraker-telegram-bot.service" - local env_template="${KIAUH_SRCDIR}/resources/moonraker-telegram-bot.env" - - ### replace all placeholders - if [[ ! -f ${service} ]]; then - status_msg "Creating service file for instance ${i} ..." - sudo cp "${service_template}" "${service}" - if [[ -z ${i} ]]; then - sudo sed -i "s| %INST%||" "${service}" - else - sudo sed -i "s|%INST%|${i}|" "${service}" - fi - sudo sed -i "s|%USER%|${USER}|g; s|%TELEGRAM_BOT_DIR%|${TELEGRAM_BOT_DIR}|; s|%ENV%|${TELEGRAM_BOT_ENV}|; s|%ENV_FILE%|${env_file}|" "${service}" - - status_msg "Creating environment file for instance ${i} ..." - cp "${env_template}" "${env_file}" - sed -i "s|%USER%|${USER}|; s|%TELEGRAM_BOT_DIR%|${TELEGRAM_BOT_DIR}|; s|%CFG%|${cfg}|; s|%LOG%|${log}|" "${env_file}" - fi -} - - -#===================================================# -#=========== REMOVE MOONRAKERTELEGRAMBOT ===========# -#===================================================# - -function remove_telegram_bot_systemd() { - [[ -z $(telegram_bot_systemd) ]] && return - - status_msg "Removing Telegram Bot Systemd Services ..." - for service in $(telegram_bot_systemd | cut -d"/" -f5); do - status_msg "Removing ${service} ..." - sudo systemctl stop "${service}" - sudo systemctl disable "${service}" - sudo rm -f "${SYSTEMD}/${service}" - ok_msg "Done!" - done - - ### reloading units - sudo systemctl daemon-reload - sudo systemctl reset-failed - ok_msg "Telegram Bot Services removed!" -} - -function remove_telegram_bot_dir() { - [[ ! -d ${TELEGRAM_BOT_DIR} ]] && return - - status_msg "Removing Moonraker-Telegram-Bot directory ..." - rm -rf "${TELEGRAM_BOT_DIR}" - ok_msg "Directory removed!" -} - -function remove_telegram_bot_env() { - [[ ! -d ${TELEGRAM_BOT_ENV} ]] && return - - status_msg "Removing moonraker-telegram-bot-env directory ..." - rm -rf "${TELEGRAM_BOT_ENV}" - ok_msg "Directory removed!" -} - -function remove_telegram_bot_env_file() { - local files regex="${HOME//\//\\/}\/([A-Za-z0-9_]+)\/systemd\/moonraker-telegram-bot\.env" - files=$(find "${HOME}" -maxdepth 3 -regextype posix-extended -regex "${regex}" | sort) - - if [[ -n ${files} ]]; then - for file in ${files}; do - status_msg "Removing ${file} ..." - rm -f "${file}" - ok_msg "${file} removed!" - done - fi -} - -function remove_telegram_bot_logs() { - local files regex="${HOME//\//\\/}\/([A-Za-z0-9_]+)\/logs\/telegram\.log.*" - files=$(find "${HOME}" -maxdepth 3 -regextype posix-extended -regex "${regex}" | sort) - - if [[ -n ${files} ]]; then - for file in ${files}; do - status_msg "Removing ${file} ..." - rm -f "${file}" - ok_msg "${file} removed!" - done - fi -} - -function remove_legacy_telegram_bot_logs() { - local files regex="telegram(-[0-9a-zA-Z]+)?\.log(.*)?" - files=$(find "${HOME}/klipper_logs" -maxdepth 1 -regextype posix-extended -regex "${HOME}/klipper_logs/${regex}" 2> /dev/null | sort) - - if [[ -n ${files} ]]; then - for file in ${files}; do - status_msg "Removing ${file} ..." - rm -f "${file}" - ok_msg "${file} removed!" - done - fi -} - -function remove_telegram_bot() { - remove_telegram_bot_systemd - remove_telegram_bot_dir - remove_telegram_bot_env - remove_telegram_bot_env_file - remove_telegram_bot_logs - remove_legacy_telegram_bot_logs - - local confirm="Moonraker-Telegram-Bot was successfully removed!" - print_confirm "${confirm}" && return -} - -#===================================================# -#=========== UPDATE MOONRAKERTELEGRAMBOT ===========# -#===================================================# - -function update_telegram_bot() { - do_action_service "stop" "moonraker-telegram-bot" - - if [[ ! -d ${TELEGRAM_BOT_DIR} ]]; then - clone_telegram_bot "${TELEGRAM_BOT_REPO}" - else - backup_before_update "moonraker-telegram-bot" - status_msg "Updating Moonraker ..." - cd "${TELEGRAM_BOT_DIR}" && git pull - ### read PKGLIST and install possible new dependencies - install_telegram_bot_dependencies - ### install possible new python dependencies - "${TELEGRAM_BOT_ENV}"/bin/pip install -r "${TELEGRAM_BOT_DIR}/scripts/requirements.txt" - fi - - ok_msg "Update complete!" - do_action_service "start" "moonraker-telegram-bot" -} - -#===================================================# -#=========== MOONRAKERTELEGRAMBOT STATUS ===========# -#===================================================# - -function get_telegram_bot_status() { - local sf_count status - sf_count="$(telegram_bot_systemd | wc -w)" - - ### remove the "SERVICE" entry from the data array if a moonraker service is installed - local data_arr=(SERVICE "${TELEGRAM_BOT_DIR}" "${TELEGRAM_BOT_ENV}") - (( sf_count > 0 )) && unset "data_arr[0]" - - ### count+1 for each found data-item from array - local filecount=0 - for data in "${data_arr[@]}"; do - [[ -e ${data} ]] && filecount=$(( filecount + 1 )) - done - - if (( filecount == ${#data_arr[*]} )); then - status="Installed: ${sf_count}" - elif (( filecount == 0 )); then - status="Not installed!" - else - status="Incomplete!" - fi - echo "${status}" -} - -function get_local_telegram_bot_commit() { - [[ ! -d ${TELEGRAM_BOT_DIR} || ! -d "${TELEGRAM_BOT_DIR}/.git" ]] && return - - local commit - cd "${TELEGRAM_BOT_DIR}" - commit="$(git describe HEAD --always --tags | cut -d "-" -f 1,2)" - echo "${commit}" -} - -function get_remote_telegram_bot_commit() { - [[ ! -d ${TELEGRAM_BOT_DIR} || ! -d "${TELEGRAM_BOT_DIR}/.git" ]] && return - - local commit - cd "${TELEGRAM_BOT_DIR}" && git fetch origin -q - commit=$(git describe origin/master --always --tags | cut -d "-" -f 1,2) - echo "${commit}" -} - -function compare_telegram_bot_versions() { - local versions local_ver remote_ver - local_ver="$(get_local_telegram_bot_commit)" - remote_ver="$(get_remote_telegram_bot_commit)" - - if [[ ${local_ver} != "${remote_ver}" ]]; then - versions="${yellow}$(printf " %-14s" "${local_ver}")${white}" - versions+="|${green}$(printf " %-13s" "${remote_ver}")${white}" - # add moonraker to application_updates_available in kiauh.ini - add_to_application_updates "telegram_bot" - else - versions="${green}$(printf " %-14s" "${local_ver}")${white}" - versions+="|${green}$(printf " %-13s" "${remote_ver}")${white}" - fi - - echo "${versions}" -} - -#================================================# -#=================== HELPERS ====================# -#================================================# - -function patch_telegram_bot_update_manager() { - local patched moonraker_configs regex - regex="${HOME//\//\\/}\/([A-Za-z0-9_]+)\/config\/moonraker\.conf" - moonraker_configs=$(find "${HOME}" -maxdepth 3 -type f -regextype posix-extended -regex "${regex}" | sort) - - patched="false" - for conf in ${moonraker_configs}; do - if ! grep -Eq "^\[update_manager moonraker-telegram-bot\]\s*$" "${conf}"; then - ### add new line to conf if it doesn't end with one - [[ $(tail -c1 "${conf}" | wc -l) -eq 0 ]] && echo "" >> "${conf}" - - ### add Moonraker-Telegram-Bot update manager section to moonraker.conf - status_msg "Adding Moonraker-Telegram-Bot to update manager in file:\n ${conf}" - /bin/sh -c "cat >> ${conf}" << MOONRAKER_CONF - -[update_manager moonraker-telegram-bot] -type: git_repo -path: ~/moonraker-telegram-bot -origin: https://github.com/nlef/moonraker-telegram-bot.git -env: ~/moonraker-telegram-bot-env/bin/python -requirements: scripts/requirements.txt -install_script: scripts/install.sh -MOONRAKER_CONF - - fi - - patched="true" - done - - if [[ ${patched} == "true" ]]; then - do_action_service "restart" "moonraker" - fi -} diff --git a/scripts/moonraker.sh b/scripts/moonraker.sh deleted file mode 100644 index 70692bd..0000000 --- a/scripts/moonraker.sh +++ /dev/null @@ -1,824 +0,0 @@ -#!/usr/bin/env bash - -#=======================================================================# -# Copyright (C) 2020 - 2024 Dominik Willner # -# # -# 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 # -#=======================================================================# - -set -e - -#===================================================# -#================ INSTALL MOONRAKER ================# -#===================================================# - -### -# this function detects all installed moonraker -# systemd instances and returns their absolute path -function moonraker_systemd() { - local services - local blacklist - local ignore - local match - - ### - # any moonraker client that uses "moonraker" in its own name must be blacklisted using - # this variable, otherwise they will be falsely recognized as moonraker instances - blacklist="obico|hmi|telegram-bot" - - ignore="${SYSTEMD}/moonraker-(${blacklist}).service" - match="${SYSTEMD}/moonraker(-[0-9a-zA-Z]+)?.service" - - services=$(find "${SYSTEMD}" -maxdepth 1 -regextype awk ! -regex "${ignore}" -regex "${match}" | sort) - echo "${services}" -} - -function moonraker_setup_dialog() { - status_msg "Initializing Moonraker installation ..." - - ### return early if python version check fails - if [[ $(python3_check) == "false" ]]; then - local error="Versioncheck failed! Python 3.7 or newer required!\n" - error="${error} Please upgrade Python." - print_error "${error}" && return - fi - - ### return early if moonraker already exists - local moonraker_services - moonraker_services=$(moonraker_systemd) - if [[ -n ${moonraker_services} ]]; then - local error="At least one Moonraker service is already installed:" - for s in ${moonraker_services}; do - log_info "Found Moonraker service: ${s}" - error="${error}\n ➔ ${s}" - done - print_error "${error}" && return - fi - - ### return early if klipper is not installed - local klipper_services - klipper_services=$(klipper_systemd) - if [[ -z ${klipper_services} ]]; then - local error="Klipper not installed! Please install Klipper first!" - log_error "Moonraker setup started without Klipper being installed. Aborting setup." - print_error "${error}" && return - fi - - local klipper_count user_input=() klipper_names=() - klipper_count=$(echo "${klipper_services}" | wc -w ) - for service in ${klipper_services}; do - klipper_names+=( "$(get_instance_name "${service}")" ) - done - - local moonraker_count - if (( klipper_count == 1 )); then - ok_msg "Klipper installation found!\n" - moonraker_count=1 - elif (( klipper_count > 1 )); then - top_border - printf "|${green}%-55s${white}|\n" " ${klipper_count} Klipper instances found!" - for name in "${klipper_names[@]}"; do - printf "|${cyan}%-57s${white}|\n" " ● klipper-${name}" - done - blank_line - echo -e "| The setup will apply the same names to Moonraker! |" - blank_line - echo -e "| Please select the number of Moonraker instances to |" - echo -e "| install. Usually one Moonraker instance per Klipper |" - echo -e "| instance is required, but you may not install more |" - echo -e "| Moonraker instances than available Klipper instances. |" - bottom_border - - ### ask for amount of instances - local re="^[1-9][0-9]*$" - while [[ ! ${moonraker_count} =~ ${re} || ${moonraker_count} -gt ${klipper_count} ]]; do - read -p "${cyan}###### Number of Moonraker instances to set up:${white} " -i "${klipper_count}" -e moonraker_count - ### break if input is valid - [[ ${moonraker_count} =~ ${re} && ${moonraker_count} -le ${klipper_count} ]] && break - ### conditional error messages - [[ ! ${moonraker_count} =~ ${re} ]] && error_msg "Input not a number" - (( moonraker_count > klipper_count )) && error_msg "Number of Moonraker instances larger than installed Klipper instances" - done && select_msg "${moonraker_count}" - else - log_error "Internal error. klipper_count of '${klipper_count}' not equal or grather than one!" - return 1 - fi - - user_input+=("${moonraker_count}") - - ### confirm instance amount - local yn - while true; do - (( moonraker_count == 1 )) && local question="Install Moonraker?" - (( moonraker_count > 1 )) && local question="Install ${moonraker_count} Moonraker instances?" - read -p "${cyan}###### ${question} (Y/n):${white} " yn - case "${yn}" in - Y|y|Yes|yes|"") - select_msg "Yes" - break;; - N|n|No|no) - select_msg "No" - abort_msg "Exiting Moonraker setup ...\n" - return;; - *) - error_msg "Invalid Input!";; - esac - done - - ### write existing klipper names into user_input array to use them as names for moonraker - if (( klipper_count > 1 )); then - for name in "${klipper_names[@]}"; do - user_input+=("${name}") - done - fi - - (( moonraker_count > 1 )) && status_msg "Installing ${moonraker_count} Moonraker instances ..." - (( moonraker_count == 1 )) && status_msg "Installing Moonraker ..." - moonraker_setup "${user_input[@]}" -} - -function install_moonraker_dependencies() { - local packages log_name="Moonraker" - local package_json="${MOONRAKER_DIR}/scripts/system-dependencies.json" - - ### read PKGLIST from official install-script - status_msg "Reading dependencies..." - # shellcheck disable=SC2016 - packages=$(python3 - << EOF -from __future__ import annotations -import shlex -import re -import pathlib -import logging - -from typing import Tuple, Dict, List, Any - -def _get_distro_info() -> Dict[str, Any]: - try: - import distro - except ModuleNotFoundError: - pass - else: - return dict( - distro_id=distro.id(), - distro_version=distro.version(), - aliases=distro.like().split() - ) - release_file = pathlib.Path("/etc/os-release") - release_info: Dict[str, str] = {} - with release_file.open("r") as f: - lexer = shlex.shlex(f, posix=True) - lexer.whitespace_split = True - for item in list(lexer): - if "=" in item: - key, val = item.split("=", maxsplit=1) - release_info[key] = val - return dict( - distro_id=release_info.get("ID", ""), - distro_version=release_info.get("VERSION_ID", ""), - aliases=release_info.get("ID_LIKE", "").split() - ) - -def _convert_version(version: str) -> Tuple[str | int, ...]: - version = version.strip() - ver_match = re.match(r"\d+(\.\d+)*((?:-|\.).+)?", version) - if ver_match is not None: - return tuple([ - int(part) if part.isdigit() else part - for part in re.split(r"\.|-", version) - ]) - return (version,) - -class SysDepsParser: - def __init__(self, distro_info: Dict[str, Any] | None = None) -> None: - if distro_info is None: - distro_info = _get_distro_info() - self.distro_id: str = distro_info.get("distro_id", "") - self.aliases: List[str] = distro_info.get("aliases", []) - self.distro_version: Tuple[int | str, ...] = tuple() - version = distro_info.get("distro_version") - if version: - self.distro_version = _convert_version(version) - self.vendor: str = "" - if pathlib.Path("/etc/rpi-issue").is_file(): - self.vendor = "raspberry-pi" - - def _parse_spec(self, full_spec: str) -> str | None: - parts = full_spec.split(";", maxsplit=1) - if len(parts) == 1: - return full_spec - pkg_name = parts[0].strip() - expressions = re.split(r"( and | or )", parts[1].strip()) - if not len(expressions) & 1: - logging.info( - f"Requirement specifier is missing an expression " - f"between logical operators : {full_spec}" - ) - return None - last_result: bool = True - last_logical_op: str | None = "and" - for idx, exp in enumerate(expressions): - if idx & 1: - if last_logical_op is not None: - logging.info( - "Requirement specifier contains sequential logical " - f"operators: {full_spec}" - ) - return None - logical_op = exp.strip() - if logical_op not in ("and", "or"): - logging.info( - f"Invalid logical operator {logical_op} in requirement " - f"specifier: {full_spec}") - return None - last_logical_op = logical_op - continue - elif last_logical_op is None: - logging.info( - f"Requirement specifier contains two seqential expressions " - f"without a logical operator: {full_spec}") - return None - dep_parts = re.split(r"(==|!=|<=|>=|<|>)", exp.strip()) - req_var = dep_parts[0].strip().lower() - if len(dep_parts) != 3: - logging.info(f"Invalid comparison, must be 3 parts: {full_spec}") - return None - elif req_var == "distro_id": - left_op: str | Tuple[int | str, ...] = self.distro_id - right_op = dep_parts[2].strip().strip("\"'") - elif req_var == "vendor": - left_op = self.vendor - right_op = dep_parts[2].strip().strip("\"'") - elif req_var == "distro_version": - if not self.distro_version: - logging.info( - "Distro Version not detected, cannot satisfy requirement: " - f"{full_spec}" - ) - return None - left_op = self.distro_version - right_op = _convert_version(dep_parts[2].strip().strip("\"'")) - else: - logging.info(f"Invalid requirement specifier: {full_spec}") - return None - operator = dep_parts[1].strip() - try: - compfunc = { - "<": lambda x, y: x < y, - ">": lambda x, y: x > y, - "==": lambda x, y: x == y, - "!=": lambda x, y: x != y, - ">=": lambda x, y: x >= y, - "<=": lambda x, y: x <= y - }.get(operator, lambda x, y: False) - result = compfunc(left_op, right_op) - if last_logical_op == "and": - last_result &= result - else: - last_result |= result - last_logical_op = None - except Exception: - logging.exception(f"Error comparing requirements: {full_spec}") - return None - if last_result: - return pkg_name - return None - - def parse_dependencies(self, sys_deps: Dict[str, List[str]]) -> List[str]: - if not self.distro_id: - logging.info( - "Failed to detect current distro ID, cannot parse dependencies" - ) - return [] - all_ids = [self.distro_id] + self.aliases - for distro_id in all_ids: - if distro_id in sys_deps: - if not sys_deps[distro_id]: - logging.info( - f"Dependency data contains an empty package definition " - f"for linux distro '{distro_id}'" - ) - continue - processed_deps: List[str] = [] - for dep in sys_deps[distro_id]: - parsed_dep = self._parse_spec(dep) - if parsed_dep is not None: - processed_deps.append(parsed_dep) - return processed_deps - else: - logging.info( - f"Dependency data has no package definition for linux " - f"distro '{self.distro_id}'" - ) - return [] -# *** SYSTEM DEPENDENCIES START *** -system_deps = { - "debian": [ - "python3-virtualenv", "python3-dev", "libopenjp2-7", "libsodium-dev", - "zlib1g-dev", "libjpeg-dev", "packagekit", - "wireless-tools; distro_id != 'ubuntu' or distro_version <= '24.04'", - "iw; distro_id == 'ubuntu' and distro_version >= '24.10'", - "python3-libcamera; vendor == 'raspberry-pi' and distro_version >= '11'", - "curl", "build-essential" - ], -} -# *** SYSTEM DEPENDENCIES END *** -parser = SysDepsParser() -pkgs = parser.parse_dependencies(system_deps) -if pkgs: - print(' '.join(pkgs), end="") -exit(0) -EOF -) - - echo "${cyan}${packages}${white}" | tr '[:space:]' '\n' - read -r -a packages <<< "${packages}" - - ### Update system package lists if stale - update_system_package_lists - - ### Install required packages - install_system_packages "${log_name}" "packages[@]" -} - -function create_moonraker_virtualenv() { - status_msg "Installing python virtual environment..." - - ### always create a clean virtualenv - [[ -d ${MOONRAKER_ENV} ]] && rm -rf "${MOONRAKER_ENV}" - - if virtualenv -p /usr/bin/python3 "${MOONRAKER_ENV}"; then - "${MOONRAKER_ENV}"/bin/pip install -r "${MOONRAKER_DIR}/scripts/moonraker-requirements.txt" - else - log_error "failure while creating python3 moonraker-env" - error_msg "Creation of Moonraker virtualenv failed!" - exit 1 - fi -} - -function moonraker_setup() { - local instance_arr=("${@}") - ### checking dependencies - local dep=(git wget curl unzip dfu-util virtualenv) - ### additional required dependencies on armbian - dep+=(libjpeg-dev zlib1g-dev) - dependency_check "${dep[@]}" - - ### step 1: clone moonraker - clone_moonraker "${MOONRAKER_REPO}" - - ### step 2: install moonraker dependencies and create python virtualenv - status_msg "Installing dependencies ..." - install_moonraker_dependencies - create_moonraker_virtualenv - - ### step 3: create moonraker.conf - create_moonraker_conf "${instance_arr[@]}" - - ### step 4: create moonraker instances - configure_moonraker_service "${instance_arr[@]}" - - ### step 5: create polkit rules for moonraker - install_moonraker_polkit || true - - ### step 6: enable and start all instances - do_action_service "enable" "moonraker" - do_action_service "start" "moonraker" - - ### confirm message - local confirm="" - (( instance_arr[0] == 1 )) && confirm="Moonraker has been set up!" - (( instance_arr[0] > 1 )) && confirm="${instance_arr[0]} Moonraker instances have been set up!" - print_confirm "${confirm}" && print_mr_ip_list "${instance_arr[0]}" && return -} - -function clone_moonraker() { - local repo=${1} - - status_msg "Cloning Moonraker from ${repo} ..." - - ### force remove existing moonraker dir and clone into fresh moonraker dir - [[ -d ${MOONRAKER_DIR} ]] && rm -rf "${MOONRAKER_DIR}" - - cd "${HOME}" || exit 1 - if ! git clone "${MOONRAKER_REPO}" "${MOONRAKER_DIR}"; then - print_error "Cloning Moonraker from\n ${repo}\n failed!" - exit 1 - fi -} - -function create_moonraker_conf() { - local input=("${@}") - local moonraker_count=${input[0]} && unset "input[0]" - local names=("${input[@]}") && unset "input[@]" - local port lan printer_data cfg_dir cfg uds - - port=7125 - lan="$(hostname -I | cut -d" " -f1 | cut -d"." -f1-2).0.0/16" - - if (( moonraker_count == 1 )); then - printer_data="${HOME}/printer_data" - cfg_dir="${printer_data}/config" - cfg="${cfg_dir}/moonraker.conf" - uds="${printer_data}/comms/klippy.sock" - - ### write single instance config - write_moonraker_conf "${cfg_dir}" "${cfg}" "${port}" "${uds}" "${lan}" - - elif (( moonraker_count > 1 )); then - local j=0 re="^[1-9][0-9]*$" - - for (( i=1; i <= moonraker_count; i++ )); do - ### overwrite config folder if name is only a number - if [[ ${names[j]} =~ ${re} ]]; then - printer_data="${HOME}/printer_${names[${j}]}_data" - else - printer_data="${HOME}/${names[${j}]}_data" - fi - - cfg_dir="${printer_data}/config" - cfg="${cfg_dir}/moonraker.conf" - uds="${printer_data}/comms/klippy.sock" - - ### write multi instance config - write_moonraker_conf "${cfg_dir}" "${cfg}" "${port}" "${uds}" "${lan}" - port=$(( port + 1 )) - j=$(( j + 1 )) - done && unset j - - else - return 1 - fi -} - -function write_moonraker_conf() { - local cfg_dir=${1} cfg=${2} port=${3} uds=${4} lan=${5} - local conf_template="${KIAUH_SRCDIR}/resources/moonraker.conf" - - [[ ! -d ${cfg_dir} ]] && mkdir -p "${cfg_dir}" - - if [[ ! -f ${cfg} ]]; then - status_msg "Creating moonraker.conf in ${cfg_dir} ..." - cp "${conf_template}" "${cfg}" - sed -i "s|%USER%|${USER}|g; s|%PORT%|${port}|; s|%UDS%|${uds}|" "${cfg}" - # if host ip is not in the default ip ranges replace placeholder, - # otherwise remove placeholder from config - if ! grep -q "${lan}" "${cfg}"; then - sed -i "s|%LAN%|${lan}|" "${cfg}" - else - sed -i "/%LAN%/d" "${cfg}" - fi - ok_msg "moonraker.conf created!" - else - status_msg "File '${cfg_dir}/moonraker.conf' already exists!\nSkipping..." - fi -} - -function configure_moonraker_service() { - local input=("${@}") - local moonraker_count=${input[0]} && unset "input[0]" - local names=("${input[@]}") && unset "input[@]" - local printer_data cfg_dir service env_file - - if (( moonraker_count == 1 )) && [[ ${#names[@]} -eq 0 ]]; then - i="" - printer_data="${HOME}/printer_data" - cfg_dir="${printer_data}/config" - service="${SYSTEMD}/moonraker.service" - env_file="${printer_data}/systemd/moonraker.env" - - ### create required folder structure - create_required_folders "${printer_data}" - - ### write single instance service - write_moonraker_service "" "${printer_data}" "${service}" "${env_file}" - ok_msg "Moonraker instance created!" - - elif (( moonraker_count > 1 )) && [[ ${#names[@]} -gt 0 ]]; then - local j=0 re="^[1-9][0-9]*$" - - for (( i=1; i <= moonraker_count; i++ )); do - ### overwrite config folder if name is only a number - if [[ ${names[j]} =~ ${re} ]]; then - printer_data="${HOME}/printer_${names[${j}]}_data" - else - printer_data="${HOME}/${names[${j}]}_data" - fi - - cfg_dir="${printer_data}/config" - service="${SYSTEMD}/moonraker-${names[${j}]}.service" - env_file="${printer_data}/systemd/moonraker.env" - - ### create required folder structure - create_required_folders "${printer_data}" - - ### write multi instance service - write_moonraker_service "${names[${j}]}" "${printer_data}" "${service}" "${env_file}" - ok_msg "Moonraker instance 'moonraker-${names[${j}]}' created!" - j=$(( j + 1 )) - done && unset i - - ### enable mainsails remoteMode if mainsail is found - if [[ -d ${MAINSAIL_DIR} ]]; then - enable_mainsail_remotemode - fi - - else - return 1 - fi -} - -function write_moonraker_service() { - local i=${1} printer_data=${2} service=${3} env_file=${4} - local service_template="${KIAUH_SRCDIR}/resources/moonraker.service" - local env_template="${KIAUH_SRCDIR}/resources/moonraker.env" - - ### replace all placeholders - if [[ ! -f ${service} ]]; then - status_msg "Creating Moonraker Service ${i} ..." - sudo cp "${service_template}" "${service}" - sudo cp "${env_template}" "${env_file}" - - [[ -z ${i} ]] && sudo sed -i "s| %INST%||" "${service}" - [[ -n ${i} ]] && sudo sed -i "s|%INST%|${i}|" "${service}" - sudo sed -i "s|%USER%|${USER}|g; s|%MOONRAKER_DIR%|${MOONRAKER_DIR}|; s|%ENV%|${MOONRAKER_ENV}|; s|%ENV_FILE%|${env_file}|" "${service}" - sudo sed -i "s|%USER%|${USER}|; s|%MOONRAKER_DIR%|${MOONRAKER_DIR}|; s|%PRINTER_DATA%|${printer_data}|" "${env_file}" - fi -} - -function print_mr_ip_list() { - local ip count=${1} port=7125 - ip=$(hostname -I | cut -d" " -f1) - - for (( i=1; i <= count; i++ )); do - echo -e " ${cyan}● Instance ${i}:${white} ${ip}:${port}" - port=$(( port + 1 )) - done && echo -} - -### introduced due to -### https://github.com/Arksine/moonraker/issues/349 -### https://github.com/Arksine/moonraker/pull/346 -function install_moonraker_polkit() { - local POLKIT_LEGACY_FILE="/etc/polkit-1/localauthority/50-local.d/10-moonraker.pkla" - local POLKIT_FILE="/etc/polkit-1/rules.d/moonraker.rules" - local POLKIT_USR_FILE="/usr/share/polkit-1/rules.d/moonraker.rules" - local legacy_file_exists - local file_exists - local usr_file_exists - - local has_sup - local require_daemon_reload="false" - - legacy_file_exists=$(sudo find "${POLKIT_LEGACY_FILE}" 2> /dev/null) - file_exists=$(sudo find "${POLKIT_FILE}" 2> /dev/null) - usr_file_exists=$(sudo find "${POLKIT_USR_FILE}" 2> /dev/null) - - ### check for required SupplementaryGroups entry in service files - ### write it to the service if it doesn't exist - for service in $(moonraker_systemd); do - has_sup="$(grep "SupplementaryGroups=moonraker-admin" "${service}")" - if [[ -z ${has_sup} ]]; then - status_msg "Adding moonraker-admin supplementary group to ${service} ..." - sudo sed -i "/^Type=simple$/a SupplementaryGroups=moonraker-admin" "${service}" - require_daemon_reload="true" - ok_msg "Adding moonraker-admin supplementary group successfull!" - fi - done - - if [[ ${require_daemon_reload} == "true" ]]; then - status_msg "Reloading unit files ..." - sudo systemctl daemon-reload - ok_msg "Unit files reloaded!" - fi - - ### execute moonrakers policykit-rules script only if rule files do not already exist - if [[ -z ${legacy_file_exists} && ( -z ${file_exists} || -z ${usr_file_exists} ) ]]; then - status_msg "Installing Moonraker policykit rules ..." - "${HOME}"/moonraker/scripts/set-policykit-rules.sh - ok_msg "Moonraker policykit rules installed!" - fi - - return -} - -#==================================================# -#================ REMOVE MOONRAKER ================# -#==================================================# - -function remove_moonraker_sysvinit() { - [[ ! -e "${INITD}/moonraker" ]] && return - - status_msg "Removing Moonraker SysVinit service ..." - sudo systemctl stop moonraker - sudo update-rc.d -f moonraker remove - sudo rm -f "${INITD}/moonraker" "${ETCDEF}/moonraker" - ok_msg "Moonraker SysVinit service removed!" -} - -function remove_moonraker_systemd() { - [[ -z $(moonraker_systemd) ]] && return - - status_msg "Removing Moonraker Systemd Services ..." - - for service in $(moonraker_systemd | cut -d"/" -f5); do - status_msg "Removing ${service} ..." - sudo systemctl stop "${service}" - sudo systemctl disable "${service}" - sudo rm -f "${SYSTEMD}/${service}" - ok_msg "Done!" - done - - ### reloading units - sudo systemctl daemon-reload - sudo systemctl reset-failed - ok_msg "Moonraker Services removed!" -} - -function remove_moonraker_env_file() { - local files regex="${HOME//\//\\/}\/([A-Za-z0-9_]+)\/systemd\/moonraker\.env" - files=$(find "${HOME}" -maxdepth 3 -regextype posix-extended -regex "${regex}" | sort) - - if [[ -n ${files} ]]; then - for file in ${files}; do - status_msg "Removing ${file} ..." - rm -f "${file}" - ok_msg "${file} removed!" - done - fi -} - -function remove_moonraker_logs() { - local files regex="${HOME//\//\\/}\/([A-Za-z0-9_]+)\/logs\/moonraker\.log.*" - files=$(find "${HOME}" -maxdepth 3 -regextype posix-extended -regex "${regex}" | sort) - - if [[ -n ${files} ]]; then - for file in ${files}; do - status_msg "Removing ${file} ..." - rm -f "${file}" - ok_msg "${file} removed!" - done - fi -} - -function remove_legacy_moonraker_logs() { - local files regex="moonraker(-[0-9a-zA-Z]+)?\.log(.*)?" - files=$(find "${HOME}/klipper_logs" -maxdepth 1 -regextype posix-extended -regex "${HOME}/klipper_logs/${regex}" 2> /dev/null | sort) - - if [[ -n ${files} ]]; then - for file in ${files}; do - status_msg "Removing ${file} ..." - rm -f "${file}" - ok_msg "${file} removed!" - done - fi -} - -function remove_moonraker_api_key() { - ### remove legacy api key - if [[ -e "${HOME}/.klippy_api_key" ]]; then - status_msg "Removing legacy API Key ..." - rm "${HOME}/.klippy_api_key" - ok_msg "Done!" - fi - - ### remove api key - if [[ -e "${HOME}/.moonraker_api_key" ]]; then - status_msg "Removing API Key ..." - rm "${HOME}/.moonraker_api_key" - ok_msg "Done!" - fi -} - -function remove_moonraker_dir() { - [[ ! -d ${MOONRAKER_DIR} ]] && return - - status_msg "Removing Moonraker directory ..." - rm -rf "${MOONRAKER_DIR}" - ok_msg "Directory removed!" -} - -function remove_moonraker_env() { - [[ ! -d ${MOONRAKER_ENV} ]] && return - - status_msg "Removing moonraker-env directory ..." - rm -rf "${MOONRAKER_ENV}" - ok_msg "Directory removed!" -} - -function remove_moonraker_polkit() { - [[ ! -d ${MOONRAKER_DIR} ]] && return - - status_msg "Removing all Moonraker PolicyKit rules ..." - "${MOONRAKER_DIR}"/scripts/set-policykit-rules.sh --clear - ok_msg "Done!" -} - -function remove_moonraker() { - remove_moonraker_sysvinit - remove_moonraker_systemd - remove_moonraker_env_file - remove_moonraker_logs - remove_legacy_moonraker_logs - remove_moonraker_api_key - remove_moonraker_polkit - remove_moonraker_dir - remove_moonraker_env - - print_confirm "Moonraker was successfully removed!" - return -} - -#==================================================# -#================ UPDATE MOONRAKER ================# -#==================================================# - -function update_moonraker() { - do_action_service "stop" "moonraker" - - if [[ ! -d ${MOONRAKER_DIR} ]]; then - clone_moonraker "${MOONRAKER_REPO}" - else - backup_before_update "moonraker" - status_msg "Updating Moonraker ..." - cd "${MOONRAKER_DIR}" && git pull - ### read PKGLIST and install possible new dependencies - install_moonraker_dependencies - ### install possible new python dependencies - "${MOONRAKER_ENV}"/bin/pip install -r "${MOONRAKER_DIR}/scripts/moonraker-requirements.txt" - fi - - ### required due to https://github.com/Arksine/moonraker/issues/349 - install_moonraker_polkit || true - - ok_msg "Update complete!" - do_action_service "restart" "moonraker" -} - -#==================================================# -#================ MOONRAKER STATUS ================# -#==================================================# - -function get_moonraker_status() { - local sf_count status - sf_count="$(moonraker_systemd | wc -w)" - - ### remove the "SERVICE" entry from the data array if a moonraker service is installed - local data_arr=(SERVICE "${MOONRAKER_DIR}" "${MOONRAKER_ENV}") - (( sf_count > 0 )) && unset "data_arr[0]" - - ### count+1 for each found data-item from array - local filecount=0 - for data in "${data_arr[@]}"; do - [[ -e ${data} ]] && filecount=$(( filecount + 1 )) - done - - if (( filecount == ${#data_arr[*]} )); then - status="Installed: ${sf_count}" - elif (( filecount == 0 )); then - status="Not installed!" - else - status="Incomplete!" - fi - - echo "${status}" -} - -function get_local_moonraker_commit() { - [[ ! -d ${MOONRAKER_DIR} || ! -d "${MOONRAKER_DIR}/.git" ]] && return - - local commit - cd "${MOONRAKER_DIR}" - commit="$(git describe HEAD --always --tags | cut -d "-" -f 1,2)" - echo "${commit}" -} - -function get_remote_moonraker_commit() { - [[ ! -d ${MOONRAKER_DIR} || ! -d "${MOONRAKER_DIR}/.git" ]] && return - - local commit - cd "${MOONRAKER_DIR}" && git fetch origin -q - commit=$(git describe origin/master --always --tags | cut -d "-" -f 1,2) - echo "${commit}" -} - -function compare_moonraker_versions() { - local versions local_ver remote_ver - local_ver="$(get_local_moonraker_commit)" - remote_ver="$(get_remote_moonraker_commit)" - - if [[ ${local_ver} != "${remote_ver}" ]]; then - versions="${yellow}$(printf " %-14s" "${local_ver}")${white}" - versions+="|${green}$(printf " %-13s" "${remote_ver}")${white}" - # add moonraker to application_updates_available in kiauh.ini - add_to_application_updates "moonraker" - else - versions="${green}$(printf " %-14s" "${local_ver}")${white}" - versions+="|${green}$(printf " %-13s" "${remote_ver}")${white}" - fi - - echo "${versions}" -} diff --git a/scripts/nginx.sh b/scripts/nginx.sh deleted file mode 100644 index 9b80d68..0000000 --- a/scripts/nginx.sh +++ /dev/null @@ -1,360 +0,0 @@ -#!/usr/bin/env bash - -#=======================================================================# -# Copyright (C) 2020 - 2024 Dominik Willner # -# # -# 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 # -#=======================================================================# - -set -e - -#===================================================# -#=================== REMOVE NGINX ==================# -#===================================================# - -function remove_nginx() { - if [[ $(dpkg -s nginx 2>/dev/null | grep "Status") = *\ installed ]]; then - status_msg "Stopping NGINX service ..." - if systemctl is-active nginx -q; then - sudo systemctl stop nginx && ok_msg "Service stopped!" - else - warn_msg "NGINX service not active!" - fi - - status_msg "Removing NGINX from system ..." - if sudo apt-get remove nginx -y && sudo update-rc.d -f nginx remove; then - ok_msg "NGINX removed!" - else - error_msg "Removing NGINX from system failed!" - fi - else - print_error "Looks like Nginx was already removed!\n Skipping..." - fi -} - -#===================================================# -#===================== HELPERS =====================# -#===================================================# - -function set_upstream_nginx_cfg() { - local current_date - local upstreams="${NGINX_CONFD}/upstreams.conf" - local common_vars="${NGINX_CONFD}/common_vars.conf" - - current_date=$(get_date) - - ### backup existing nginx configs - [[ ! -d "${BACKUP_DIR}/nginx_cfg" ]] && mkdir -p "${BACKUP_DIR}/nginx_cfg" - - if [[ -f ${upstreams} ]]; then - sudo mv "${upstreams}" "${BACKUP_DIR}/nginx_cfg/${current_date}_upstreams.conf" - fi - - if [[ -f ${common_vars} ]]; then - sudo mv "${common_vars}" "${BACKUP_DIR}/nginx_cfg/${current_date}_common_vars.conf" - fi - - ### transfer ownership of backed up files from root to ${USER} - local files - files=$(find "${BACKUP_DIR}/nginx_cfg") - - for file in ${files}; do - if [[ $(stat -c "%U" "${file}") != "${USER}" ]]; then - log_info "chown for user: ${USER} on file: ${file}" - sudo chown "${USER}" "${file}" - fi - done - - ### copy nginx configs to target destination - [[ ! -f ${upstreams} ]] && sudo cp "${RESOURCES}/upstreams.conf" "${upstreams}" - [[ ! -f ${common_vars} ]] && sudo cp "${RESOURCES}/common_vars.conf" "${common_vars}" -} - -function symlink_webui_nginx_log() { - local interface path access_log error_log regex logpaths - - interface=${1} - access_log="/var/log/nginx/${interface}-access.log" - error_log="/var/log/nginx/${interface}-error.log" - regex="${HOME//\//\\/}\/([A-Za-z0-9_]+)\/logs" - logpaths=$(find "${HOME}" -maxdepth 2 -type d -regextype posix-extended -regex "${regex}" | sort) - - for path in ${logpaths}; do - [[ ! -d ${path} ]] && mkdir -p "${path}" - - if [[ -f ${access_log} && ! -L "${path}/${interface}-access.log" ]]; then - status_msg "Creating symlink for ${access_log} ..." - ln -s "${access_log}" "${path}" - ok_msg "Symlink created: ${path}/${interface}-access.log" - fi - - if [[ -f ${error_log} && ! -L "${path}/${interface}-error.log" ]]; then - status_msg "Creating symlink for ${error_log} ..." - ln -s "${error_log}" "${path}" - ok_msg "Symlink created: ${path}/${interface}-error.log" - fi - done -} - -function match_nginx_configs() { - read_kiauh_ini "${FUNCNAME[0]}" - local require_service_restart="false" - local upstreams="${NGINX_CONFD}/upstreams.conf" - local common_vars="${NGINX_CONFD}/common_vars.conf" - local mainsail_nginx_cfg="/etc/nginx/sites-available/mainsail" - local fluidd_nginx_cfg="/etc/nginx/sites-available/fluidd" - local upstreams_webcams - local mainsail_webcams - local fluidd_webcams - - ### reinstall nginx configs if the amount of upstreams don't match anymore - upstreams_webcams=$(grep -Ec "mjpgstreamer" "/etc/nginx/conf.d/upstreams.conf") - mainsail_webcams=$(grep -Ec "mjpgstreamer" "${mainsail_nginx_cfg}" 2>/dev/null || echo "0") - fluidd_webcams=$(grep -Ec "mjpgstreamer" "${fluidd_nginx_cfg}" 2>/dev/null || echo "0") - - status_msg "Checking validity of NGINX configurations ..." - - ### check for outdated upstreams.conf - if (( upstreams_webcams < mainsail_webcams || upstreams_webcams < fluidd_webcams )); then - status_msg "Outdated upstreams.conf found! Updating ..." - - sudo rm -f "${upstreams}" "${common_vars}" - set_upstream_nginx_cfg - - require_service_restart="true" - fi - - ### check for outdated mainsail config - if [[ -e ${mainsail_nginx_cfg} ]] && (( upstreams_webcams > mainsail_webcams )); then - status_msg "Outdated Mainsail config found! Updating ..." - - sudo rm -f "${mainsail_nginx_cfg}" - sudo cp "${RESOURCES}/mainsail" "${mainsail_nginx_cfg}" - sudo sed -i "s/<>/mainsail/g" "${mainsail_nginx_cfg}" - sudo sed -i "/root/s/pi/${USER}/" "${mainsail_nginx_cfg}" - sudo sed -i "s/listen\s[0-9]*;/listen ${mainsail_port};/" "${mainsail_nginx_cfg}" - sudo sed -i "s/listen\s\[\:*\]\:[0-9]*;/listen \[::\]\:${mainsail_port};/" "${mainsail_nginx_cfg}" - - require_service_restart="true" - fi - - ### check for outdated fluidd config - if [[ -e ${fluidd_nginx_cfg} ]] && (( upstreams_webcams > fluidd_webcams )); then - status_msg "Outdated Fluidd config found! Updating ..." - - sudo rm -f "${fluidd_nginx_cfg}" - sudo cp "${RESOURCES}/fluidd" "${fluidd_nginx_cfg}" - sudo sed -i "s/<>/fluidd/g" "${fluidd_nginx_cfg}" - sudo sed -i "/root/s/pi/${USER}/" "${fluidd_nginx_cfg}" - sudo sed -i "s/listen\s[0-9]*;/listen ${fluidd_port};/" "${fluidd_nginx_cfg}" - sudo sed -i "s/listen\s\[\:*\]\:[0-9]*;/listen \[::\]\:${fluidd_port};/" "${fluidd_nginx_cfg}" - - require_service_restart="true" - fi - - ### only restart nginx if configs were updated - if [[ ${require_service_restart} == "true" ]]; then - sudo systemctl restart nginx.service - fi - - ok_msg "Done!" -} - -function remove_conflicting_packages() { - local apache=${1} haproxy=${2} - - ### disable services before removing them - disable_conflicting_packages "${apache}" "${haproxy}" - - if [[ ${apache} == "true" ]]; then - status_msg "Removing Apache2 from system ..." - if sudo apt-get remove apache2 -y && sudo update-rc.d -f apache2 remove; then - ok_msg "Apache2 removed!" - else - error_msg "Removing Apache2 from system failed!" - fi - fi - - if [[ ${haproxy} == "true" ]]; then - status_msg "Removing haproxy from system ..." - if sudo apt-get remove haproxy -y && sudo update-rc.d -f haproxy remove; then - ok_msg "Haproxy removed!" - else - error_msg "Removing Haproxy from system failed!" - fi - fi -} - -function disable_conflicting_packages() { - local apache=${1} haproxy=${2} - - if [[ ${apache} == "true" ]]; then - status_msg "Stopping Apache2 service ..." - if systemctl is-active apache2 -q; then - sudo systemctl stop apache2 && ok_msg "Service stopped!" - else - warn_msg "Apache2 service not active!" - fi - - status_msg "Disabling Apache2 service ..." - if sudo systemctl disable apache2; then - ok_msg "Apache2 service disabled!" - else - error_msg "Disabling Apache2 service failed!" - fi - fi - - if [[ ${haproxy} == "true" ]]; then - status_msg "Stopping Haproxy service ..." - if systemctl is-active haproxy -q; then - sudo systemctl stop haproxy && ok_msg "Service stopped!" - else - warn_msg "Haproxy service not active!" - fi - - status_msg "Disabling Haproxy service ..." - if sudo systemctl disable haproxy; then - ok_msg "Haproxy service disabled!" - else - error_msg "Disabling Haproxy service failed!" - fi - fi -} - -function detect_conflicting_packages() { - local apache="false" haproxy="false" - - ### check system for an installed apache2 service - [[ $(dpkg -s apache2 2>/dev/null | grep "Status") = *\ installed ]] && apache="true" - ### check system for an installed haproxy service - [[ $(dpkg -s haproxy 2>/dev/null | grep "Status") = *\ installed ]] && haproxy="true" - - #notify user about haproxy or apache2 services found and possible issues - if [[ ${haproxy} == "false" && ${apache} == "false" ]]; then - return - else - while true; do - echo - top_border - echo -e "| ${red}Conflicting package installations found:${white} |" - [[ ${apache} == "true" ]] && \ - echo -e "| ${red}● apache2${white} |" - [[ ${haproxy} == "true" ]] && \ - echo -e "| ${red}● haproxy${white} |" - blank_line - echo -e "| Having those packages installed can lead to unwanted |" - echo -e "| behaviour. It's recommended to remove those packages. |" - echo -e "| |" - echo -e "| ${green}1) Remove packages (recommend)${white} |" - echo -e "| 2) Disable only (may still cause issues) |" - echo -e "| ${red}3) Skip this step (not recommended)${white} |" - bottom_border - - local action - read -p "${cyan}###### Please choose:${white} " action - case "${action}" in - 1) - echo -e "###### > Remove packages" - remove_conflicting_packages "${apache}" "${haproxy}" - break;; - 2) - echo -e "###### > Disable only" - disable_conflicting_packages "${apache}" "${haproxy}" - break;; - 3) - echo -e "###### > Skip" - break;; - *) - error_msg "Invalid command!";; - esac - done - fi -} - -function set_nginx_cfg() { - local interface=${1} - - if [[ ${SET_NGINX_CFG} == "true" ]]; then - #check for dependencies - local dep=(nginx) - dependency_check "${dep[@]}" - - local cfg_src="${RESOURCES}/${interface}" - local cfg_dest="/etc/nginx/sites-available/${interface}" - - status_msg "Creating NGINX configuration for ${interface^} ..." - - # copy config to destination and set correct username - [[ -f ${cfg_dest} ]] && sudo rm -f "${cfg_dest}" - sudo cp "${cfg_src}" "${cfg_dest}" - sudo sed -i "/root/s/pi/${USER}/" "${cfg_dest}" - - if [[ ${SET_LISTEN_PORT} != "${DEFAULT_PORT}" ]]; then - sudo sed -i "s/listen\s[0-9]*;/listen ${SET_LISTEN_PORT};/" "${cfg_dest}" - sudo sed -i "s/listen\s\[\:*\]\:[0-9]*;/listen \[::\]\:${SET_LISTEN_PORT};/" "${cfg_dest}" - fi - - #remove nginx default config - if [[ -e "/etc/nginx/sites-enabled/default" ]]; then - sudo rm "/etc/nginx/sites-enabled/default" - fi - - #create symlink for own sites - if [[ ! -e "/etc/nginx/sites-enabled/${interface}" ]]; then - sudo ln -s "/etc/nginx/sites-available/${interface}" "/etc/nginx/sites-enabled/" - fi - - if [[ -n ${SET_LISTEN_PORT} ]]; then - ok_msg "${interface^} configured for port ${SET_LISTEN_PORT}!" - else - ok_msg "${interface^} configured for default port ${DEFAULT_PORT}!" - fi - - sudo systemctl restart nginx.service - - ok_msg "NGINX configuration for ${interface^} was set!" - fi -} - -### -# check if permissions of the users home directory -# grant execution rights to group and other which is -# required for NGINX to be able to serve Mainsail/Fluidd -# -function set_nginx_permissions() { - local homedir_perm - local exec_perms_count - - homedir_perm=$(ls -ld "${HOME}") - exec_perms_count=$(echo "${homedir_perm}" | cut -d" " -f1 | grep -c "x") - - if (( exec_perms_count < 3 )); then - status_msg "Granting NGINX the required permissions ..." - chmod og+x "${HOME}" && ok_msg "Done!" - fi - - return -} - -function read_listen_port() { - local port interface=${1} - port=$(grep listen "/etc/nginx/sites-enabled/${interface}" | head -1 | sed 's/^\s*//' | cut -d" " -f2 | cut -d";" -f1) - echo "${port}" -} - -function detect_enabled_sites() { - MAINSAIL_ENABLED="false" FLUIDD_ENABLED="false" - #check if there is another UI config already installed and reads the port they are listening on - if [[ -e "/etc/nginx/sites-enabled/mainsail" ]]; then - SITE_ENABLED="true" && MAINSAIL_ENABLED="true" - MAINSAIL_PORT=$(read_listen_port "mainsail") - fi - if [[ -e "/etc/nginx/sites-enabled/fluidd" ]]; then - SITE_ENABLED="true" && FLUIDD_ENABLED="true" - FLUIDD_PORT=$(read_listen_port "fluidd") - - fi -} diff --git a/scripts/obico.sh b/scripts/obico.sh deleted file mode 100644 index bd6a1cd..0000000 --- a/scripts/obico.sh +++ /dev/null @@ -1,489 +0,0 @@ -#!/usr/bin/env bash - -#=======================================================================# -# Copyright (C) 2020 - 2024 Dominik Willner # -# # -# 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 # -#=======================================================================# - -set -e - -#===================================================# -#============== INSTALL MOONRAKER-OBICO ============# -#===================================================# - -function moonraker_obico_systemd() { - local services - services=$(find "${SYSTEMD}" -maxdepth 1 -regextype posix-extended -regex "${SYSTEMD}/moonraker-obico(-[0-9a-zA-Z]+)?.service") - echo "${services}" -} - -function moonraker_obico_config() { - local moonraker_cfg_dirs - - read -r -a moonraker_cfg_dirs <<< "$(get_instance_folder_path "config")" - - if (( ${#moonraker_cfg_dirs[@]} > 0 )); then - echo "${moonraker_cfg_dirs[${1}]}/moonraker-obico.cfg" - else - echo "" - fi -} - -function moonraker_obico_needs_linking() { - local moonraker_obico_cfg=${1} - if [[ ! -f "${moonraker_obico_cfg}" ]]; then - return 1 - fi - if grep -s -E "^[^#]" "${moonraker_obico_cfg}" | grep -q 'auth_token'; then - return 1 - else - return 0 - fi -} - -function obico_server_url_prompt() { - top_border - printf "|${green}%-55s${white}|\n" " Obico Server URL" - blank_line - echo -e "| You can use a self-hosted Obico Server or the Obico |" - echo -e "| Cloud. For more information, please visit: |" - echo -e "| https://obico.io. |" - blank_line - echo -e "| For the Obico Cloud, leave it as the default: |" - printf "|${cyan}%-55s${white}|\n" " https://app.obico.io" - blank_line - echo -e "| For self-hosted server, specify: |" - printf "|${cyan}%-55s${white}|\n" " http://server_ip:port" - echo -e "| For instance, 'http://192.168.0.5:3334'. |" - bottom_border -} - -function moonraker_obico_setup_dialog() { - status_msg "Initializing Obico installation ..." - - local moonraker_count - local moonraker_names - - moonraker_count=$(moonraker_systemd | wc -w) - - if (( moonraker_count == 0 )); then - ### return early if moonraker is not installed - local error="Moonraker not installed! Please install Moonraker first!" - 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 - read -r -a moonraker_names <<< "$(get_multi_instance_names)" - fi - - local moonraker_obico_services - local existing_moonraker_obico_count - moonraker_obico_services=$(moonraker_obico_systemd) - existing_moonraker_obico_count=$(echo "${moonraker_obico_services}" | wc -w ) - local allowed_moonraker_obico_count=$(( moonraker_count - existing_moonraker_obico_count )) - - # Allow user to reinstall an incomplete installation. - if (( allowed_moonraker_obico_count == 0 && moonraker_count > 0 )) && [[ $(get_moonraker_obico_status) != "Not linked!" ]]; then - local yn - while true; do - 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?" - read -p "${cyan}###### ${question} (Y/n):${white} " yn - case "${yn}" in - Y|y|Yes|yes|"") - select_msg "Yes" - break;; - N|n|No|no) - select_msg "No" - abort_msg "Exiting Obico installation...\n" - return;; - *) - error_msg "Invalid Input!";; - esac - done - # The user responded yes, allow the install to run again. - allowed_moonraker_obico_count=1 - fi - - if (( allowed_moonraker_obico_count > 0 )); then - local new_moonraker_obico_count - - ### Step 1: Ask for the number of moonraker-obico instances to install - if (( moonraker_count == 1 )); then - ok_msg "Moonraker installation found!\n" - new_moonraker_obico_count=1 - elif (( moonraker_count > 1 )); then - top_border - printf "|${green}%-55s${white}|\n" " ${moonraker_count} Moonraker instances found!" - for name in "${moonraker_names[@]}"; do - printf "|${cyan}%-57s${white}|\n" " ● moonraker-${name}" - done - blank_line - if (( existing_moonraker_obico_count > 0 )); then - 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 Obico! |" - blank_line - 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 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 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 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!" - return 1 - fi # (( moonraker_count == 1 )) - - ### Step 2: Confirm instance amount - local yn - while true; do - (( 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|"") - select_msg "Yes" - break;; - N|n|No|no) - select_msg "No" - abort_msg "Exiting Obico setup ...\n" - return;; - *) - error_msg "Invalid Input!";; - esac - done - fi # (( allowed_moonraker_obico_count > 0 )) - - if (( new_moonraker_obico_count > 0 )); then - - ### Step 3: Ask for the Obico server URL - obico_server_url_prompt - local obico_server_url - while true; do - read -p "${cyan}###### Obico Server URL:${white} " -i "https://app.obico.io" -e obico_server_url - if echo "${obico_server_url}" | grep -qE "^(http|https)://[a-zA-Z0-9./?=_%:-]*"; then - break - else - error_msg "Invalid server URL!" - fi - done - - (( 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}" - - ### step 6: call moonrake-obico/install.sh with the correct params - local port=7125 - local instance_cfg_dirs - local instance_log_dirs - - read -r -a instance_cfg_dirs <<< "$(get_instance_folder_path "config")" - read -r -a instance_log_dirs <<< "$(get_instance_folder_path "logs")" - - if (( moonraker_count == 1 )); then - "${MOONRAKER_OBICO_DIR}/install.sh"\ - -C "${instance_cfg_dirs[0]}/moonraker.conf"\ - -p "${port}" -H 127.0.0.1 -l\ - "${instance_log_dirs[0]}"\ - -L -S "${obico_server_url}" - elif (( moonraker_count > 1 )); then - local j=${existing_moonraker_obico_count} - - for (( i=1; i <= new_moonraker_obico_count; i++ )); do - "${MOONRAKER_OBICO_DIR}/install.sh"\ - -n "${moonraker_names[${j}]}"\ - -C "${instance_cfg_dirs[${j}]}/moonraker.conf"\ - -p $((port+j))\ - -H 127.0.0.1\ - -l "${instance_log_dirs[${j}]}"\ - -L -S "${obico_server_url}" - j=$(( j + 1 )) - done && unset j - fi # (( moonraker_count == 1 )) - fi # (( new_moonraker_obico_count > 0 )) - - ### Step 7: Link to the Obico server if necessary - local not_linked_instances=() - if (( moonraker_count == 1 )); then - if moonraker_obico_needs_linking "$(moonraker_obico_config 0)"; then - not_linked_instances+=("0") - fi - elif (( moonraker_count > 1 )); then - for (( i=0; i <= moonraker_count; i++ )); do - if moonraker_obico_needs_linking "$(moonraker_obico_config "${i}")"; then - not_linked_instances+=("${i}") - fi - done - fi # (( moonraker_count == 1 )) - - if (( ${#not_linked_instances[@]} > 0 )); then - top_border - if (( moonraker_count == 1 )); then - printf "|${green}%-55s${white}|\n" " Obico not linked to the server!" - else - 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 "| 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 |" - echo -e "| restart the linking process later by: |" - echo -e "| 1. 'cd ~/kiauh && ./kiauh.sh' to launch KIAUH. |" - echo -e "| 2. Select ${green}[Install]${white} |" - echo -e "| 3. Select ${green}[Link to Obico Server]${white} |" - bottom_border - - while true; do - read -p "${cyan}###### Link to your Obico Server account now? (Y/n):${white} " yn - case "${yn}" in - Y|y|Yes|yes|"") - select_msg "Yes" - break;; - N|n|No|no) - select_msg "No" - abort_msg "Exiting Obico setup ...\n" - return;; - *) - error_msg "Invalid Input!";; - esac - done - - if (( moonraker_count == 1 )); then - status_msg "Link moonraker-obico to the Obico Server..." - "${MOONRAKER_OBICO_DIR}/scripts/link.sh" -q -c "$(moonraker_obico_config 0)" - elif (( moonraker_count > 1 )); then - for i in "${not_linked_instances[@]}"; do - local name="${moonraker_names[i]}" - status_msg "Link moonraker-obico-${name} to the Obico Server..." - "${MOONRAKER_OBICO_DIR}/scripts/link.sh" -q -n "${name}" -c "$(moonraker_obico_config "${i}")" - done - fi # (( moonraker_count == 1 )) - fi # (( ${#not_linked_instances[@]} > 0 )) -} - -function clone_moonraker_obico() { - local repo=${1} - - 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 Obico from\n ${repo}\n failed!" - exit 1 - fi -} - -function moonraker_obico_install() { - "${MOONRAKER_OBICO_DIR}/install.sh" "$@" -} - -#===================================================# -#============= REMOVE MOONRAKER-OBICO ==============# -#===================================================# - -function remove_moonraker_obico_systemd() { - [[ -z $(moonraker_obico_systemd) ]] && return - status_msg "Removing Obico Systemd Services ..." - - for service in $(moonraker_obico_systemd | cut -d"/" -f5); do - status_msg "Removing ${service} ..." - sudo systemctl stop "${service}" - sudo systemctl disable "${service}" - sudo rm -f "${SYSTEMD}/${service}" - ok_msg "Done!" - done - - ### reloading units - sudo systemctl daemon-reload - sudo systemctl reset-failed - ok_msg "Obico Services removed!" -} - -function remove_moonraker_obico_logs() { - local files regex="${HOME//\//\\/}\/([A-Za-z0-9_]+)\/logs\/moonraker-obico(-[0-9a-zA-Z]+)?\.log(.*)?" - files=$(find "${HOME}" -maxdepth 3 -regextype posix-extended -regex "${regex}" | sort) - - if [[ -n ${files} ]]; then - for file in ${files}; do - status_msg "Removing ${file} ..." - rm -f "${file}" - ok_msg "${file} removed!" - done - fi -} - -function remove_legacy_moonraker_obico_logs() { - local files regex="moonraker-obico(-[0-9a-zA-Z]+)?\.log(.*)?" - files=$(find "${HOME}/klipper_logs" -maxdepth 1 -regextype posix-extended -regex "${HOME}/klipper_logs/${regex}" 2> /dev/null | sort) - - if [[ -n ${files} ]]; then - for file in ${files}; do - status_msg "Removing ${file} ..." - rm -f "${file}" - ok_msg "${file} removed!" - done - fi -} - -function remove_moonraker_obico_dir() { - [[ ! -d ${MOONRAKER_OBICO_DIR} ]] && return - - status_msg "Removing Obico directory ..." - rm -rf "${MOONRAKER_OBICO_DIR}" - ok_msg "Directory removed!" -} - -function remove_moonraker_obico_env() { - [[ ! -d "${HOME}/moonraker-obico-env" ]] && return - - status_msg "Removing moonraker-obico-env directory ..." - rm -rf "${HOME}/moonraker-obico-env" - ok_msg "Directory removed!" -} - -function remove_moonraker_obico() { - remove_moonraker_obico_systemd - remove_moonraker_obico_logs - remove_moonraker_obico_dir - remove_moonraker_obico_env - - print_confirm "Obico was successfully removed!" - return -} - -#===================================================# -#============= UPDATE MOONRAKER-OBICO ==============# -#===================================================# - -function update_moonraker_obico() { - do_action_service "stop" "moonraker-obico" - - if [[ ! -d ${MOONRAKER_OBICO_DIR} ]]; then - clone_moonraker_obico "${MOONRAKER_OBICO_REPO}" - else - status_msg "Updating Obico ..." - cd "${MOONRAKER_OBICO_DIR}" && git pull - fi - - "${MOONRAKER_OBICO_DIR}/install.sh" -U - - ok_msg "Update complete!" - do_action_service "restart" "moonraker-obico" -} - -#===================================================# -#============= MOONRAKER-OBICO STATUS ==============# -#===================================================# - -function get_moonraker_obico_status() { - local status - local service_count - local is_linked - local moonraker_obico_services - - moonraker_obico_services=$(moonraker_obico_systemd) - service_count=$(echo "${moonraker_obico_services}" | wc -w ) - - is_linked="true" - if [[ -n ${moonraker_obico_services} ]]; then - for cfg_dir in $(get_instance_folder_path "config"); do - if moonraker_obico_needs_linking "${cfg_dir}/moonraker-obico.cfg"; then - is_linked="false" - fi - done - fi - - if (( service_count == 0 )); then - status="Not installed!" - elif [[ ! -d "${MOONRAKER_OBICO_DIR}" ]]; then - status="Incomplete!" - elif [[ ${is_linked} == "false" ]]; then - status="Not linked!" - else - status="Installed!" - fi - - echo "${status}" -} - -function get_local_moonraker_obico_commit() { - [[ ! -d ${MOONRAKER_OBICO_DIR} || ! -d "${MOONRAKER_OBICO_DIR}/.git" ]] && return - - local commit - cd "${MOONRAKER_OBICO_DIR}" - commit="$(git describe HEAD --always --tags | cut -d "-" -f 1,2)" - echo "${commit}" -} - -function get_remote_moonraker_obico_commit() { - [[ ! -d ${MOONRAKER_OBICO_DIR} || ! -d "${MOONRAKER_OBICO_DIR}/.git" ]] && return - - local commit - cd "${MOONRAKER_OBICO_DIR}" && git fetch origin -q - commit=$(git describe origin/master --always --tags | cut -d "-" -f 1,2) - echo "${commit}" -} - -function compare_moonraker_obico_versions() { - local versions local_ver remote_ver - local_ver="$(get_local_moonraker_obico_commit)" - remote_ver="$(get_remote_moonraker_obico_commit)" - - if [[ ${local_ver} != "${remote_ver}" ]]; then - versions="${yellow}$(printf " %-14s" "${local_ver}")${white}" - versions+="|${green}$(printf " %-13s" "${remote_ver}")${white}" - # add moonraker to application_updates_available in kiauh.ini - add_to_application_updates "moonraker_obico" - else - versions="${green}$(printf " %-14s" "${local_ver}")${white}" - versions+="|${green}$(printf " %-13s" "${remote_ver}")${white}" - fi - - echo "${versions}" -} - -### -# it is possible, that moonraker_obico is installed in a so called -# "non-linked" state. the linking can be achieved by running the -# installation script again. this function will check the obico -# installation status and returns the correctly formulated menu title -# -function obico_install_title() { - if [[ $(get_moonraker_obico_status) == "Not linked!" ]]; then - echo "[Link to Obico Server]" - else - echo "[Obico for Klipper] " - fi -} - diff --git a/scripts/octoapp.sh b/scripts/octoapp.sh deleted file mode 100644 index dea6918..0000000 --- a/scripts/octoapp.sh +++ /dev/null @@ -1,369 +0,0 @@ -#!/usr/bin/env bash - -#=======================================================================# -# Copyright (C) 2020 - 2024 Dominik Willner # -# # -# 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 # -#=======================================================================# - -# -# This file is written and maintained by Christian Würthner from OctoApp -# Please contact me if you need any help! -# hello@octoapp.eu -# - -set -e - -#===================================================# -#============== Install ============# -#===================================================# - -function octoapp_systemd() { - local services - services=$(find "${SYSTEMD}" -maxdepth 1 -regextype posix-extended -regex "${SYSTEMD}/octoapp(-[0-9a-zA-Z]+)?.service") - echo "${services}" -} - -function octoapp_setup_dialog() { - status_msg "Initializing OctoApp for Klipper installation ..." - - # First, check for moonraker service instances. - local moonraker_count - local moonraker_names - moonraker_count=$(moonraker_systemd | wc -w) - if (( moonraker_count == 0 )); then - ### return early if moonraker is not installed - local error="Moonraker not installed! Please install Moonraker first!" - log_error "OctoApp 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 - read -r -a moonraker_names <<< "$(get_multi_instance_names)" - fi - - # Next, check for any existing OctoApp services. - local octoapp_services - local existing_octoapp_count - octoapp_services=$(octoapp_systemd) - existing_octoapp_count=$(echo "${octoapp_services}" | wc -w ) - - # We need to make the moonraker instance count to the OctoApp service count. - local allowed_octoapp_count=$(( moonraker_count - existing_octoapp_count )) - if (( allowed_octoapp_count > 0 )); then - local new_octoapp_count - - ### Step 1: Ask for the number of OctoApp instances to install - if (( moonraker_count == 1 )); then - ok_msg "Moonraker installation found!\n" - new_octoapp_count=1 - elif (( moonraker_count > 1 )); then - top_border - printf "|${green}%-55s${white}|\n" " ${moonraker_count} Moonraker instances found!" - for name in "${moonraker_names[@]}"; do - printf "|${cyan}%-57s${white}|\n" " ● moonraker-${name}" - done - blank_line - if (( existing_octoapp_count > 0 )); then - printf "|${green}%-55s${white}|\n" " ${existing_octoapp_count} OctoApp instances already installed!" - for svc in ${octoapp_services}; do - printf "|${cyan}%-57s${white}|\n" " ● octoapp-$(get_instance_name "${svc}")" - done - fi - blank_line - echo -e "| The setup will apply the same names to OctoApp |" - blank_line - echo -e "| Please select the number of OctoApp instances to |" - echo -e "| install. Usually one OctoApp instance per Moonraker |" - echo -e "| instance is required, but you may not install more |" - echo -e "| OctoApp instances than available Moonraker instances. |" - bottom_border - - ### ask for amount of instances - local re="^[1-9][0-9]*$" - while [[ ! ${new_octoapp_count} =~ ${re} || ${new_octoapp_count} -gt ${allowed_octoapp_count} ]]; do - read -p "${cyan}###### Number of new OctoApp instances to set up:${white} " -i "${allowed_octoapp_count}" -e new_octoapp_count - ### break if input is valid - [[ ${new_octoapp_count} =~ ${re} && ${new_octoapp_count} -le ${allowed_octoapp_count} ]] && break - ### conditional error messages - [[ ! ${new_octoapp_count} =~ ${re} ]] && error_msg "Input not a number" - (( new_octoapp_count > allowed_octoapp_count )) && error_msg "Number of OctoApp instances larger than installed Moonraker instances" - done && select_msg "${new_octoapp_count}" - else - log_error "Internal error. moonraker_count of '${moonraker_count}' not equal or grater than one!" - return 1 - fi # (( moonraker_count == 1 )) - fi # (( allowed_octoapp_count > 0 )) - - # Special case for one moonraker instance with OctoApp already installed. - # If the user selects the install option again, they might be trying to recover the install - # or complete a printer link they didn't finish in the past. - # So in this case, we will allow them to run the install script again, since it's safe to run - # if the service is already installed, it will repair any missing issues. - if (( allowed_octoapp_count == 0 && moonraker_count == 1 )); then - local yn - while true; do - echo "${yellow}OctoApp is already installed.${white}" - echo "It is safe to run the install again to repair any issues or if the printer isn't linked, run the printer linking logic again." - echo "" - local question="Do you want to run the OctoApp recovery or linking logic again?" - read -p "${cyan}###### ${question} (Y/n):${white} " yn - case "${yn}" in - Y|y|Yes|yes|"") - select_msg "Yes" - break;; - N|n|No|no) - select_msg "No" - abort_msg "Exiting OctoApp setup ...\n" - return;; - *) - error_msg "Invalid Input!";; - esac - done - # The user responded yes, allow the install to run again. - allowed_octoapp_count=1 - fi - - # If there's something to install, do it! - if (( allowed_octoapp_count > 0 )); then - - (( new_octoapp_count > 1 )) && status_msg "Installing ${new_octoapp_count} OctoApp instances ..." - (( new_octoapp_count == 1 )) && status_msg "Installing OctoApp ..." - - # Ensure the basic system dependencies are installed. - local dep=(git dfu-util virtualenv python3 python3-pip python3-venv) - dependency_check "${dep[@]}" - - # Close the repo - clone_octoapp "${OCTOAPP_REPO}" - - # Call install with the correct args. - local instance_cfg_dirs - read -r -a instance_cfg_dirs <<< "$(get_instance_folder_path "config")" - echo instance_cfg_dirs[0] - - if (( moonraker_count == 1 )); then - "${OCTOAPP_DIR}/install.sh" "${instance_cfg_dirs[0]}/moonraker.conf" - elif (( moonraker_count > 1 )); then - local j=${existing_octoapp_count} - - for (( i=1; i <= new_octoapp_count; i++ )); do - "${OCTOAPP_DIR}/install.sh" "${instance_cfg_dirs[${j}]}/moonraker.conf" - j=$(( j + 1 )) - done && unset j - fi # (( moonraker_count == 1 )) - fi # (( allowed_octoapp_count > 0 )) -} - -function octoapp_install() { - "${OCTOAPP_DIR}/install.sh" "$@" -} - -#===================================================# -#============= Remove ==============# -#===================================================# - -function remove_octoapp_systemd() { - [[ -z $(octoapp_systemd) ]] && return - status_msg "Removing OctoApp Systemd Services ..." - - for service in $(octoapp_systemd | cut -d"/" -f5); do - status_msg "Removing ${service} ..." - sudo systemctl stop "${service}" - sudo systemctl disable "${service}" - sudo rm -f "${SYSTEMD}/${service}" - ok_msg "Done!" - done - - ### reloading units - sudo systemctl daemon-reload - sudo systemctl reset-failed - ok_msg "OctoApp Services removed!" -} - -function remove_octoapp_logs() { - local files regex="${HOME//\//\\/}\/([A-Za-z0-9_]+)\/logs\/octoapp(-[0-9a-zA-Z]+)?\.log(.*)?" - files=$(find "${HOME}" -maxdepth 3 -regextype posix-extended -regex "${regex}" | sort) - - if [[ -n ${files} ]]; then - for file in ${files}; do - status_msg "Removing ${file} ..." - rm -f "${file}" - ok_msg "${file} removed!" - done - fi -} - -function remove_octoapp_dir() { - [[ ! -d ${OCTOAPP_DIR} ]] && return - - status_msg "Removing OctoApp directory ..." - rm -rf "${OCTOAPP_DIR}" - ok_msg "Directory removed!" -} - -function remove_octoapp_config() { - # Remove the system config but not the main config, so the printer id doesn't get lost. - local files regex="${HOME//\//\\/}\/([A-Za-z0-9_]+)\/config\/octoapp-system(-[0-9a-zA-Z]+)?\.cfg(.*)?" - files=$(find "${HOME}" -maxdepth 4 -regextype posix-extended -regex "${regex}" | sort) - - if [[ -n ${files} ]]; then - for file in ${files}; do - status_msg "Removing ${file} ..." - rm -f "${file}" - ok_msg "${file} removed!" - done - fi -} - -function remove_octoapp_store_dir() { - local files regex="${HOME//\//\\/}\/([A-Za-z0-9_]+)\/octoapp-store" - files=$(find "${HOME}" -maxdepth 2 -type d -regextype posix-extended -regex "${regex}" | sort) - - if [[ -n ${files} ]]; then - for file in ${files}; do - status_msg "Removing ${file} ..." - rm -rf "${file}" - ok_msg "${file} removed!" - done - fi -} - -function remove_octoapp_env() { - [[ ! -d "${HOME}/octoapp-env" ]] && return - - status_msg "Removing octoapp-env directory ..." - rm -rf "${HOME}/octoapp-env" - ok_msg "Directory removed!" -} - -function remove_octoapp() -{ - remove_octoapp_systemd - remove_octoapp_logs - remove_octoapp_dir - remove_octoapp_env - remove_octoapp_config - remove_octoapp_store_dir - - print_confirm "OctoApp was successfully removed!" - return -} - -#===================================================# -#============= UPDATE ==============# -#===================================================# - -function update_octoapp() { - do_action_service "stop" "octoapp" - - if [[ ! -d ${OCTOAPP_DIR} ]]; then - clone_octoapp "${OCTOAPP_REPO}" - else - backup_before_update "octoapp" - status_msg "Updating OctoApp for Klipper ..." - cd "${OCTOAPP_DIR}" && git pull - ### read PKGLIST and install possible new dependencies - install_octoapp_dependencies - ### install possible new python dependencies - "${OCTOAPP_ENV}"/bin/pip install -r "${OCTOAPP_DIR}/requirements.txt" - fi - - ok_msg "Update complete!" - do_action_service "restart" "octoapp" -} - -function clone_octoapp() { - local repo=${1} - - status_msg "Cloning OctoApp from ${repo} ..." - - ### force remove existing octoapp dir and clone into fresh octoapp dir - [[ -d ${OCTOAPP_DIR} ]] && rm -rf "${OCTOAPP_DIR}" - - cd "${HOME}" || exit 1 - if ! git clone "${OCTOAPP_REPO}" "${OCTOAPP_DIR}"; then - print_error "Cloning OctoApp from\n ${repo}\n failed!" - exit 1 - fi -} - -function install_octoapp_dependencies() { - local packages log_name="OctoApp" - local install_script="${OCTOAPP_DIR}/install.sh" - - ### read PKGLIST from official install-script - status_msg "Reading dependencies..." - # shellcheck disable=SC2016 - packages="$(grep "PKGLIST=" "${install_script}" | cut -d'"' -f2 | sed 's/\${PKGLIST}//g' | tr -d '\n')" - - echo "${cyan}${packages}${white}" | tr '[:space:]' '\n' - read -r -a packages <<< "${packages}" - - ### Update system package lists if stale - update_system_package_lists - - ### Install required packages - install_system_packages "${log_name}" "packages[@]" -} - -#===================================================# -#============= STATUS ==============# -#===================================================# - -function get_octoapp_status() { - local status - local service_count - local octoapp_services - - octoapp_services=$(octoapp_systemd) - service_count=$(echo "${octoapp_services}" | wc -w ) - - if (( service_count == 0 )); then - status="Not installed!" - elif [[ ! -d "${OCTOAPP_DIR}" ]]; then - status="Incomplete!" - else - status="Installed!" - fi - - echo "${status}" -} - -function get_local_octoapp_commit() { - [[ ! -d ${OCTOAPP_DIR} || ! -d "${OCTOAPP_DIR}/.git" ]] && return - - local commit - cd "${OCTOAPP_DIR}" - commit="$(git describe HEAD --always --tags | cut -d "-" -f 1,2)" - echo "${commit}" -} - -function get_remote_octoapp_commit() { - [[ ! -d ${OCTOAPP_DIR} || ! -d "${OCTOAPP_DIR}/.git" ]] && return - - local commit - cd "${OCTOAPP_DIR}" && git fetch origin -q - commit=$(git describe origin/release --always --tags | cut -d "-" -f 1,2) - echo "${commit}" -} - -function compare_octoapp_versions() { - local versions local_ver remote_ver - local_ver="$(get_local_octoapp_commit)" - remote_ver="$(get_remote_octoapp_commit)" - - if [[ ${local_ver} != "${remote_ver}" ]]; then - versions="${yellow}$(printf " %-14s" "${local_ver}")${white}" - versions+="|${green}$(printf " %-13s" "${remote_ver}")${white}" - # Add us to the update file, so if the user selects "update all" it includes us. - add_to_application_updates "octoapp" - else - versions="${green}$(printf " %-14s" "${local_ver}")${white}" - versions+="|${green}$(printf " %-13s" "${remote_ver}")${white}" - fi - - echo "${versions}" -} diff --git a/scripts/octoeverywhere.sh b/scripts/octoeverywhere.sh deleted file mode 100644 index 49a0f96..0000000 --- a/scripts/octoeverywhere.sh +++ /dev/null @@ -1,385 +0,0 @@ -#!/usr/bin/env bash - -#=======================================================================# -# Copyright (C) 2020 - 2024 Dominik Willner # -# # -# 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 # -#=======================================================================# - -# -# This file is written and maintained by Quinn Damerell from OctoEverywhere -# Please contact our support team if you need any help! -# https://octoeverywhere.com/support -# - -set -e - -#===================================================# -#============== Install ============# -#===================================================# - -function octoeverywhere_systemd() { - local services - services=$(find "${SYSTEMD}" -maxdepth 1 -regextype posix-extended -regex "${SYSTEMD}/octoeverywhere(-[0-9a-zA-Z]+)?.service") - echo "${services}" -} - -function octoeverywhere_setup_dialog() { - status_msg "Initializing OctoEverywhere for Klipper installation ..." - - # First, check for moonraker service instances. - local moonraker_count - local moonraker_names - moonraker_count=$(moonraker_systemd | wc -w) - if (( moonraker_count == 0 )); then - ### return early if moonraker is not installed - local error="Moonraker not installed! Please install Moonraker first!" - log_error "OctoEverywhere 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 - read -r -a moonraker_names <<< "$(get_multi_instance_names)" - fi - - # Next, check for any existing OctoEverywhere services. - local octoeverywhere_services - local existing_octoeverywhere_count - octoeverywhere_services=$(octoeverywhere_systemd) - existing_octoeverywhere_count=$(echo "${octoeverywhere_services}" | wc -w ) - - # We need to make the moonraker instance count to the OctoEverywhere service count. - local allowed_octoeverywhere_count=$(( moonraker_count - existing_octoeverywhere_count )) - if (( allowed_octoeverywhere_count > 0 )); then - local new_octoeverywhere_count - - ### Step 1: Ask for the number of OctoEverywhere instances to install - if (( moonraker_count == 1 )); then - ok_msg "Moonraker installation found!\n" - new_octoeverywhere_count=1 - elif (( moonraker_count > 1 )); then - top_border - printf "|${green}%-55s${white}|\n" " ${moonraker_count} Moonraker instances found!" - for name in "${moonraker_names[@]}"; do - printf "|${cyan}%-57s${white}|\n" " ● moonraker-${name}" - done - blank_line - if (( existing_octoeverywhere_count > 0 )); then - printf "|${green}%-55s${white}|\n" " ${existing_octoeverywhere_count} OctoEverywhere instances already installed!" - for svc in ${octoeverywhere_services}; do - printf "|${cyan}%-57s${white}|\n" " ● octoeverywhere-$(get_instance_name "${svc}")" - done - fi - blank_line - echo -e "| The setup will apply the same names to |" - echo -e "| OctoEverywhere |" - blank_line - echo -e "| Please select the number of OctoEverywhere instances |" - echo -e "| to install. Usually one OctoEverywhere instance per |" - echo -e "| Moonraker instance is required, but you may not |" - echo -e "| install more OctoEverywhere instances than available |" - echo -e "| Moonraker instances. |" - bottom_border - - ### ask for amount of instances - local re="^[1-9][0-9]*$" - while [[ ! ${new_octoeverywhere_count} =~ ${re} || ${new_octoeverywhere_count} -gt ${allowed_octoeverywhere_count} ]]; do - read -p "${cyan}###### Number of new OctoEverywhere instances to set up:${white} " -i "${allowed_octoeverywhere_count}" -e new_octoeverywhere_count - ### break if input is valid - [[ ${new_octoeverywhere_count} =~ ${re} && ${new_octoeverywhere_count} -le ${allowed_octoeverywhere_count} ]] && break - ### conditional error messages - [[ ! ${new_octoeverywhere_count} =~ ${re} ]] && error_msg "Input not a number" - (( new_octoeverywhere_count > allowed_octoeverywhere_count )) && error_msg "Number of OctoEverywhere instances larger than installed Moonraker instances" - done && select_msg "${new_octoeverywhere_count}" - else - log_error "Internal error. moonraker_count of '${moonraker_count}' not equal or grater than one!" - return 1 - fi # (( moonraker_count == 1 )) - fi # (( allowed_octoeverywhere_count > 0 )) - - # Special case for one moonraker instance with OctoEverywhere already installed. - # If the user selects the install option again, they might be trying to recover the install - # or complete a printer link they didn't finish in the past. - # So in this case, we will allow them to run the install script again, since it's safe to run - # if the service is already installed, it will repair any missing issues. - if (( allowed_octoeverywhere_count == 0 && moonraker_count == 1 )); then - local yn - while true; do - echo "${yellow}OctoEverywhere is already installed.${white}" - echo "It is safe to run the install again to repair any issues or if the printer isn't linked, run the printer linking logic again." - echo "" - local question="Do you want to run the OctoEverywhere recovery or linking logic again?" - read -p "${cyan}###### ${question} (Y/n):${white} " yn - case "${yn}" in - Y|y|Yes|yes|"") - select_msg "Yes" - break;; - N|n|No|no) - select_msg "No" - abort_msg "Exiting OctoEverywhere setup ...\n" - return;; - *) - error_msg "Invalid Input!";; - esac - done - # The user responded yes, allow the install to run again. - allowed_octoeverywhere_count=1 - fi - - # If there's something to install, do it! - if (( allowed_octoeverywhere_count > 0 )); then - - (( new_octoeverywhere_count > 1 )) && status_msg "Installing ${new_octoeverywhere_count} OctoEverywhere instances ..." - (( new_octoeverywhere_count == 1 )) && status_msg "Installing OctoEverywhere ..." - - # Ensure the basic system dependencies are installed. - local dep=(git dfu-util virtualenv python3 python3-pip python3-venv) - dependency_check "${dep[@]}" - - # Close the repo - clone_octoeverywhere "${OCTOEVERYWHERE_REPO}" - - # Call install with the correct args. - local instance_cfg_dirs - read -r -a instance_cfg_dirs <<< "$(get_instance_folder_path "config")" - echo instance_cfg_dirs[0] - - if (( moonraker_count == 1 )); then - "${OCTOEVERYWHERE_DIR}/install.sh" "${instance_cfg_dirs[0]}/moonraker.conf" - elif (( moonraker_count > 1 )); then - local j=${existing_octoeverywhere_count} - - for (( i=1; i <= new_octoeverywhere_count; i++ )); do - "${OCTOEVERYWHERE_DIR}/install.sh" "${instance_cfg_dirs[${j}]}/moonraker.conf" - j=$(( j + 1 )) - done && unset j - fi # (( moonraker_count == 1 )) - fi # (( allowed_octoeverywhere_count > 0 )) -} - -function clone_octoeverywhere() { - local repo=${1} - - status_msg "Cloning OctoEverywhere..." - ### force remove existing repos - [[ -d "${OCTOEVERYWHERE_DIR}" ]] && rm -rf "${OCTOEVERYWHERE_DIR}" - - cd "${HOME}" || exit 1 - if ! git clone "${repo}" "${OCTOEVERYWHERE_DIR}"; then - print_error "Cloning OctoEverywhere from\n ${repo}\n failed!" - exit 1 - fi -} - -function octoeverywhere_install() { - "${OCTOEVERYWHERE_DIR}/install.sh" "$@" -} - -#===================================================# -#============= Remove ==============# -#===================================================# - -function remove_octoeverywhere_systemd() { - [[ -z $(octoeverywhere_systemd) ]] && return - status_msg "Removing OctoEverywhere Systemd Services ..." - - for service in $(octoeverywhere_systemd | cut -d"/" -f5); do - status_msg "Removing ${service} ..." - sudo systemctl stop "${service}" - sudo systemctl disable "${service}" - sudo rm -f "${SYSTEMD}/${service}" - ok_msg "Done!" - done - - ### reloading units - sudo systemctl daemon-reload - sudo systemctl reset-failed - ok_msg "OctoEverywhere Services removed!" -} - -function remove_octoeverywhere_logs() { - local files regex="${HOME//\//\\/}\/([A-Za-z0-9_]+)\/logs\/octoeverywhere(-[0-9a-zA-Z]+)?\.log(.*)?" - files=$(find "${HOME}" -maxdepth 3 -regextype posix-extended -regex "${regex}" | sort) - - if [[ -n ${files} ]]; then - for file in ${files}; do - status_msg "Removing ${file} ..." - rm -f "${file}" - ok_msg "${file} removed!" - done - fi -} - -function remove_octoeverywhere_dir() { - [[ ! -d ${OCTOEVERYWHERE_DIR} ]] && return - - status_msg "Removing OctoEverywhere directory ..." - rm -rf "${OCTOEVERYWHERE_DIR}" - ok_msg "Directory removed!" -} - -function remove_octoeverywhere_config() { - # Remove the system config but not the main config, so the printer id doesn't get lost. - local files regex="${HOME//\//\\/}\/([A-Za-z0-9_]+)\/config\/octoeverywhere-system(-[0-9a-zA-Z]+)?\.cfg(.*)?" - files=$(find "${HOME}" -maxdepth 4 -regextype posix-extended -regex "${regex}" | sort) - - if [[ -n ${files} ]]; then - for file in ${files}; do - status_msg "Removing ${file} ..." - rm -f "${file}" - ok_msg "${file} removed!" - done - fi -} - -function remove_octoeverywhere_store_dir() { - local files regex="${HOME//\//\\/}\/([A-Za-z0-9_]+)\/octoeverywhere-store" - files=$(find "${HOME}" -maxdepth 2 -type d -regextype posix-extended -regex "${regex}" | sort) - - if [[ -n ${files} ]]; then - for file in ${files}; do - status_msg "Removing ${file} ..." - rm -rf "${file}" - ok_msg "${file} removed!" - done - fi -} - -function remove_octoeverywhere_env() { - [[ ! -d "${HOME}/octoeverywhere-env" ]] && return - - status_msg "Removing octoeverywhere-env directory ..." - rm -rf "${HOME}/octoeverywhere-env" - ok_msg "Directory removed!" -} - -function remove_octoeverywhere() -{ - remove_octoeverywhere_systemd - remove_octoeverywhere_logs - remove_octoeverywhere_dir - remove_octoeverywhere_env - remove_octoeverywhere_config - remove_octoeverywhere_store_dir - - print_confirm "OctoEverywhere was successfully removed!" - return -} - -#===================================================# -#============= UPDATE ==============# -#===================================================# - -function update_octoeverywhere() { - do_action_service "stop" "octoeverywhere" - - if [[ ! -d ${OCTOEVERYWHERE_DIR} ]]; then - clone_octoeverywhere "${OCTOEVERYWHERE_REPO}" - else - backup_before_update "octoeverywhere" - status_msg "Updating OctoEverywhere for Klipper ..." - cd "${OCTOEVERYWHERE_DIR}" && git pull - ### read PKGLIST and install possible new dependencies - install_octoeverywhere_dependencies - ### install possible new python dependencies - "${OCTOEVERYWHERE_ENV}"/bin/pip install -r "${OCTOEVERYWHERE_DIR}/requirements.txt" - fi - - ok_msg "Update complete!" - do_action_service "restart" "octoeverywhere" -} - -function clone_octoeverywhere() { - local repo=${1} - - status_msg "Cloning OctoEverywhere from ${repo} ..." - - ### force remove existing octoeverywhere dir and clone into fresh octoeverywhere dir - [[ -d ${OCTOEVERYWHERE_DIR} ]] && rm -rf "${OCTOEVERYWHERE_DIR}" - - cd "${HOME}" || exit 1 - if ! git clone "${OCTOEVERYWHERE_REPO}" "${OCTOEVERYWHERE_DIR}"; then - print_error "Cloning OctoEverywhere from\n ${repo}\n failed!" - exit 1 - fi -} - -function install_octoeverywhere_dependencies() { - local packages log_name="OctoEverywhere" - local install_script="${OCTOEVERYWHERE_DIR}/install.sh" - - ### read PKGLIST from official install-script - status_msg "Reading dependencies..." - # shellcheck disable=SC2016 - packages="$(grep "PKGLIST=" "${install_script}" | cut -d'"' -f2 | sed 's/\${PKGLIST}//g' | tr -d '\n')" - - echo "${cyan}${packages}${white}" | tr '[:space:]' '\n' - read -r -a packages <<< "${packages}" - - ### Update system package lists if stale - update_system_package_lists - - ### Install required packages - install_system_packages "${log_name}" "packages[@]" -} - -#===================================================# -#============= STATUS ==============# -#===================================================# - -function get_octoeverywhere_status() { - local status - local service_count - local octoeverywhere_services - - octoeverywhere_services=$(octoeverywhere_systemd) - service_count=$(echo "${octoeverywhere_services}" | wc -w ) - - if (( service_count == 0 )); then - status="Not installed!" - elif [[ ! -d "${OCTOEVERYWHERE_DIR}" ]]; then - status="Incomplete!" - else - status="Installed!" - fi - - echo "${status}" -} - -function get_local_octoeverywhere_commit() { - [[ ! -d ${OCTOEVERYWHERE_DIR} || ! -d "${OCTOEVERYWHERE_DIR}/.git" ]] && return - - local commit - cd "${OCTOEVERYWHERE_DIR}" - commit="$(git describe HEAD --always --tags | cut -d "-" -f 1,2)" - echo "${commit}" -} - -function get_remote_octoeverywhere_commit() { - [[ ! -d ${OCTOEVERYWHERE_DIR} || ! -d "${OCTOEVERYWHERE_DIR}/.git" ]] && return - - local commit - cd "${OCTOEVERYWHERE_DIR}" && git fetch origin -q - commit=$(git describe origin/master --always --tags | cut -d "-" -f 1,2) - echo "${commit}" -} - -function compare_octoeverywhere_versions() { - local versions local_ver remote_ver - local_ver="$(get_local_octoeverywhere_commit)" - remote_ver="$(get_remote_octoeverywhere_commit)" - - if [[ ${local_ver} != "${remote_ver}" ]]; then - versions="${yellow}$(printf " %-14s" "${local_ver}")${white}" - versions+="|${green}$(printf " %-13s" "${remote_ver}")${white}" - # Add us to the update file, so if the user selects "update all" it includes us. - add_to_application_updates "octoeverywhere" - else - versions="${green}$(printf " %-14s" "${local_ver}")${white}" - versions+="|${green}$(printf " %-13s" "${remote_ver}")${white}" - fi - - echo "${versions}" -} diff --git a/scripts/octoprint.sh b/scripts/octoprint.sh deleted file mode 100644 index 40640ff..0000000 --- a/scripts/octoprint.sh +++ /dev/null @@ -1,416 +0,0 @@ -#!/usr/bin/env bash - -#=======================================================================# -# Copyright (C) 2020 - 2024 Dominik Willner # -# # -# 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 # -#=======================================================================# - -set -e - -#=================================================# -#=============== INSTALL OCTOPRINT ===============# -#=================================================# - -function octoprint_systemd() { - local services - services=$(find "${SYSTEMD}" -maxdepth 1 -regextype posix-extended -regex "${SYSTEMD}/octoprint(-[0-9a-zA-Z]+)?.service" | sort) - echo "${services}" -} - -function octoprint_setup_dialog() { - status_msg "Initializing OctoPrint installation ..." - - local klipper_services - klipper_services=$(klipper_systemd) - if [[ -z ${klipper_services} ]]; then - local error="Klipper not installed! Please install Klipper first!" - log_error "OctoPrint setup started without Klipper being installed. Aborting setup." - print_error "${error}" && return - fi - - local klipper_count user_input=() klipper_names=() - klipper_count=$(echo "${klipper_services}" | wc -w ) - for service in ${klipper_services}; do - klipper_names+=( "$(get_instance_name "${service}")" ) - done - - local octoprint_count - if (( klipper_count == 1 )); then - ok_msg "Klipper installation found!\n" - octoprint_count=1 - - elif (( klipper_count > 1 )); then - top_border - printf "|${green}%-55s${white}|\n" " ${klipper_count} Klipper instances found!" - for name in "${klipper_names[@]}"; do - printf "|${cyan}%-57s${white}|\n" " ● ${name}" - done - blank_line - echo -e "| The setup will apply the same names to OctoPrint! |" - blank_line - echo -e "| Please select the number of OctoPrint instances to |" - echo -e "| install. Usually one OctoPrint instance per Klipper |" - echo -e "| instance is required, but you may not install more |" - echo -e "| OctoPrint instances than available Klipper instances. |" - bottom_border - - local re="^[1-9][0-9]*$" - while [[ ! ${octoprint_count} =~ ${re} || ${octoprint_count} -gt ${klipper_count} ]]; do - read -p "${cyan}###### Number of OctoPrint instances to set up:${white} " -i "${klipper_count}" -e octoprint_count - ### break if input is valid - [[ ${octoprint_count} =~ ${re} ]] && break - ### conditional error messages - [[ ! ${octoprint_count} =~ ${re} ]] && error_msg "Input not a number" - (( octoprint_count > klipper_count )) && error_msg "Number of OctoPrint instances larger than existing Klipper instances" - done && select_msg "${octoprint_count}" - - else - log_error "Internal error. klipper_count of '${klipper_count}' not equal or grather than one!" - return 1 - fi - - user_input+=("${octoprint_count}") - - ### confirm instance amount - local yn - while true; do - (( octoprint_count == 1 )) && local question="Install OctoPrint?" - (( octoprint_count > 1 )) && local question="Install ${octoprint_count} OctoPrint instances?" - read -p "${cyan}###### ${question} (Y/n):${white} " yn - case "${yn}" in - Y|y|Yes|yes|"") - select_msg "Yes" - break;; - N|n|No|no) - select_msg "No" - abort_msg "Exiting OctoPrint setup ...\n" - return;; - *) - error_msg "Invalid Input!";; - esac - done - - ### write existing klipper names into user_input array to use them as names for octoprint - if (( klipper_count > 1 )); then - for name in "${klipper_names[@]}"; do - user_input+=("${name}") - done - fi - - (( octoprint_count > 1 )) && status_msg "Installing ${octoprint_count} OctoPrint instances ..." - (( octoprint_count == 1 )) && status_msg "Installing OctoPrint ..." - octoprint_setup "${user_input[@]}" -} - -function octoprint_setup() { - local instance_arr=("${@}") - ### check and install all dependencies - local dep=( - git - wget - python3-pip - python3-dev - libyaml-dev - build-essential - python3-setuptools - python3-virtualenv - ) - dependency_check "${dep[@]}" - - ### step 1: check for tty and dialout usergroups and add reboot permissions - check_usergroups - add_reboot_permission - - ### step 2: install octoprint - install_octoprint "${instance_arr[@]}" - - ### step 3: set up service - create_octoprint_service "${instance_arr[@]}" - - ### step 4: enable and start all instances - do_action_service "enable" "octoprint" - do_action_service "start" "octoprint" - - ### confirm message - local confirm="" - (( instance_arr[0] == 1 )) && confirm="OctoPrint has been set up!" - (( instance_arr[0] > 1 )) && confirm="${instance_arr[0]} OctoPrint instances have been set up!" - print_confirm "${confirm}" && print_op_ip_list "${instance_arr[0]}" && return -} - -function install_octoprint() { - - function install_octoprint_python_env() { - local tmp="${1}" - ### create and activate the virtualenv - status_msg "Installing python virtual environment..." - - if [[ ! -d ${tmp} ]]; then - mkdir -p "${tmp}" - else - error_msg "Cannot create temporary directory in ${HOME}!" - error_msg "Folder 'TMP_OCTO_ENV' exists and may not be empty!" - error_msg "Please remove/rename that folder and start again." - return 1 - fi - - cd "${tmp}" - - if virtualenv --python=python3 venv; then - ### activate virtualenv - source venv/bin/activate - pip install pip --upgrade - pip install --no-cache-dir octoprint - ### leave virtualenv - deactivate - else - log_error "failure while creating python3 OctoPrint env" - error_msg "Creation of OctoPrint virtualenv failed!" - exit 1 - fi - - cd "${HOME}" - } - - local input=("${@}") - local octoprint_count=${input[0]} && unset "input[0]" - local names=("${input[@]}") && unset "input[@]" - local j=0 octo_env - local tmp="${HOME}/TMP_OCTO_ENV" - - ### handle single instance installs - if (( octoprint_count == 1 )); then - if install_octoprint_python_env "${tmp}"; then - status_msg "Installing OctoPrint ..." - octo_env="${HOME}/OctoPrint" - - ### rename the temporary directory to the correct name - [[ -d ${octo_env} ]] && rm -rf "${octo_env}" - mv "${tmp}" "${octo_env}" - - ### replace the temporary directory name with the actual one in ${octo_env}/venv/bin/python/octoprint - sed -i "s|${tmp}|${octo_env}|" "${octo_env}/venv/bin/octoprint" - else - error_msg "OctoPrint installation failed!" - return 1 - fi - fi - - ### handle multi instance installs - if (( octoprint_count > 1 )); then - if install_octoprint_python_env "${tmp}"; then - for (( i=1; i <= octoprint_count; i++ )); do - status_msg "Installing OctoPrint instance ${i}(${names[${j}]}) ..." - octo_env="${HOME}/OctoPrint_${names[${j}]}" - - ### rename the temporary directory to the correct name - [[ -d ${octo_env} ]] && rm -rf "${octo_env}" - cp -r "${tmp}" "${octo_env}" - - ### replace the temporary directory name with the actual one in ${octo_env}/venv/bin/python/octoprint - sed -i "s|${tmp}|${octo_env}|" "${octo_env}/venv/bin/octoprint" - j=$(( j + 1 )) - done && rm -rf "${tmp}" - else - error_msg "OctoPrint installation failed!" - return 1 - fi - fi -} - -function create_octoprint_service() { - local input=("${@}") - local octoprint_count=${input[0]} && unset "input[0]" - local names=("${input[@]}") && unset "input[@]" - local j=0 port=5000 - local printer_data octo_env service basedir printer config_yaml restart_cmd - - for (( i=1; i <= octoprint_count; i++ )); do - if (( octoprint_count == 1 )); then - printer_data="${HOME}/printer_data" - octo_env="${HOME}/OctoPrint" - service="${SYSTEMD}/octoprint.service" - basedir="${HOME}/.octoprint" - printer="${printer_data}/comms/klippy.serial" - config_yaml="${basedir}/config.yaml" - restart_cmd="sudo service octoprint restart" - elif (( octoprint_count > 1 )); then - - local re="^[1-9][0-9]*$" - if [[ ${names[j]} =~ ${re} ]]; then - printer_data="${HOME}/printer_${names[${j}]}_data" - else - printer_data="${HOME}/${names[${j}]}_data" - fi - - octo_env="${HOME}/OctoPrint_${names[${j}]}" - service="${SYSTEMD}/octoprint-${names[${j}]}.service" - basedir="${HOME}/.octoprint_${names[${j}]}" - printer="${printer_data}/comms/klippy.serial" - config_yaml="${basedir}/config.yaml" - restart_cmd="sudo service octoprint-${names[${j}]} restart" - fi - - (( octoprint_count == 1 )) && status_msg "Creating OctoPrint Service ..." - (( octoprint_count > 1 )) && status_msg "Creating OctoPrint Service ${i}(${names[${j}]}) ..." - - sudo /bin/sh -c "cat > ${service}" << OCTOPRINT -[Unit] -Description=Starts OctoPrint on startup -After=network-online.target -Wants=network-online.target - -[Service] -Environment="LC_ALL=C.UTF-8" -Environment="LANG=C.UTF-8" -Type=simple -User=${USER} -ExecStart=${octo_env}/venv/bin/octoprint --basedir ${basedir} --config ${config_yaml} --port=${port} serve - -[Install] -WantedBy=multi-user.target -OCTOPRINT - - port=$(( port + 1 )) - j=$(( j + 1 )) - ok_msg "Ok!" - - ### create config.yaml - if [[ ! -f ${basedir}/config.yaml ]]; then - [[ ! -d ${basedir} ]] && mkdir "${basedir}" - - (( octoprint_count == 1 )) && status_msg "Creating config.yaml ..." - (( octoprint_count > 1 )) && status_msg "Creating config.yaml for instance ${i}(${names[${j}]}) ..." - - /bin/sh -c "cat > ${basedir}/config.yaml" << CONFIGYAML -serial: - additionalPorts: - - ${printer} - disconnectOnErrors: false - port: ${printer} -server: - commands: - serverRestartCommand: ${restart_cmd} - systemRestartCommand: sudo shutdown -r now - systemShutdownCommand: sudo shutdown -h now -CONFIGYAML - ok_msg "Ok!" - fi - done -} - -function add_reboot_permission() { - #create a backup if file already exists - if [[ -f /etc/sudoers.d/octoprint-shutdown ]]; then - sudo mv /etc/sudoers.d/octoprint-shutdown /etc/sudoers.d/octoprint-shutdown.old - fi - - #create new permission file - status_msg "Add reboot permission to user '${USER}' ..." - cd "${HOME}" && echo "${USER} ALL=NOPASSWD: /sbin/shutdown" > octoprint-shutdown - sudo chown 0 octoprint-shutdown - sudo mv octoprint-shutdown /etc/sudoers.d/octoprint-shutdown - ok_msg "Permission set!" -} - -function print_op_ip_list() { - local ip octoprint_count="${1}" port=5000 - ip=$(hostname -I | cut -d" " -f1) - - for (( i=1; i <= octoprint_count; i++ )); do - echo -e " ${cyan}● Instance ${i}:${white} ${ip}:${port}" - port=$(( port + 1 )) - done && echo -} - -#=================================================# -#=============== REMOVE OCTOPRINT ================# -#=================================================# - -function remove_octoprint_service() { - [[ -z $(octoprint_systemd) ]] && return - - ###remove all octoprint services - status_msg "Removing OctoPrint Systemd Services ..." - - for service in $(octoprint_systemd | cut -d"/" -f5); do - status_msg "Removing ${service} ..." - sudo systemctl stop "${service}" - sudo systemctl disable "${service}" - sudo rm -f "${SYSTEMD}/${service}" - ok_msg "Done!" - done - - ### reloading units - sudo systemctl daemon-reload - sudo systemctl reset-failed -} - -function remove_octoprint_sudoers() { - [[ ! -f /etc/sudoers.d/octoprint-shutdown ]] && return - - ### remove sudoers file - sudo rm -f /etc/sudoers.d/octoprint-shutdown -} - -function remove_octoprint_env() { - local files - files=$(find "${HOME}" -maxdepth 1 -regextype posix-extended -regex "${HOME}/OctoPrint(_[0-9a-zA-Z]+)?" | sort) - - if [[ -n ${files} ]]; then - for file in ${files}; do - status_msg "Removing ${file} ..." - rm -rf "${file}" - ok_msg "${file} removed!" - done - fi -} - -function remove_octoprint_dir() { - local files - files=$(find "${HOME}" -maxdepth 1 -regextype posix-extended -regex "${HOME}/.octoprint(_[0-9a-zA-Z]+)?" | sort) - - if [[ -n ${files} ]]; then - for file in ${files}; do - status_msg "Removing ${file} ..." - rm -rf "${file}" - ok_msg "${file} removed!" - done - fi -} - -function remove_octoprint() { - remove_octoprint_service - remove_octoprint_sudoers - remove_octoprint_env - remove_octoprint_dir - - local confirm="OctoPrint was successfully removed!" - - print_confirm "${confirm}" && return -} - -#=================================================# -#=============== OCTOPRINT STATUS ================# -#=================================================# - -function get_octoprint_status() { - local sf_count env_count dir_count status - sf_count="$(octoprint_systemd | wc -w)" - env_count=$(find "${HOME}" -maxdepth 1 -regextype posix-extended -regex "${HOME}/OctoPrint(_[0-9a-zA-Z]+)?" | wc -w) - dir_count=$(find "${HOME}" -maxdepth 1 -regextype posix-extended -regex "${HOME}/.octoprint(_[0-9a-zA-Z]+)?" | wc -w) - - if (( sf_count == 0 )) && (( env_count == 0 )) && (( dir_count == 0 )); then - status="Not installed!" - elif (( sf_count == env_count )) && (( sf_count == dir_count )); then - status="Installed: ${sf_count}" - else - status="Incomplete!" - fi - - echo "${status}" -} diff --git a/scripts/pretty_gcode.sh b/scripts/pretty_gcode.sh deleted file mode 100644 index a3e1130..0000000 --- a/scripts/pretty_gcode.sh +++ /dev/null @@ -1,127 +0,0 @@ -#!/usr/bin/env bash - -#=======================================================================# -# Copyright (C) 2020 - 2024 Dominik Willner # -# # -# 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 # -#=======================================================================# - -set -e - -#=================================================# -#================== INSTALL PGC ==================# -#=================================================# - -function install_pgc_for_klipper() { - local pgconfsrc="${PGC_DIR}/pgcode.local.conf" - local pgconf="/etc/nginx/sites-available/pgcode.local.conf" - local pgconfsl="/etc/nginx/sites-enabled/pgcode.local.conf" - local pgc_uri pgc_custom_port pgc_default_port="7136" - - status_msg "Installing PrettyGCode for Klipper ..." - echo -e "${cyan}\n###### On which port should PrettyGCode run? (Default: ${pgc_default_port})${white} " - read -e -p "${cyan}###### Port:${white} " -i "${pgc_default_port}" pgc_custom_port - - ### check nginx dependency - local dep=(nginx) - dependency_check "${dep[@]}" - - [[ -d ${PGC_DIR} ]] && rm -rf "${PGC_DIR}" - - cd "${HOME}" || exit 1 - if ! git clone "${PGC_REPO}" "${PGC_DIR}"; then - print_error "Cloning PrettyGCode for Klipper from\n ${PGC_REPO}\n failed!" - exit 1 - fi - - sudo cp "${pgconfsrc}" "${pgconf}" - sudo sed -i "s|/home/pi/pgcode;|${HOME}/pgcode;|" "${pgconf}" - - ### replace default port - if (( pgc_custom_port != pgc_default_port )); then - sudo sed -i "s|listen ${pgc_default_port};|listen ${pgc_custom_port};|" "${pgconf}" - sudo sed -i "s|listen \[::\]:${pgc_default_port};|listen \[::\]:${pgc_custom_port};|" "${pgconf}" - fi - - [[ ! -L ${pgconfsl} ]] && sudo ln -s "${pgconf}" "${pgconfsl}" - sudo systemctl restart nginx - - pgc_uri="http://$(hostname -I | cut -d" " -f1):${pgc_custom_port}" - echo -e "${cyan}\n● Accessible via:${white} ${pgc_uri}" - ok_msg "PrettyGCode for Klipper installed!\n" -} - -#=================================================# -#=================== REMOVE PGC ==================# -#=================================================# - -function remove_prettygcode() { - local pgconf="/etc/nginx/sites-available/pgcode.local.conf" - local pgconfsl="/etc/nginx/sites-enabled/pgcode.local.conf" - - if [[ -d ${PGC_DIR} || -f ${pgconf} || -L ${pgconfsl} ]]; then - status_msg "Removing PrettyGCode for Klipper ..." - rm -rf "${PGC_DIR}" - sudo rm -f "${pgconf}" - sudo rm -f "${pgconfsl}" - sudo systemctl restart nginx - print_confirm "PrettyGCode for Klipper successfully removed!" - else - print_error "PrettyGCode for Klipper not found!\n Skipping..." - fi -} - -#=================================================# -#=================== UPDATE PGC ==================# -#=================================================# - -function update_pgc_for_klipper() { - [[ ! -d ${PGC_DIR} ]] && return - - status_msg "Updating PrettyGCode for Klipper ..." - cd "${PGC_DIR}" && git pull - ok_msg "Update complete!" -} - -#=================================================# -#=================== PGC STATUS ==================# -#=================================================# - -function get_local_prettygcode_commit() { - local commit - - [[ ! -d ${PGC_DIR} || ! -d "${PGC_DIR}/.git" ]] && return - cd "${PGC_DIR}" - commit="$(git describe HEAD --always --tags | cut -d "-" -f 1,2)" - echo "${commit}" -} - -function get_remote_prettygcode_commit() { - local commit - - [[ ! -d ${PGC_DIR} || ! -d "${PGC_DIR}/.git" ]] && return - cd "${PGC_DIR}" && git fetch origin -q - commit=$(git describe origin/main --always --tags | cut -d "-" -f 1,2) - echo "${commit}" -} - -function compare_prettygcode_versions() { - local versions local_ver remote_ver - local_ver="$(get_local_prettygcode_commit)" - remote_ver="$(get_remote_prettygcode_commit)" - - if [[ ${local_ver} != "${remote_ver}" ]]; then - versions="${yellow}$(printf " %-14s" "${local_ver}")${white}" - versions+="|${green}$(printf " %-13s" "${remote_ver}")${white}" - # add moonraker to application_updates_available in kiauh.ini - add_to_application_updates "pgc_for_klipper" - else - versions="${green}$(printf " %-14s" "${local_ver}")${white}" - versions+="|${green}$(printf " %-13s" "${remote_ver}")${white}" - fi - - echo "${versions}" -} diff --git a/scripts/rollback.sh b/scripts/rollback.sh deleted file mode 100755 index 8cf837d..0000000 --- a/scripts/rollback.sh +++ /dev/null @@ -1,85 +0,0 @@ -#!/usr/bin/env bash - -#=======================================================================# -# Copyright (C) 2020 - 2024 Dominik Willner # -# # -# 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 # -#=======================================================================# - -set -e - -function rollback_menu() { - top_border - echo -e "| $(title_msg "~~~~~~~~~~~~~ [ Rollback Menu ] ~~~~~~~~~~~~~") |" - hr - echo -e "| If serious errors occured after updating Klipper or |" - echo -e "| Moonraker, you can use this menu to try and reset the |" - echo -e "| repository to an earlier state. |" - hr - echo -e "| 1) Rollback Klipper |" - echo -e "| 2) Rollback Moonraker |" - back_footer - - local action - while true; do - read -p "${cyan}###### Perform action:${white} " action - case "${action}" in - 1) - select_msg "Klipper" - rollback_component "klipper" - break;; - 2) - select_msg "Moonraker" - rollback_component "moonraker" - break;; - B|b) - clear; advanced_menu; break;; - *) - error_msg "Invalid command!";; - esac - done -} - -function rollback_component() { - local component=${1} - - if [[ ! -d "${HOME}/${component}" ]]; then - print_error "Rollback not possible! Missing installation?" - return - fi - - echo - top_border - echo -e "| Please select how many commits you want to revert. |" - echo -e "| Consider using the information provided by the GitHub |" - echo -e "| commit history to decide how many commits to revert. |" - blank_line - echo -e "| ${red}Warning:${white} |" - echo -e "| ${red}Do not proceed if you are currently in the progress${white} |" - echo -e "| ${red}of printing! Proceeding WILL terminate that print!${white} |" - back_footer - - local count - while true; do - read -p "${cyan}###### Revert this amount of commits:${white} " count - if [[ -n ${count} ]] && (( count > 0 )); then - status_msg "Revert ${component^} by ${count} commits ..." - cd "${HOME}/${component}" - if git reset --hard HEAD~"${count}"; then - do_action_service "restart" "${component}" - print_confirm "${component^} was successfully reset!" - else - print_error "Reverting ${component^} failed! Please see the console output above." - fi - break - elif [[ ${count} == "B" || ${count} == "b" ]]; then - clear && print_header && break - else - error_msg "Invalid command!" - fi - done - rollback_menu -} diff --git a/scripts/spoolman.sh b/scripts/spoolman.sh deleted file mode 100644 index fd29edd..0000000 --- a/scripts/spoolman.sh +++ /dev/null @@ -1,281 +0,0 @@ -#!/usr/bin/env bash - -#=======================================================================# -# Copyright (C) 2020 - 2024 Dominik Willner # -# # -# 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 # -#=======================================================================# - -# Error Handling -set -e - -function install_spoolman() { - - pushd "${HOME}" &> /dev/null || exit 1 - - dependency_check curl jq - - if [[ ! -d "${SPOOLMAN_DIR}" && -z "$(ls -A "${SPOOLMAN_DIR}" 2> /dev/null)" ]]; then - status_msg "Downloading spoolman..." - setup_spoolman_folder - status_msg "Downloading complete" - start_install_script - advanced_config_prompt - else - ### In case spoolman is "incomplete" rerun install script - if get_spoolman_status | grep -q "Incomplete!"; then - start_install_script - exit 1 - fi - - ok_msg "Spoolman already installed" - exit 1 - fi - - enable_moonraker_integration_prompt - patch_spoolman_update_manager - - do_action_service "restart" "moonraker" -} - -function update_spoolman() { - ### stop and disable old spoolman service - do_action_service "stop" "Spoolman" - do_action_service "disable" "Spoolman" - - mv "${SPOOLMAN_DIR}" "${SPOOLMAN_DIR}_old" - - setup_spoolman_folder - cp "${SPOOLMAN_DIR}_old/.env" "${SPOOLMAN_DIR}/.env" - - start_install_script - - rm -rf "${SPOOLMAN_DIR}_old" -} - -function remove_spoolman(){ - if [[ -d "${SPOOLMAN_DIR}" ]]; then - status_msg "Removing spoolman service..." - do_action_service "stop" "Spoolman" - do_action_service "disable" "Spoolman" - sudo rm -f "${SYSTEMD}/Spoolman.service" - sudo systemctl daemon-reload - sudo systemctl reset-failed - ok_msg "Spoolman service removed!" - - status_msg "Removing spoolman directory..." - rm -rf "${SPOOLMAN_DIR}" - ok_msg "Spoolman directory removed!" - fi - - print_confirm "Spoolman successfully removed!" -} - -function update_moonraker_configs() { - local moonraker_configs regex - regex="${HOME//\//\\/}\/([A-Za-z0-9_]+)\/config\/moonraker\.conf" - moonraker_configs=$(find "${HOME}" -maxdepth 3 -type f -regextype posix-extended -regex "${regex}" | sort) - - for conf in ${moonraker_configs}; do - if ! grep -Eq "^\[update_manager Spoolman\]\s*$" "${conf}"; then - ### add new line to conf if it doesn't end with one - [[ $(tail -c1 "${conf}" | wc -l) -eq 0 ]] && echo "" >> "${conf}" - /bin/sh -c "cat >> ${conf}" << MOONRAKER_CONF -${1} -MOONRAKER_CONF - fi - done -} - -function enable_moonraker_integration() { - local integration_str env_port - # get spoolman port from .env - env_port=$(grep "^SPOOLMAN_PORT=" "${SPOOLMAN_DIR}/.env" | cut -d"=" -f2) - - integration_str=" -[spoolman] -server: http://$(hostname -I | cut -d" " -f1):${env_port} -" - - status_msg "Adding Spoolman integration..." - update_moonraker_configs "${integration_str}" -} - -function patch_spoolman_update_manager() { - local updater_str - updater_str=" -[update_manager Spoolman] -type: zip -channel: stable -repo: Donkie/Spoolman -path: ${SPOOLMAN_DIR} -virtualenv: .venv -requirements: requirements.txt -persistent_files: - .venv - .env -managed_services: Spoolman -" - - update_moonraker_configs "${updater_str}" - - # add spoolman service to moonraker.asvc - local moonraker_asvc regex - regex="${HOME//\//\\/}\/([A-Za-z0-9_]+)\/moonraker\.asvc" - moonraker_asvc=$(find "${HOME}" -maxdepth 2 -type f -regextype posix-extended -regex "${regex}" | sort) - - if ! grep -q "^Spoolman$" "${moonraker_asvc}"; then - status_msg "Adding Spoolman service to moonraker.asvc..." - sed -i '$a''Spoolman' "${moonraker_asvc}" - fi -} - -function advanced_config_prompt() { - local reply - while true; do - read -erp "${cyan}###### Continue with default configuration? (Y/n):${white} " reply - case "${reply}" in - Y|y|Yes|yes|"") - select_msg "Yes" - break;; - N|n|No|no) - select_msg "No" - advanced_config - break;; - *) - error_msg "Invalid Input!\n";; - esac - done - return 0 -} - -function enable_moonraker_integration_prompt() { - local reply - while true; do - read -erp "${cyan}###### Enable Moonraker integration? (Y/n):${white} " reply - case "${reply}" in - Y|y|Yes|yes|"") - select_msg "Yes" - enable_moonraker_integration - break;; - N|n|No|no) - select_msg "No" - break;; - *) - error_msg "Invalid Input!\n";; - esac - done - return 0 -} - -function advanced_config() { - status_msg "###### Advanced configuration" - - local reply - while true; do - read -erp "${cyan}###### Select spoolman port (7912):${white} " reply - ### set default - if [[ -z "${reply}" ]]; then - reply="7912" - fi - - select_msg "${reply}" - ### check if port is valid - if ! [[ "${reply}" =~ ^[0-9]+$ && "${reply}" -ge 1024 && "${reply}" -le 65535 ]]; then - error_msg "Invalid port number!\n" - continue - fi - - ### update .env - sed -i "s/^SPOOLMAN_PORT=.*$/SPOOLMAN_PORT=${reply}/" "${SPOOLMAN_DIR}/.env" - do_action_service "restart" "Spoolman" - break - done - return 0 -} - -function setup_spoolman_folder() { - local source_url - ### get latest spoolman release url - source_url="$(curl -s "${SPOOLMAN_REPO}" | jq -r '.assets[] | select(.name == "spoolman.zip").browser_download_url')" - - mkdir -p "${SPOOLMAN_DIR}" - curl -sSL "${source_url}" -o /tmp/temp.zip - unzip /tmp/temp.zip -d "${SPOOLMAN_DIR}" &> /dev/null - rm /tmp/temp.zip - - chmod +x "${SPOOLMAN_DIR}"/scripts/install.sh -} - -function start_install_script() { - - pushd "${SPOOLMAN_DIR}" &> /dev/null || exit 1 - - if bash ./scripts/install.sh; then - ok_msg "Spoolman successfully installed!" - else - print_error "Spoolman installation failed!" - exit 1 - fi -} - -function get_spoolman_status() { - local -a files - files=( - "${SPOOLMAN_DIR}" - "${SYSTEMD}/Spoolman.service" - "${SPOOLMAN_DB_DIR}" - ) - - local count - count=0 - - for file in "${files[@]}"; do - [[ -e "${file}" ]] && count=$(( count +1 )) - done - - if [[ "${count}" -eq "${#files[*]}" ]]; then - echo "Installed" - elif [[ "${count}" -gt 0 ]]; then - echo "Incomplete!" - else - echo "Not installed!" - fi -} - -function get_local_spoolman_version() { - [[ ! -d "${SPOOLMAN_DIR}" ]] && return - - local version - version=$(grep -o '"version":\s*"[^"]*' "${SPOOLMAN_DIR}"/release_info.json | cut -d'"' -f4) - echo "${version}" -} - -function get_remote_spoolman_version() { - [[ ! -d "${SPOOLMAN_DIR}" ]] && return - - local version - version=$(curl -s "${SPOOLMAN_REPO}" | grep -o '"tag_name":\s*"v[^"]*"' | cut -d'"' -f4) - echo "${version}" -} - -function compare_spoolman_versions() { - local local_ver remote_ver - local_ver="$(get_local_spoolman_version)" - remote_ver="$(get_remote_spoolman_version)" - - if [[ ${local_ver} != "${remote_ver}" ]]; then - versions="${yellow}$(printf " %-14s" "${local_ver}")${white}" - versions+="|${green}$(printf " %-13s" "${remote_ver}")${white}" - # add spoolman to application_updates_available in kiauh.ini - add_to_application_updates "spoolman" - else - versions="${green}$(printf " %-14s" "${local_ver}")${white}" - versions+="|${green}$(printf " %-13s" "${remote_ver}")${white}" - fi - - echo "${versions}" -} diff --git a/scripts/switch_klipper_repo.sh b/scripts/switch_klipper_repo.sh deleted file mode 100644 index 7f224c2..0000000 --- a/scripts/switch_klipper_repo.sh +++ /dev/null @@ -1,144 +0,0 @@ -#!/usr/bin/env bash - -#=======================================================================# -# Copyright (C) 2020 - 2024 Dominik Willner # -# # -# 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 # -#=======================================================================# - -set -e - -function change_klipper_repo_menu() { - local repo_file="${KIAUH_SRCDIR}/klipper_repos.txt" - local repo branch repos=() branches=() - - if [[ ! -f ${repo_file} ]]; then - print_error "File not found:\n '${KIAUH_SRCDIR}/klipper_repos.txt'" - return - fi - - ### generate the repolist from the klipper_repos.txt textfile - while IFS="," read -r repo branch; do - repo=$(echo "${repo}" | sed -r "s/^http(s)?:\/\/github.com\///" | sed "s/\.git$//" ) - repos+=("${repo}") - ### if branch is not given, default to 'master' - [[ -z ${branch} ]] && branch="master" - branches+=("${branch}") - done < <(grep -E "^[^#]" "${repo_file}") - - top_border - echo -e "| ~~~~~~~~ [ Set custom Klipper repo ] ~~~~~~~~ | " - hr - blank_line - ### print repolist - local i=0 - for _ in "${repos[@]}"; do - printf "| %s) %-63s|\n" "${i}" "${yellow}${repos[${i}]}${white} → ${branches[${i}]}" - i=$(( i + 1 )) - done - blank_line - back_help_footer - - local option - local num="^[0-9]+$" - local back="^(B|b)$" - local help="^(H|h)$" - - while true; do - read -p "${cyan}###### Perform action:${white} " option - - if [[ ${option} =~ ${num} && ${option} -lt ${#repos[@]} ]]; then - select_msg "Repo: ${repos[option]} Branch: ${branches[option]}" - - if [[ -d ${KLIPPER_DIR} ]]; then - top_border - echo -e "| ${red}!!! ATTENTION !!!${white} |" - echo -e "| Existing Klipper folder found! Proceeding will remove | " - echo -e "| the existing Klipper folder and replace it with a | " - echo -e "| clean copy of the previously selected source repo! | " - bottom_border - - local yn - while true; do - read -p "${cyan}###### Proceed? (Y/n):${white} " yn - case "${yn}" in - Y|y|Yes|yes|"") - select_msg "Yes" - switch_klipper_repo "${repos[${option}]}" "${branches[${option}]}" - set_custom_klipper_repo "${repos[${option}]}" "${branches[${option}]}" - break;; - N|n|No|no) - select_msg "No" - break;; - *) - 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 - clear && print_header - settings_menu - elif [[ ${option} =~ ${help} ]]; then - clear && print_header - show_custom_klipper_repo_help - else - error_msg "Invalid command!" - fi - done - - change_klipper_repo_menu -} - -#================================================# -#=================== HELPERS ====================# -#================================================# - -function switch_klipper_repo() { - local repo=${1} branch=${2} - - status_msg "Switching Klipper repository..." - do_action_service "stop" "klipper" - - [[ -d ${KLIPPER_DIR} ]] && rm -rf "${KLIPPER_DIR}" - clone_klipper "${repo}" "${branch}" - - do_action_service "start" "klipper" -} - -function show_custom_klipper_repo_help() { - top_border - echo -e "| ~~~~ < ? > Help: Custom Klipper repo < ? > ~~~~ |" - hr - echo -e "| With this setting, it is possible to install Klipper |" - echo -e "| from a custom repository. It will also switch an |" - echo -e "| existing Klipper installation to the newly selected |" - echo -e "| source repository. |" - echo -e "| A list of repositories is automatically generated by |" - echo -e "| a 'klipper_repos.txt' textfile in KIAUHs root folder. |" - echo -e "| An example file is provided at the same location. |" - blank_line - back_footer - - local choice - while true; do - read -p "${cyan}###### Please select:${white} " choice - case "${choice}" in - B|b) - clear && print_header - change_klipper_repo_menu - break;; - *) - deny_action "show_settings_help";; - esac - done -} diff --git a/scripts/ui/advanced_menu.sh b/scripts/ui/advanced_menu.sh deleted file mode 100755 index 12923e5..0000000 --- a/scripts/ui/advanced_menu.sh +++ /dev/null @@ -1,69 +0,0 @@ -#!/usr/bin/env bash - -#=======================================================================# -# Copyright (C) 2020 - 2024 Dominik Willner # -# # -# 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 # -#=======================================================================# - -set -e - -function advanced_ui() { - top_border - echo -e "| ${yellow}~~~~~~~~~~~~~ [ Advanced Menu ] ~~~~~~~~~~~~~${white} |" - hr - echo -e "| Klipper & API: | Mainsail: |" - echo -e "| 1) [Rollback] | 6) [Theme installer] |" - echo -e "| | |" - echo -e "| Firmware: | System: |" - echo -e "| 2) [Build only] | 7) [Change hostname] |" - echo -e "| 3) [Flash only] | |" - echo -e "| 4) [Build + Flash] | Extras: |" - echo -e "| 5) [Get MCU ID] | 8) [G-Code Shell Command] |" - back_footer -} - -function advanced_menu() { - do_action "" "advanced_ui" - - local action - while true; do - read -p "${cyan}####### Perform action:${white} " action - case "${action}" in - 1) - do_action "rollback_menu" "advanced_menu";; - 2) - do_action "build_fw" "advanced_ui";; - 3) - clear && print_header - do_action "init_flash_process" "advanced_ui";; - 4) - clear && print_header - status_msg "Please wait..." - build_fw && init_flash_process - advanced_ui;; - 5) - clear && print_header - select_mcu_connection - print_detected_mcu_to_screen - advanced_ui;; - 6) - do_action "ms_theme_installer_menu";; - 7) - clear - print_header - set_custom_hostname - advanced_ui;; - 8) - do_action "setup_gcode_shell_command" "advanced_ui";; - B|b) - clear; main_menu; break;; - *) - deny_action "advanced_ui";; - esac - done - advanced_menu -} diff --git a/scripts/ui/backup_menu.sh b/scripts/ui/backup_menu.sh deleted file mode 100755 index 783476c..0000000 --- a/scripts/ui/backup_menu.sh +++ /dev/null @@ -1,69 +0,0 @@ -#!/usr/bin/env bash - -#=======================================================================# -# Copyright (C) 2020 - 2024 Dominik Willner # -# # -# 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 # -#=======================================================================# - -set -e - -function backup_ui() { - top_border - echo -e "| $(title_msg "~~~~~~~~~~~~~~ [ Backup Menu ] ~~~~~~~~~~~~~~") |" - hr - echo -e "| ${yellow}INFO: Backups are located in '~/kiauh-backups'${white} |" - hr - echo -e "| Klipper & API: | Touchscreen GUI: |" - echo -e "| 1) [Klipper] | 7) [KlipperScreen] |" - echo -e "| 2) [Moonraker] | |" - echo -e "| 3) [Config Folder] | 3rd Party Webinterface: |" - echo -e "| 4) [Moonraker Database] | 8) [OctoPrint] |" - echo -e "| | |" - echo -e "| Klipper Webinterface: | Other: |" - echo -e "| 5) [Mainsail] | 9) [Telegram Bot] |" - echo -e "| 6) [Fluidd] | 10) [OctoEverywhere] |" - echo -e "| | 11) [Spoolman] |" - back_footer -} - -function backup_menu() { - do_action "" "backup_ui" - - local action - while true; do - read -p "${cyan}####### Perform action:${white} " action - case "${action}" in - 1) - do_action "backup_klipper" "backup_ui";; - 2) - do_action "backup_moonraker" "backup_ui";; - 3) - do_action "backup_config_dir" "backup_ui";; - 4) - do_action "backup_moonraker_database" "backup_ui";; - 5) - do_action "backup_mainsail" "backup_ui";; - 6) - do_action "backup_fluidd" "backup_ui";; - 7) - do_action "backup_klipperscreen" "backup_ui";; - 8) - do_action "backup_octoprint" "backup_ui";; - 9) - do_action "backup_telegram_bot" "backup_ui";; - 10) - do_action "backup_octoeverywhere" "backup_ui";; - 11) - do_action "backup_spoolman" "backup_ui";; - B|b) - clear; main_menu; break;; - *) - deny_action "backup_ui";; - esac - done - backup_menu -} diff --git a/scripts/ui/general_ui.sh b/scripts/ui/general_ui.sh deleted file mode 100755 index 2abf794..0000000 --- a/scripts/ui/general_ui.sh +++ /dev/null @@ -1,70 +0,0 @@ -#!/usr/bin/env bash - -#=======================================================================# -# Copyright (C) 2020 - 2024 Dominik Willner # -# # -# 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 # -#=======================================================================# - -set -e - -#ui total width = 57 chars -function top_border() { - echo -e "/=======================================================\\" -} - -function bottom_border() { - echo -e "\=======================================================/" -} - -function blank_line() { - echo -e "| |" -} - -function hr() { - echo -e "|-------------------------------------------------------|" -} - -function quit_footer() { - hr - echo -e "| ${red}Q) Quit${white} |" - bottom_border -} - -function back_footer() { - hr - echo -e "| ${green}B) « Back${white} |" - bottom_border -} - -function back_help_footer() { - hr - echo -e "| ${green}B) « Back${white} | ${yellow}H) Help [?]${white} |" - bottom_border -} - -function print_header() { - top_border - echo -e "| $(title_msg "~~~~~~~~~~~~~~~~~ [ KIAUH ] ~~~~~~~~~~~~~~~~~") |" - echo -e "| $(title_msg " Klipper Installation And Update Helper ") |" - echo -e "| $(title_msg "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~") |" - bottom_border -} - -function do_action() { - clear && print_header - ### $1 is the action the user wants to fire - $1 -# print_msg && clear_msg - ### $2 is the menu the user usually gets directed back to after an action is completed - $2 -} - -function deny_action() { - clear && print_header - print_error "Invalid command!" - $1 -} diff --git a/scripts/ui/install_menu.sh b/scripts/ui/install_menu.sh deleted file mode 100755 index 3501e0a..0000000 --- a/scripts/ui/install_menu.sh +++ /dev/null @@ -1,88 +0,0 @@ -#!/usr/bin/env bash - -#=======================================================================# -# Copyright (C) 2020 - 2024 Dominik Willner # -# # -# 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 # -#=======================================================================# - -set -e - -function install_ui() { - top_border - echo -e "| ${green}~~~~~~~~~~~ [ Installation Menu ] ~~~~~~~~~~~${white} |" - hr - echo -e "| You need this menu usually only for installing |" - echo -e "| all necessary dependencies for the various |" - echo -e "| functions on a completely fresh system. |" - hr - echo -e "| Firmware & API: | Other: |" - echo -e "| 1) [Klipper] | 7) [PrettyGCode] |" - echo -e "| 2) [Moonraker] | 8) [Telegram Bot] |" - echo -e "| | 9) $(obico_install_title) |" - echo -e "| Klipper Webinterface: | 10) [OctoEverywhere] |" - echo -e "| 3) [Mainsail] | 11) [Mobileraker] |" - echo -e "| 4) [Fluidd] | 12) [OctoApp for Klipper] |" - echo -e "| | 13) [Spoolman] |" - echo -e "| Touchscreen GUI: | |" - echo -e "| 5) [KlipperScreen] | Webcam Streamer: |" - echo -e "| | 14) [Crowsnest] |" - echo -e "| 3rd Party Webinterface: | |" - echo -e "| 6) [OctoPrint] | |" - back_footer -} - -function install_menu() { - clear -x && sudo true && clear -x # (re)cache sudo credentials so password prompt doesn't bork ui - print_header - install_ui - - ### save all installed webinterface ports to the ini file - fetch_webui_ports - - ### save all klipper multi-instance names to the ini file - set_multi_instance_names - - local action - while true; do - read -p "${cyan}####### Perform action:${white} " action - case "${action}" in - 1) - do_action "start_klipper_setup" "install_ui";; - 2) - do_action "moonraker_setup_dialog" "install_ui";; - 3) - do_action "install_mainsail" "install_ui";; - 4) - do_action "install_fluidd" "install_ui";; - 5) - do_action "install_klipperscreen" "install_ui";; - 6) - do_action "octoprint_setup_dialog" "install_ui";; - 7) - do_action "install_pgc_for_klipper" "install_ui";; - 8) - do_action "telegram_bot_setup_dialog" "install_ui";; - 9) - do_action "moonraker_obico_setup_dialog" "install_ui";; - 10) - do_action "octoeverywhere_setup_dialog" "install_ui";; - 11) - do_action "install_mobileraker" "install_ui";; - 12) - do_action "octoapp_setup_dialog" "install_ui";; - 13) - do_action "install_spoolman" "install_ui";; - 14) - do_action "install_crowsnest" "install_ui";; - B|b) - clear; main_menu; break;; - *) - deny_action "install_ui";; - esac - done - install_menu -} diff --git a/scripts/ui/main_menu.sh b/scripts/ui/main_menu.sh deleted file mode 100755 index 14cc1a4..0000000 --- a/scripts/ui/main_menu.sh +++ /dev/null @@ -1,142 +0,0 @@ -#!/usr/bin/env bash - -#=======================================================================# -# Copyright (C) 2020 - 2024 Dominik Willner # -# # -# 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 # -#=======================================================================# - -set -e - -function main_ui() { - top_border - echo -e "| $(title_msg "~~~~~~~~~~~~~~~ [ Main Menu ] ~~~~~~~~~~~~~~~") |" - hr - echo -e "| 0) [Log-Upload] | Klipper: $(print_status "klipper")|" - echo -e "| | Repo: $(print_klipper_repo)|" - echo -e "| 1) [Install] | |" - echo -e "| 2) [Update] | Moonraker: $(print_status "moonraker")|" - echo -e "| 3) [Remove] | |" - echo -e "| 4) [Advanced] | Mainsail: $(print_status "mainsail")|" - echo -e "| 5) [Backup] | Fluidd: $(print_status "fluidd")|" - echo -e "| | KlipperScreen: $(print_status "klipperscreen")|" - echo -e "| 6) [Settings] | Telegram Bot: $(print_status "telegram_bot")|" - echo -e "| | Crowsnest: $(print_status "crowsnest")|" - echo -e "| | Obico: $(print_status "moonraker_obico")|" - echo -e "| | OctoEverywhere: $(print_status "octoeverywhere")|" - echo -e "| | Mobileraker: $(print_status "mobileraker")|" - echo -e "| | OctoApp: $(print_status "octoapp")|" - echo -e "| | Spoolman: $(print_status "spoolman")|" - echo -e "| | |" - echo -e "| | Octoprint: $(print_status "octoprint")|" - hr - echo -e "| $(print_kiauh_version)| Changelog: ${magenta}https://git.io/JnmlX${white} |" - quit_footer -} - -function get_kiauh_version() { - local version - cd "${KIAUH_SRCDIR}" - version="$(git tag -l 'v5*' | tail -1)" - echo "${version}" -} - -function print_kiauh_version() { - local version - version="$(printf "%-16s" "$(get_kiauh_version)")" - echo "${cyan}${version}${white}" -} - -function print_status() { - local status component="${1}" - status=$(get_"${component}"_status) - - if [[ ${status} == "Not installed!" ]]; then - status="${red}${status}${white}" - elif [[ ${status} == "Incomplete!" ]]; then - status="${yellow}${status}${white}" - elif [[ ${status} == "Not linked!" ]]; then - ### "Not linked!" is only required for Obico for Klipper - status="${yellow}${status}${white}" - else - status="${green}${status}${white}" - fi - - printf "%-28s" "${status}" -} - -function print_klipper_repo() { - read_kiauh_ini - - local repo klipper_status - klipper_status=$(get_klipper_status) - repo=$(echo "${custom_klipper_repo}" | sed "s/https:\/\/github\.com\///" | sed "s/\.git$//") - repo="${repo^^}" - - if [[ ${klipper_status} == "Not installed!" ]]; then - repo="${red}-${white}" - elif [[ -n ${repo} && ${repo} != "KLIPPER3D/KLIPPER" ]]; then - repo="${cyan}custom${white}" - else - repo="${cyan}Klipper3d/klipper${white}" - fi - - printf "%-28s" "${repo}" -} - - - -function main_menu() { - clear && print_header - main_ui - - local action - while true; do - read -p "${cyan}####### Perform action:${white} " action - case "${action}" in - "start klipper") do_action_service "start" "klipper"; main_ui;; - "stop klipper") do_action_service "stop" "klipper"; main_ui;; - "restart klipper") do_action_service "restart" "klipper"; main_ui;; - "start moonraker") do_action_service "start" "moonraker"; main_ui;; - "stop moonraker") do_action_service "stop" "moonraker"; main_ui;; - "restart moonraker")do_action_service "restart" "moonraker"; main_ui;; - "start octoprint") do_action_service "start" "octoprint"; main_ui;; - "stop octoprint") do_action_service "stop" "octoprint"; main_ui;; - "restart octoprint") do_action_service "restart" "octoprint"; main_ui;; - "start crowsnest") do_action_service "start" "crowsnest"; main_ui;; - "stop crowsnest") do_action_service "stop" "crowsnest"; main_ui;; - "restart crowsnest") do_action_service "restart" "crowsnest"; main_ui;; - update) do_action "update_kiauh" "main_ui";; - 0)clear && print_header - upload_selection - main_ui;; - 1)clear && print_header - install_menu - break;; - 2) clear && print_header - update_menu - break;; - 3) clear && print_header - remove_menu - break;; - 4)clear && print_header - advanced_menu - break;; - 5)clear && print_header - backup_menu - main_ui;; - 6)clear && print_header - settings_menu - break;; - Q|q) - echo -e "${green}###### Happy printing! ######${white}"; echo - exit 0;; - *) - deny_action "main_ui";; - esac - done - main_menu -} diff --git a/scripts/ui/remove_menu.sh b/scripts/ui/remove_menu.sh deleted file mode 100755 index a24d1c9..0000000 --- a/scripts/ui/remove_menu.sh +++ /dev/null @@ -1,88 +0,0 @@ -#!/usr/bin/env bash - -#=======================================================================# -# Copyright (C) 2020 - 2024 Dominik Willner # -# # -# 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 # -#=======================================================================# - -set -e - -function remove_ui() { - top_border - echo -e "| ${red}~~~~~~~~~~~~~~ [ Remove Menu ] ~~~~~~~~~~~~~~${white} |" - hr - echo -e "| ${yellow}INFO: Configurations and/or any backups will be kept!${white} |" - hr - echo -e "| Firmware & API: | Webcam Streamer: |" - echo -e "| 1) [Klipper] | 9) [Crowsnest] |" - echo -e "| 2) [Moonraker] | 10) [MJPG-Streamer] |" - echo -e "| | |" - echo -e "| Klipper Webinterface: | Other: |" - echo -e "| 3) [Mainsail] | 11) [PrettyGCode] |" - echo -e "| 4) [Mainsail-Config] | 12) [Telegram Bot] |" - echo -e "| 5) [Fluidd] | 13) [Obico for Klipper] |" - echo -e "| 6) [Fluidd-Config] | 14) [OctoEverywhere] |" - echo -e "| | 15) [Mobileraker] |" - echo -e "| Touchscreen GUI: | 16) [NGINX] |" - echo -e "| 7) [KlipperScreen] | 17) [OctoApp] |" - echo -e "| | 18) [Spoolman] |" - echo -e "| 3rd Party Webinterface: | |" - echo -e "| 8) [OctoPrint] | |" - back_footer -} - -function remove_menu() { - do_action "" "remove_ui" - - local action - while true; do - read -p "${cyan}####### Perform action:${white} " action - case "${action}" in - 1) - do_action "remove_klipper" "remove_ui";; - 2) - do_action "remove_moonraker" "remove_ui";; - 3) - do_action "remove_mainsail" "remove_ui";; - 4) - do_action "remove_mainsail_config" "remove_ui";; - 5) - do_action "remove_fluidd" "remove_ui";; - 6) - do_action "remove_fluidd_config" "remove_ui";; - 7) - do_action "remove_klipperscreen" "remove_ui";; - 8) - do_action "remove_octoprint" "remove_ui";; - 9) - do_action "remove_crowsnest" "remove_ui";; - 10) - do_action "remove_mjpg-streamer" "remove_ui";; - 11) - do_action "remove_prettygcode" "remove_ui";; - 12) - do_action "remove_telegram_bot" "remove_ui";; - 13) - do_action "remove_moonraker_obico" "remove_ui";; - 14) - do_action "remove_octoeverywhere" "remove_ui";; - 15) - do_action "remove_mobileraker" "remove_ui";; - 16) - do_action "remove_nginx" "remove_ui";; - 17) - do_action "remove_octoapp" "remove_ui";; - 18) - do_action "remove_spoolman" "remove_ui";; - B|b) - clear; main_menu; break;; - *) - deny_action "remove_ui";; - esac - done - remove_menu -} diff --git a/scripts/ui/settings_menu.sh b/scripts/ui/settings_menu.sh deleted file mode 100755 index 0cf4835..0000000 --- a/scripts/ui/settings_menu.sh +++ /dev/null @@ -1,166 +0,0 @@ -#!/usr/bin/env bash - -#=======================================================================# -# Copyright (C) 2020 - 2024 Dominik Willner # -# # -# 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 # -#=======================================================================# - -set -e - -function settings_ui() { - read_kiauh_ini "${FUNCNAME[0]}" - - local custom_repo="${custom_klipper_repo}" - local custom_branch="${custom_klipper_repo_branch}" - local ms_pre_rls="${mainsail_install_unstable}" - local fl_pre_rls="${fluidd_install_unstable}" - local bbu="${backup_before_update}" - - ### custom repository - custom_repo=$(echo "${custom_repo}" | sed "s/https:\/\/github\.com\///" | sed "s/\.git$//" ) - if [[ -z ${custom_repo} ]]; then - custom_repo="${cyan}Klipper3D/klipper${white}" - else - custom_repo="${cyan}${custom_repo}${white}" - fi - - ### custom repository branch - if [[ -z ${custom_branch} ]]; then - custom_branch="${cyan}master${white}" - else - custom_branch="${cyan}${custom_branch}${white}" - fi - - ### webinterface stable toggle - if [[ ${ms_pre_rls} == "false" ]]; then - ms_pre_rls="${red}● ${ms_pre_rls}${white}" - else - ms_pre_rls="${green}● ${ms_pre_rls}${white}" - fi - - if [[ ${fl_pre_rls} == "false" ]]; then - fl_pre_rls="${red}● ${fl_pre_rls}${white}" - else - fl_pre_rls="${green}● ${fl_pre_rls}${white}" - fi - - ### backup before update toggle - if [[ "${bbu}" == "false" ]]; then - bbu="${red}● ${bbu}${white}" - else - bbu="${green}● ${bbu}${white}" - fi - - top_border - echo -e "| $(title_msg "~~~~~~~~~~~~ [ KIAUH Settings ] ~~~~~~~~~~~~~") |" - hr - echo -e "| Klipper: |" - echo -e "| ● Repository: |" - printf "| %-70s|\n" "${custom_repo} (${custom_branch})" - hr - echo -e "| Install unstable releases: |" - printf "| Mainsail: %-29sFluidd: %-27s|\n" "${ms_pre_rls}" "${fl_pre_rls}" - hr - printf "| Backup before updating: %-42s|\n" "${bbu}" - hr - echo -e "| 1) Set custom Klipper repository |" - blank_line - if [[ ${mainsail_install_unstable} == "false" ]]; then - echo -e "| 2) ${green}Allow${white} unstable Mainsail releases |" - else - echo -e "| 2) ${red}Disallow${white} unstable Mainsail releases |" - fi - if [[ ${fluidd_install_unstable} == "false" ]]; then - echo -e "| 3) ${green}Allow${white} unstable Fluidd releases |" - else - echo -e "| 3) ${red}Disallow${white} unstable Fluidd releases |" - fi - blank_line - if [[ ${backup_before_update} == "false" ]]; then - echo -e "| 4) ${green}Enable${white} automatic backups before updates |" - else - echo -e "| 4) ${red}Disable${white} automatic backups before updates |" - fi - back_help_footer -} - -function show_settings_help() { - local default_cfg="${cyan}${HOME}/klipper_config${white}" - - top_border - echo -e "| ~~~~~~ < ? > Help: KIAUH Settings < ? > ~~~~~~ |" - hr - echo -e "| ${cyan}Install unstable releases:${white} |" - echo -e "| If set to ${green}true${white}, KIAUH installs/updates the software |" - echo -e "| with the latest, currently available release. |" - echo -e "| ${yellow}This will include alpha, beta and rc releases!${white} |" - blank_line - echo -e "| If set to ${red}false${white}, KIAUH installs/updates the software |" - echo -e "| with the most recent stable release. |" - blank_line - echo -e "| Default: ${red}false${white} |" - blank_line - hr - echo -e "| ${cyan}Backup before updating:${white} |" - echo -e "| If set to true, KIAUH will automatically create a |" - echo -e "| backup from the corresponding component you are about |" - echo -e "| to update before actually updating it, preserving the |" - echo -e "| current state of the component in a safe location. |" - echo -e "| All backups are stored in '~/kiauh_backups'. |" - blank_line - echo -e "| Default: ${red}false${white} |" - blank_line - back_footer - - local choice - while true; do - read -p "${cyan}###### Please select:${white} " choice - case "${choice}" in - B|b) - clear && print_header - settings_menu - break;; - *) - deny_action "show_settings_help";; - esac - done -} - -function settings_menu() { - clear && print_header - settings_ui - - local action - while true; do - read -p "${cyan}####### Perform action:${white} " action - case "${action}" in - 1) - clear && print_header - change_klipper_repo_menu - settings_ui;; - 2) - switch_mainsail_releasetype - settings_menu;; - 3) - switch_fluidd_releasetype - settings_menu;; - 4) - toggle_backup_before_update - settings_menu;; - B|b) - clear - main_menu - break;; - H|h) - clear && print_header - show_settings_help - break;; - *) - deny_action "settings_ui";; - esac - done -} diff --git a/scripts/ui/update_menu.sh b/scripts/ui/update_menu.sh deleted file mode 100755 index 8e85599..0000000 --- a/scripts/ui/update_menu.sh +++ /dev/null @@ -1,172 +0,0 @@ -#!/usr/bin/env bash - -#=======================================================================# -# Copyright (C) 2020 - 2024 Dominik Willner # -# # -# 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 # -#=======================================================================# - -set -e - -function update_ui() { - top_border - echo -e "| ${green}~~~~~~~~~~~~~~ [ Update Menu ] ~~~~~~~~~~~~~~${white} |" - hr - echo -e "| a) [Update all] | | |" - echo -e "| | Installed: | Latest: |" - echo -e "| Klipper & API: |---------------|--------------|" - echo -e "| 1) [Klipper] |$(compare_klipper_versions)|" - echo -e "| 2) [Moonraker] |$(compare_moonraker_versions)|" - echo -e "| | | |" - echo -e "| Klipper Webinterface: |---------------|--------------|" - echo -e "| 3) [Mainsail] |$(compare_mainsail_versions)|" - echo -e "| 4) [Fluidd] |$(compare_fluidd_versions)|" - echo -e "| | | |" - echo -e "| Touchscreen GUI: |---------------|--------------|" - echo -e "| 5) [KlipperScreen] |$(compare_klipperscreen_versions)|" - echo -e "| | | |" - echo -e "| Other: |---------------|--------------|" - echo -e "| 6) [PrettyGCode] |$(compare_prettygcode_versions)|" - echo -e "| 7) [Telegram Bot] |$(compare_telegram_bot_versions)|" - echo -e "| 8) [Obico for Klipper]|$(compare_moonraker_obico_versions)|" - echo -e "| 9) [OctoEverywhere] |$(compare_octoeverywhere_versions)|" - echo -e "| 10) [Mobileraker] |$(compare_mobileraker_versions)|" - echo -e "| 11) [Crowsnest] |$(compare_crowsnest_versions)|" - echo -e "| 12) [OctoApp] |$(compare_octoapp_versions)|" - echo -e "| 13) [Spoolman] |$(compare_spoolman_versions)|" - echo -e "| |------------------------------|" - echo -e "| 14) [System] | $(check_system_updates) |" - back_footer -} - -function update_menu() { - clear -x && sudo true && clear -x # (re)cache sudo credentials so password prompt doesn't bork ui - do_action "" "update_ui" - - local action - while true; do - read -p "${cyan}####### Perform action:${white} " action - case "${action}" in - 0) - do_action "toggle_backups" "update_ui";; - 1) - do_action "update_klipper" "update_ui";; - 2) - do_action "update_moonraker" "update_ui";; - 3) - do_action "update_mainsail" "update_ui";; - 4) - do_action "update_fluidd" "update_ui";; - 5) - do_action "update_klipperscreen" "update_ui";; - 6) - do_action "update_pgc_for_klipper" "update_ui";; - 7) - do_action "update_telegram_bot" "update_ui";; - 8) - do_action "update_moonraker_obico" "update_ui";; - 9) - do_action "update_octoeverywhere" "update_ui";; - 10) - do_action "update_mobileraker" "update_ui";; - 11) - do_action "update_crowsnest" "update_ui";; - 12) - do_action "update_octoapp" "update_ui";; - 13) - do_action "update_spoolman" "update_ui";; - 14) - do_action "upgrade_system_packages" "update_ui";; - a) - do_action "update_all" "update_ui";; - B|b) - clear; main_menu; break;; - *) - deny_action "update_ui";; - esac - done - update_menu -} - -function update_all() { - read_kiauh_ini "${FUNCNAME[0]}" - - local update_arr - local app_update_state="${application_updates_available}" - - IFS=', ' read -r -a update_arr <<< "${app_update_state}" - - while true; do - if (( ${#update_arr[@]} == 0 )); then - print_confirm "Everything is already up-to-date!" - echo; break - fi - - echo - top_border - echo -e "| The following installations will be updated: |" - - [[ "${update_arr[*]}" =~ "klipper" ]] && \ - echo -e "| ${cyan}● Klipper${white} |" - - [[ "${update_arr[*]}" =~ "moonraker" ]] && \ - echo -e "| ${cyan}● Moonraker${white} |" - - [[ "${update_arr[*]}" =~ "mainsail" ]] && \ - echo -e "| ${cyan}● Mainsail${white} |" - - [[ "${update_arr[*]}" =~ "fluidd" ]] && \ - echo -e "| ${cyan}● Fluidd${white} |" - - [[ "${update_arr[*]}" =~ "klipperscreen" ]] && \ - echo -e "| ${cyan}● KlipperScreen${white} |" - - [[ "${update_arr[*]}" =~ "spoolman" ]] && \ - echo -e "| ${cyan}● SpoolMan${white} |" - - [[ "${update_arr[*]}" =~ "pgc_for_klipper" ]] && \ - echo -e "| ${cyan}● PrettyGCode for Klipper${white} |" - - [[ "${update_arr[*]}" =~ "telegram_bot" ]] && \ - echo -e "| ${cyan}● MoonrakerTelegramBot${white} |" - - [[ "${update_arr[*]}" =~ "octoeverywhere" ]] && \ - echo -e "| ${cyan}● OctoEverywhere${white} |" - - [[ "${update_arr[*]}" =~ "mobileraker" ]] && \ - echo -e "| ${cyan}● Mobileraker${white} |" - - [[ "${update_arr[*]}" =~ "octoapp" ]] && \ - echo -e "| ${cyan}● OctoApp${white} |" - - [[ "${update_arr[*]}" =~ "system" ]] && \ - echo -e "| ${cyan}● System${white} |" - - bottom_border - - local yn - read -p "${cyan}###### Do you want to proceed? (Y/n):${white} " yn - case "${yn}" in - Y|y|Yes|yes|"") - local component - local update - for component in "${update_arr[@]}"; do - if [[ ${component} == "system" ]]; then - update="upgrade_system_packages" - else - update="update_${component}" - fi - #shellcheck disable=SC2250 - $update - done - break;; - N|n|No|no) - break;; - *) - error_msg "Invalid command!";; - esac - done -} diff --git a/scripts/upload_log.sh b/scripts/upload_log.sh deleted file mode 100755 index 97f2e88..0000000 --- a/scripts/upload_log.sh +++ /dev/null @@ -1,125 +0,0 @@ -#!/usr/bin/env bash - -#=======================================================================# -# Copyright (C) 2020 - 2024 Dominik Willner # -# # -# 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 # -#=======================================================================# - -set -e - -function accept_upload_conditions() { - top_border - echo -e "| ${red}~~~~~~~~~~~ [ Upload Agreement ] ~~~~~~~~~~~~${white} |" - hr - echo -e "| The following function will help to quickly upload |" - echo -e "| logs for debugging purposes. With confirming this |" - echo -e "| dialog, you agree that during that process your logs |" - echo -e "| will be uploaded to: ${yellow}http://paste.c-net.org/${white} |" - hr - echo -e "| ${red}PLEASE NOTE:${white} |" - echo -e "| Be aware that logs can contain network information, |" - echo -e "| private data like usernames, filenames, or other |" - echo -e "| information you may not want to make public. |" - blank_line - echo -e "| Do ${red}NOT${white} use this function if you don't agree! |" - bottom_border - - local yn - while true; do - read -p "${cyan}Do you accept? (Y/n):${white} " yn - case "${yn}" in - Y|y|Yes|yes|"") - sed -i "/logupload_accepted=/s/false/true/" "${INI_FILE}" - clear && print_header && upload_selection - ;; - N|n|No|no) - clear - main_menu - break - ;; - *) - error_msg "Invalid command!";; - esac - done -} - -function upload_selection() { - read_kiauh_ini "${FUNCNAME[0]}" - - local upload_agreed="${logupload_accepted}" - [[ ${upload_agreed} == "false" ]] && accept_upload_conditions - - local logfiles - local webif_logs="/var/log/nginx" - - function find_logfile() { - local name=${1} location=${2} - for log in $(find "${location}" -maxdepth 1 -regextype posix-extended -regex "${location}/${name}" | sort -g); do - logfiles+=("${log}") - done - } - - local logdir log_dirs - log_dirs=$(get_instance_folder_path "logs") - for logdir in ${log_dirs}; do - find_logfile "klippy(-[0-9a-zA-Z]+)?\.log" "${logdir}" - find_logfile "moonraker(-[0-9a-zA-Z]+)?\.log" "${logdir}" - find_logfile "telegram(-[0-9a-zA-Z]+)?\.log" "${logdir}" - done - find_logfile "mainsail.*" "${webif_logs}" - find_logfile "fluidd.*" "${webif_logs}" - find_logfile "KlipperScreen.log" "/tmp" - find_logfile "webcamd\.log(\.[0-9]+)?$" "/var/log" - find_logfile "kiauh\.log" "/tmp" - - ### draw interface - local i=0 - top_border - echo -e "| ${yellow}~~~~~~~~~~~~~~~ [ Log Upload ] ~~~~~~~~~~~~~~${white} |" - hr - echo -e "| You can choose the following logfiles for uploading: |" - blank_line - - for log in "${logfiles[@]}"; do - log=${log//${HOME}/"~"} - (( i < 10 )) && printf "| ${i}) %-50s|\n" "${log}" - (( i >= 10 )) && printf "| ${i}) %-50s|\n" "${log}" - i=$(( i + 1 )) - done - - blank_line - back_footer - - local option re="^[0-9]+$" - while true; do - read -p "${cyan}###### Please select:${white} " option - - if [[ ${option} =~ ${re} && ${option} -lt ${#logfiles[@]} ]]; then - upload_log "${logfiles[${option}]}" - upload_selection - elif [[ ${option} == "B" || ${option} == "b" ]]; then - return - else - error_msg "Invalid command!" - fi - done -} - -function upload_log() { - local link - clear && print_header - status_msg "Uploading ${1} ..." - link=$(curl -s -H "x-random;" --upload-file "${1}" 'http://paste.c-net.org/') - - if [[ -n ${link} ]]; then - ok_msg "${1} upload successfull!" - echo -e "\n${cyan}###### Here is your link:${white}" - echo -e ">>>>>> ${link}\n" - else - error_msg "Uploading failed!" - fi -} diff --git a/scripts/utilities.sh b/scripts/utilities.sh deleted file mode 100644 index aed70d5..0000000 --- a/scripts/utilities.sh +++ /dev/null @@ -1,778 +0,0 @@ -#!/usr/bin/env bash - -#=======================================================================# -# Copyright (C) 2020 - 2024 Dominik Willner # -# # -# 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 # -#=======================================================================# - -set -e - -#================================================# -#=================== STARTUP ====================# -#================================================# - -function check_euid() { - if [[ ${EUID} -eq 0 ]]; then - echo -e "${red}" - top_border - echo -e "| !!! THIS SCRIPT MUST NOT RUN AS ROOT !!! |" - echo -e "| |" - echo -e "| It will ask for credentials as needed. |" - bottom_border - echo -e "${white}" - exit 1 - fi -} - -function check_if_ratos() { - if [[ -n $(which ratos) ]]; then - echo -e "${red}" - top_border - echo -e "| !!! RatOS 2.1 or greater detected !!! |" - echo -e "| |" - echo -e "| KIAUH does currently not support RatOS. |" - echo -e "| If you have any questions, please ask for help on the |" - echo -e "| RatRig Community Discord: https://discord.gg/ratrig |" - bottom_border - echo -e "${white}" - exit 1 - fi -} - -#================================================# -#============= MESSAGE FORMATTING ===============# -#================================================# - -function select_msg() { - echo -e "${white} [➔] ${1}" -} -function status_msg() { - echo -e "\n${magenta}###### ${1}${white}" -} -function ok_msg() { - echo -e "${green}[✓ OK] ${1}${white}" -} -function warn_msg() { - echo -e "${yellow}>>>>>> ${1}${white}" -} -function error_msg() { - echo -e "${red}>>>>>> ${1}${white}" -} -function abort_msg() { - echo -e "${red}<<<<<< ${1}${white}" -} -function title_msg() { - echo -e "${cyan}${1}${white}" -} - -function print_error() { - [[ -z ${1} ]] && return - - echo -e "${red}" - echo -e "#=======================================================#" - echo -e " ${1} " - echo -e "#=======================================================#" - echo -e "${white}" -} - -function print_confirm() { - [[ -z ${1} ]] && return - - echo -e "${green}" - echo -e "#=======================================================#" - echo -e " ${1} " - echo -e "#=======================================================#" - echo -e "${white}" -} - -#================================================# -#=================== LOGGING ====================# -#================================================# - -function timestamp() { - date +"[%F %T]" -} - -function init_logfile() { - local log="/tmp/kiauh.log" - { - echo -e "#================================================================#" - echo -e "# New KIAUH session started on: $(date) #" - echo -e "#================================================================#" - echo -e "KIAUH $(get_kiauh_version)" - echo -e "#================================================================#" - } >> "${log}" -} - -function log_info() { - local message="${1}" log="${LOGFILE}" - echo -e "$(timestamp) [INFO]: ${message}" | tr -s " " >> "${log}" -} - -function log_warning() { - local message="${1}" log="${LOGFILE}" - echo -e "$(timestamp) [WARN]: ${message}" | tr -s " " >> "${log}" -} - -function log_error() { - local message="${1}" log="${LOGFILE}" - echo -e "$(timestamp) [ERR]: ${message}" | tr -s " " >> "${log}" -} - -#================================================# -#=============== KIAUH SETTINGS =================# -#================================================# - -function read_kiauh_ini() { - local func=${1} - - if [[ ! -f ${INI_FILE} ]]; then - log_warning "Reading from .kiauh.ini failed! File not found! Creating default ini file." - init_ini - fi - - log_info "Reading from .kiauh.ini ... (${func})" - source "${INI_FILE}" -} - -function init_ini() { - ### remove pre-version 4 ini files - if [[ -f ${INI_FILE} ]] && ! grep -Eq "^# KIAUH v4\.0\.0$" "${INI_FILE}"; then - rm "${INI_FILE}" - fi - - ### initialize v4.0.0 ini file - if [[ ! -f ${INI_FILE} ]]; then - { - echo -e "# File creation date: $(date)" - echo -e "#=================================================#" - echo -e "# KIAUH - Klipper Installation And Update Helper #" - echo -e "# https://github.com/dw-0/kiauh #" - echo -e "# DO NOT edit this file! #" - echo -e "#=================================================#" - echo -e "# KIAUH v4.0.0" - echo -e "#" - } >> "${INI_FILE}" - fi - - if ! grep -Eq "^application_updates_available=" "${INI_FILE}"; then - echo -e "\napplication_updates_available=\c" >> "${INI_FILE}" - else - sed -i "/application_updates_available=/s/=.*/=/" "${INI_FILE}" - fi - - if ! grep -Eq "^backup_before_update=." "${INI_FILE}"; then - echo -e "\nbackup_before_update=false\c" >> "${INI_FILE}" - fi - - if ! grep -Eq "^logupload_accepted=." "${INI_FILE}"; then - echo -e "\nlogupload_accepted=false\c" >> "${INI_FILE}" - fi - - if ! grep -Eq "^custom_klipper_repo=" "${INI_FILE}"; then - echo -e "\ncustom_klipper_repo=\c" >> "${INI_FILE}" - fi - - if ! grep -Eq "^custom_klipper_repo_branch=" "${INI_FILE}"; then - echo -e "\ncustom_klipper_repo_branch=\c" >> "${INI_FILE}" - fi - - if ! grep -Eq "^mainsail_install_unstable=" "${INI_FILE}"; then - echo -e "\nmainsail_install_unstable=false\c" >> "${INI_FILE}" - fi - - if ! grep -Eq "^fluidd_install_unstable=" "${INI_FILE}"; then - echo -e "\nfluidd_install_unstable=false\c" >> "${INI_FILE}" - fi - - if ! grep -Eq "^multi_instance_names=" "${INI_FILE}"; then - echo -e "\nmulti_instance_names=\c" >> "${INI_FILE}" - fi - - if ! grep -Eq "^version_to_launch=" "${INI_FILE}"; then - echo -e "\nversion_to_launch=\n\c" >> "${INI_FILE}" - fi - - ### strip all empty lines out of the file - sed -i "/^[[:blank:]]*$/ d" "${INI_FILE}" -} - -function switch_mainsail_releasetype() { - read_kiauh_ini "${FUNCNAME[0]}" - local state="${mainsail_install_unstable}" - - if [[ ${state} == "false" ]]; then - sed -i '/mainsail_install_unstable=/s/false/true/' "${INI_FILE}" - log_info "mainsail_install_unstable changed (false -> true) " - else - sed -i '/mainsail_install_unstable=/s/true/false/' "${INI_FILE}" - log_info "mainsail_install_unstable changed (true -> false) " - fi -} - -function switch_fluidd_releasetype() { - read_kiauh_ini "${FUNCNAME[0]}" - local state="${fluidd_install_unstable}" - - if [[ ${state} == "false" ]]; then - sed -i '/fluidd_install_unstable=/s/false/true/' "${INI_FILE}" - log_info "fluidd_install_unstable changed (false -> true) " - else - sed -i '/fluidd_install_unstable=/s/true/false/' "${INI_FILE}" - log_info "fluidd_install_unstable changed (true -> false) " - fi -} - -function toggle_backup_before_update() { - read_kiauh_ini "${FUNCNAME[0]}" - local state="${backup_before_update}" - - if [[ ${state} = "false" ]]; then - sed -i '/backup_before_update=/s/false/true/' "${INI_FILE}" - else - sed -i '/backup_before_update=/s/true/false/' "${INI_FILE}" - fi -} - -function set_custom_klipper_repo() { - read_kiauh_ini "${FUNCNAME[0]}" - local repo=${1} branch=${2} - - sed -i "/^custom_klipper_repo=/d" "${INI_FILE}" - sed -i '$a'"custom_klipper_repo=${repo}" "${INI_FILE}" - sed -i "/^custom_klipper_repo_branch=/d" "${INI_FILE}" - sed -i '$a'"custom_klipper_repo_branch=${branch}" "${INI_FILE}" -} - -function add_to_application_updates() { - read_kiauh_ini "${FUNCNAME[0]}" - - local application="${1}" - local app_update_state="${application_updates_available}" - - if ! grep -Eq "${application}" <<< "${app_update_state}"; then - app_update_state="${app_update_state}${application}," - sed -i "/application_updates_available=/s/=.*/=${app_update_state}/" "${INI_FILE}" - fi -} - -#================================================# -#=============== HANDLE SERVICES ================# -#================================================# - -function do_action_service() { - local services action=${1} service=${2} - services=$(find "${SYSTEMD}" -maxdepth 1 -regextype posix-extended -regex "${SYSTEMD}/${service}(-[0-9a-zA-Z]+)?.service" | sort) - - if [[ -n ${services} ]]; then - for service in ${services}; do - service=$(echo "${service}" | rev | cut -d"/" -f1 | rev) - status_msg "${action^} ${service} ..." - - if sudo systemctl "${action}" "${service}"; then - log_info "${service}: ${action} > success" - ok_msg "${action^} ${service} successfull!" - else - log_warning "${service}: ${action} > failed" - warn_msg "${action^} ${service} failed!" - fi - done - fi -} - -#================================================# -#================ DEPENDENCIES ==================# -#================================================# - -### returns 'true' if python version >= 3.7 -function python3_check() { - local major minor passed - - major=$(python3 --version | cut -d" " -f2 | cut -d"." -f1) - minor=$(python3 --version | cut -d"." -f2) - - if (( major >= 3 && minor >= 7 )); then - passed="true" - else - passed="false" - fi - - echo "${passed}" -} - -function dependency_check() { - local dep=( "${@}" ) - local packages log_name="dependencies" - status_msg "Checking for the following dependencies:" - - #check if package is installed, if not write its name into array - for pkg in "${dep[@]}"; do - echo -e "${cyan}● ${pkg} ${white}" - [[ ! $(dpkg-query -f'${Status}' --show "${pkg}" 2>/dev/null) = *\ installed ]] && \ - packages+=("${pkg}") - done - - #if array is not empty, install packages from array - if (( ${#packages[@]} > 0 )); then - status_msg "Installing the following dependencies:" - for package in "${packages[@]}"; do - echo -e "${cyan}● ${package} ${white}" - done - echo - - # update system package lists if stale - update_system_package_lists - - # install required packages - install_system_packages "${log_name}" "packages[@]" - - else - ok_msg "Dependencies already met!" - return - fi -} - -function fetch_webui_ports() { - local port interfaces=("mainsail" "fluidd" "octoprint") - - ### read ports from possible installed interfaces and write them to ~/.kiauh.ini - for interface in "${interfaces[@]}"; do - if [[ -f "/etc/nginx/sites-available/${interface}" ]]; then - port=$(grep -E "listen" "/etc/nginx/sites-available/${interface}" | head -1 | sed 's/^\s*//' | sed 's/;$//' | cut -d" " -f2) - if ! grep -Eq "${interface}_port" "${INI_FILE}"; then - sed -i '$a'"${interface}_port=${port}" "${INI_FILE}" - else - sed -i "/^${interface}_port/d" "${INI_FILE}" - sed -i '$a'"${interface}_port=${port}" "${INI_FILE}" - fi - else - sed -i "/^${interface}_port/d" "${INI_FILE}" - fi - done -} - -#================================================# -#=================== SYSTEM =====================# -#================================================# - -function create_required_folders() { - local printer_data=${1} folders - folders=("backup" "certs" "config" "database" "gcodes" "comms" "logs" "systemd") - - for folder in "${folders[@]}"; do - local dir="${printer_data}/${folder}" - - ### remove possible symlink created by moonraker - if [[ -L "${dir}" && -d "${dir}" ]]; then - rm "${dir}" - fi - - if [[ ! -d "${dir}" ]]; then - status_msg "Creating folder '${dir}' ..." - mkdir -p "${dir}" - ok_msg "Folder '${dir}' created!" - fi - done -} - -function update_system_package_lists() { - local cache_mtime update_age update_interval silent - - if [[ $1 == '--silent' ]]; then silent="true"; fi - - if [[ -e /var/lib/apt/periodic/update-success-stamp ]]; then - cache_mtime="$(stat -c %Y /var/lib/apt/periodic/update-success-stamp)" - elif [[ -e /var/lib/apt/lists ]]; then - cache_mtime="$(stat -c %Y /var/lib/apt/lists)" - else - log_warning "Failure determining package cache age, forcing update" - cache_mtime=0 - fi - - update_age="$(($(date +'%s') - cache_mtime))" - update_interval=$((48*60*60)) # 48hrs - - # update if cache is greater than update_interval - if (( update_age > update_interval )); then - if [[ ! ${silent} == "true" ]]; then status_msg "Updating package lists..."; fi - if ! sudo apt-get update --allow-releaseinfo-change &>/dev/null; then - log_error "Failure while updating package lists!" - if [[ ! ${silent} == "true" ]]; then error_msg "Updating package lists failed!"; fi - return 1 - else - log_info "Package lists updated successfully" - if [[ ! ${silent} == "true" ]]; then status_msg "Updated package lists."; fi - fi - else - log_info "Package lists updated recently, skipping update..." - fi -} - -function check_system_updates() { - local updates_avail status - if ! update_system_package_lists --silent; then - status="${red}Update check failed! ${white}" - else - updates_avail="$(apt list --upgradeable 2>/dev/null | sed "1d")" - - if [[ -n ${updates_avail} ]]; then - status="${yellow}System upgrade available!${white}" - # add system to application_updates_available in kiauh.ini - add_to_application_updates "system" - else - status="${green}System up to date! ${white}" - fi - fi - - echo "${status}" -} - -function upgrade_system_packages() { - status_msg "Upgrading System ..." - update_system_package_lists - if sudo apt-get upgrade -y; then - print_confirm "Upgrade complete! Check the log above!\n ${yellow}KIAUH will not install any dist-upgrades or\n any packages which have been held back!${green}" - else - print_error "System upgrade failed! Please look for any errors printed above!" - fi -} - -function install_system_packages() { - local log_name="$1" - local packages=("${!2}") - status_msg "Installing packages..." - if sudo apt-get install -y "${packages[@]}"; then - ok_msg "${log_name^} packages installed!" - else - log_error "Failure while installing ${log_name,,} packages" - error_msg "Installing ${log_name} packages failed!" - exit 1 # exit kiauh - fi -} - -function check_usergroups() { - local group_dialout group_tty - - if grep -q "dialout" .local' in the browser. |" - echo -e "| |" - echo -e "| E.g.: If you set the hostname to 'my-printer' you |" - echo -e "| can open Mainsail / Fluidd / Octoprint by |" - echo -e "| browsing to: http://my-printer.local |" - bottom_border - - local yn - while true; do - read -p "${cyan}###### Do you want to change the hostname? (y/N):${white} " yn - case "${yn}" in - Y|y|Yes|yes) - select_msg "Yes" - change_hostname - break;; - N|n|No|no|"") - select_msg "No" - break;; - *) - error_msg "Invalid command!";; - esac - done -} - -function change_hostname() { - local new_hostname regex="^[^\-\_]+([0-9a-z]\-{0,1})+[^\-\_]+$" - echo - top_border - echo -e "| ${green}Allowed characters: a-z, 0-9 and single '-'${white} |" - echo -e "| ${red}No special characters allowed!${white} |" - echo -e "| ${red}No leading or trailing '-' allowed!${white} |" - bottom_border - - while true; do - read -p "${cyan}###### Please set the new hostname:${white} " new_hostname - - if [[ ${new_hostname} =~ ${regex} ]]; then - local yn - while true; do - echo - read -p "${cyan}###### Do you want '${new_hostname}' to be the new hostname? (Y/n):${white} " yn - case "${yn}" in - Y|y|Yes|yes|"") - select_msg "Yes" - set_hostname "${new_hostname}" - break;; - N|n|No|no) - select_msg "No" - abort_msg "Skip hostname change ..." - break;; - *) - print_error "Invalid command!";; - esac - done - else - warn_msg "'${new_hostname}' is not a valid hostname!" - fi - break - done -} - -function set_hostname() { - local new_hostname=${1} current_date - #check for dependencies - local dep=(avahi-daemon) - dependency_check "${dep[@]}" - - #create host file if missing or create backup of existing one with current date&time - if [[ -f /etc/hosts ]]; then - current_date=$(get_date) - status_msg "Creating backup of hosts file ..." - sudo cp "/etc/hosts" "/etc/hosts.${current_date}.bak" - ok_msg "Backup done!" - ok_msg "File:'/etc/hosts.${current_date}.bak'" - else - sudo touch /etc/hosts - fi - - #set new hostname in /etc/hostname - status_msg "Setting hostname to '${new_hostname}' ..." - status_msg "Please wait ..." - sudo hostnamectl set-hostname "${new_hostname}" - - #write new hostname to /etc/hosts - status_msg "Writing new hostname to /etc/hosts ..." - echo "127.0.0.1 ${new_hostname}" | sudo tee -a /etc/hosts &>/dev/null - ok_msg "New hostname successfully configured!" - ok_msg "Remember to reboot for the changes to take effect!" -} - -#================================================# -#============ INSTANCE MANAGEMENT ===============# -#================================================# - -### -# takes in a systemd service files full path and -# returns the sub-string with the instance name -# -# @param {string}: service file absolute path -# (e.g. '/etc/systemd/system/klipper-.service') -# -# => return sub-string containing only the part of the full string -# -function get_instance_name() { - local instance=${1} - local name - - name=$(echo "${instance}" | rev | cut -d"/" -f1 | cut -d"." -f2 | cut -d"-" -f1 | rev) - - echo "${name}" -} - -### -# returns the instance name/identifier of the klipper service -# if the klipper service is part of a multi instance setup -# otherwise returns an emtpy string -# -# @param {string}: name - klipper service name (e.g. klipper-name.service) -# -function get_klipper_instance_name() { - local instance=${1} - local name - - name=$(echo "${instance}" | rev | cut -d"/" -f1 | cut -d"." -f2 | rev) - - local regex="^klipper-[0-9a-zA-Z]+$" - if [[ ${name} =~ ${regex} ]]; then - name=$(echo "${name}" | cut -d"-" -f2) - else - name="" - fi - - echo "${name}" -} - -### -# loops through all installed klipper services and saves -# each instances name in a comma separated format to the kiauh.ini -# -function set_multi_instance_names() { - read_kiauh_ini "${FUNCNAME[0]}" - - local name - local names="" - local services - - services=$(klipper_systemd) - - ### - # if value of 'multi_instance_names' is not an empty - # string, delete its value, so it can be re-written - if [[ -n ${multi_instance_names} ]]; then - sed -i "/multi_instance_names=/s/=.*/=/" "${INI_FILE}" - fi - - for svc in ${services}; do - name=$(get_klipper_instance_name "${svc}") - - if ! grep -Eq "${name}" <<<"${names}"; then - names="${names}${name}," - fi - - done - - # write up-to-date instance name string to kiauh.ini - sed -i "/multi_instance_names=/s/=.*/=${names}/" "${INI_FILE}" -} - -### -# Helper function that returns all configured instance names -# -# => return an empty string if 0 or 1 klipper instance is installed -# => return space-separated string for names of the configured instances -# if 2 or more klipper instances are installed -# -function get_multi_instance_names() { - read_kiauh_ini "${FUNCNAME[0]}" - local instance_names=() - - ### - # convert the comma separates string from the .kiauh.ini into - # an array of instance names. a single instance installation - # results in an empty instance_names array - IFS=',' read -r -a instance_names <<< "${multi_instance_names}" - - echo "${instance_names[@]}" -} - -### -# helper function that returns all possibly available absolute -# klipper config directory paths based on their instance name. -# -# => return an empty string if klipper is not installed -# => return space-separated string of absolute config directory paths -# -function get_config_folders() { - local cfg_dirs=() - local instance_names - instance_names=$(get_multi_instance_names) - - if [[ -n ${instance_names} ]]; then - for name in ${instance_names}; do - ### - # by KIAUH convention, all instance names of only numbers - # need to be prefixed with 'printer_' - if [[ ${name} =~ ^[0-9]+$ ]]; then - cfg_dirs+=("${HOME}/printer_${name}_data/config") - else - cfg_dirs+=("${HOME}/${name}_data/config") - fi - done - elif [[ -z ${instance_names} && $(klipper_systemd | wc -w) -gt 0 ]]; then - cfg_dirs+=("${HOME}/printer_data/config") - else - cfg_dirs=() - fi - - echo "${cfg_dirs[@]}" -} - -### -# helper function that returns all available absolute directory paths -# based on their instance name and specified target folder -# -# @param {string}: folder name - target instance folder name (e.g. config) -# -# => return an empty string if klipper is not installed -# => return space-separated string of absolute directory paths -# -function get_instance_folder_path() { - local folder_name=${1} - local folder_paths=() - local instance_names - local path - - instance_names=$(get_multi_instance_names) - - if [[ -n ${instance_names} ]]; then - for name in ${instance_names}; do - ### - # by KIAUH convention, all instance names of only numbers - # need to be prefixed with 'printer_' - if [[ ${name} =~ ^[0-9]+$ ]]; then - path="${HOME}/printer_${name}_data/${folder_name}" - if [[ -d ${path} ]]; then - folder_paths+=("${path}") - fi - else - path="${HOME}/${name}_data/${folder_name}" - if [[ -d ${path} ]]; then - folder_paths+=("${path}") - fi - fi - done - elif [[ -z ${instance_names} && $(klipper_systemd | wc -w) -gt 0 ]]; then - path="${HOME}/printer_data/${folder_name}" - if [[ -d ${path} ]]; then - folder_paths+=("${path}") - fi - fi - - echo "${folder_paths[@]}" -} From 31150c98e22c7a1bd254b544205e88e40d2f1807 Mon Sep 17 00:00:00 2001 From: dw-0 Date: Sat, 11 Oct 2025 16:56:02 +0200 Subject: [PATCH 14/14] fix: implement custom version parsing for tag sorting --- kiauh/utils/git_utils.py | 60 ++++++++++++++++++++++++++++++++++++---- 1 file changed, 55 insertions(+), 5 deletions(-) diff --git a/kiauh/utils/git_utils.py b/kiauh/utils/git_utils.py index 857c0ad..ffd178c 100644 --- a/kiauh/utils/git_utils.py +++ b/kiauh/utils/git_utils.py @@ -1,7 +1,6 @@ from __future__ import annotations import json -import re import shutil import urllib.request from http.client import HTTPResponse @@ -121,6 +120,59 @@ def get_local_tags(repo_path: Path, _filter: str | None = None) -> List[str]: :param _filter: Optional filter to filter the tags by :return: List of tags """ + + def parse_version(version: str) -> tuple: + # Remove 'v' prefix if present + if version.startswith("v") and version[1:][0].isdigit(): + version = version[1:] + + # Split into version parts and pre-release parts + if "-" in version: + version_part, pre_part = version.split("-", 1) + pre_parts = pre_part.replace("-", ".").split(".") + else: + version_part = version + pre_parts = [] + + # Split version into components + version_parts = version_part.split(".") + + # Convert to integers where possible + def try_int(x): + try: + return int(x) + except ValueError: + return ( + x.lower() + ) # Convert strings to lowercase for case-insensitive comparison + + version_ints = [try_int(part) for part in version_parts] + + # Pad version parts to at least 3 components + while len(version_ints) < 3: + version_ints.append(0) + + # Handle pre-release versions + pre_type = 999 # High number for stable releases + pre_num = 0 + + if pre_parts: + pre_type_map = {"alpha": 0, "beta": 1, "rc": 2} + pre_type = pre_type_map.get( + pre_parts[0].lower(), 3 + ) # Default to 3 for unknown pre-release types + + if len(pre_parts) > 1 and str(pre_parts[1]).isdigit(): + pre_num = int(pre_parts[1]) + + return ( + version_ints[0], # major + version_ints[1], # minor + version_ints[2], # patch + pre_type, # pre-release type (higher number = more stable) + pre_num, # pre-release number + ) + try: cmd: List[str] = ["git", "tag", "-l"] @@ -135,10 +187,8 @@ def get_local_tags(repo_path: Path, _filter: str | None = None) -> List[str]: tags: List[str] = result.split("\n")[:-1] - return sorted( - tags, - key=lambda x: [int(i) if i.isdigit() else i for i in re.split(r"(\d+)", x)], - ) + # Sort using our custom version parser + return sorted(tags, key=parse_version) except CalledProcessError: return []