diff --git a/README.md b/README.md index 55e104f..46796e0 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. @@ -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 installations 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/blob/work-13092020/docs/features.md) + +--- + ## Notes: - Tested only on Raspbian Buster Lite @@ -42,7 +66,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 +75,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) : @@ -75,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. diff --git a/docs/changelog.md b/docs/changelog.md new file mode 100644 index 0000000..e69de29 diff --git a/docs/features.md b/docs/features.md new file mode 100644 index 0000000..3ba46c1 --- /dev/null +++ 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... 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 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 diff --git a/scripts/install_dwc2.sh b/scripts/install_dwc2.sh index 6aedec5..789a4d4 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 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 select, |" + echo -e "| please do a research before. |" + hr + 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 + 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!"