From ac96cb2eb7ead7071ae3d2837d7b0b589333ede2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Boisselier?= Date: Tue, 9 Jan 2024 16:14:37 +0000 Subject: [PATCH] modified moonraker update management section and install --- README.md | 12 ------------ install.sh | 16 ++++++++++++++++ moonraker.conf | 11 +++++++++++ system-dependencies.json | 9 +++++++++ 4 files changed, 36 insertions(+), 12 deletions(-) create mode 100644 moonraker.conf create mode 100644 system-dependencies.json diff --git a/README.md b/README.md index 429da33..8bc648d 100644 --- a/README.md +++ b/README.md @@ -29,18 +29,6 @@ Follow these steps to install the Shake&Tune module in your printer: ``` [include K-ShakeTune/*.cfg] ``` - 1. Finally, if you want to get automatic updates, add the following to your `moonraker.cfg` file: - ``` - [update_manager Klippain-ShakeTune] - type: git_repo - path: ~/klippain_shaketune - channel: beta - origin: https://github.com/Frix-x/klippain-shaketune.git - primary_branch: main - managed_services: klipper - install_script: install.sh - ``` - ## Usage diff --git a/install.sh b/install.sh index f2b99a2..7e57a13 100755 --- a/install.sh +++ b/install.sh @@ -1,6 +1,7 @@ #!/bin/bash USER_CONFIG_PATH="${HOME}/printer_data/config" +MOONRAKER_CONFIG="${HOME}/printer_data/config/moonraker.conf" KLIPPER_PATH="${HOME}/klipper" K_SHAKETUNE_PATH="${HOME}/klippain_shaketune" @@ -110,11 +111,24 @@ function link_gcodeshellcommandpy { fi } +function add_updater { + update_section=$(grep -c '\[update_manager[a-z ]* Klippain-ShakeTune\]' $MOONRAKER_CONFIG || true) + if [ "$update_section" -eq 0 ]; then + echo -n "[INSTALL] Adding update manager to moonraker.conf..." + cat ${K_SHAKETUNE_PATH}/moonraker.conf >> $MOONRAKER_CONFIG + fi +} + function restart_klipper { echo "[POST-INSTALL] Restarting Klipper..." sudo systemctl restart klipper } +function restart_moonraker { + echo "[POST-INSTALL] Restarting Moonraker..." + sudo systemctl restart moonraker +} + printf "\n=============================================\n" echo "- Klippain Shake&Tune module install script -" @@ -126,5 +140,7 @@ preflight_checks check_download setup_venv link_extension +add_updater link_gcodeshellcommandpy restart_klipper +restart_moonraker diff --git a/moonraker.conf b/moonraker.conf new file mode 100644 index 0000000..83c6acb --- /dev/null +++ b/moonraker.conf @@ -0,0 +1,11 @@ + +## Klippain Shake&Tune automatic update management +[update_manager Klippain-ShakeTune] +type: git_repo +origin: https://github.com/Frix-x/klippain-shaketune.git +path: ~/klippain_shaketune +virtualenv: ~/klippain_shaketune-env +requirements: requirements.txt +system_dependencies: system-dependencies.json +primary_branch: main +managed_services: klipper diff --git a/system-dependencies.json b/system-dependencies.json new file mode 100644 index 0000000..dd9f748 --- /dev/null +++ b/system-dependencies.json @@ -0,0 +1,9 @@ +{ + "debian": [ + "python3-venv", + "python3-numpy", + "python3-matplotlib", + "libopenblas-dev", + "libatlas-base-dev" + ] +}