mirror of
https://github.com/dw-0/kiauh.git
synced 2025-12-14 19:14:27 +05:00
50
README.md
50
README.md
@@ -1,10 +1,10 @@
|
||||
# KIAUH - Klipper Installation And Update Helper
|
||||
# **KIAUH - Klipper Installation And Update Helper**
|
||||
|
||||

|
||||

|
||||
|
||||
---
|
||||
|
||||
## 📢 Disclaimer: Usage of this script happens at your own risk!
|
||||
## **📢 Disclaimer: Usage of this script happens at your own risk!**
|
||||
|
||||
This script acts as a helping hand for you to get set up in a fast and comfortable way.\
|
||||
**This does not mean, it will relieve you of using your brain.exe! 🧠**\
|
||||
@@ -12,7 +12,7 @@ Feel free to give it a try. If you have suggestions or encounter any problems, p
|
||||
|
||||
---
|
||||
|
||||
## 🛠️ Instructions:
|
||||
## **🛠️ Instructions:**
|
||||
|
||||
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.\
|
||||
@@ -28,7 +28,7 @@ chmod +x kiauh.sh scripts/*
|
||||
./kiauh.sh
|
||||
```
|
||||
|
||||
### Additional Instructions:
|
||||
## Additional Instructions:
|
||||
|
||||
If you need some more detailed instructions on how to install Klipper and Mainsail with KIAUH, check out this website:\
|
||||
[Installing Klipper and Mainsail](https://3dp.tumbleweedlabs.com/firmware/klipper-firmware/installing-klipper-and-mainsail-on-your-raspberry-pi)\
|
||||
@@ -37,9 +37,9 @@ Feel free to check out his work.
|
||||
|
||||
---
|
||||
|
||||
## 🧰 Functions and Features:
|
||||
## **🧰 Functions and Features:**
|
||||
|
||||
### Core Functions:
|
||||
### **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, Fluidd or OctoPrint including their dependencies.
|
||||
@@ -48,85 +48,83 @@ Feel free to check out his work.
|
||||
- **Removing** of all the listed installations above.
|
||||
- **Backup** of all the listed installations above.
|
||||
|
||||
**What also is possible:**
|
||||
### **Also 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.
|
||||
- and more ...
|
||||
|
||||
For a list of additional features and their descriptions please see:
|
||||
[Feature List](https://github.com/th33xitus/kiauh/blob/master/docs/features.md)
|
||||
### **For a list of additional features please see: [Feature List](docs/features.md)**
|
||||
|
||||
---
|
||||
|
||||
## 📝 Notes:
|
||||
## **📝 Notes:**
|
||||
|
||||
- Important changes to the script will be listed in the [Changelog](https://github.com/th33xitus/kiauh/blob/master/docs/changelog.md)
|
||||
- Tested only on Raspbian Buster Lite
|
||||
- During the use of this script you will be asked for your sudo password. There are several functions involved which need sudo privileges.
|
||||
- Prevent simultaneous use of DWC2 and OctoPrint if possible. There have been reports that DWC2 does strange things while the OctoPrint service is running while using the DWC2 webinterface. The script disables an existing OctoPrint service when installing DWC2. However, the service can also be reactivated with the script!
|
||||
- If you used Mainsail v0.0.12 before and you want to upgrade to v0.1.0 or later, you have to reinstall Moonraker as well! Mainsail v0.1.0 will not work with the old Moonraker service. Don't worry, the script can handle the proper removal of the old version.
|
||||
- ### **Important changes to the script will be listed in the [Changelog](docs/changelog.md)**
|
||||
- Tested **only** on Raspberry Pi OS Lite (Debian Buster)
|
||||
- During the use of this script you might be asked for your sudo password. There are several functions involved which need sudo privileges.
|
||||
|
||||
---
|
||||
|
||||
## 🛈 Sources & Further Information
|
||||
## **🛈 Sources & Further Information**
|
||||
|
||||
For more information or instructions, please check out the appropriate repositories listed below:
|
||||
|
||||
---
|
||||
|
||||
**⛵Klipper** by [KevinOConnor](https://github.com/KevinOConnor) :
|
||||
### **⛵Klipper** by [KevinOConnor](https://github.com/KevinOConnor) :
|
||||
|
||||
https://github.com/KevinOConnor/klipper
|
||||
|
||||
---
|
||||
|
||||
**⛵Klipper S-Curve fork** by [dmbutyugin](https://github.com/dmbutyugin) :
|
||||
### **⛵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** by [Arksine](https://github.com/Arksine) :
|
||||
### **🌙Moonraker** by [Arksine](https://github.com/Arksine) :
|
||||
|
||||
https://github.com/Arksine/moonraker
|
||||
|
||||
---
|
||||
|
||||
**💨Mainsail Webinterface** by [meteyou](https://github.com/meteyou) :
|
||||
### **💨Mainsail Webinterface** by [meteyou](https://github.com/meteyou) :
|
||||
|
||||
https://github.com/meteyou/mainsail
|
||||
|
||||
---
|
||||
|
||||
**🌊Fluidd Webinterface** by [cadriel](https://github.com/cadriel) :
|
||||
### **🌊Fluidd Webinterface** by [cadriel](https://github.com/cadriel) :
|
||||
|
||||
https://github.com/cadriel/fluidd
|
||||
|
||||
---
|
||||
|
||||
**🕸️Duet Web Control** by [Duet3D](https://github.com/Duet3D) :
|
||||
### **🕸️Duet Web Control** by [Duet3D](https://github.com/Duet3D) :
|
||||
|
||||
https://github.com/Duet3D/DuetWebControl
|
||||
|
||||
---
|
||||
|
||||
**🕸️DWC2-for-Klipper-Socket** by [Stephan3](https://github.com/Stephan3) :
|
||||
### **🕸️DWC2-for-Klipper-Socket** by [Stephan3](https://github.com/Stephan3) :
|
||||
|
||||
https://github.com/Stephan3/dwc2-for-klipper-socket
|
||||
|
||||
---
|
||||
|
||||
**🐙OctoPrint Webinterface** by [OctoPrint](https://github.com/OctoPrint) :
|
||||
### **🐙OctoPrint Webinterface** by [OctoPrint](https://github.com/OctoPrint) :
|
||||
|
||||
https://octoprint.org \
|
||||
https://github.com/OctoPrint/OctoPrint
|
||||
|
||||
---
|
||||
|
||||
## ❓ FAQ
|
||||
## **❓ FAQ**
|
||||
|
||||
**_Q: Can i use this script to install multiple instancec of Klipper on the same Pi? (Multisession?)_**
|
||||
|
||||
|
||||
@@ -2,25 +2,34 @@
|
||||
|
||||
This document covers possible important changes to KIAUH.
|
||||
|
||||
### 2020-10-30:
|
||||
|
||||
* The user can now choose to install Klipper as a systemd service.
|
||||
|
||||
* The Shell Command extension and `shell_command.py` got renamed to G-Code Shell Command extension and `gcode_shell_command.py`. In case the [pending PR](https://github.com/KevinOConnor/klipper/pull/2173) will be merged in the future, this was an early attempt to dodge possible incompatibilities. The [G-Code Shell Command docs](gcode_shell_command.md) has been updated accordingly.
|
||||
|
||||
* The way how KIAUH interacts and writes to the users printer.cfg got changed. Usually KIAUH wrote everything directly into the printer.cfg. The way it will work from now on is, that a new file called `kiauh.cfg` will be created if there is something that needs to be written to the printer.cfg and everything gets written to `kiauh.cfg` instead. The only thing which then gets written to the users printer.cfg is `[include kiauh.cfg]`. This line will be located at the very top of the existing printer.cfg with a little comment as a note. The user can then decide to either keep the `kiauh.cfg` or take its content, places it into the printer.cfg directly and remove the `[include kiauh.cfg]`.
|
||||
|
||||
* The `mainsail_macros.cfg` got renamed to `webui_macros.cfg`. Since Mainsail and Fluidd both use the same kind of pause, cancel and resume macros, a more generic name was chosen for the file containing the example macros one can choose to install when installing those webinterfaces.
|
||||
|
||||
### 2020-10-10:
|
||||
|
||||
Support for changing the Klipper branch to the moonraker-dev branch from @Arksine has been dropped. Support for Moonraker has been merged into Klipper mainline a long time ago.
|
||||
* Support for changing the Klipper branch to the moonraker-dev branch from @Arksine has been dropped. Support for Moonraker has been merged into Klipper mainline a long time ago.
|
||||
|
||||
A new function is available from the main menu. You can now upload your log files to http://paste.c-net.org/ to share them for debugging purposes.
|
||||
* A new function is available from the main menu. You can now upload your log files to http://paste.c-net.org/ to share them for debugging purposes.
|
||||
|
||||
### 2020-10-06:
|
||||
|
||||
Fluidd, a new Klipper interface got added to the list of available installers. At the same time some installation routines have changed or have seen some rework. Changes were made to the installation of NGINX configurations. A method was introduced to change the listen port of a webinterface configuration if there is already another webinterface listening on the default port (80).\
|
||||
At the moment, the Moonraker installer no longer asks you whether you want to install a web interface too. For now you therefore have to install them with their respective installers. Please report any bugs or issues you encounter.
|
||||
* Fluidd, a new Klipper interface got added to the list of available installers. At the same time some installation routines have changed or have seen some rework. Changes were made to the installation of NGINX configurations. A method was introduced to change the listen port of a webinterface configuration if there is already another webinterface listening on the default port (80).
|
||||
|
||||
* At the moment, the Moonraker installer no longer asks you whether you want to install a web interface too. For now you therefore have to install them with their respective installers. Please report any bugs or issues you encounter.
|
||||
|
||||
### 2020-09-17:
|
||||
|
||||
The dev-2.0 branch will be abandoned as of today. If you did a checkout to that branch in the past, you have to checkout back to master to receive updates.
|
||||
* The dev-2.0 branch will be abandoned as of today. If you did a checkout to that branch in the past, you have to checkout back to master to receive updates.
|
||||
|
||||
### 2020-09-12:
|
||||
|
||||
The old [dwc2-for-klipper](https://github.com/Stephan3/dwc2-for-klipper) won't be supported anymore!
|
||||
|
||||
The is a new, fully rewritten project available: [dwc2-for-klipper-socket](https://github.com/Stephan3/dwc2-for-klipper-socket).
|
||||
|
||||
* The old [dwc2-for-klipper](https://github.com/Stephan3/dwc2-for-klipper) won't be supported anymore!\
|
||||
The is a new, fully rewritten project available: [dwc2-for-klipper-socket](https://github.com/Stephan3/dwc2-for-klipper-socket).\
|
||||
The installer of this script also got rewritten to make use of that new project. You will not be able to install or remove the old [dwc2-for-klipper](https://github.com/Stephan3/dwc2-for-klipper) with KIAUH anymore if you updated KIAUH to the newest version.
|
||||
|
||||
@@ -1,25 +1,33 @@
|
||||
# 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:
|
||||
- **Automatic dependency check:**\
|
||||
If packages are missing but needed for the asked task, the script will automatically install them
|
||||
- **Switch between different 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)\
|
||||
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
|
||||
- **Rollback:**\
|
||||
When updating Klipper, KIAUH saves the current commit hash to a local ini-file. In case of an unsuccesfull update you can use this function to quickly revert back to the commit with the hash you updated from.
|
||||
- **Preconfigure OctoPrint:**\
|
||||
When installing OctoPrint, a config is created which preconfigures your installation to be used with Klipper.\
|
||||
That means:
|
||||
- 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/Fluidd and OctoPrint at the same time to prevent them interfering with each other
|
||||
- **Set up reverse proxy for DWC2, Mainsail, Fluidd and OctoPrint and changing the hostname:**
|
||||
- The script can install and configure Nginx for the selected webinterface
|
||||
- It also allows you to make your webinterface reachable over an URL like `<hostname>.local` via avahi
|
||||
- Example: If you name the host "my-printer", type `my-printer.local` in your webbrowser to open the installed webinterface
|
||||
- If there is more than one webinterface installed, you have to append the port to that adress
|
||||
|
||||
- The script can install and configure Nginx for the selected webinterface. This will allow you to make your webinterface reachable over an URL like `<hostname>.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 a G-Code Shell Command extension:**\
|
||||
For further information about that extension please see the [G-Code Shell Command Extension Doc](gcode_shell_command.md)
|
||||
|
||||
- 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...
|
||||
- **Uploading logfiles:**\
|
||||
You can directly upload logfiles like klippy.log, moonraker.log and dwc2.log from the KIAUH main menu for providing them for troubleshooting purposes.
|
||||
|
||||
|
||||
to be continued...
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 26 KiB After Width: | Height: | Size: 26 KiB |
@@ -1,6 +1,4 @@
|
||||
##########################
|
||||
### CREATED WITH KIAUH ###
|
||||
##########################
|
||||
### AUTOCREATED WITH KIAUH ###
|
||||
#is required to load the pause_resume module in klipper
|
||||
[pause_resume]
|
||||
|
||||
@@ -31,14 +29,8 @@ gcode:
|
||||
|
||||
[gcode_macro CANCEL_PRINT]
|
||||
rename_existing: BASE_CANCEL_PRINT
|
||||
default_parameter_X: 230 #edit to your park position
|
||||
default_parameter_Y: 230 #edit to your park position
|
||||
default_parameter_Z: 10 #edit to your park position
|
||||
gcode:
|
||||
M104 S0
|
||||
M140 S0
|
||||
M141 S0
|
||||
M106 S0
|
||||
TURN_OFF_HEATERS
|
||||
CLEAR_PAUSE
|
||||
SDCARD_RESET_FILE
|
||||
BASE_CANCEL_PRINT
|
||||
@@ -238,47 +238,82 @@ setup_gcode_shell_command(){
|
||||
|
||||
install_gcode_shell_command(){
|
||||
stop_klipper
|
||||
status_msg "Copy 'gcode_shell_command.py' to $KLIPPER_DIR/klippy/extras"
|
||||
cp ${HOME}/kiauh/resources/gcode_shell_command.py $KLIPPER_DIR/klippy/extras
|
||||
status_msg "Creating example macro ..."
|
||||
locate_printer_cfg
|
||||
create_shell_command_example
|
||||
ok_msg "Example macro created!"
|
||||
echo
|
||||
while true; do
|
||||
read -p "${cyan}###### Do you want to create the example shell command? (Y/n):${default} " yn
|
||||
case "$yn" in
|
||||
Y|y|Yes|yes|"")
|
||||
ADD_SHELL_CMD_MACRO="true"
|
||||
status_msg "Creating example macro ..."
|
||||
locate_printer_cfg
|
||||
read_printer_cfg "gcode_shell_command"
|
||||
write_printer_cfg
|
||||
ok_msg "Example macro created!"
|
||||
break;;
|
||||
N|n|No|no)
|
||||
break;;
|
||||
esac
|
||||
done
|
||||
ok_msg "Shell command extension installed!"
|
||||
restart_klipper
|
||||
}
|
||||
|
||||
create_shell_command_example(){
|
||||
unset SC_ENTRY
|
||||
unset write_entries
|
||||
#check for a SAVE_CONFIG entry
|
||||
SC="#*# <---------------------- SAVE_CONFIG ---------------------->"
|
||||
if [[ $(grep "$SC" $PRINTER_CFG) ]]; then
|
||||
SC_LINE=$(grep -n "$SC" $PRINTER_CFG | cut -d ":" -f1)
|
||||
PRE_SC_LINE=$(expr $SC_LINE - 1)
|
||||
SC_ENTRY="true"
|
||||
else
|
||||
SC_ENTRY="false"
|
||||
read_printer_cfg(){
|
||||
KIAUH_CFG=$(echo $PRINTER_CFG | sed 's/printer/kiauh/')
|
||||
if [ "$1" = "gcode_shell_command" ]; then
|
||||
[ ! -f $KIAUH_CFG ] && KIAUH_CFG_FOUND="false" || KIAUH_CFG_FOUND="true"
|
||||
elif [ "$1" = "moonraker" ]; then
|
||||
[ ! -f $KIAUH_CFG ] && KIAUH_CFG_FOUND="false" || KIAUH_CFG_FOUND="true"
|
||||
[ ! "$(grep '^\[virtual_sdcard\]$' $PRINTER_CFG)" ] && VSD="false"
|
||||
[ ! "$(grep '^\[pause_resume\]$' $PRINTER_CFG)" ] && PAUSE_RESUME="false"
|
||||
[ ! "$(grep '^\[display_status\]$' $PRINTER_CFG)" ] && DISPLAY_STATUS="false"
|
||||
elif [ "$1" = "mainsail" ] || [ "$1" = "fluidd" ]; then
|
||||
[ ! -f $KIAUH_CFG ] && KIAUH_CFG_FOUND="false" || KIAUH_CFG_FOUND="true"
|
||||
[ ! "$(grep '^\[include webui_macros\.cfg\]$' $PRINTER_CFG)" ] && WEBUI_MACROS="false"
|
||||
fi
|
||||
#example shell command
|
||||
write_entries+=("[shell_command hello_world]\ncommand: echo hello world\ntimeout: 2.\nverbose: True")
|
||||
#example macro
|
||||
write_entries+=("[gcode_macro HELLO_WORLD]\ngcode:\n RUN_SHELL_COMMAND CMD=hello_world")
|
||||
#execute writing
|
||||
status_msg "Writing to printer.cfg ..."
|
||||
if [ "$SC_ENTRY" = "true" ]; then
|
||||
PRE_SC_LINE="$(expr $SC_LINE - 1)a"
|
||||
for entry in "${write_entries[@]}"
|
||||
do
|
||||
sed -i "$PRE_SC_LINE $entry" $PRINTER_CFG
|
||||
done
|
||||
}
|
||||
|
||||
write_printer_cfg(){
|
||||
#create kiauh.cfg if its needed and doesn't exist
|
||||
if [ "$KIAUH_CFG_FOUND" = "false" ]; then
|
||||
status_msg "Creating kiauh.cfg ..."
|
||||
echo -e "##### AUTOCREATED BY KIAUH #####\c" > $KIAUH_CFG
|
||||
fi
|
||||
if [ "$SC_ENTRY" = "false" ]; then
|
||||
LINE_COUNT="$(wc -l < $PRINTER_CFG)a"
|
||||
for entry in "${write_entries[@]}"
|
||||
do
|
||||
sed -i "$LINE_COUNT $entry" $PRINTER_CFG
|
||||
done
|
||||
#write each entry to kiauh.cfg if it doesn't exist
|
||||
#Moonraker related config options
|
||||
if [ "$VSD" = "false" ] && [[ ! $(grep '^\[virtual_sdcard\]$' $KIAUH_CFG) ]]; then
|
||||
echo -e "\n[virtual_sdcard]\npath: ~/sdcard" >> $KIAUH_CFG
|
||||
fi
|
||||
if [ "$PAUSE_RESUME" = "false" ] && [[ ! $(grep '^\[pause_resume]$' $KIAUH_CFG) ]]; then
|
||||
echo -e "\n[pause_resume]" >> $KIAUH_CFG
|
||||
fi
|
||||
if [ "$DISPLAY_STATUS" = "false" ] && [[ ! $(grep '^\[display_status]$' $KIAUH_CFG) ]]; then
|
||||
echo -e "\n[display_status]" >> $KIAUH_CFG
|
||||
fi
|
||||
#Klipper webui related config options
|
||||
if [ "$WEBUI_MACROS" = "false" ] && [ "$ADD_WEBUI_MACROS" = "true" ] && [[ ! $(grep '^\[include webui_macros.cfg]$' $KIAUH_CFG) ]]; then
|
||||
echo -e "\n[include webui_macros.cfg]" >> $KIAUH_CFG
|
||||
fi
|
||||
#G-Code Shell Command extension related config options
|
||||
if [ "$ADD_SHELL_CMD_MACRO" = "true" ] && [[ ! $(grep '^\[gcode_shell_command hello_world]$' $KIAUH_CFG) ]]; then
|
||||
cat <<-EOF >> $KIAUH_CFG
|
||||
[gcode_shell_command hello_world]
|
||||
command: echo hello world
|
||||
timeout: 2.
|
||||
verbose: True
|
||||
[gcode_macro HELLO_WORLD]
|
||||
gcode:
|
||||
RUN_SHELL_COMMAND CMD=hello_world
|
||||
EOF
|
||||
fi
|
||||
#including the kiauh.cfg into printer.cfg if not already done
|
||||
if [ ! "$(grep '^\[include kiauh\.cfg\]$' $PRINTER_CFG)" ]; then
|
||||
status_msg "Writing [include kiauh.cfg] to printer.cfg ..."
|
||||
sed -i '1 i ##### AUTOCREATED BY KIAUH #####\n[include kiauh.cfg]\n################################' $PRINTER_CFG
|
||||
fi
|
||||
ok_msg "Done!"
|
||||
}
|
||||
|
||||
init_ini(){
|
||||
|
||||
@@ -1,94 +0,0 @@
|
||||
install_fluidd(){
|
||||
if [ "$INST_FLUIDD" = "true" ]; then
|
||||
#check if moonraker is already installed
|
||||
check_moonraker
|
||||
if [ "$MOONRAKER_SERVICE_FOUND" = "true" ]; then
|
||||
#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
|
||||
#creating the fluidd nginx cfg
|
||||
set_nginx_cfg "fluidd"
|
||||
test_nginx "$SET_LISTEN_PORT"
|
||||
fluidd_setup
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
fluidd_port_check(){
|
||||
if [ "$FLUIDD_ENABLED" = "false" ]; then
|
||||
if [ "$SITE_ENABLED" = "true" ]; then
|
||||
status_msg "Detected other enabled interfaces:"
|
||||
[ "$OCTOPRINT_ENABLED" = "true" ] && echo " ${cyan}● OctoPrint - Port: $OCTOPRINT_PORT${default}"
|
||||
[ "$MAINSAIL_ENABLED" = "true" ] && echo " ${cyan}● Mainsail - Port: $MAINSAIL_PORT${default}"
|
||||
[ "$DWC2_ENABLED" = "true" ] && echo " ${cyan}● DWC2 - Port: $DWC2_PORT${default}"
|
||||
if [ "$MAINSAIL_PORT" = "80" ] || [ "$DWC2_PORT" = "80" ] || [ "$OCTOPRINT_PORT" = "80" ]; then
|
||||
PORT_80_BLOCKED="true"
|
||||
select_fluidd_port
|
||||
fi
|
||||
else
|
||||
DEFAULT_PORT=$(grep listen ${SRCDIR}/kiauh/resources/fluidd_nginx.cfg | 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
|
||||
}
|
||||
|
||||
select_fluidd_port(){
|
||||
if [ "$PORT_80_BLOCKED" = "true" ]; then
|
||||
echo
|
||||
top_border
|
||||
echo -e "| ${red}!!!WARNING!!!${default} |"
|
||||
echo -e "| ${red}You need to choose a different port for Fluidd!${default} |"
|
||||
echo -e "| ${red}The following web interface is listening at port 80:${default} |"
|
||||
blank_line
|
||||
[ "$OCTOPRINT_PORT" = "80" ] && echo "| ● OctoPrint |"
|
||||
[ "$MAINSAIL_PORT" = "80" ] && echo "| ● Mainsail |"
|
||||
[ "$DWC2_PORT" = "80" ] && echo "| ● DWC2 |"
|
||||
blank_line
|
||||
echo -e "| Make sure you don't choose a port which was already |"
|
||||
echo -e "| assigned to one of the other web interfaces! |"
|
||||
blank_line
|
||||
echo -e "| Be aware: there is ${red}NO${default} sanity check for the following |"
|
||||
echo -e "| input. So make sure to choose a valid port! |"
|
||||
bottom_border
|
||||
while true; do
|
||||
read -p "${cyan}Please enter a new Port:${default} " NEW_PORT
|
||||
if [ "$NEW_PORT" != "$MAINSAIL_PORT" ] && [ "$NEW_PORT" != "$DWC2_PORT" ] && [ "$NEW_PORT" != "$OCTOPRINT_PORT" ]; then
|
||||
echo "Setting port $NEW_PORT for Fluidd!"
|
||||
SET_LISTEN_PORT=$NEW_PORT
|
||||
break
|
||||
else
|
||||
echo "That port is already taken! Select a different one!"
|
||||
fi
|
||||
done
|
||||
fi
|
||||
}
|
||||
|
||||
get_fluidd_ver(){
|
||||
FLUIDD_VERSION=$(curl -s https://api.github.com/repositories/295836951/releases/latest | grep tag_name | cut -d'"' -f4 | cut -d"v" -f2)
|
||||
}
|
||||
|
||||
fluidd_setup(){
|
||||
#get fluidd download url
|
||||
FLUIDD_DL_URL=$(curl -s https://api.github.com/repositories/295836951/releases/latest | grep browser_download_url | cut -d'"' -f4)
|
||||
#clean up an existing fluidd folder
|
||||
[ -d $FLUIDD_DIR ] && rm -rf $FLUIDD_DIR
|
||||
#create fresh fluidd folder and download fluidd
|
||||
mkdir $FLUIDD_DIR && cd $FLUIDD_DIR
|
||||
status_msg "Downloading Fluidd $FLUIDD_VERSION ..."
|
||||
wget $FLUIDD_DL_URL && ok_msg "Download complete!"
|
||||
#extract archive
|
||||
status_msg "Unzipping archive ..."
|
||||
unzip -q -o *.zip && ok_msg "Done!"
|
||||
#write fluidd version to file for update check reasons
|
||||
status_msg "Writing Fluidd version to file ..."
|
||||
get_fluidd_ver && echo $FLUIDD_VERSION > $FLUIDD_DIR/version && ok_msg "Done!"
|
||||
#delete downloaded zip
|
||||
status_msg "Do a little cleanup ..."
|
||||
rm -rf *.zip && ok_msg "Done!" && ok_msg "Fluidd installation complete!"
|
||||
echo
|
||||
}
|
||||
246
scripts/install_klipper_webui.sh
Executable file
246
scripts/install_klipper_webui.sh
Executable file
@@ -0,0 +1,246 @@
|
||||
check_moonraker(){
|
||||
status_msg "Checking for Moonraker service ..."
|
||||
if [ "$(systemctl list-units --full -all -t service --no-legend | grep -F "moonraker.service")" ]; then
|
||||
ok_msg "Moonraker service found!"; echo
|
||||
MOONRAKER_SERVICE_FOUND="true"
|
||||
else
|
||||
warn_msg "Moonraker service not found!"
|
||||
warn_msg "Please install Moonraker first!"; echo
|
||||
MOONRAKER_SERVICE_FOUND="false"
|
||||
fi
|
||||
}
|
||||
|
||||
get_user_selection_webui(){
|
||||
#ask user for webui default macros
|
||||
while true; do
|
||||
unset ADD_WEBUI_MACROS
|
||||
echo
|
||||
top_border
|
||||
echo -e "| It is recommended to have some important macros to |"
|
||||
echo -e "| have full functionality of the web interface. |"
|
||||
blank_line
|
||||
echo -e "| If you do not have such macros, you can choose to |"
|
||||
echo -e "| install the suggested default macros now. |"
|
||||
bottom_border
|
||||
read -p "${cyan}###### Add the recommended macros? (Y/n):${default} " yn
|
||||
case "$yn" in
|
||||
Y|y|Yes|yes|"")
|
||||
echo -e "###### > Yes"
|
||||
ADD_WEBUI_MACROS="true"
|
||||
break;;
|
||||
N|n|No|no)
|
||||
echo -e "###### > No"
|
||||
ADD_WEBUI_MACROS="false"
|
||||
break;;
|
||||
*)
|
||||
print_unkown_cmd
|
||||
print_msg && clear_msg;;
|
||||
esac
|
||||
done
|
||||
}
|
||||
|
||||
install_mainsail(){
|
||||
get_user_selection_webui
|
||||
#check if moonraker is already installed
|
||||
check_moonraker
|
||||
if [ "$MOONRAKER_SERVICE_FOUND" = "true" ]; then
|
||||
#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
|
||||
#creating the mainsail nginx cfg
|
||||
set_nginx_cfg "mainsail"
|
||||
test_nginx "$SET_LISTEN_PORT"
|
||||
locate_printer_cfg && read_printer_cfg "mainsail"
|
||||
install_webui_macros
|
||||
mainsail_setup
|
||||
fi
|
||||
}
|
||||
|
||||
install_fluidd(){
|
||||
get_user_selection_webui
|
||||
#check if moonraker is already installed
|
||||
check_moonraker
|
||||
if [ "$MOONRAKER_SERVICE_FOUND" = "true" ]; then
|
||||
#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
|
||||
#creating the fluidd nginx cfg
|
||||
set_nginx_cfg "fluidd"
|
||||
test_nginx "$SET_LISTEN_PORT"
|
||||
locate_printer_cfg && read_printer_cfg "fluidd"
|
||||
install_webui_macros
|
||||
fluidd_setup
|
||||
fi
|
||||
}
|
||||
|
||||
install_webui_macros(){
|
||||
#copy webui_macros.cfg
|
||||
if [ "$ADD_WEBUI_MACROS" = "true" ]; then
|
||||
status_msg "Create webui_macros.cfg ..."
|
||||
if [ ! -f ${HOME}/klipper_config/webui_macros.cfg ]; then
|
||||
cp ${HOME}/kiauh/resources/webui_macros.cfg ${HOME}/klipper_config
|
||||
ok_msg "File created!"
|
||||
else
|
||||
warn_msg "File already exists! Skipping ..."
|
||||
fi
|
||||
fi
|
||||
write_printer_cfg
|
||||
}
|
||||
|
||||
mainsail_port_check(){
|
||||
if [ "$MAINSAIL_ENABLED" = "false" ]; then
|
||||
if [ "$SITE_ENABLED" = "true" ]; then
|
||||
status_msg "Detected other enabled interfaces:"
|
||||
[ "$OCTOPRINT_ENABLED" = "true" ] && echo -e " ${cyan}● OctoPrint - Port: $OCTOPRINT_PORT${default}"
|
||||
[ "$FLUIDD_ENABLED" = "true" ] && echo -e " ${cyan}● Fluidd - Port: $FLUIDD_PORT${default}"
|
||||
[ "$DWC2_ENABLED" = "true" ] && echo -e " ${cyan}● DWC2 - Port: $DWC2_PORT${default}"
|
||||
if [ "$FLUIDD_PORT" = "80" ] || [ "$DWC2_PORT" = "80" ] || [ "$OCTOPRINT_PORT" = "80" ]; then
|
||||
PORT_80_BLOCKED="true"
|
||||
select_mainsail_port
|
||||
fi
|
||||
else
|
||||
DEFAULT_PORT=$(grep listen ${SRCDIR}/kiauh/resources/mainsail_nginx.cfg | 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
|
||||
}
|
||||
|
||||
fluidd_port_check(){
|
||||
if [ "$FLUIDD_ENABLED" = "false" ]; then
|
||||
if [ "$SITE_ENABLED" = "true" ]; then
|
||||
status_msg "Detected other enabled interfaces:"
|
||||
[ "$OCTOPRINT_ENABLED" = "true" ] && echo " ${cyan}● OctoPrint - Port: $OCTOPRINT_PORT${default}"
|
||||
[ "$MAINSAIL_ENABLED" = "true" ] && echo " ${cyan}● Mainsail - Port: $MAINSAIL_PORT${default}"
|
||||
[ "$DWC2_ENABLED" = "true" ] && echo " ${cyan}● DWC2 - Port: $DWC2_PORT${default}"
|
||||
if [ "$MAINSAIL_PORT" = "80" ] || [ "$DWC2_PORT" = "80" ] || [ "$OCTOPRINT_PORT" = "80" ]; then
|
||||
PORT_80_BLOCKED="true"
|
||||
select_fluidd_port
|
||||
fi
|
||||
else
|
||||
DEFAULT_PORT=$(grep listen ${SRCDIR}/kiauh/resources/fluidd_nginx.cfg | 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
|
||||
}
|
||||
|
||||
select_mainsail_port(){
|
||||
if [ "$PORT_80_BLOCKED" = "true" ]; then
|
||||
echo
|
||||
top_border
|
||||
echo -e "| ${red}!!!WARNING!!!${default} |"
|
||||
echo -e "| ${red}You need to choose a different port for Mainsail!${default} |"
|
||||
echo -e "| ${red}The following web interface is listening at port 80:${default} |"
|
||||
blank_line
|
||||
[ "$OCTOPRINT_PORT" = "80" ] && echo "| ● OctoPrint |"
|
||||
[ "$FLUIDD_PORT" = "80" ] && echo "| ● Fluidd |"
|
||||
[ "$DWC2_PORT" = "80" ] && echo "| ● DWC2 |"
|
||||
blank_line
|
||||
echo -e "| Make sure you don't choose a port which was already |"
|
||||
echo -e "| assigned to one of the other web interfaces! |"
|
||||
blank_line
|
||||
echo -e "| Be aware: there is ${red}NO${default} sanity check for the following |"
|
||||
echo -e "| input. So make sure to choose a valid port! |"
|
||||
bottom_border
|
||||
while true; do
|
||||
read -p "${cyan}Please enter a new Port:${default} " NEW_PORT
|
||||
if [ "$NEW_PORT" != "$FLUIDD_PORT" ] && [ "$NEW_PORT" != "$DWC2_PORT" ] && [ "$NEW_PORT" != "$OCTOPRINT_PORT" ]; then
|
||||
echo "Setting port $NEW_PORT for Mainsail!"
|
||||
SET_LISTEN_PORT=$NEW_PORT
|
||||
break
|
||||
else
|
||||
echo "That port is already taken! Select a different one!"
|
||||
fi
|
||||
done
|
||||
fi
|
||||
}
|
||||
|
||||
select_fluidd_port(){
|
||||
if [ "$PORT_80_BLOCKED" = "true" ]; then
|
||||
echo
|
||||
top_border
|
||||
echo -e "| ${red}!!!WARNING!!!${default} |"
|
||||
echo -e "| ${red}You need to choose a different port for Fluidd!${default} |"
|
||||
echo -e "| ${red}The following web interface is listening at port 80:${default} |"
|
||||
blank_line
|
||||
[ "$OCTOPRINT_PORT" = "80" ] && echo "| ● OctoPrint |"
|
||||
[ "$MAINSAIL_PORT" = "80" ] && echo "| ● Mainsail |"
|
||||
[ "$DWC2_PORT" = "80" ] && echo "| ● DWC2 |"
|
||||
blank_line
|
||||
echo -e "| Make sure you don't choose a port which was already |"
|
||||
echo -e "| assigned to one of the other web interfaces! |"
|
||||
blank_line
|
||||
echo -e "| Be aware: there is ${red}NO${default} sanity check for the following |"
|
||||
echo -e "| input. So make sure to choose a valid port! |"
|
||||
bottom_border
|
||||
while true; do
|
||||
read -p "${cyan}Please enter a new Port:${default} " NEW_PORT
|
||||
if [ "$NEW_PORT" != "$MAINSAIL_PORT" ] && [ "$NEW_PORT" != "$DWC2_PORT" ] && [ "$NEW_PORT" != "$OCTOPRINT_PORT" ]; then
|
||||
echo "Setting port $NEW_PORT for Fluidd!"
|
||||
SET_LISTEN_PORT=$NEW_PORT
|
||||
break
|
||||
else
|
||||
echo "That port is already taken! Select a different one!"
|
||||
fi
|
||||
done
|
||||
fi
|
||||
}
|
||||
|
||||
get_mainsail_ver(){
|
||||
MAINSAIL_VERSION=$(curl -s https://api.github.com/repositories/240875926/releases | grep tag_name | cut -d'"' -f4 | cut -d"v" -f2 | head -1)
|
||||
}
|
||||
|
||||
get_fluidd_ver(){
|
||||
FLUIDD_VERSION=$(curl -s https://api.github.com/repositories/295836951/releases | grep tag_name | cut -d'"' -f4 | cut -d"v" -f2 | head -1)
|
||||
}
|
||||
|
||||
mainsail_setup(){
|
||||
#get mainsail download url
|
||||
MAINSAIL_DL_URL=$(curl -s https://api.github.com/repositories/240875926/releases | grep browser_download_url | cut -d'"' -f4 | head -1)
|
||||
#clean up an existing mainsail folder
|
||||
[ -d $MAINSAIL_DIR ] && rm -rf $MAINSAIL_DIR
|
||||
#create fresh mainsail folder and download mainsail
|
||||
mkdir $MAINSAIL_DIR && cd $MAINSAIL_DIR
|
||||
status_msg "Downloading Mainsail $MAINSAIL_VERSION ..."
|
||||
wget $MAINSAIL_DL_URL && ok_msg "Download complete!"
|
||||
#extract archive
|
||||
status_msg "Extracting archive ..."
|
||||
unzip -q -o *.zip && ok_msg "Done!"
|
||||
### write mainsail version to file for update check reasons
|
||||
status_msg "Writing Mainsail version to file ..."
|
||||
get_mainsail_ver && echo "$MAINSAIL_VERSION" > $MAINSAIL_DIR/version && ok_msg "Done!"
|
||||
#delete downloaded zip
|
||||
status_msg "Remove downloaded archive ..."
|
||||
rm -rf *.zip && ok_msg "Done!" && ok_msg "Mainsail installation complete!"
|
||||
echo
|
||||
}
|
||||
|
||||
fluidd_setup(){
|
||||
#get fluidd download url
|
||||
FLUIDD_DL_URL=$(curl -s https://api.github.com/repositories/295836951/releases/latest | grep browser_download_url | cut -d'"' -f4)
|
||||
#clean up an existing fluidd folder
|
||||
[ -d $FLUIDD_DIR ] && rm -rf $FLUIDD_DIR
|
||||
#create fresh fluidd folder and download fluidd
|
||||
mkdir $FLUIDD_DIR && cd $FLUIDD_DIR
|
||||
status_msg "Downloading Fluidd $FLUIDD_VERSION ..."
|
||||
wget $FLUIDD_DL_URL && ok_msg "Download complete!"
|
||||
#extract archive
|
||||
status_msg "Extracting archive ..."
|
||||
unzip -q -o *.zip && ok_msg "Done!"
|
||||
#write fluidd version to file for update check reasons
|
||||
status_msg "Writing Fluidd version to file ..."
|
||||
get_fluidd_ver && echo $FLUIDD_VERSION > $FLUIDD_DIR/version && ok_msg "Done!"
|
||||
#delete downloaded zip
|
||||
status_msg "Remove downloaded archive ..."
|
||||
rm -rf *.zip && ok_msg "Done!" && ok_msg "Fluidd installation complete!"
|
||||
echo
|
||||
}
|
||||
@@ -1,103 +0,0 @@
|
||||
install_mainsail(){
|
||||
if [ "$INST_MAINSAIL" = "true" ]; then
|
||||
#check if moonraker is already installed
|
||||
check_moonraker
|
||||
if [ "$MOONRAKER_SERVICE_FOUND" = "true" ]; then
|
||||
#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
|
||||
#creating the mainsail nginx cfg
|
||||
set_nginx_cfg "mainsail"
|
||||
test_nginx "$SET_LISTEN_PORT"
|
||||
mainsail_setup && ok_msg "Mainsail installation complete!"; echo
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
check_moonraker(){
|
||||
status_msg "Checking for Moonraker service ..."
|
||||
if [ "$(systemctl list-units --full -all -t service --no-legend | grep -F "moonraker.service")" ]; then
|
||||
ok_msg "Moonraker service found!"; echo
|
||||
MOONRAKER_SERVICE_FOUND="true"
|
||||
else
|
||||
warn_msg "Moonraker service not found!"
|
||||
warn_msg "Please install Moonraker first!"; echo
|
||||
MOONRAKER_SERVICE_FOUND="false"
|
||||
fi
|
||||
}
|
||||
|
||||
mainsail_port_check(){
|
||||
if [ "$MAINSAIL_ENABLED" = "false" ]; then
|
||||
if [ "$SITE_ENABLED" = "true" ]; then
|
||||
status_msg "Detected other enabled interfaces:"
|
||||
[ "$OCTOPRINT_ENABLED" = "true" ] && echo -e " ${cyan}● OctoPrint - Port: $OCTOPRINT_PORT${default}"
|
||||
[ "$FLUIDD_ENABLED" = "true" ] && echo -e " ${cyan}● Fluidd - Port: $FLUIDD_PORT${default}"
|
||||
[ "$DWC2_ENABLED" = "true" ] && echo -e " ${cyan}● DWC2 - Port: $DWC2_PORT${default}"
|
||||
if [ "$FLUIDD_PORT" = "80" ] || [ "$DWC2_PORT" = "80" ] || [ "$OCTOPRINT_PORT" = "80" ]; then
|
||||
PORT_80_BLOCKED="true"
|
||||
select_mainsail_port
|
||||
fi
|
||||
else
|
||||
DEFAULT_PORT=$(grep listen ${SRCDIR}/kiauh/resources/mainsail_nginx.cfg | 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
|
||||
}
|
||||
|
||||
select_mainsail_port(){
|
||||
if [ "$PORT_80_BLOCKED" = "true" ]; then
|
||||
echo
|
||||
top_border
|
||||
echo -e "| ${red}!!!WARNING!!!${default} |"
|
||||
echo -e "| ${red}You need to choose a different port for Mainsail!${default} |"
|
||||
echo -e "| ${red}The following web interface is listening at port 80:${default} |"
|
||||
blank_line
|
||||
[ "$OCTOPRINT_PORT" = "80" ] && echo "| ● OctoPrint |"
|
||||
[ "$FLUIDD_PORT" = "80" ] && echo "| ● Fluidd |"
|
||||
[ "$DWC2_PORT" = "80" ] && echo "| ● DWC2 |"
|
||||
blank_line
|
||||
echo -e "| Make sure you don't choose a port which was already |"
|
||||
echo -e "| assigned to one of the other web interfaces! |"
|
||||
blank_line
|
||||
echo -e "| Be aware: there is ${red}NO${default} sanity check for the following |"
|
||||
echo -e "| input. So make sure to choose a valid port! |"
|
||||
bottom_border
|
||||
while true; do
|
||||
read -p "${cyan}Please enter a new Port:${default} " NEW_PORT
|
||||
if [ "$NEW_PORT" != "$FLUIDD_PORT" ] && [ "$NEW_PORT" != "$DWC2_PORT" ] && [ "$NEW_PORT" != "$OCTOPRINT_PORT" ]; then
|
||||
echo "Setting port $NEW_PORT for Mainsail!"
|
||||
SET_LISTEN_PORT=$NEW_PORT
|
||||
break
|
||||
else
|
||||
echo "That port is already taken! Select a different one!"
|
||||
fi
|
||||
done
|
||||
fi
|
||||
}
|
||||
|
||||
get_mainsail_ver(){
|
||||
MAINSAIL_VERSION=$(curl -s https://api.github.com/repositories/240875926/tags | grep name | cut -d'"' -f4 | cut -d"v" -f2 | head -1)
|
||||
}
|
||||
|
||||
mainsail_dl_url(){
|
||||
get_mainsail_ver
|
||||
MAINSAIL_URL=https://github.com/meteyou/mainsail/releases/download/v$MAINSAIL_VERSION/mainsail-beta-$MAINSAIL_VERSION.zip
|
||||
}
|
||||
|
||||
mainsail_setup(){
|
||||
mainsail_dl_url
|
||||
#clean up an existing mainsail folder
|
||||
[ -d $MAINSAIL_DIR ] && rm -rf $MAINSAIL_DIR
|
||||
#create fresh mainsail folder and download mainsail
|
||||
mkdir $MAINSAIL_DIR && cd $MAINSAIL_DIR
|
||||
status_msg "Downloading Mainsail v$MAINSAIL_VERSION ..."
|
||||
wget -O mainsail.zip $MAINSAIL_URL && status_msg "Extracting archive ..." && unzip -o mainsail.zip && rm mainsail.zip
|
||||
### write mainsail version to file for update check reasons
|
||||
echo "$MAINSAIL_VERSION" > $MAINSAIL_DIR/version
|
||||
echo
|
||||
}
|
||||
@@ -8,13 +8,12 @@ install_moonraker(){
|
||||
moonraker_setup
|
||||
check_for_folder_moonraker
|
||||
#setup configs
|
||||
setup_printer_config_mainsail
|
||||
setup_printer_config_moonraker
|
||||
setup_moonraker_conf
|
||||
#execute customizations
|
||||
write_custom_trusted_clients
|
||||
symlinks_moonraker
|
||||
disable_octoprint
|
||||
set_hostname
|
||||
#after install actions
|
||||
restart_moonraker
|
||||
restart_klipper
|
||||
@@ -32,17 +31,9 @@ system_check_moonraker(){
|
||||
PRINTER_CFG_FOUND="false"
|
||||
fi
|
||||
#check for existing klippy.log symlink in /klipper_config
|
||||
if [ ! -e ${HOME}/klipper_config/klippy.log ]; then
|
||||
KLIPPY_SL_FOUND="false"
|
||||
else
|
||||
KLIPPY_SL_FOUND="true"
|
||||
fi
|
||||
[ ! -e ${HOME}/klipper_config/klippy.log ] && KLIPPY_SL_FOUND="false"
|
||||
#check for existing moonraker.log symlink in /klipper_config
|
||||
if [ ! -e ${HOME}/klipper_config/moonraker.log ]; then
|
||||
MOONRAKER_SL_FOUND="false"
|
||||
else
|
||||
MOONRAKER_SL_FOUND="true"
|
||||
fi
|
||||
[ ! -e ${HOME}/klipper_config/moonraker.log ] && MOONRAKER_SL_FOUND="false"
|
||||
#check for existing moonraker.conf
|
||||
if [ ! -f ${HOME}/moonraker.conf ]; then
|
||||
MOONRAKER_CONF_FOUND="false"
|
||||
@@ -158,25 +149,6 @@ get_user_selections_moonraker(){
|
||||
print_msg && clear_msg;;
|
||||
esac
|
||||
done
|
||||
#ask user for mainsail default macros
|
||||
while true; do
|
||||
unset ADD_MS_MACROS
|
||||
echo
|
||||
read -p "${cyan}###### Add the recommended Mainsail macros? (Y/n):${default} " yn
|
||||
case "$yn" in
|
||||
Y|y|Yes|yes|"")
|
||||
echo -e "###### > Yes"
|
||||
ADD_MS_MACROS="true"
|
||||
break;;
|
||||
N|n|No|no)
|
||||
echo -e "###### > No"
|
||||
ADD_MS_MACROS="false"
|
||||
break;;
|
||||
*)
|
||||
print_unkown_cmd
|
||||
print_msg && clear_msg;;
|
||||
esac
|
||||
done
|
||||
#ask user to disable octoprint when such installed service was found
|
||||
if [ "$OCTOPRINT_ENABLED" = "true" ]; then
|
||||
unset DISABLE_OPRINT
|
||||
@@ -274,9 +246,6 @@ moonraker_setup(){
|
||||
dep=(wget curl unzip dfu-util nginx)
|
||||
dependency_check
|
||||
status_msg "Downloading Moonraker ..."
|
||||
if [ -d $MOONRAKER_DIR ]; then
|
||||
mv -f $MOONRAKER_DIR ${HOME}/moonraker_bak
|
||||
fi
|
||||
cd ${HOME} && git clone $MOONRAKER_REPO
|
||||
ok_msg "Download complete!"
|
||||
status_msg "Installing Moonraker ..."
|
||||
@@ -289,8 +258,7 @@ moonraker_setup(){
|
||||
patch_klipper_sysfile
|
||||
#re-run printer.cfg location function to read the new path for the printer.cfg
|
||||
locate_printer_cfg
|
||||
echo
|
||||
ok_msg "Moonraker successfully installed!"
|
||||
echo; ok_msg "Moonraker successfully installed!"
|
||||
}
|
||||
|
||||
patch_klipper_sysfile(){
|
||||
@@ -354,7 +322,7 @@ check_for_folder_moonraker(){
|
||||
#############################################################
|
||||
#############################################################
|
||||
|
||||
setup_printer_config_mainsail(){
|
||||
setup_printer_config_moonraker(){
|
||||
if [ "$PRINTER_CFG_FOUND" = "true" ]; then
|
||||
backup_printer_cfg
|
||||
#copy printer.cfg to new location if
|
||||
@@ -365,79 +333,16 @@ setup_printer_config_mainsail(){
|
||||
ok_msg "printer.cfg location: '$PRINTER_CFG'"
|
||||
ok_msg "Done!"
|
||||
fi
|
||||
#check printer.cfg for necessary mainsail entries
|
||||
read_printer_cfg_mainsail
|
||||
write_printer_cfg_mainsail
|
||||
#check printer.cfg for necessary moonraker entries
|
||||
read_printer_cfg "moonraker"
|
||||
write_printer_cfg
|
||||
fi
|
||||
if [ "$SEL_DEF_CFG" = "true" ]; then
|
||||
status_msg "Creating minimal default printer.cfg ..."
|
||||
create_default_mainsail_printer_cfg
|
||||
create_default_moonraker_printer_cfg
|
||||
ok_msg "printer.cfg location: '$PRINTER_CFG'"
|
||||
ok_msg "Done!"
|
||||
fi
|
||||
#copy mainsail_macro.cfg
|
||||
if [ "$ADD_MS_MACROS" = "true" ]; then
|
||||
status_msg "Create mainsail_macros.cfg ..."
|
||||
if [ ! -f ${HOME}/klipper_config/mainsail_macros.cfg ]; then
|
||||
cp ${HOME}/kiauh/resources/mainsail_macros.cfg ${HOME}/klipper_config
|
||||
ok_msg "File created!"
|
||||
else
|
||||
warn_msg "File does already exist! Skipping ..."
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
read_printer_cfg_mainsail(){
|
||||
SC="#*# <---------------------- SAVE_CONFIG ---------------------->"
|
||||
[ ! "$(grep '^\[virtual_sdcard\]$' $PRINTER_CFG)" ] && VSD="false"
|
||||
[ ! "$(grep '^\[pause_resume\]$' $PRINTER_CFG)" ] && PAUSE_RESUME="false"
|
||||
[ ! "$(grep '^\[display_status\]$' $PRINTER_CFG)" ] && DISPLAY_STATUS="false"
|
||||
[ ! "$(grep '^\[include mainsail_macros\.cfg\]$' $PRINTER_CFG)" ] && MS_MACRO="false"
|
||||
#check for a SAVE_CONFIG entry
|
||||
if [[ $(grep "$SC" $PRINTER_CFG) ]]; then
|
||||
SC_LINE=$(grep -n "$SC" $PRINTER_CFG | cut -d ":" -f1)
|
||||
PRE_SC_LINE=$(expr $SC_LINE - 1)
|
||||
SC_ENTRY="true"
|
||||
else
|
||||
SC_ENTRY="false"
|
||||
fi
|
||||
}
|
||||
|
||||
write_printer_cfg_mainsail(){
|
||||
unset write_entries
|
||||
if [ "$MS_MACRO" = "false" ] && [ "$ADD_MS_MACROS" = "true" ]; then
|
||||
write_entries+=("[include mainsail_macros.cfg]")
|
||||
fi
|
||||
if [ "$PAUSE_RESUME" = "false" ]; then
|
||||
write_entries+=("[pause_resume]")
|
||||
fi
|
||||
if [ "$DISPLAY_STATUS" = "false" ]; then
|
||||
write_entries+=("[display_status]")
|
||||
fi
|
||||
if [ "$VSD" = "false" ]; then
|
||||
write_entries+=("[virtual_sdcard]\npath: ~/sdcard")
|
||||
fi
|
||||
if [ "${#write_entries[@]}" != "0" ]; then
|
||||
write_entries+=("\\\n############################\n##### CREATED BY KIAUH #####\n############################")
|
||||
write_entries=("############################\n" "${write_entries[@]}")
|
||||
fi
|
||||
#execute writing
|
||||
status_msg "Writing to printer.cfg ..."
|
||||
if [ "$SC_ENTRY" = "true" ]; then
|
||||
PRE_SC_LINE="$(expr $SC_LINE - 1)a"
|
||||
for entry in "${write_entries[@]}"
|
||||
do
|
||||
sed -i "$PRE_SC_LINE $entry" $PRINTER_CFG
|
||||
done
|
||||
fi
|
||||
if [ "$SC_ENTRY" = "false" ]; then
|
||||
LINE_COUNT="$(wc -l < $PRINTER_CFG)a"
|
||||
for entry in "${write_entries[@]}"
|
||||
do
|
||||
sed -i "$LINE_COUNT $entry" $PRINTER_CFG
|
||||
done
|
||||
fi
|
||||
ok_msg "Done!"
|
||||
}
|
||||
|
||||
setup_moonraker_conf(){
|
||||
@@ -479,23 +384,16 @@ setup_moonraker_nginx_cfg(){
|
||||
#############################################################
|
||||
#############################################################
|
||||
|
||||
create_default_mainsail_printer_cfg(){
|
||||
create_default_moonraker_printer_cfg(){
|
||||
#create default config
|
||||
touch ${HOME}/klipper_config/printer.cfg
|
||||
cat <<DEFAULT_CFG >> ${HOME}/klipper_config/printer.cfg
|
||||
|
||||
##########################
|
||||
### CREATED WITH KIAUH ###
|
||||
##########################
|
||||
### AUTOCREATED WITH KIAUH ###
|
||||
[virtual_sdcard]
|
||||
path: ~/sdcard
|
||||
|
||||
[pause_resume]
|
||||
[display_status]
|
||||
[include mainsail_macros.cfg]
|
||||
|
||||
##########################
|
||||
##########################
|
||||
DEFAULT_CFG
|
||||
}
|
||||
|
||||
|
||||
@@ -96,9 +96,9 @@ create_custom_hostname(){
|
||||
echo -e "| You can change the hostname of this machine to use |"
|
||||
echo -e "| that name to open the Interface in your browser. |"
|
||||
echo -e "| |"
|
||||
echo -e "| Example: If you set the hostname to 'my-printer' |"
|
||||
echo -e "| you can open DWC2/Mainsail/Octoprint by |"
|
||||
echo -e "| browsing to: http://my-printer.local |"
|
||||
echo -e "| E.g.: If you set the hostname to 'my-printer' you |"
|
||||
echo -e "| can open DWC2/Mainsail/Fluidd/Octoprint by |"
|
||||
echo -e "| browsing to: http://my-printer.local |"
|
||||
bottom_border
|
||||
while true; do
|
||||
read -p "${cyan}###### Do you want to change the hostname? (y/N):${default} " yn
|
||||
|
||||
@@ -41,13 +41,13 @@ install_menu(){
|
||||
4)
|
||||
clear
|
||||
print_header
|
||||
INST_MAINSAIL="true" && install_mainsail
|
||||
install_mainsail
|
||||
print_msg && clear_msg
|
||||
install_ui;;
|
||||
5)
|
||||
clear
|
||||
print_header
|
||||
INST_FLUIDD="true" && install_fluidd
|
||||
install_fluidd
|
||||
print_msg && clear_msg
|
||||
install_ui;;
|
||||
6)
|
||||
|
||||
Reference in New Issue
Block a user