From d9d3006be44c59217c77a4a838710f8b1ea1fd84 Mon Sep 17 00:00:00 2001 From: th33xitus <> Date: Sun, 13 Sep 2020 11:25:13 +0200 Subject: [PATCH 1/9] fix: correct ExecStart parameter --- scripts/dwc2-for-klipper-socket-installer/install-debian.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/dwc2-for-klipper-socket-installer/install-debian.sh b/scripts/dwc2-for-klipper-socket-installer/install-debian.sh index cc88e4a..86fd8f3 100755 --- a/scripts/dwc2-for-klipper-socket-installer/install-debian.sh +++ b/scripts/dwc2-for-klipper-socket-installer/install-debian.sh @@ -62,7 +62,7 @@ WantedBy=multi-user.target Type=simple User=$DWC_USER RemainAfterExit=yes -ExecStart=${PYTHONDIR}/bin/python3 ${SRCDIR}/dwc2-for-klipper-socket/web_dwc2.py +ExecStart=${PYTHONDIR}/bin/python3 ${SRCDIR}/web_dwc2.py Restart=always RestartSec=10 EOF From 3e35be5681e1b0161b0ea7a612d8412c8a2a56c4 Mon Sep 17 00:00:00 2001 From: th33xitus <> Date: Sun, 13 Sep 2020 11:25:46 +0200 Subject: [PATCH 2/9] add: user choice for dwc service (init.d or systemd) --- scripts/install_dwc2.sh | 38 +++++++++++++++++++++++++++++++++++++- scripts/remove.sh | 12 +++++++++++- 2 files changed, 48 insertions(+), 2 deletions(-) diff --git a/scripts/install_dwc2.sh b/scripts/install_dwc2.sh index 6aedec5..6e89936 100755 --- a/scripts/install_dwc2.sh +++ b/scripts/install_dwc2.sh @@ -37,6 +37,38 @@ system_check_dwc2(){ } get_user_selections_dwc2(){ + #let user choose to install systemd or init.d service + unset INST_SYSTEMD + unset INST_INITD + while true; do + echo + top_border + echo -e "| Do you wan't to install dwc2-for-klipper-socket as |" + echo -e "| 1) Init.d Service |" + echo -e "| 2) Systemd Service |" + hr + echo -e "| Please use the appropriate option for your chosen |" + echo -e "| Linux distribution. If you are unsure what to pick, |" + echo -e "| please do a research before. |" + hr + echo -e "| In case you are using Raspberry Pi OS, either option |" + echo -e "| 1 or 2 will work. |" + bottom_border + read -p "${cyan}###### Please choose:${default} " action + case "$action" in + 1) + INST_INITD="true" + INST_SYSTEMD="false" + break;; + 2) + INST_INITD="false" + INST_SYSTEMD="true" + break;; + *) + print_unkown_cmd + print_msg && clear_msg;; + esac + done #user selection for printer.cfg if [ "$PRINTER_CFG_FOUND" = "false" ]; then unset SEL_DEF_CFG @@ -127,7 +159,11 @@ dwc2_setup(){ cp -r ${SRCDIR}/kiauh/scripts/dwc2-for-klipper-socket-installer $DWC2FK_DIR/scripts ok_msg "Done!" status_msg "Starting service-installer ..." - $DWC2FK_DIR/scripts/install-octopi.sh + if [ "$INST_INITD" = "true" ] && [ "$INST_SYSTEMD" = "false" ]; then + $DWC2FK_DIR/scripts/install-octopi.sh + elif [ "$INST_INITD" = "false" ] && [ "$INST_SYSTEMD" = "true" ]; then + $DWC2FK_DIR/scripts/install-debian.sh + fi ok_msg "Service installed!" #patch /etc/default/klipper to append the uds argument patch_klipper_sysfile_dwc2 diff --git a/scripts/remove.sh b/scripts/remove.sh index 1f58320..489be4f 100755 --- a/scripts/remove.sh +++ b/scripts/remove.sh @@ -34,6 +34,7 @@ remove_dwc2(){ data_arr=( /etc/init.d/dwc /etc/default/dwc + /etc/systemd/system/dwc.service $DWC2FK_DIR $DWC_ENV_DIR $DWC2_DIR @@ -42,15 +43,24 @@ remove_dwc2(){ if [ "$ERROR_MSG" = "" ]; then if systemctl is-active dwc -q; then status_msg "Stopping DWC2-for-Klipper-Socket Service ..." - sudo /etc/init.d/dwc stop && sudo systemctl disable dwc + sudo systemctl stop dwc && sudo systemctl disable dwc ok_msg "Service stopped!" fi + #remove if init.d service if [[ -e /etc/init.d/dwc || -e /etc/default/dwc ]]; then + status_msg "Init.d Service found ..." status_msg "Removing DWC2-for-Klipper-Socket Service ..." sudo rm -rf /etc/init.d/dwc /etc/default/dwc sudo update-rc.d -f dwc remove ok_msg "DWC2-for-Klipper-Socket Service removed!" fi + #remove if systemd service + if [ -e /etc/systemd/system/dwc.service ]; then + status_msg "Systemd Service found ..." + status_msg "Removing DWC2-for-Klipper-Socket Service ..." + sudo rm -rf /etc/systemd/system/dwc.service + ok_msg "DWC2-for-Klipper-Socket Service removed!" + fi if [ -d $DWC2FK_DIR ]; then status_msg "Removing DWC2-for-Klipper-Socket directory ..." rm -rf $DWC2FK_DIR && ok_msg "Directory removed!" From 2e9be1adc5d6894791efa1824c0216e1e301a0b8 Mon Sep 17 00:00:00 2001 From: th33xitus <> Date: Sun, 13 Sep 2020 11:47:01 +0200 Subject: [PATCH 3/9] fix: typos --- scripts/install_dwc2.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/install_dwc2.sh b/scripts/install_dwc2.sh index 6e89936..789a4d4 100755 --- a/scripts/install_dwc2.sh +++ b/scripts/install_dwc2.sh @@ -43,16 +43,16 @@ get_user_selections_dwc2(){ while true; do echo top_border - echo -e "| Do you wan't to install dwc2-for-klipper-socket as |" + echo -e "| Do you want to install dwc2-for-klipper-socket as |" echo -e "| 1) Init.d Service |" echo -e "| 2) Systemd Service |" hr echo -e "| Please use the appropriate option for your chosen |" - echo -e "| Linux distribution. If you are unsure what to pick, |" + echo -e "| Linux distribution. If you are unsure what to select, |" echo -e "| please do a research before. |" hr - echo -e "| In case you are using Raspberry Pi OS, either option |" - echo -e "| 1 or 2 will work. |" + echo -e "| If you are using Raspberry Pi OS, either option 1 or |" + echo -e "| 2 will work. |" bottom_border read -p "${cyan}###### Please choose:${default} " action case "$action" in From 125eea921f4157da8784a84b789577141c9ae815 Mon Sep 17 00:00:00 2001 From: th33xitus <> Date: Sun, 13 Sep 2020 11:57:03 +0200 Subject: [PATCH 4/9] add: some docs --- README.md | 7 +++---- docs/changelog.md | 0 docs/core_functions.md | 0 docs/features.md | 0 docs/{Shell Command Extension.md => shell_command.md} | 0 5 files changed, 3 insertions(+), 4 deletions(-) create mode 100644 docs/changelog.md create mode 100644 docs/core_functions.md create mode 100644 docs/features.md rename docs/{Shell Command Extension.md => shell_command.md} (100%) diff --git a/README.md b/README.md index 55e104f..3ea7546 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,7 @@ Feel free to give it a try if you want. If you have suggestions or encounter any ## Instructions: -For downloading this script it is best to have git installed on your machine or Raspberry Pi. +For downloading this script it is best to have git already installed. If you haven't, please run `sudo apt-get install git -y` to install git first. You will need it anyways! After git is installed, use the following commands in the given order to download and execute the script. @@ -42,7 +42,7 @@ chmod +x kiauh.sh scripts/* ### For more information or instructions, please check out the appropriate repositories listed below: -Klipper mainline by [KevinOConnor](https://github.com/KevinOConnor) : +Klipper by [KevinOConnor](https://github.com/KevinOConnor) : - https://github.com/KevinOConnor/klipper @@ -51,9 +51,8 @@ Klipper S-Curve fork by [dmbutyugin](https://github.com/dmbutyugin) : - https://github.com/dmbutyugin/klipper/tree/scurve-smoothing - https://github.com/dmbutyugin/klipper/tree/scurve-shaping -Moonraker and Klipper fork by [Arksine](https://github.com/Arksine) : +Moonraker by [Arksine](https://github.com/Arksine) : -- https://github.com/Arksine/klipper/tree/dev-moonraker-testing - https://github.com/Arksine/moonraker Mainsail Webinterface by [meteyou](https://github.com/meteyou) : diff --git a/docs/changelog.md b/docs/changelog.md new file mode 100644 index 0000000..e69de29 diff --git a/docs/core_functions.md b/docs/core_functions.md new file mode 100644 index 0000000..e69de29 diff --git a/docs/features.md b/docs/features.md new file mode 100644 index 0000000..e69de29 diff --git a/docs/Shell Command Extension.md b/docs/shell_command.md similarity index 100% rename from docs/Shell Command Extension.md rename to docs/shell_command.md From ecd9e7f489497973e00dca4945fd56f672e79234 Mon Sep 17 00:00:00 2001 From: th33xitus <31533186+th33xitus@users.noreply.github.com> Date: Sun, 13 Sep 2020 12:11:52 +0200 Subject: [PATCH 5/9] Update README.md --- README.md | 76 ++++++++++++++++++------------------------------------- 1 file changed, 24 insertions(+), 52 deletions(-) diff --git a/README.md b/README.md index 3ea7546..2373597 100644 --- a/README.md +++ b/README.md @@ -31,6 +31,30 @@ chmod +x kiauh.sh scripts/* ./kiauh.sh ``` +--- + +## Functions and Features: + +### Core Functions: + +- **Installing** of the Klipper Firmware to your Raspberry Pi or other Linux Distribution which makes use of init.d. +- **Installing** of several different web interfaces such as Duet Web Control, Mainsail or OctoPrint including their dependencies. +- **Installing** of the Moonraker API +- **Updating** of all the listed installations above excluding OctoPrint. For updating OctoPrint, please use the OctoPrint interface! +- **Removing** of all the listed installations above. +- **Backup** of all the listed installationes above. + +What also is possible: +- Build the Klipper Firmware +- Flash the MCU +- Read ID of the currently connected printer (only one at the time) +- Write necessary entries to your printer.cfg, some of them customizable right in the CLI. + +For a list of additional features and their descriptions please see: +[Feature List](https://github.com/th33xitus/kiauh/edit/work-13092020/docs/features.md) + +--- + ## Notes: - Tested only on Raspbian Buster Lite @@ -74,60 +98,8 @@ OctoPrint Webinterface by [OctoPrint](https://github.com/OctoPrint) : --- -## Functions and Features: - -### Core Functions: - -- **Install:** Klipper Firmware, dwc2-for-klipper-socket + Duet Web Control, Moonraker + Mainsail, OctoPrint -- **Update:** Klipper Firmware, dwc2-for-klipper-socket + Duet Web Control, Moonraker + Mainsail -- **Backup:** Klipper Firmware, dwc2-for-klipper-socket + Duet Web Control, Moonraker + Mainsail, OctoPrint -- **Remove:** Klipper Firmware, dwc2-for-klipper-socket + Duet Web Control, Moonraker + Mainsail, OctoPrint -- Build Klipper Firmware -- Flash MCU -- Read ID of the currently connected printer (only one at the time) -- Write several entries to your printer.cfg, some of them customizable right in the console - - Before writing to an existing printer.cfg the script will create a backup! (better safe than sorry!) - -### Features: - -- Automatic dependency check: - - If packages are missing on your machine but needed for the asked task, the script will automatically install them -- Switch between Klipper Forks: - - [origin/master](https://github.com/KevinOConnor/klipper/tree/master), [scurve-shaping](https://github.com/dmbutyugin/klipper/tree/scurve-shaping), [scurve-smoothing](https://github.com/dmbutyugin/klipper/tree/scurve-smoothing), [moonraker](https://github.com/Arksine/klipper/tree/dev-moonraker-testing) - - The update function of the script will always update the currently selected/active fork! -- Toggle auto-create backups before updating: - - When enabled, a backup of the installation you want to update is made prior updating -- Preconfigure OctoPrint: - - When installing OctoPrint, a config is created which preconfigures your installation to be used with Klipper - - adding the restart/shutdown commands for OctoPrint - - adding the serial port `/tmp/printer` - - set the behavior to "Cancel any ongoing prints but stay connected to the printer" -- Enable/Disable OctoPrint Service: - - Usefull when using DWC2/Mainsail and OctoPrint at the same time to prevent them interfering with each other -- Set up reverse proxy for DWC2, Mainsail and OctoPrint and changing the hostname: - - - The script can install and configure Nginx for the selected webinterface. This will allow you to make your webinterface reachable over an URL like `.local` - - Example: If you name the host "mainsail" and set up a reverse proxy, type `mainsail.local` in your webbrowser to open the Mainsail webinterface - - to be continued... - -## What this script can't do: - -- Updating OctoPrint -> Use OctoPrint for updating! -- Setting up webcam related stuff: - - - If you want to use a webcam you have to install the dependencies and configurations yourself. I can't test this stuff sufficient enough due to me not having/using a webcam and therefore it's just too much work for me to set up an installation script which works, at best, with the first try. - - There are install instructions (at least in case of OctoPrint) available: - [Setting up OctoPrint on a Raspberry Pi running Raspbian](https://community.octoprint.org/t/setting-up-octoprint-on-a-raspberry-pi-running-raspbian/2337) - (look for "Optional: Webcam") - ## Q&A -**_Q: Can i install octoprint with this script?_** - -**A:** ~~Soon™~~ Yes :) - **_Q: Can i use this script to install multiple instancec of Klipper on the same Pi? (Multisession?)_** **A:** No, and at the moment i don't plan to implement this function. For multisession installations take a look at this script manu7irl created: https://github.com/manu7irl/klipper-DWC2-installer . Keep in mind that klipper-DWC2-installer and KIAUH are **NOT** compatible with each other. From 3770f0fd7a7f8920d526d96ed2c0dc4dfc365955 Mon Sep 17 00:00:00 2001 From: th33xitus <31533186+th33xitus@users.noreply.github.com> Date: Sun, 13 Sep 2020 12:12:33 +0200 Subject: [PATCH 6/9] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 2373597..3e0f37d 100644 --- a/README.md +++ b/README.md @@ -42,7 +42,7 @@ chmod +x kiauh.sh scripts/* - **Installing** of the Moonraker API - **Updating** of all the listed installations above excluding OctoPrint. For updating OctoPrint, please use the OctoPrint interface! - **Removing** of all the listed installations above. -- **Backup** of all the listed installationes above. +- **Backup** of all the listed installations above. What also is possible: - Build the Klipper Firmware From 1fa1636f75ad1c5bc6446dc47cc3bf6bc04d4872 Mon Sep 17 00:00:00 2001 From: th33xitus <31533186+th33xitus@users.noreply.github.com> Date: Sun, 13 Sep 2020 12:21:54 +0200 Subject: [PATCH 7/9] Update features.md --- docs/features.md | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/docs/features.md b/docs/features.md index e69de29..3ba46c1 100644 --- a/docs/features.md +++ b/docs/features.md @@ -0,0 +1,25 @@ +# Feature List: + +- Automatic dependency check: + - If packages are missing but needed for the asked task, the script will automatically install them +- Switch between Klipper Forks: + - [origin/master](https://github.com/KevinOConnor/klipper/tree/master) or [scurve-shaping](https://github.com/dmbutyugin/klipper/tree/scurve-shaping) or [scurve-smoothing](https://github.com/dmbutyugin/klipper/tree/scurve-smoothing) or [moonraker](https://github.com/Arksine/klipper/tree/dev-moonraker-testing) + - The update function of the script will always update the currently selected/active fork! +- Toggle auto-create backups before updating: + - When enabled, a backup of the installation you want to update is made prior updating +- Preconfigure OctoPrint: + - When installing OctoPrint, a config is created which preconfigures your installation to be used with Klipper + - adding the restart/shutdown commands for OctoPrint + - adding the serial port `/tmp/printer` + - set the behavior to "Cancel any ongoing prints but stay connected to the printer" +- Enable/Disable OctoPrint Service: + - Usefull when using DWC2/Mainsail and OctoPrint at the same time to prevent them interfering with each other +- Set up reverse proxy for DWC2, Mainsail and OctoPrint and changing the hostname: + + - The script can install and configure Nginx for the selected webinterface. This will allow you to make your webinterface reachable over an URL like `.local` + - Example: If you name the host "mainsail" and set up a reverse proxy, type `mainsail.local` in your webbrowser to open the Mainsail webinterface + +- Installing the Shell Command extension. Please see: [Shell Command Extension](https://github.com/th33xitus/kiauh/blob/work-13092020/docs/shell_command.md) + + + to be continued... From 043f09aeeb21b090a975d27f36394b523e21462c Mon Sep 17 00:00:00 2001 From: th33xitus <31533186+th33xitus@users.noreply.github.com> Date: Sun, 13 Sep 2020 12:23:04 +0200 Subject: [PATCH 8/9] Delete core_functions.md --- docs/core_functions.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 docs/core_functions.md diff --git a/docs/core_functions.md b/docs/core_functions.md deleted file mode 100644 index e69de29..0000000 From 63a2f95cc05b16b03ffc2533035f2c18579d7fa2 Mon Sep 17 00:00:00 2001 From: th33xitus <31533186+th33xitus@users.noreply.github.com> Date: Sun, 13 Sep 2020 12:24:02 +0200 Subject: [PATCH 9/9] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 3e0f37d..46796e0 100644 --- a/README.md +++ b/README.md @@ -51,7 +51,7 @@ What also is possible: - Write necessary entries to your printer.cfg, some of them customizable right in the CLI. For a list of additional features and their descriptions please see: -[Feature List](https://github.com/th33xitus/kiauh/edit/work-13092020/docs/features.md) +[Feature List](https://github.com/th33xitus/kiauh/blob/work-13092020/docs/features.md) ---