mirror of
https://github.com/dw-0/kiauh.git
synced 2025-12-11 17:44:28 +05:00
feat: add PrettyGCode for Klipper
This commit is contained in:
@@ -129,6 +129,12 @@ https://github.com/OctoPrint/OctoPrint
|
||||
|
||||
---
|
||||
|
||||
### **🔬PrettyGCode for Klipper** by [Kragrathea](https://github.com/Kragrathea) :
|
||||
|
||||
https://github.com/Kragrathea/pgcode
|
||||
|
||||
---
|
||||
|
||||
## **❓ FAQ**
|
||||
|
||||
**_Q: Can i use this script to install multiple instances of Klipper on the same Pi? (Multisession?)_**
|
||||
|
||||
@@ -2,6 +2,9 @@
|
||||
|
||||
This document covers possible important changes to KIAUH.
|
||||
|
||||
### 2021-08-10
|
||||
* KIAUH now supports the installation of the "PrettyGCode for Klipper" GCode-Viewer created by [Kragrathea](https://github.com/Kragrathea)! Installation, updating and removal are possible with KIAUH. For more details to this cool piece of software, please have a look here: https://github.com/Kragrathea/pgcode
|
||||
|
||||
### 2021-07-10
|
||||
* The NGINX configuration files got updated to be in sync with MainsailOS and FluiddPi. Issues with the NGINX service not starting up due to wrong configuration should be resolved now. To get the updated configuration files, please remove Moonraker and Mainsail / Fluidd with KIAUH first and then re-install it. An automated file check for those configuration files might follow in the future which then automates updating those files if there were important changes.
|
||||
|
||||
|
||||
37
scripts/install_pgc_for_klipper.sh
Executable file
37
scripts/install_pgc_for_klipper.sh
Executable file
@@ -0,0 +1,37 @@
|
||||
### base variables
|
||||
PGC_FOR_KLIPPER_REPO="https://github.com/Kragrathea/pgcode"
|
||||
PGC_DIR="${HOME}/pgcode"
|
||||
|
||||
install_pgc_for_klipper(){
|
||||
pgconfsrc="$PGC_DIR/pgcode.local.conf"
|
||||
pgconf="/etc/nginx/sites-available/pgcode.local.conf"
|
||||
pgconfsl="/etc/nginx/sites-enabled/pgcode.local.conf"
|
||||
pgc_default_port="7136"
|
||||
|
||||
status_msg "Installing PrettyGCode for Klipper ..."
|
||||
### let the user decide which port is used
|
||||
echo -e "${cyan}\n###### On which port should PrettyGCode run? (Default: $pgc_default_port)${default} "
|
||||
read -e -p "${cyan}###### Port:${default} " -i "$pgc_default_port" pgc_custom_port
|
||||
### check nginx dependency
|
||||
dep=(nginx)
|
||||
dependency_check
|
||||
### clone repo
|
||||
[ -d $PGC_DIR ] && rm -rf $PGC_DIR
|
||||
cd ${HOME} && git clone $PGC_FOR_KLIPPER_REPO
|
||||
### copy nginx config into destination directory
|
||||
sudo cp $pgconfsrc $pgconf
|
||||
### replace default pi user in case the user is called different
|
||||
sudo sed -i "s|/home/pi/pgcode;|/home/${USER}/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
|
||||
### create symlink
|
||||
[ ! -L $pgconfsl ] && sudo ln -s $pgconf $pgconfsl
|
||||
sudo systemctl restart nginx
|
||||
### show URI
|
||||
pgc_uri="http://$(hostname -I | cut -d" " -f1):$pgc_custom_port"
|
||||
echo -e "${cyan}\n● Accessible via:${default} $pgc_uri"
|
||||
ok_msg "PrettyGCode for Klipper installed!\n"
|
||||
}
|
||||
@@ -439,4 +439,19 @@ remove_mjpg-streamer(){
|
||||
[ -L "${HOME}/klipper_logs/webcamd.log" ] && rm -f "${HOME}/klipper_logs/webcamd.log"
|
||||
|
||||
CONFIRM_MSG="MJPG-Streamer successfully removed!"
|
||||
}
|
||||
|
||||
remove_prettygcode(){
|
||||
pgconf="/etc/nginx/sites-available/pgcode.local.conf"
|
||||
pgconfsl="/etc/nginx/sites-enabled/pgcode.local.conf"
|
||||
if [ -d ${HOME}/pgcode ] || [ -f $pgconf ] || [ -L $pgconfsl ]; then
|
||||
status_msg "Removing PrettyGCode for Klipper ..."
|
||||
rm -rf ${HOME}/pgcode
|
||||
sudo rm -f $pgconf
|
||||
sudo rm -f $pgconfsl
|
||||
sudo systemctl restart nginx
|
||||
CONFIRM_MSG="PrettyGCode for Klipper successfully removed!"
|
||||
else
|
||||
ERROR_MSG="PrettyGCode for Klipper not found!\n Skipping..."
|
||||
fi
|
||||
}
|
||||
@@ -520,6 +520,37 @@ compare_klipperscreen_versions(){
|
||||
#############################################################
|
||||
#############################################################
|
||||
|
||||
read_pgc_versions(){
|
||||
PGC_DIR="${HOME}/pgcode"
|
||||
if [ -d $PGC_DIR ] && [ -d $PGC_DIR/.git ]; then
|
||||
cd $PGC_DIR
|
||||
git fetch origin main -q
|
||||
LOCAL_PGC_COMMIT=$(git describe HEAD --always --tags | cut -d "-" -f 1,2)
|
||||
REMOTE_PGC_COMMIT=$(git describe origin/main --always --tags | cut -d "-" -f 1,2)
|
||||
else
|
||||
LOCAL_PGC_COMMIT=$NONE
|
||||
REMOTE_PGC_COMMIT=$NONE
|
||||
fi
|
||||
}
|
||||
|
||||
compare_pgc_versions(){
|
||||
unset PGC_UPDATE_AVAIL
|
||||
read_pgc_versions
|
||||
if [ "$LOCAL_PGC_COMMIT" != "$REMOTE_PGC_COMMIT" ]; then
|
||||
LOCAL_PGC_COMMIT="${yellow}$(printf "%-12s" "$LOCAL_PGC_COMMIT")${default}"
|
||||
REMOTE_PGC_COMMIT="${green}$(printf "%-12s" "$REMOTE_PGC_COMMIT")${default}"
|
||||
PGC_UPDATE_AVAIL="true"
|
||||
update_arr+=(update_pgc)
|
||||
else
|
||||
LOCAL_PGC_COMMIT="${green}$(printf "%-12s" "$LOCAL_PGC_COMMIT")${default}"
|
||||
REMOTE_PGC_COMMIT="${green}$(printf "%-12s" "$REMOTE_PGC_COMMIT")${default}"
|
||||
PGC_UPDATE_AVAIL="false"
|
||||
fi
|
||||
}
|
||||
|
||||
#############################################################
|
||||
#############################################################
|
||||
|
||||
#display this as placeholder if no version/commit could be fetched
|
||||
NONE="${red}$(printf "%-12s" "--------")${default}"
|
||||
|
||||
@@ -533,4 +564,5 @@ ui_print_versions(){
|
||||
compare_mainsail_versions
|
||||
compare_fluidd_versions
|
||||
compare_klipperscreen_versions
|
||||
compare_pgc_versions
|
||||
}
|
||||
|
||||
@@ -12,9 +12,10 @@ install_ui(){
|
||||
echo -e "| Klipper API: | Other: | "
|
||||
echo -e "| 2) [Moonraker] | 6) [Duet Web Control] | "
|
||||
echo -e "| | 7) [OctoPrint] | "
|
||||
echo -e "| Klipper Webinterface: | | "
|
||||
echo -e "| 3) [Mainsail] | Webcam: | "
|
||||
echo -e "| 4) [Fluidd] | 8) [MJPG-Streamer] | "
|
||||
echo -e "| Klipper Webinterface: | 8) [PrettyGCode] | "
|
||||
echo -e "| 3) [Mainsail] | | "
|
||||
echo -e "| 4) [Fluidd] | Webcam: | "
|
||||
echo -e "| | 9) [MJPG-Streamer] | "
|
||||
echo -e "| | | "
|
||||
quit_footer
|
||||
}
|
||||
@@ -39,6 +40,8 @@ install_menu(){
|
||||
7)
|
||||
do_action "octoprint_setup_dialog" "install_ui";;
|
||||
8)
|
||||
do_action "install_pgc_for_klipper" "install_ui";;
|
||||
9)
|
||||
do_action "install_mjpg-streamer" "install_ui";;
|
||||
Q|q)
|
||||
clear; main_menu; break;;
|
||||
|
||||
@@ -13,10 +13,10 @@ remove_ui(){
|
||||
echo -e "| Klipper API: | Other: | "
|
||||
echo -e "| 2) [Moonraker] | 6) [Duet Web Control] | "
|
||||
echo -e "| | 7) [OctoPrint] | "
|
||||
echo -e "| Klipper Webinterface: | 8) [NGINX] | "
|
||||
echo -e "| 3) [Mainsail] | 9) [MJPG-Streamer] | "
|
||||
echo -e "| Klipper Webinterface: | 8) [MJPG-Streamer] | "
|
||||
echo -e "| 3) [Mainsail] | 9) [PrettyGCode] | "
|
||||
echo -e "| 4) [Fluidd] | | "
|
||||
echo -e "| | | "
|
||||
echo -e "| | 10) [NGINX] | "
|
||||
quit_footer
|
||||
}
|
||||
|
||||
@@ -40,9 +40,11 @@ remove_menu(){
|
||||
7)
|
||||
do_action "remove_octoprint" "remove_ui";;
|
||||
8)
|
||||
do_action "remove_nginx" "remove_ui";;
|
||||
9)
|
||||
do_action "remove_mjpg-streamer" "remove_ui";;
|
||||
9)
|
||||
do_action "remove_prettygcode" "remove_ui";;
|
||||
10)
|
||||
do_action "remove_nginx" "remove_ui";;
|
||||
Q|q)
|
||||
clear; main_menu; break;;
|
||||
*)
|
||||
|
||||
@@ -21,8 +21,9 @@ update_ui(){
|
||||
echo -e "| Other: |---------------|--------------| "
|
||||
echo -e "| 6) [DWC2-for-Klipper] | $LOCAL_DWC2FK_COMMIT | $REMOTE_DWC2FK_COMMIT | "
|
||||
echo -e "| 7) [DWC2 Web UI] | $DWC2_LOCAL_VER | $DWC2_REMOTE_VER | "
|
||||
echo -e "| 8) [PrettyGCode] | $LOCAL_PGC_COMMIT | $REMOTE_PGC_COMMIT | "
|
||||
echo -e "| |------------------------------| "
|
||||
echo -e "| 8) [System] | $DISPLAY_SYS_UPDATE | "
|
||||
echo -e "| 9) [System] | $DISPLAY_SYS_UPDATE | "
|
||||
quit_footer
|
||||
}
|
||||
|
||||
@@ -49,6 +50,8 @@ update_menu(){
|
||||
7)
|
||||
do_action "update_dwc2" "update_ui";;
|
||||
8)
|
||||
do_action "update_pgc_for_klipper" "update_ui";;
|
||||
9)
|
||||
do_action "update_system" "update_ui";;
|
||||
a)
|
||||
do_action "update_all" "update_ui";;
|
||||
|
||||
@@ -303,6 +303,13 @@ update_klipperscreen(){
|
||||
start_klipperscreen
|
||||
}
|
||||
|
||||
update_pgc_for_klipper(){
|
||||
PGC_DIR="${HOME}/pgcode"
|
||||
status_msg "Updating PrettyGCode for Klipper ..."
|
||||
cd $PGC_DIR && git pull
|
||||
ok_msg "Update complete!"
|
||||
}
|
||||
|
||||
update_system(){
|
||||
status_msg "Updating System ..."
|
||||
sudo apt-get update && sudo apt-get upgrade -y
|
||||
|
||||
Reference in New Issue
Block a user