refactor!: removing support for DWC
Signed-off-by: Dominik Willner th33xitus@gmail.com
This commit is contained in:
@@ -64,8 +64,6 @@ For more information or instructions to the various components KIAUH can install
|
|||||||
* 🌙[Moonraker](https://github.com/Arksine/moonraker) by [Arksine](https://github.com/Arksine)
|
* 🌙[Moonraker](https://github.com/Arksine/moonraker) by [Arksine](https://github.com/Arksine)
|
||||||
* 💨[Mainsail](https://github.com/mainsail-crew/mainsail) by [mainsail-crew](https://github.com/mainsail-crew)
|
* 💨[Mainsail](https://github.com/mainsail-crew/mainsail) by [mainsail-crew](https://github.com/mainsail-crew)
|
||||||
* 🌊[Fluidd](https://github.com/fluidd-core/fluidd) by [fluidd-core](https://github.com/fluidd-core)
|
* 🌊[Fluidd](https://github.com/fluidd-core/fluidd) by [fluidd-core](https://github.com/fluidd-core)
|
||||||
* 🕸️[Duet Web Control](https://github.com/Duet3D/DuetWebControl) by [Duet3D](https://github.com/Duet3D)
|
|
||||||
* 🕸️[DWC2-for-Klipper-Socket](https://github.com/Stephan3/dwc2-for-klipper-socket) by [Stephan3](https://github.com/Stephan3)
|
|
||||||
* 🖥️[KlipperScreen](https://github.com/jordanruthe/KlipperScreen) by [jordanruthe](https://github.com/jordanruthe)
|
* 🖥️[KlipperScreen](https://github.com/jordanruthe/KlipperScreen) by [jordanruthe](https://github.com/jordanruthe)
|
||||||
* 🐙[OctoPrint](https://github.com/OctoPrint/OctoPrint) by [OctoPrint](https://github.com/OctoPrint)
|
* 🐙[OctoPrint](https://github.com/OctoPrint/OctoPrint) by [OctoPrint](https://github.com/OctoPrint)
|
||||||
* 🔬[PrettyGCode](https://github.com/Kragrathea/pgcode) by [Kragrathea](https://github.com/Kragrathea)
|
* 🔬[PrettyGCode](https://github.com/Kragrathea/pgcode) by [Kragrathea](https://github.com/Kragrathea)
|
||||||
|
|||||||
@@ -114,9 +114,9 @@ Each service gets its corresponding instance added to the service filename.
|
|||||||
--> moonraker-2.service
|
--> moonraker-2.service
|
||||||
--> moonraker-n.service
|
--> moonraker-n.service
|
||||||
```
|
```
|
||||||
* The same service file rules from above apply to DWC and OctoPrint even though only Klipper and Moonraker are shown in this example.
|
* The same service file rules from above apply to OctoPrint even though only Klipper and Moonraker are shown in this example.
|
||||||
|
|
||||||
* You can start, stop and restart all Klipper, Moonraker, DWC and OctoPrint instances from the KIAUH main menu. For doing this, just type "stop klipper", "start moonraker", "restart octoprint" and so on.
|
* You can start, stop and restart all Klipper, Moonraker and OctoPrint instances from the KIAUH main menu. For doing this, just type "stop klipper", "start moonraker", "restart octoprint" and so on.
|
||||||
|
|
||||||
* KIAUH v3.0 relocated its ini-file. It is now a hidden file in the users home-directory calles `.kiauh.ini`. This has the benefit of keeping all values in that file between possible re-installations of KIAUH. Otherwise that file would be lost.
|
* KIAUH v3.0 relocated its ini-file. It is now a hidden file in the users home-directory calles `.kiauh.ini`. This has the benefit of keeping all values in that file between possible re-installations of KIAUH. Otherwise that file would be lost.
|
||||||
|
|
||||||
|
|||||||
@@ -16,13 +16,13 @@ That means:
|
|||||||
- adding the serial port `/tmp/printer`
|
- adding the serial port `/tmp/printer`
|
||||||
- set the behavior to "Cancel any ongoing prints but stay connected to the printer"
|
- set the behavior to "Cancel any ongoing prints but stay connected to the printer"
|
||||||
- **Enable/Disable OctoPrint Service:**\
|
- **Enable/Disable OctoPrint Service:**\
|
||||||
Usefull when using DWC2/Mainsail/Fluidd and OctoPrint at the same time to prevent them interfering with each other
|
Usefull when using Mainsail/Fluidd and OctoPrint at the same time to prevent them interfering with each other
|
||||||
|
|
||||||
- **Installing a G-Code Shell Command extension:**\
|
- **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)
|
For further information about that extension please see the [G-Code Shell Command Extension Doc](gcode_shell_command.md)
|
||||||
|
|
||||||
- **Uploading logfiles:**\
|
- **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.
|
You can directly upload logfiles like klippy.log and moonraker.log from the KIAUH main menu for providing them for troubleshooting purposes.
|
||||||
|
|
||||||
|
|
||||||
to be continued...
|
to be continued...
|
||||||
|
|||||||
@@ -1,26 +0,0 @@
|
|||||||
map $http_upgrade $connection_upgrade {
|
|
||||||
default upgrade;
|
|
||||||
'' close;
|
|
||||||
}
|
|
||||||
|
|
||||||
upstream dwc2 {
|
|
||||||
server 127.0.0.1:4750;
|
|
||||||
}
|
|
||||||
|
|
||||||
server {
|
|
||||||
listen 80;
|
|
||||||
#listen [::]:80;
|
|
||||||
|
|
||||||
location / {
|
|
||||||
proxy_pass http://dwc2/;
|
|
||||||
proxy_set_header Host $http_host;
|
|
||||||
proxy_set_header Upgrade $http_upgrade;
|
|
||||||
proxy_set_header Connection "upgrade";
|
|
||||||
proxy_set_header X-Real-IP $remote_addr;
|
|
||||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
||||||
proxy_set_header X-Scheme $scheme;
|
|
||||||
#proxy_set_header X-Script-Name /;
|
|
||||||
proxy_http_version 1.1;
|
|
||||||
client_max_body_size 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -115,20 +115,6 @@ function backup_klipper(){
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
function backup_dwc2(){
|
|
||||||
if [ -d "${DWC2FK_DIR}" ] && [ -d "${DWC_ENV_DIR}" ] && [ -d "${DWC2_DIR}" ]; then
|
|
||||||
status_msg "Creating DWC2 Web UI backup ..."
|
|
||||||
check_for_backup_dir
|
|
||||||
get_date
|
|
||||||
status_msg "Timestamp: ${current_date}"
|
|
||||||
mkdir -p "${BACKUP_DIR}/dwc2-backups/${current_date}"
|
|
||||||
cp -r "${DWC2FK_DIR}" "${_}" && cp -r "${DWC_ENV_DIR}" "${_}" && cp -r "${DWC2_DIR}" "${_}"
|
|
||||||
ok_msg "Backup complete!"
|
|
||||||
else
|
|
||||||
print_error "Can't backup dwc2-for-klipper-socket and/or dwc2 directory!\n Not found!"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
function backup_mainsail(){
|
function backup_mainsail(){
|
||||||
if [ -d "${MAINSAIL_DIR}" ]; then
|
if [ -d "${MAINSAIL_DIR}" ]; then
|
||||||
status_msg "Creating Mainsail backup ..."
|
status_msg "Creating Mainsail backup ..."
|
||||||
|
|||||||
@@ -1,54 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
# System startup script for dwc2-for-klipper-socket
|
|
||||||
|
|
||||||
### BEGIN INIT INFO
|
|
||||||
# Provides: dwc2-for-klipper-socket
|
|
||||||
# Required-Start: $local_fs
|
|
||||||
# Required-Stop:
|
|
||||||
# Default-Start: 2 3 4 5
|
|
||||||
# Default-Stop: 0 1 6
|
|
||||||
# Short-Description: dwc2-for-klipper-socket daemon
|
|
||||||
# Description: Starts the dwc2-for-klipper-socket daemon.
|
|
||||||
### END INIT INFO
|
|
||||||
|
|
||||||
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
|
|
||||||
DESC="dwc2-for-klipper-socket daemon"
|
|
||||||
NAME="dwc2-for-klipper-socket"
|
|
||||||
DEFAULTS_FILE=/etc/default/dwc
|
|
||||||
PIDFILE=/var/run/dwc.pid
|
|
||||||
|
|
||||||
. /lib/lsb/init-functions
|
|
||||||
|
|
||||||
# Read defaults file
|
|
||||||
[ -r $DEFAULTS_FILE ] && . $DEFAULTS_FILE
|
|
||||||
|
|
||||||
case "$1" in
|
|
||||||
start) log_daemon_msg "Starting dwc2-for-klipper-socket" $NAME
|
|
||||||
start-stop-daemon --start --quiet --exec $DWC_EXEC \
|
|
||||||
--background --pidfile $PIDFILE --make-pidfile \
|
|
||||||
--chuid $DWC_USER --user $DWC_USER \
|
|
||||||
-- $DWC_ARGS
|
|
||||||
log_end_msg $?
|
|
||||||
;;
|
|
||||||
stop) log_daemon_msg "Stopping dwc2-for-klipper-socket" $NAME
|
|
||||||
killproc -p $PIDFILE $DWC_EXEC
|
|
||||||
RETVAL=$?
|
|
||||||
[ $RETVAL -eq 0 ] && [ -e "$PIDFILE" ] && rm -f $PIDFILE
|
|
||||||
log_end_msg $RETVAL
|
|
||||||
;;
|
|
||||||
restart) log_daemon_msg "Restarting dwc2-for-klipper-socket" $NAME
|
|
||||||
$0 stop
|
|
||||||
$0 start
|
|
||||||
;;
|
|
||||||
reload|force-reload)
|
|
||||||
log_daemon_msg "Reloading configuration not supported" $NAME
|
|
||||||
log_end_msg 1
|
|
||||||
;;
|
|
||||||
status)
|
|
||||||
status_of_proc -p $PIDFILE $DWC_EXEC $NAME && exit 0 || exit $?
|
|
||||||
;;
|
|
||||||
*) log_action_msg "Usage: /etc/init.d/dwc {start|stop|status|restart|reload|force-reload}"
|
|
||||||
exit 2
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
exit 0
|
|
||||||
@@ -1,106 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
# This script installs dwc2-for-klipper-socket on a Raspberry Pi machine running
|
|
||||||
# Raspbian/Raspberry Pi OS based distributions.
|
|
||||||
|
|
||||||
# https://github.com/Stephan3/dwc2-for-klipper-socket.git
|
|
||||||
|
|
||||||
PYTHONDIR="${HOME}/dwc-env"
|
|
||||||
SYSTEMDDIR="/etc/systemd/system"
|
|
||||||
DWC_USER=${USER}
|
|
||||||
|
|
||||||
# Step 1: Verify Klipper has been installed
|
|
||||||
check_klipper()
|
|
||||||
{
|
|
||||||
if [ "$(systemctl list-units --full -all -t service --no-legend | grep -F "klipper.service")" ]; then
|
|
||||||
echo "Klipper service found!"
|
|
||||||
else
|
|
||||||
echo "Klipper service not found, please install Klipper first"
|
|
||||||
exit -1
|
|
||||||
fi
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
# Step 2: Install packages
|
|
||||||
install_packages()
|
|
||||||
{
|
|
||||||
PKGLIST="python3-virtualenv python3-dev python3-tornado"
|
|
||||||
|
|
||||||
# Update system package info
|
|
||||||
report_status "Running apt-get update..."
|
|
||||||
sudo apt-get update --allow-releaseinfo-change
|
|
||||||
|
|
||||||
# Install desired packages
|
|
||||||
report_status "Installing packages..."
|
|
||||||
sudo apt-get install --yes ${PKGLIST}
|
|
||||||
}
|
|
||||||
|
|
||||||
# Step 3: Create python virtual environment
|
|
||||||
create_virtualenv()
|
|
||||||
{
|
|
||||||
report_status "Updating python virtual environment..."
|
|
||||||
|
|
||||||
# Create virtualenv if it doesn't already exist
|
|
||||||
[ ! -d ${PYTHONDIR} ] && virtualenv -p /usr/bin/python3 ${PYTHONDIR}
|
|
||||||
|
|
||||||
# Install/update dependencies
|
|
||||||
${PYTHONDIR}/bin/pip install tornado==6.0.4
|
|
||||||
}
|
|
||||||
|
|
||||||
# Step 4: Install startup script
|
|
||||||
install_script(){
|
|
||||||
report_status "Installing system start script..."
|
|
||||||
sudo /bin/sh -c "cat > $SYSTEMDDIR/dwc.service" << EOF
|
|
||||||
#Systemd service file for DWC
|
|
||||||
[Unit]
|
|
||||||
Description=dwc_webif
|
|
||||||
After=network.target
|
|
||||||
|
|
||||||
[Install]
|
|
||||||
WantedBy=multi-user.target
|
|
||||||
|
|
||||||
[Service]
|
|
||||||
Type=simple
|
|
||||||
User=$DWC_USER
|
|
||||||
RemainAfterExit=yes
|
|
||||||
ExecStart=${PYTHONDIR}/bin/python3 ${SRCDIR}/web_dwc2.py
|
|
||||||
Restart=always
|
|
||||||
RestartSec=10
|
|
||||||
EOF
|
|
||||||
# Use systemctl to enable the klipper systemd service script
|
|
||||||
sudo systemctl enable dwc.service
|
|
||||||
}
|
|
||||||
|
|
||||||
# Step 5: Start DWC service
|
|
||||||
start_software()
|
|
||||||
{
|
|
||||||
report_status "Launching dwc2-for-klipper-socket..."
|
|
||||||
sudo systemctl start dwc
|
|
||||||
}
|
|
||||||
|
|
||||||
# Helper functions
|
|
||||||
report_status()
|
|
||||||
{
|
|
||||||
echo -e "\n\n###### $1"
|
|
||||||
}
|
|
||||||
|
|
||||||
verify_ready()
|
|
||||||
{
|
|
||||||
if [ "$EUID" -eq 0 ]; then
|
|
||||||
echo "This script must not run as root"
|
|
||||||
exit -1
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
# Force script to exit if an error occurs
|
|
||||||
set -e
|
|
||||||
|
|
||||||
# Find SRCDIR from the pathname of this script
|
|
||||||
SRCDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )"/.. && pwd )"
|
|
||||||
|
|
||||||
# Run installation steps defined above
|
|
||||||
verify_ready
|
|
||||||
check_klipper
|
|
||||||
install_packages
|
|
||||||
create_virtualenv
|
|
||||||
install_script
|
|
||||||
start_software
|
|
||||||
@@ -1,106 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
# This script installs dwc2-for-klipper-socket on a Raspberry Pi machine running
|
|
||||||
# Raspbian/Raspberry Pi OS based distributions.
|
|
||||||
|
|
||||||
# https://github.com/Stephan3/dwc2-for-klipper-socket.git
|
|
||||||
|
|
||||||
PYTHONDIR="${HOME}/dwc-env"
|
|
||||||
|
|
||||||
# Step 1: Verify Klipper has been installed
|
|
||||||
check_klipper()
|
|
||||||
{
|
|
||||||
if [ "$(systemctl list-units --full -all -t service --no-legend | grep -F "klipper.service")" ]; then
|
|
||||||
echo "Klipper service found!"
|
|
||||||
else
|
|
||||||
echo "Klipper service not found, please install Klipper first"
|
|
||||||
exit -1
|
|
||||||
fi
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
# Step 2: Install packages
|
|
||||||
install_packages()
|
|
||||||
{
|
|
||||||
PKGLIST="python3-virtualenv python3-dev python3-tornado"
|
|
||||||
|
|
||||||
# Update system package info
|
|
||||||
report_status "Running apt-get update..."
|
|
||||||
sudo apt-get update --allow-releaseinfo-change
|
|
||||||
|
|
||||||
# Install desired packages
|
|
||||||
report_status "Installing packages..."
|
|
||||||
sudo apt-get install --yes ${PKGLIST}
|
|
||||||
}
|
|
||||||
|
|
||||||
# Step 3: Create python virtual environment
|
|
||||||
create_virtualenv()
|
|
||||||
{
|
|
||||||
report_status "Updating python virtual environment..."
|
|
||||||
|
|
||||||
# Create virtualenv if it doesn't already exist
|
|
||||||
[ ! -d ${PYTHONDIR} ] && virtualenv -p /usr/bin/python3 ${PYTHONDIR}
|
|
||||||
|
|
||||||
# Install/update dependencies
|
|
||||||
${PYTHONDIR}/bin/pip install tornado==6.0.4
|
|
||||||
}
|
|
||||||
|
|
||||||
# Step 4: Install startup script
|
|
||||||
install_script(){
|
|
||||||
report_status "Installing system start script..."
|
|
||||||
sudo cp "${SRCDIR}/scripts/dwc-start.sh" /etc/init.d/dwc
|
|
||||||
sudo update-rc.d dwc defaults
|
|
||||||
}
|
|
||||||
|
|
||||||
# Step 5: Install startup script config
|
|
||||||
install_config(){
|
|
||||||
DEFAULTS_FILE=/etc/default/dwc
|
|
||||||
[ -f $DEFAULTS_FILE ] && return
|
|
||||||
|
|
||||||
report_status "Installing system start configuration..."
|
|
||||||
sudo /bin/sh -c "cat > $DEFAULTS_FILE" <<EOF
|
|
||||||
# Configuration for /etc/init.d/dwc
|
|
||||||
DWC_USER=$USER
|
|
||||||
|
|
||||||
DWC_EXEC=${PYTHONDIR}/bin/python3
|
|
||||||
|
|
||||||
DWC_ARGS="${SRCDIR}/web_dwc2.py"
|
|
||||||
EOF
|
|
||||||
}
|
|
||||||
|
|
||||||
# Step 4: Start server
|
|
||||||
start_software()
|
|
||||||
{
|
|
||||||
report_status "Launching dwc2-for-klipper-socket..."
|
|
||||||
sudo /etc/init.d/klipper stop
|
|
||||||
sudo /etc/init.d/dwc restart
|
|
||||||
sudo /etc/init.d/klipper start
|
|
||||||
}
|
|
||||||
|
|
||||||
# Helper functions
|
|
||||||
report_status()
|
|
||||||
{
|
|
||||||
echo -e "\n\n###### $1"
|
|
||||||
}
|
|
||||||
|
|
||||||
verify_ready()
|
|
||||||
{
|
|
||||||
if [ "$EUID" -eq 0 ]; then
|
|
||||||
echo "This script must not run as root"
|
|
||||||
exit -1
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
# Force script to exit if an error occurs
|
|
||||||
set -e
|
|
||||||
|
|
||||||
# Find SRCDIR from the pathname of this script
|
|
||||||
SRCDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )"/.. && pwd )"
|
|
||||||
|
|
||||||
# Run installation steps defined above
|
|
||||||
verify_ready
|
|
||||||
check_klipper
|
|
||||||
install_packages
|
|
||||||
create_virtualenv
|
|
||||||
install_script
|
|
||||||
install_config
|
|
||||||
start_software
|
|
||||||
@@ -1,41 +0,0 @@
|
|||||||
stop_service() {
|
|
||||||
# Stop DWC Service
|
|
||||||
echo "#### Stopping DWC Service.."
|
|
||||||
sudo systemctl stop dwc
|
|
||||||
sudo systemctl disable dwc
|
|
||||||
}
|
|
||||||
|
|
||||||
remove_service() {
|
|
||||||
# Remove DWC from Services
|
|
||||||
echo
|
|
||||||
echo "#### Removing DWC Service.."
|
|
||||||
sudo rm -f /etc/systemd/system/dwc.service
|
|
||||||
sudo systemctl daemon-reload
|
|
||||||
}
|
|
||||||
|
|
||||||
remove_files() {
|
|
||||||
# Remove virtualenv
|
|
||||||
if [ -d ~/dwc-env ]; then
|
|
||||||
echo "Removing virtualenv..."
|
|
||||||
rm -rf ~/dwc-env
|
|
||||||
else
|
|
||||||
echo "No DWC virtualenv found"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Notify user of method to remove DWC source code
|
|
||||||
echo
|
|
||||||
echo "The DWC system files and virtualenv have been removed."
|
|
||||||
}
|
|
||||||
|
|
||||||
verify_ready()
|
|
||||||
{
|
|
||||||
if [ "$EUID" -eq 0 ]; then
|
|
||||||
echo "This script must not run as root"
|
|
||||||
exit -1
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
verify_ready
|
|
||||||
stop_service
|
|
||||||
remove_service
|
|
||||||
remove_files
|
|
||||||
@@ -1,45 +0,0 @@
|
|||||||
stop_service() {
|
|
||||||
# Stop DWC Service
|
|
||||||
echo "#### Stopping DWC Service.."
|
|
||||||
sudo service dwc stop
|
|
||||||
}
|
|
||||||
|
|
||||||
remove_service() {
|
|
||||||
# Remove DWC from Startup
|
|
||||||
echo
|
|
||||||
echo "#### Removing DWC from Startup.."
|
|
||||||
sudo update-rc.d -f dwc remove
|
|
||||||
|
|
||||||
# Remove DWC from Services
|
|
||||||
echo
|
|
||||||
echo "#### Removing DWC Service.."
|
|
||||||
sudo rm -f /etc/init.d/dwc /etc/default/dwc
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
remove_files() {
|
|
||||||
# Remove virtualenv
|
|
||||||
if [ -d ~/dwc-env ]; then
|
|
||||||
echo "Removing virtualenv..."
|
|
||||||
rm -rf ~/dwc-env
|
|
||||||
else
|
|
||||||
echo "No DWC virtualenv found"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Notify user of method to remove DWC source code
|
|
||||||
echo
|
|
||||||
echo "The DWC system files and virtualenv have been removed."
|
|
||||||
}
|
|
||||||
|
|
||||||
verify_ready()
|
|
||||||
{
|
|
||||||
if [ "$EUID" -eq 0 ]; then
|
|
||||||
echo "This script must not run as root"
|
|
||||||
exit -1
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
verify_ready
|
|
||||||
stop_service
|
|
||||||
remove_service
|
|
||||||
remove_files
|
|
||||||
593
scripts/dwc2.sh
593
scripts/dwc2.sh
@@ -1,593 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
#=======================================================================#
|
|
||||||
# Copyright (C) 2020 - 2022 Dominik Willner <th33xitus@gmail.com> #
|
|
||||||
# #
|
|
||||||
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
|
||||||
# https://github.com/th33xitus/kiauh #
|
|
||||||
# #
|
|
||||||
# This file may be distributed under the terms of the GNU GPLv3 license #
|
|
||||||
#=======================================================================#
|
|
||||||
|
|
||||||
set -e
|
|
||||||
|
|
||||||
### global variables
|
|
||||||
SYSTEMD="/etc/systemd/system"
|
|
||||||
DWC_ENV_DIR=${HOME}/dwc-env
|
|
||||||
DWC2FK_DIR=${HOME}/dwc2-for-klipper-socket
|
|
||||||
DWC2_DIR=${HOME}/duetwebcontrol
|
|
||||||
DWC2FK_REPO=https://github.com/Stephan3/dwc2-for-klipper-socket.git
|
|
||||||
|
|
||||||
#=================================================#
|
|
||||||
#================= INSTALL DWC2 ==================#
|
|
||||||
#=================================================#
|
|
||||||
|
|
||||||
system_check_dwc(){
|
|
||||||
### check system for an installed octoprint service
|
|
||||||
if systemctl is-enabled octoprint.service -q 2>/dev/null; then
|
|
||||||
OCTOPRINT_ENABLED="true"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
dwc_setup_dialog(){
|
|
||||||
status_msg "Initializing Duet Web Control installation ..."
|
|
||||||
|
|
||||||
### check system for several requirements before initializing the dwc2 installation
|
|
||||||
system_check_dwc
|
|
||||||
|
|
||||||
### check for existing klipper service installations
|
|
||||||
if [ ! "$(systemctl list-units --full -all -t service --no-legend | grep -F "klipper.service")" ] && [ ! "$(systemctl list-units --full -all -t service --no-legend | grep -E "klipper-[[:digit:]].service")" ]; then
|
|
||||||
ERROR_MSG="Klipper service not found, please install Klipper first!" && return 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
### count amount of klipper services
|
|
||||||
if [ "$(systemctl list-units --full -all -t service --no-legend | grep -F "klipper.service")" ]; then
|
|
||||||
INSTANCE_COUNT=1
|
|
||||||
else
|
|
||||||
INSTANCE_COUNT=$(systemctl list-units --full -all -t service --no-legend | grep -E "klipper-[[:digit:]].service" | wc -l)
|
|
||||||
fi
|
|
||||||
|
|
||||||
### initial config path check
|
|
||||||
check_klipper_cfg_path
|
|
||||||
|
|
||||||
### ask user how to handle OctoPrint, Haproxy and Lighttpd
|
|
||||||
process_octoprint_dialog_dwc2
|
|
||||||
process_services_dialog
|
|
||||||
|
|
||||||
### instance confirmation dialog
|
|
||||||
while true; do
|
|
||||||
echo
|
|
||||||
top_border
|
|
||||||
if [ "$INSTANCE_COUNT" -gt 1 ]; then
|
|
||||||
printf "|%-55s|\n" " $INSTANCE_COUNT Klipper instances were found!"
|
|
||||||
else
|
|
||||||
echo -e "| 1 Klipper instance was found! | "
|
|
||||||
fi
|
|
||||||
echo -e "| You need one DWC instance per Klipper instance. | "
|
|
||||||
bottom_border
|
|
||||||
echo
|
|
||||||
read -p "${cyan}###### Create $INSTANCE_COUNT DWC instances? (Y/n):${default} " yn
|
|
||||||
case "$yn" in
|
|
||||||
Y|y|Yes|yes|"")
|
|
||||||
echo -e "###### > Yes"
|
|
||||||
status_msg "Creating $INSTANCE_COUNT DWC instances ..."
|
|
||||||
dwc_setup
|
|
||||||
break;;
|
|
||||||
N|n|No|no)
|
|
||||||
echo -e "###### > No"
|
|
||||||
warn_msg "Exiting DWC setup ..."
|
|
||||||
echo
|
|
||||||
break;;
|
|
||||||
*)
|
|
||||||
print_unkown_cmd
|
|
||||||
print_msg && clear_msg;;
|
|
||||||
esac
|
|
||||||
done
|
|
||||||
}
|
|
||||||
|
|
||||||
###TODO for future: should be some kind of shared function between moonraker and this installer, since it does the same
|
|
||||||
process_octoprint_dialog_dwc2(){
|
|
||||||
### ask user to disable octoprint when its service was found
|
|
||||||
if [ "$OCTOPRINT_ENABLED" = "true" ]; then
|
|
||||||
while true; do
|
|
||||||
echo
|
|
||||||
top_border
|
|
||||||
echo -e "| ${red}!!! WARNING - OctoPrint service found !!!${default} |"
|
|
||||||
hr
|
|
||||||
echo -e "| You might consider disabling the OctoPrint service, |"
|
|
||||||
echo -e "| since an active OctoPrint service may lead to unex- |"
|
|
||||||
echo -e "| pected behavior of Duet Web Control for Klipper. |"
|
|
||||||
bottom_border
|
|
||||||
read -p "${cyan}###### Do you want to disable OctoPrint now? (Y/n):${default} " yn
|
|
||||||
case "$yn" in
|
|
||||||
Y|y|Yes|yes|"")
|
|
||||||
echo -e "###### > Yes"
|
|
||||||
status_msg "Stopping OctoPrint ..."
|
|
||||||
sudo systemctl stop octoprint && ok_msg "OctoPrint service stopped!"
|
|
||||||
status_msg "Disabling OctoPrint ..."
|
|
||||||
sudo systemctl disable octoprint && ok_msg "OctoPrint service disabled!"
|
|
||||||
break;;
|
|
||||||
N|n|No|no)
|
|
||||||
echo -e "###### > No"
|
|
||||||
break;;
|
|
||||||
*)
|
|
||||||
print_unkown_cmd
|
|
||||||
print_msg && clear_msg;;
|
|
||||||
esac
|
|
||||||
done
|
|
||||||
fi
|
|
||||||
status_msg "Installation will start now! Please wait ..."
|
|
||||||
}
|
|
||||||
|
|
||||||
#############################################################
|
|
||||||
#############################################################
|
|
||||||
|
|
||||||
get_dwc_ver(){
|
|
||||||
DWC2_VERSION=$(curl -s https://api.github.com/repositories/28820678/releases/latest | grep tag_name | cut -d'"' -f4)
|
|
||||||
}
|
|
||||||
|
|
||||||
dwc_setup(){
|
|
||||||
### get printer config directory
|
|
||||||
source_kiauh_ini
|
|
||||||
DWC_CONF_LOC="$klipper_cfg_loc"
|
|
||||||
|
|
||||||
### check dependencies
|
|
||||||
dep=(git wget gzip tar curl)
|
|
||||||
dependency_check
|
|
||||||
|
|
||||||
### step 1: get dwc2-for-klipper
|
|
||||||
status_msg "Downloading DWC2-for-Klipper-Socket ..."
|
|
||||||
cd "${HOME}" && git clone "$DWC2FK_REPO"
|
|
||||||
ok_msg "Download complete!"
|
|
||||||
|
|
||||||
### step 2: install dwc2 dependencies and create python virtualenv
|
|
||||||
status_msg "Installing dependencies ..."
|
|
||||||
install_dwc_packages
|
|
||||||
create_dwc_virtualenv
|
|
||||||
|
|
||||||
### step 3: create dwc2.cfg folder and dwc2.cfg
|
|
||||||
[ ! -d "$DWC_CONF_LOC" ] && mkdir -p "$DWC_CONF_LOC"
|
|
||||||
dwc_cfg_creation
|
|
||||||
|
|
||||||
### step 4: download Duet Web Control
|
|
||||||
download_dwc_webui
|
|
||||||
|
|
||||||
### step 5: create dwc instances
|
|
||||||
INSTANCE=1
|
|
||||||
if [ "$INSTANCE_COUNT" -eq $INSTANCE ]; then
|
|
||||||
create_single_dwc_instance
|
|
||||||
else
|
|
||||||
#create_multi_dwc_instance
|
|
||||||
create_multi_dwc_instance
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
download_dwc_webui(){
|
|
||||||
#get Duet Web Control
|
|
||||||
GET_DWC2_URL=$(curl -s https://api.github.com/repositories/28820678/releases/latest | grep browser_download_url | cut -d'"' -f4)
|
|
||||||
status_msg "Downloading DWC2 Web UI ..."
|
|
||||||
[ ! -d "$DWC2_DIR" ] && mkdir -p "$DWC2_DIR"
|
|
||||||
cd "$DWC2_DIR" && wget "$GET_DWC2_URL"
|
|
||||||
ok_msg "Download complete!"
|
|
||||||
status_msg "Extracting archive ..."
|
|
||||||
unzip -q -o *.zip
|
|
||||||
for f_ in $(find . | grep '.gz')
|
|
||||||
do
|
|
||||||
gunzip -f "${f_}"
|
|
||||||
done
|
|
||||||
ok_msg "Done!"
|
|
||||||
status_msg "Writing DWC version to file ..."
|
|
||||||
echo "$GET_DWC2_URL" | cut -d/ -f8 > "$DWC2_DIR/.version"
|
|
||||||
ok_msg "Done!"
|
|
||||||
status_msg "Remove downloaded archive ..."
|
|
||||||
rm -rf *.zip && ok_msg "Done!" && ok_msg "Duet Web Control installed!"
|
|
||||||
}
|
|
||||||
|
|
||||||
##############################################################################################
|
|
||||||
#********************************************************************************************#
|
|
||||||
##############################################################################################
|
|
||||||
|
|
||||||
install_dwc_packages()
|
|
||||||
{
|
|
||||||
PKGLIST="python3-virtualenv python3-dev python3-tornado"
|
|
||||||
|
|
||||||
# Update system package info
|
|
||||||
status_msg "Running apt-get update..."
|
|
||||||
sudo apt-get update --allow-releaseinfo-change
|
|
||||||
|
|
||||||
# Install desired packages
|
|
||||||
status_msg "Installing packages..."
|
|
||||||
sudo apt-get install --yes "${PKGLIST}"
|
|
||||||
}
|
|
||||||
|
|
||||||
create_dwc_virtualenv()
|
|
||||||
{
|
|
||||||
status_msg "Installing python virtual environment..."
|
|
||||||
|
|
||||||
# Create virtualenv if it doesn't already exist
|
|
||||||
[ ! -d "${DWC_ENV}" ] && virtualenv -p /usr/bin/python3 "${DWC_ENV}"
|
|
||||||
|
|
||||||
# Install/update dependencies
|
|
||||||
"${DWC_ENV}"/bin/pip install tornado==6.0.4
|
|
||||||
}
|
|
||||||
|
|
||||||
create_single_dwc_startscript(){
|
|
||||||
### create systemd service file
|
|
||||||
sudo /bin/sh -c "cat > ${SYSTEMDDIR}/dwc.service" << DWC
|
|
||||||
[Unit]
|
|
||||||
Description=DuetWebControl
|
|
||||||
After=network.target
|
|
||||||
[Install]
|
|
||||||
WantedBy=multi-user.target
|
|
||||||
[Service]
|
|
||||||
Type=simple
|
|
||||||
User=${USER}
|
|
||||||
RemainAfterExit=yes
|
|
||||||
ExecStart=${DWC_ENV}/bin/python3 ${DWC2FK_DIR}/web_dwc2.py -l ${DWC_LOG} -c ${DWC_CFG}
|
|
||||||
Restart=always
|
|
||||||
RestartSec=10
|
|
||||||
DWC
|
|
||||||
}
|
|
||||||
|
|
||||||
create_multi_dwc_startscript(){
|
|
||||||
### create systemd service file
|
|
||||||
sudo /bin/sh -c "cat > ${SYSTEMDDIR}/dwc-$INSTANCE.service" << DWC
|
|
||||||
[Unit]
|
|
||||||
Description=DuetWebControl
|
|
||||||
After=network.target
|
|
||||||
[Install]
|
|
||||||
WantedBy=multi-user.target
|
|
||||||
[Service]
|
|
||||||
Type=simple
|
|
||||||
User=${USER}
|
|
||||||
RemainAfterExit=yes
|
|
||||||
ExecStart=${DWC_ENV}/bin/python3 ${DWC2FK_DIR}/web_dwc2.py -l ${DWC_LOG} -c ${DWC_CFG}
|
|
||||||
Restart=always
|
|
||||||
RestartSec=10
|
|
||||||
DWC
|
|
||||||
}
|
|
||||||
|
|
||||||
create_single_dwcfk_cfg(){
|
|
||||||
### create single instance config file
|
|
||||||
/bin/sh -c "cat > $DWC_CONF_LOC/dwc2.cfg" << DWCCFG
|
|
||||||
[webserver]
|
|
||||||
listen_adress: 0.0.0.0
|
|
||||||
web_root: ${HOME}/duetwebcontrol
|
|
||||||
port: ${PORT}
|
|
||||||
|
|
||||||
[reply_filters]
|
|
||||||
regex:
|
|
||||||
max_accel: \d+.\d+
|
|
||||||
max_accel_to_decel: \d+.\d+
|
|
||||||
square_corner_velocity: \d+.\d+
|
|
||||||
max_velocity: \d+.\d+
|
|
||||||
DWCCFG
|
|
||||||
}
|
|
||||||
|
|
||||||
create_multi_dwcfk_cfg(){
|
|
||||||
### create single instance config file
|
|
||||||
/bin/sh -c "cat > $DWC_CONF_LOC/printer_$INSTANCE/dwc2.cfg" << DWCCFG
|
|
||||||
[webserver]
|
|
||||||
listen_adress: 0.0.0.0
|
|
||||||
web_root: ${HOME}/duetwebcontrol
|
|
||||||
port: ${PORT}
|
|
||||||
|
|
||||||
[reply_filters]
|
|
||||||
regex:
|
|
||||||
max_accel: \d+.\d+
|
|
||||||
max_accel_to_decel: \d+.\d+
|
|
||||||
square_corner_velocity: \d+.\d+
|
|
||||||
max_velocity: \d+.\d+
|
|
||||||
DWCCFG
|
|
||||||
}
|
|
||||||
|
|
||||||
##############################################################################################
|
|
||||||
#********************************************************************************************#
|
|
||||||
##############################################################################################
|
|
||||||
|
|
||||||
print_dwc_ip_list(){
|
|
||||||
i=1
|
|
||||||
for ip in ${dwc_ip_list[@]}; do
|
|
||||||
echo -e " ${cyan}● Instance $i:${default} $ip"
|
|
||||||
i=$((i + 1))
|
|
||||||
done
|
|
||||||
}
|
|
||||||
|
|
||||||
create_single_dwc_instance(){
|
|
||||||
status_msg "Setting up 1 Duet Web Control instance ..."
|
|
||||||
|
|
||||||
### single instance variables
|
|
||||||
DWC_LOG=/tmp/dwc.log
|
|
||||||
DWC_CFG="$DWC_CONF_LOC/dwc2.cfg"
|
|
||||||
|
|
||||||
### create instance
|
|
||||||
status_msg "Creating single DWC instance ..."
|
|
||||||
create_single_dwc_startscript
|
|
||||||
|
|
||||||
### enable instance
|
|
||||||
sudo systemctl enable dwc.service
|
|
||||||
ok_msg "Single DWC instance created!"
|
|
||||||
|
|
||||||
### launching instance
|
|
||||||
status_msg "Launching DWC instance ..."
|
|
||||||
sudo systemctl start dwc
|
|
||||||
|
|
||||||
### confirm message
|
|
||||||
CONFIRM_MSG="Single DWC instance has been set up!"
|
|
||||||
print_msg && clear_msg
|
|
||||||
|
|
||||||
### display moonraker ip to the user
|
|
||||||
print_dwc_ip_list; echo
|
|
||||||
}
|
|
||||||
|
|
||||||
create_multi_dwc_instance(){
|
|
||||||
status_msg "Setting up $INSTANCE_COUNT instances of Duet Web Control ..."
|
|
||||||
while [ $INSTANCE -le "$INSTANCE_COUNT" ]; do
|
|
||||||
### multi instance variables
|
|
||||||
DWC_LOG=/tmp/dwc-$INSTANCE.log
|
|
||||||
DWC_CFG="$DWC_CONF_LOC/printer_$INSTANCE/dwc2.cfg"
|
|
||||||
|
|
||||||
### create instance
|
|
||||||
status_msg "Creating instance #$INSTANCE ..."
|
|
||||||
create_multi_dwc_startscript
|
|
||||||
|
|
||||||
### enable instance
|
|
||||||
sudo systemctl enable dwc-$INSTANCE.service
|
|
||||||
ok_msg "DWC instance $INSTANCE created!"
|
|
||||||
|
|
||||||
### launching instance
|
|
||||||
status_msg "Launching DWC instance $INSTANCE ..."
|
|
||||||
sudo systemctl start dwc-$INSTANCE
|
|
||||||
|
|
||||||
### instance counter +1
|
|
||||||
INSTANCE=$(expr $INSTANCE + 1)
|
|
||||||
done
|
|
||||||
|
|
||||||
### confirm message
|
|
||||||
CONFIRM_MSG="$INSTANCE_COUNT DWC instances has been set up!"
|
|
||||||
print_msg && clear_msg
|
|
||||||
|
|
||||||
### display moonraker ip to the user
|
|
||||||
print_dwc_ip_list; echo
|
|
||||||
}
|
|
||||||
|
|
||||||
dwc_cfg_creation(){
|
|
||||||
### default dwc port
|
|
||||||
DEFAULT_PORT=4750
|
|
||||||
|
|
||||||
### get printer config directory
|
|
||||||
source_kiauh_ini
|
|
||||||
DWC_CONF_LOC="$klipper_cfg_loc"
|
|
||||||
|
|
||||||
### reset instances back to 1 again
|
|
||||||
INSTANCE=1
|
|
||||||
|
|
||||||
### declare empty array for ips which get displayed to the user at the end of the setup
|
|
||||||
HOSTNAME=$(hostname -I | cut -d" " -f1)
|
|
||||||
dwc_ip_list=()
|
|
||||||
|
|
||||||
### create single instance dwc2.cfg file
|
|
||||||
if [ "$INSTANCE_COUNT" -eq $INSTANCE ]; then
|
|
||||||
### set port
|
|
||||||
PORT=$DEFAULT_PORT
|
|
||||||
|
|
||||||
### write the ip and port to the ip list for displaying it later to the user
|
|
||||||
dwc_ip_list+=("$HOSTNAME:$PORT")
|
|
||||||
|
|
||||||
status_msg "Creating dwc2.cfg in $DWC_CONF_LOC"
|
|
||||||
[ ! -d "$DWC_CONF_LOC" ] && mkdir -p "$DWC_CONF_LOC"
|
|
||||||
if [ ! -f "$DWC_CONF_LOC/dwc2.cfg" ]; then
|
|
||||||
create_single_dwcfk_cfg && ok_msg "dwc2.cfg created!"
|
|
||||||
else
|
|
||||||
warn_msg "There is already a file called 'dwc2.cfg'!"
|
|
||||||
warn_msg "Skipping..."
|
|
||||||
fi
|
|
||||||
|
|
||||||
### create multi instance moonraker.conf files
|
|
||||||
else
|
|
||||||
while [ $INSTANCE -le "$INSTANCE_COUNT" ]; do
|
|
||||||
### set each instance to its own port
|
|
||||||
PORT=$(expr $DEFAULT_PORT + $INSTANCE - 1)
|
|
||||||
|
|
||||||
### write the ip and port to the ip list for displaying it later to the user
|
|
||||||
dwc_ip_list+=("$HOSTNAME:$PORT")
|
|
||||||
|
|
||||||
### start the creation of each instance
|
|
||||||
status_msg "Creating dwc2.cfg for instance #$INSTANCE"
|
|
||||||
[ ! -d "$DWC_CONF_LOC/printer_$INSTANCE" ] && mkdir -p "$DWC_CONF_LOC/printer_$INSTANCE"
|
|
||||||
if [ ! -f "$DWC_CONF_LOC/printer_$INSTANCE/dwc2.cfg" ]; then
|
|
||||||
create_multi_dwcfk_cfg && ok_msg "dwc2.cfg created!"
|
|
||||||
else
|
|
||||||
warn_msg "There is already a file called 'dwc2.cfg'!"
|
|
||||||
warn_msg "Skipping..."
|
|
||||||
fi
|
|
||||||
|
|
||||||
### raise instance counter by 1
|
|
||||||
INSTANCE=$(expr $INSTANCE + 1)
|
|
||||||
done
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
#=================================================#
|
|
||||||
#================= REMOVE DWC2 ===================#
|
|
||||||
#=================================================#
|
|
||||||
|
|
||||||
remove_dwc2(){
|
|
||||||
### remove "legacy" init.d service
|
|
||||||
if [ -e /etc/init.d/dwc ]; then
|
|
||||||
status_msg "Removing DWC2-for-Klipper-Socket Service ..."
|
|
||||||
sudo systemctl stop dwc
|
|
||||||
sudo update-rc.d -f dwc remove
|
|
||||||
sudo rm -f /etc/init.d/dwc
|
|
||||||
sudo rm -f /etc/default/dwc
|
|
||||||
ok_msg "DWC2-for-Klipper-Socket Service removed!"
|
|
||||||
fi
|
|
||||||
|
|
||||||
### remove all dwc services
|
|
||||||
if ls /etc/systemd/system/dwc*.service 2>/dev/null 1>&2; then
|
|
||||||
status_msg "Removing DWC2-for-Klipper-Socket Services ..."
|
|
||||||
for service in $(ls /etc/systemd/system/dwc*.service | cut -d"/" -f5)
|
|
||||||
do
|
|
||||||
status_msg "Removing $service ..."
|
|
||||||
sudo systemctl stop $service
|
|
||||||
sudo systemctl disable $service
|
|
||||||
sudo rm -f $SYSTEMDDIR/$service
|
|
||||||
ok_msg "Done!"
|
|
||||||
done
|
|
||||||
### reloading units
|
|
||||||
sudo systemctl daemon-reload
|
|
||||||
sudo systemctl reset-failed
|
|
||||||
ok_msg "DWC2-for-Klipper-Socket Service removed!"
|
|
||||||
fi
|
|
||||||
|
|
||||||
### remove all logfiles
|
|
||||||
if ls /tmp/dwc*.log 2>/dev/null 1>&2; then
|
|
||||||
for logfile in $(ls /tmp/dwc*.log)
|
|
||||||
do
|
|
||||||
status_msg "Removing $logfile ..."
|
|
||||||
rm -f $logfile
|
|
||||||
ok_msg "File '$logfile' removed!"
|
|
||||||
done
|
|
||||||
fi
|
|
||||||
|
|
||||||
### removing the rest of the folders
|
|
||||||
if [ -d $DWC2FK_DIR ]; then
|
|
||||||
status_msg "Removing DWC2-for-Klipper-Socket directory ..."
|
|
||||||
rm -rf $DWC2FK_DIR && ok_msg "Directory removed!"
|
|
||||||
fi
|
|
||||||
if [ -d $DWC_ENV_DIR ]; then
|
|
||||||
status_msg "Removing DWC2-for-Klipper-Socket virtualenv ..."
|
|
||||||
rm -rf $DWC_ENV_DIR && ok_msg "Directory removed!"
|
|
||||||
fi
|
|
||||||
if [ -d $DWC2_DIR ]; then
|
|
||||||
status_msg "Removing DWC2 directory ..."
|
|
||||||
rm -rf $DWC2_DIR && ok_msg "Directory removed!"
|
|
||||||
fi
|
|
||||||
|
|
||||||
### remove dwc2_port from ~/.kiauh.ini
|
|
||||||
sed -i "/^dwc2_port=/d" $INI_FILE
|
|
||||||
|
|
||||||
CONFIRM_MSG=" DWC2-for-Klipper-Socket was successfully removed!"
|
|
||||||
}
|
|
||||||
|
|
||||||
#=================================================#
|
|
||||||
#================= UPDATE DWC2 ===================#
|
|
||||||
#=================================================#
|
|
||||||
|
|
||||||
update_dwc2fk(){
|
|
||||||
do_action_service "stop" "dwc"
|
|
||||||
bb4u "dwc2"
|
|
||||||
if [ ! -d $DWC2FK_DIR ]; then
|
|
||||||
cd ${HOME} && git clone $DWC2FK_REPO
|
|
||||||
else
|
|
||||||
cd $DWC2FK_DIR && git pull
|
|
||||||
fi
|
|
||||||
do_action_service "start" "dwc"
|
|
||||||
}
|
|
||||||
|
|
||||||
update_dwc2(){
|
|
||||||
bb4u "dwc2"
|
|
||||||
download_dwc_webui
|
|
||||||
}
|
|
||||||
|
|
||||||
#=================================================#
|
|
||||||
#================= DWC2 STATUS ===================#
|
|
||||||
#=================================================#
|
|
||||||
|
|
||||||
dwc2_status(){
|
|
||||||
dcount=0
|
|
||||||
dwc_data=(
|
|
||||||
SERVICE
|
|
||||||
$DWC2_DIR
|
|
||||||
$DWC2FK_DIR
|
|
||||||
$DWC_ENV_DIR
|
|
||||||
)
|
|
||||||
|
|
||||||
### count amount of dwc service files in /etc/systemd/system
|
|
||||||
SERVICE_FILE_COUNT=$(ls /etc/systemd/system | grep -E "^dwc(\-[[:digit:]]+)?\.service$" | wc -l)
|
|
||||||
|
|
||||||
### remove the "SERVICE" entry from the dwc_data array if a dwc service is installed
|
|
||||||
[ $SERVICE_FILE_COUNT -gt 0 ] && unset dwc_data[0]
|
|
||||||
|
|
||||||
#count+1 for each found data-item from array
|
|
||||||
for dd in "${dwc_data[@]}"
|
|
||||||
do
|
|
||||||
if [ -e $dd ]; then
|
|
||||||
dcount=$(expr $dcount + 1)
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
if [ "$dcount" == "${#dwc_data[*]}" ]; then
|
|
||||||
DWC2_STATUS="$(printf "${green}Installed: %-5s${default}" $SERVICE_FILE_COUNT)"
|
|
||||||
elif [ "$dcount" == 0 ]; then
|
|
||||||
DWC2_STATUS="${red}Not installed!${default} "
|
|
||||||
else
|
|
||||||
DWC2_STATUS="${yellow}Incomplete!${default} "
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
read_dwc2fk_versions(){
|
|
||||||
if [ -d $DWC2FK_DIR ] && [ -d $DWC2FK_DIR/.git ]; then
|
|
||||||
cd $DWC2FK_DIR
|
|
||||||
git fetch origin master -q
|
|
||||||
LOCAL_DWC2FK_COMMIT=$(git describe HEAD --always --tags | cut -d "-" -f 1,2)
|
|
||||||
REMOTE_DWC2FK_COMMIT=$(git describe origin/master --always --tags | cut -d "-" -f 1,2)
|
|
||||||
else
|
|
||||||
LOCAL_DWC2FK_COMMIT=$NONE
|
|
||||||
REMOTE_DWC2FK_COMMIT=$NONE
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
compare_dwc2fk_versions(){
|
|
||||||
unset DWC2FK_UPDATE_AVAIL
|
|
||||||
read_dwc2fk_versions
|
|
||||||
if [ "$LOCAL_DWC2FK_COMMIT" != "$REMOTE_DWC2FK_COMMIT" ]; then
|
|
||||||
LOCAL_DWC2FK_COMMIT="${yellow}$(printf "%-12s" "$LOCAL_DWC2FK_COMMIT")${default}"
|
|
||||||
REMOTE_DWC2FK_COMMIT="${green}$(printf "%-12s" "$REMOTE_DWC2FK_COMMIT")${default}"
|
|
||||||
# add dwc2fk to the update all array for the update all function in the updater
|
|
||||||
DWC2FK_UPDATE_AVAIL="true" && update_arr+=(update_dwc2fk)
|
|
||||||
else
|
|
||||||
LOCAL_DWC2FK_COMMIT="${green}$(printf "%-12s" "$LOCAL_DWC2FK_COMMIT")${default}"
|
|
||||||
REMOTE_DWC2FK_COMMIT="${green}$(printf "%-12s" "$REMOTE_DWC2FK_COMMIT")${default}"
|
|
||||||
DWC2FK_UPDATE_AVAIL="false"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
read_local_dwc2_version(){
|
|
||||||
unset DWC2_VER_FOUND
|
|
||||||
if [ -e $DWC2_DIR/.version ]; then
|
|
||||||
DWC2_VER_FOUND="true"
|
|
||||||
DWC2_LOCAL_VER=$(head -n 1 $DWC2_DIR/.version)
|
|
||||||
else
|
|
||||||
DWC2_VER_FOUND="false" && unset DWC2_LOCAL_VER
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
read_remote_dwc2_version(){
|
|
||||||
#remote checks don't work without curl installed!
|
|
||||||
if [[ ! $(dpkg-query -f'${Status}' --show curl 2>/dev/null) = *\ installed ]]; then
|
|
||||||
DWC2_REMOTE_VER=$NONE
|
|
||||||
else
|
|
||||||
get_dwc_ver
|
|
||||||
DWC2_REMOTE_VER=$DWC2_VERSION
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
compare_dwc2_versions(){
|
|
||||||
unset DWC2_UPDATE_AVAIL
|
|
||||||
read_local_dwc2_version && read_remote_dwc2_version
|
|
||||||
if [[ $DWC2_VER_FOUND = "true" ]] && [[ $DWC2_LOCAL_VER == $DWC2_REMOTE_VER ]]; then
|
|
||||||
#printf fits the string for displaying it in the ui to a total char length of 12
|
|
||||||
DWC2_LOCAL_VER="${green}$(printf "%-12s" "$DWC2_LOCAL_VER")${default}"
|
|
||||||
DWC2_REMOTE_VER="${green}$(printf "%-12s" "$DWC2_REMOTE_VER")${default}"
|
|
||||||
elif [[ $DWC2_VER_FOUND = "true" ]] && [[ $DWC2_LOCAL_VER != $DWC2_REMOTE_VER ]]; then
|
|
||||||
DWC2_LOCAL_VER="${yellow}$(printf "%-12s" "$DWC2_LOCAL_VER")${default}"
|
|
||||||
DWC2_REMOTE_VER="${green}$(printf "%-12s" "$DWC2_REMOTE_VER")${default}"
|
|
||||||
# add dwc to the update all array for the update all function in the updater
|
|
||||||
DWC2_UPDATE_AVAIL="true" && update_arr+=(update_dwc2)
|
|
||||||
else
|
|
||||||
DWC2_LOCAL_VER=$NONE
|
|
||||||
DWC2_REMOTE_VER="${green}$(printf "%-12s" "$DWC2_REMOTE_VER")${default}"
|
|
||||||
DWC2_UPDATE_AVAIL="false"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
@@ -223,8 +223,7 @@ mainsail_port_check(){
|
|||||||
status_msg "Detected other enabled interfaces:"
|
status_msg "Detected other enabled interfaces:"
|
||||||
[ "${OCTOPRINT_ENABLED}" = "true" ] && echo -e " ${cyan}● OctoPrint - Port: ${OCTOPRINT_PORT}${default}"
|
[ "${OCTOPRINT_ENABLED}" = "true" ] && echo -e " ${cyan}● OctoPrint - Port: ${OCTOPRINT_PORT}${default}"
|
||||||
[ "${FLUIDD_ENABLED}" = "true" ] && echo -e " ${cyan}● Fluidd - Port: ${FLUIDD_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" ] || [ "${OCTOPRINT_PORT}" = "80" ]; then
|
||||||
if [ "${FLUIDD_PORT}" = "80" ] || [ "${DWC2_PORT}" = "80" ] || [ "${OCTOPRINT_PORT}" = "80" ]; then
|
|
||||||
PORT_80_BLOCKED="true"
|
PORT_80_BLOCKED="true"
|
||||||
select_mainsail_port
|
select_mainsail_port
|
||||||
fi
|
fi
|
||||||
@@ -244,8 +243,7 @@ fluidd_port_check(){
|
|||||||
status_msg "Detected other enabled interfaces:"
|
status_msg "Detected other enabled interfaces:"
|
||||||
[ "${OCTOPRINT_ENABLED}" = "true" ] && echo " ${cyan}● OctoPrint - Port: ${OCTOPRINT_PORT}${default}"
|
[ "${OCTOPRINT_ENABLED}" = "true" ] && echo " ${cyan}● OctoPrint - Port: ${OCTOPRINT_PORT}${default}"
|
||||||
[ "${MAINSAIL_ENABLED}" = "true" ] && echo " ${cyan}● Mainsail - Port: ${MAINSAIL_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" ] || [ "${OCTOPRINT_PORT}" = "80" ]; then
|
||||||
if [ "${MAINSAIL_PORT}" = "80" ] || [ "${DWC2_PORT}" = "80" ] || [ "${OCTOPRINT_PORT}" = "80" ]; then
|
|
||||||
PORT_80_BLOCKED="true"
|
PORT_80_BLOCKED="true"
|
||||||
select_fluidd_port
|
select_fluidd_port
|
||||||
fi
|
fi
|
||||||
@@ -269,7 +267,6 @@ select_mainsail_port(){
|
|||||||
blank_line
|
blank_line
|
||||||
[ "${OCTOPRINT_PORT}" = "80" ] && echo "| ● OctoPrint |"
|
[ "${OCTOPRINT_PORT}" = "80" ] && echo "| ● OctoPrint |"
|
||||||
[ "${FLUIDD_PORT}" = "80" ] && echo "| ● Fluidd |"
|
[ "${FLUIDD_PORT}" = "80" ] && echo "| ● Fluidd |"
|
||||||
[ "${DWC2_PORT}" = "80" ] && echo "| ● DWC2 |"
|
|
||||||
blank_line
|
blank_line
|
||||||
echo -e "| Make sure you don't choose a port which was already |"
|
echo -e "| Make sure you don't choose a port which was already |"
|
||||||
echo -e "| assigned to one of the other webinterfaces and do ${red}NOT${default} |"
|
echo -e "| assigned to one of the other webinterfaces and do ${red}NOT${default} |"
|
||||||
@@ -280,7 +277,7 @@ select_mainsail_port(){
|
|||||||
bottom_border
|
bottom_border
|
||||||
while true; do
|
while true; do
|
||||||
read -p "${cyan}Please enter a new Port:${default} " NEW_PORT
|
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
|
if [ "${NEW_PORT}" != "${FLUIDD_PORT}" ] && [ "${NEW_PORT}" != "${OCTOPRINT_PORT}" ]; then
|
||||||
echo "Setting port ${NEW_PORT} for Mainsail!"
|
echo "Setting port ${NEW_PORT} for Mainsail!"
|
||||||
SET_LISTEN_PORT=${NEW_PORT}
|
SET_LISTEN_PORT=${NEW_PORT}
|
||||||
break
|
break
|
||||||
@@ -301,7 +298,6 @@ select_fluidd_port(){
|
|||||||
blank_line
|
blank_line
|
||||||
[ "${OCTOPRINT_PORT}" = "80" ] && echo "| ● OctoPrint |"
|
[ "${OCTOPRINT_PORT}" = "80" ] && echo "| ● OctoPrint |"
|
||||||
[ "${MAINSAIL_PORT}" = "80" ] && echo "| ● Mainsail |"
|
[ "${MAINSAIL_PORT}" = "80" ] && echo "| ● Mainsail |"
|
||||||
[ "${DWC2_PORT}" = "80" ] && echo "| ● DWC2 |"
|
|
||||||
blank_line
|
blank_line
|
||||||
echo -e "| Make sure you don't choose a port which was already |"
|
echo -e "| Make sure you don't choose a port which was already |"
|
||||||
echo -e "| assigned to one of the other webinterfaces and do ${red}NOT${default} |"
|
echo -e "| assigned to one of the other webinterfaces and do ${red}NOT${default} |"
|
||||||
@@ -312,7 +308,7 @@ select_fluidd_port(){
|
|||||||
bottom_border
|
bottom_border
|
||||||
while true; do
|
while true; do
|
||||||
read -p "${cyan}Please enter a new Port:${default} " NEW_PORT
|
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
|
if [ "${NEW_PORT}" != "${MAINSAIL_PORT}" ] && [ "${NEW_PORT}" != "${OCTOPRINT_PORT}" ]; then
|
||||||
echo "Setting port ${NEW_PORT} for Fluidd!"
|
echo "Setting port ${NEW_PORT} for Fluidd!"
|
||||||
SET_LISTEN_PORT=${NEW_PORT}
|
SET_LISTEN_PORT=${NEW_PORT}
|
||||||
break
|
break
|
||||||
@@ -401,7 +397,7 @@ set_upstream_nginx_cfg(){
|
|||||||
fetch_webui_ports(){
|
fetch_webui_ports(){
|
||||||
### read listen ports from possible installed interfaces
|
### read listen ports from possible installed interfaces
|
||||||
### and write them to ~/.kiauh.ini
|
### and write them to ~/.kiauh.ini
|
||||||
WEBIFS=(mainsail fluidd octoprint dwc2)
|
WEBIFS=(mainsail fluidd octoprint)
|
||||||
for interface in "${WEBIFS[@]}"; do
|
for interface in "${WEBIFS[@]}"; do
|
||||||
if [ -f "/etc/nginx/sites-available/${interface}" ]; then
|
if [ -f "/etc/nginx/sites-available/${interface}" ]; then
|
||||||
port=$(grep -E "listen" "/etc/nginx/sites-available/${interface}" | head -1 | sed 's/^\s*//' | sed 's/;$//' | cut -d" " -f2)
|
port=$(grep -E "listen" "/etc/nginx/sites-available/${interface}" | head -1 | sed 's/^\s*//' | sed 's/;$//' | cut -d" " -f2)
|
||||||
|
|||||||
@@ -59,14 +59,6 @@ detect_enabled_sites(){
|
|||||||
else
|
else
|
||||||
FLUIDD_ENABLED="false"
|
FLUIDD_ENABLED="false"
|
||||||
fi
|
fi
|
||||||
if [ -e /etc/nginx/sites-enabled/dwc2 ]; then
|
|
||||||
SITE_ENABLED="true" && DWC2_ENABLED="true"
|
|
||||||
read_listen_port "dwc2"
|
|
||||||
DWC2_PORT=$LISTEN_PORT
|
|
||||||
#echo "debug: DWC2 listens on port: $DWC2_PORT"
|
|
||||||
else
|
|
||||||
DWC2_ENABLED="false"
|
|
||||||
fi
|
|
||||||
if [ -e /etc/nginx/sites-enabled/octoprint ]; then
|
if [ -e /etc/nginx/sites-enabled/octoprint ]; then
|
||||||
SITE_ENABLED="true" && OCTOPRINT_ENABLED="true"
|
SITE_ENABLED="true" && OCTOPRINT_ENABLED="true"
|
||||||
read_listen_port "octoprint"
|
read_listen_port "octoprint"
|
||||||
@@ -84,7 +76,7 @@ create_custom_hostname(){
|
|||||||
echo -e "| that name to open the Interface in your browser. |"
|
echo -e "| that name to open the Interface in your browser. |"
|
||||||
echo -e "| |"
|
echo -e "| |"
|
||||||
echo -e "| E.g.: If you set the hostname to 'my-printer' you |"
|
echo -e "| E.g.: If you set the hostname to 'my-printer' you |"
|
||||||
echo -e "| can open DWC2/Mainsail/Fluidd/Octoprint by |"
|
echo -e "| can open Mainsail / Fluidd / Octoprint by |"
|
||||||
echo -e "| browsing to: http://my-printer.local |"
|
echo -e "| browsing to: http://my-printer.local |"
|
||||||
bottom_border
|
bottom_border
|
||||||
while true; do
|
while true; do
|
||||||
|
|||||||
@@ -156,8 +156,6 @@ ui_print_versions(){
|
|||||||
unset update_arr
|
unset update_arr
|
||||||
check_system_updates
|
check_system_updates
|
||||||
# compare_klipper_versions
|
# compare_klipper_versions
|
||||||
# compare_dwc2fk_versions
|
|
||||||
# compare_dwc2_versions
|
|
||||||
# compare_moonraker_versions
|
# compare_moonraker_versions
|
||||||
# compare_mainsail_versions
|
# compare_mainsail_versions
|
||||||
# compare_fluidd_versions
|
# compare_fluidd_versions
|
||||||
|
|||||||
@@ -12,9 +12,8 @@ backup_ui(){
|
|||||||
echo -e "| | 6) [KlipperScreen] | "
|
echo -e "| | 6) [KlipperScreen] | "
|
||||||
echo -e "| Klipper API: | | "
|
echo -e "| Klipper API: | | "
|
||||||
echo -e "| 2) [Moonraker] | Other: | "
|
echo -e "| 2) [Moonraker] | Other: | "
|
||||||
echo -e "| 3) [Moonraker DB] | 7) [Duet Web Control] | "
|
echo -e "| 3) [Moonraker DB] | 7) [OctoPrint] | "
|
||||||
echo -e "| | 8) [OctoPrint] | "
|
echo -e "| | 8) [MoonrakerTelegramBot] | "
|
||||||
echo -e "| | 9) [MoonrakerTelegramBot] | "
|
|
||||||
back_footer
|
back_footer
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -38,10 +37,8 @@ backup_menu(){
|
|||||||
6)
|
6)
|
||||||
do_action "backup_klipperscreen" "backup_ui";;
|
do_action "backup_klipperscreen" "backup_ui";;
|
||||||
7)
|
7)
|
||||||
do_action "backup_dwc2" "backup_ui";;
|
|
||||||
8)
|
|
||||||
do_action "backup_octoprint" "backup_ui";;
|
do_action "backup_octoprint" "backup_ui";;
|
||||||
9)
|
8)
|
||||||
do_action "backup_MoonrakerTelegramBot" "backup_ui";;
|
do_action "backup_MoonrakerTelegramBot" "backup_ui";;
|
||||||
B|b)
|
B|b)
|
||||||
clear; main_menu; break;;
|
clear; main_menu; break;;
|
||||||
|
|||||||
@@ -1,19 +1,19 @@
|
|||||||
install_ui(){
|
install_ui(){
|
||||||
top_border
|
top_border
|
||||||
echo -e "| ${green}~~~~~~~~~~~ [ Installation Menu ] ~~~~~~~~~~~${default} | "
|
echo -e "| ${green}~~~~~~~~~~~ [ Installation Menu ] ~~~~~~~~~~~${white} | "
|
||||||
hr
|
hr
|
||||||
echo -e "| You need this menu usually only for installing | "
|
echo -e "| You need this menu usually only for installing | "
|
||||||
echo -e "| all necessary dependencies for the various | "
|
echo -e "| all necessary dependencies for the various | "
|
||||||
echo -e "| functions on a completely fresh system. | "
|
echo -e "| functions on a completely fresh system. | "
|
||||||
hr
|
hr
|
||||||
echo -e "| Firmware & API: | Other: | "
|
echo -e "| Firmware & API: | Other: | "
|
||||||
echo -e "| 1) [Klipper] | 6) [Duet Web Control] | "
|
echo -e "| 1) [Klipper] | 6) [OctoPrint] | "
|
||||||
echo -e "| 2) [Moonraker] | 7) [OctoPrint] | "
|
echo -e "| 2) [Moonraker] | 7) [PrettyGCode] | "
|
||||||
echo -e "| | 8) [PrettyGCode] | "
|
echo -e "| | 8) [Telegram Bot] | "
|
||||||
echo -e "| Klipper Webinterface: | 9) [Telegram Bot] | "
|
echo -e "| Klipper Webinterface: | | "
|
||||||
echo -e "| 3) [Mainsail] | | "
|
echo -e "| 3) [Mainsail] | Webcam: | "
|
||||||
echo -e "| 4) [Fluidd] | Webcam: | "
|
echo -e "| 4) [Fluidd] | 9) [MJPG-Streamer] | "
|
||||||
echo -e "| | 10) [MJPG-Streamer] | "
|
echo -e "| | | "
|
||||||
echo -e "| Touchscreen GUI: | | "
|
echo -e "| Touchscreen GUI: | | "
|
||||||
echo -e "| 5) [KlipperScreen] | | "
|
echo -e "| 5) [KlipperScreen] | | "
|
||||||
back_footer
|
back_footer
|
||||||
@@ -35,14 +35,12 @@ install_menu(){
|
|||||||
5)
|
5)
|
||||||
do_action "install_klipperscreen" "install_ui";;
|
do_action "install_klipperscreen" "install_ui";;
|
||||||
6)
|
6)
|
||||||
do_action "dwc_setup_dialog" "install_ui";;
|
|
||||||
7)
|
|
||||||
do_action "octoprint_setup_dialog" "install_ui";;
|
do_action "octoprint_setup_dialog" "install_ui";;
|
||||||
8)
|
7)
|
||||||
do_action "install_pgc_for_klipper" "install_ui";;
|
do_action "install_pgc_for_klipper" "install_ui";;
|
||||||
9)
|
8)
|
||||||
do_action "install_MoonrakerTelegramBot" "install_ui";;
|
do_action "install_MoonrakerTelegramBot" "install_ui";;
|
||||||
10)
|
9)
|
||||||
do_action "install_mjpg-streamer" "install_ui";;
|
do_action "install_mjpg-streamer" "install_ui";;
|
||||||
B|b)
|
B|b)
|
||||||
clear; main_menu; break;;
|
clear; main_menu; break;;
|
||||||
|
|||||||
@@ -13,8 +13,7 @@ main_ui(){
|
|||||||
echo -e "| | KlipperScreen: $KLIPPERSCREEN_STATUS|"
|
echo -e "| | KlipperScreen: $KLIPPERSCREEN_STATUS|"
|
||||||
echo -e "| 6) [Settings] | Telegram Bot: $MOONRAKER_TELEGRAM_BOT_STATUS|"
|
echo -e "| 6) [Settings] | Telegram Bot: $MOONRAKER_TELEGRAM_BOT_STATUS|"
|
||||||
echo -e "| | |"
|
echo -e "| | |"
|
||||||
echo -e "| | DWC2: $DWC2_STATUS|"
|
echo -e "| ${cyan}${KIAUH_VER}${white}| Octoprint: $OCTOPRINT_STATUS|"
|
||||||
echo -e "| ${cyan}$KIAUH_VER${default}| Octoprint: $OCTOPRINT_STATUS|"
|
|
||||||
quit_footer
|
quit_footer
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -49,7 +48,6 @@ main_menu(){
|
|||||||
print_kiauh_version
|
print_kiauh_version
|
||||||
# klipper_status
|
# klipper_status
|
||||||
# moonraker_status
|
# moonraker_status
|
||||||
dwc2_status
|
|
||||||
fluidd_status
|
fluidd_status
|
||||||
mainsail_status
|
mainsail_status
|
||||||
octoprint_status
|
octoprint_status
|
||||||
@@ -60,16 +58,13 @@ main_menu(){
|
|||||||
main_ui
|
main_ui
|
||||||
while true; do
|
while true; do
|
||||||
read -p "${cyan}Perform action:${default} " action; echo
|
read -p "${cyan}Perform action:${default} " action; echo
|
||||||
case "$action" in
|
case "${action}" in
|
||||||
"start klipper") do_action_service "start" "klipper"; main_ui;;
|
"start klipper") do_action_service "start" "klipper"; main_ui;;
|
||||||
"stop klipper") do_action_service "stop" "klipper"; main_ui;;
|
"stop klipper") do_action_service "stop" "klipper"; main_ui;;
|
||||||
"restart klipper") do_action_service "restart" "klipper"; main_ui;;
|
"restart klipper") do_action_service "restart" "klipper"; main_ui;;
|
||||||
"start moonraker") do_action_service "start" "moonraker"; main_ui;;
|
"start moonraker") do_action_service "start" "moonraker"; main_ui;;
|
||||||
"stop moonraker") do_action_service "stop" "moonraker"; main_ui;;
|
"stop moonraker") do_action_service "stop" "moonraker"; main_ui;;
|
||||||
"restart moonraker")do_action_service "restart" "moonraker"; main_ui;;
|
"restart moonraker")do_action_service "restart" "moonraker"; main_ui;;
|
||||||
"start dwc") do_action_service "start" "dwc"; main_ui;;
|
|
||||||
"stop dwc") do_action_service "stop" "dwc"; main_ui;;
|
|
||||||
"restart dwc") do_action_service "restart" "dwc"; main_ui;;
|
|
||||||
"start octoprint") do_action_service "start" "octoprint"; main_ui;;
|
"start octoprint") do_action_service "start" "octoprint"; main_ui;;
|
||||||
"stop octoprint") do_action_service "stop" "octoprint"; main_ui;;
|
"stop octoprint") do_action_service "stop" "octoprint"; main_ui;;
|
||||||
"restart octoprint") do_action_service "restart" "octoprint"; main_ui;;
|
"restart octoprint") do_action_service "restart" "octoprint"; main_ui;;
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
remove_ui(){
|
remove_ui(){
|
||||||
top_border
|
top_border
|
||||||
echo -e "| ${red}~~~~~~~~~~~~~~ [ Remove Menu ] ~~~~~~~~~~~~~~${default} | "
|
echo -e "| ${red}~~~~~~~~~~~~~~ [ Remove Menu ] ~~~~~~~~~~~~~~${white} | "
|
||||||
hr
|
hr
|
||||||
echo -e "| Directories which remain untouched: | "
|
echo -e "| Directories which remain untouched: | "
|
||||||
echo -e "| --> Your printer configuration directory | "
|
echo -e "| --> Your printer configuration directory | "
|
||||||
@@ -11,13 +11,12 @@ remove_ui(){
|
|||||||
echo -e "| 1) [Klipper] | 5) [KlipperScreen] | "
|
echo -e "| 1) [Klipper] | 5) [KlipperScreen] | "
|
||||||
echo -e "| | | "
|
echo -e "| | | "
|
||||||
echo -e "| Klipper API: | Other: | "
|
echo -e "| Klipper API: | Other: | "
|
||||||
echo -e "| 2) [Moonraker] | 6) [Duet Web Control] | "
|
echo -e "| 2) [Moonraker] | 6) [OctoPrint] | "
|
||||||
echo -e "| | 7) [OctoPrint] | "
|
echo -e "| | 7) [PrettyGCode] | "
|
||||||
echo -e "| Klipper Webinterface: | 8) [PrettyGCode] | "
|
echo -e "| Klipper Webinterface: | 9) [Telegram Bot] | "
|
||||||
echo -e "| 3) [Mainsail] | 9) [Telegram Bot] | "
|
echo -e "| 3) [Mainsail] | | "
|
||||||
echo -e "| 4) [Fluidd] | | "
|
echo -e "| 4) [Fluidd] | 9) [MJPG-Streamer] | "
|
||||||
echo -e "| | 10) [MJPG-Streamer] | "
|
echo -e "| | 10) [NGINX] | "
|
||||||
echo -e "| | 11) [NGINX] | "
|
|
||||||
back_footer
|
back_footer
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -25,7 +24,7 @@ remove_menu(){
|
|||||||
do_action "" "remove_ui"
|
do_action "" "remove_ui"
|
||||||
while true; do
|
while true; do
|
||||||
read -p "${cyan}Perform action:${default} " action; echo
|
read -p "${cyan}Perform action:${default} " action; echo
|
||||||
case "$action" in
|
case "${action}" in
|
||||||
1)
|
1)
|
||||||
do_action "remove_klipper" "remove_ui";;
|
do_action "remove_klipper" "remove_ui";;
|
||||||
2)
|
2)
|
||||||
@@ -37,16 +36,14 @@ remove_menu(){
|
|||||||
5)
|
5)
|
||||||
do_action "remove_klipperscreen" "remove_ui";;
|
do_action "remove_klipperscreen" "remove_ui";;
|
||||||
6)
|
6)
|
||||||
do_action "remove_dwc2" "remove_ui";;
|
|
||||||
7)
|
|
||||||
do_action "remove_octoprint" "remove_ui";;
|
do_action "remove_octoprint" "remove_ui";;
|
||||||
8)
|
7)
|
||||||
do_action "remove_prettygcode" "remove_ui";;
|
do_action "remove_prettygcode" "remove_ui";;
|
||||||
9)
|
8)
|
||||||
do_action "remove_MoonrakerTelegramBot" "remove_ui";;
|
do_action "remove_MoonrakerTelegramBot" "remove_ui";;
|
||||||
10)
|
9)
|
||||||
do_action "remove_mjpg-streamer" "remove_ui";;
|
do_action "remove_mjpg-streamer" "remove_ui";;
|
||||||
11)
|
10)
|
||||||
do_action "remove_nginx" "remove_ui";;
|
do_action "remove_nginx" "remove_ui";;
|
||||||
B|b)
|
B|b)
|
||||||
clear; main_menu; break;;
|
clear; main_menu; break;;
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
update_ui(){
|
update_ui(){
|
||||||
ui_print_versions
|
ui_print_versions
|
||||||
top_border
|
top_border
|
||||||
echo -e "| ${green}~~~~~~~~~~~~~~ [ Update Menu ] ~~~~~~~~~~~~~~${default} | "
|
echo -e "| ${green}~~~~~~~~~~~~~~ [ Update Menu ] ~~~~~~~~~~~~~~${white} | "
|
||||||
hr
|
hr
|
||||||
echo -e "| 0) $BB4U_STATUS| "
|
echo -e "| 0) ${BB4U_STATUS}| "
|
||||||
hr
|
hr
|
||||||
echo -e "| a) [Update all] | | | "
|
echo -e "| a) [Update all] | | | "
|
||||||
echo -e "| | Installed: | Latest: | "
|
echo -e "| | Installed: | Latest: | "
|
||||||
@@ -19,12 +19,10 @@ update_ui(){
|
|||||||
echo -e "| 5) [KlipperScreen] | $LOCAL_KLIPPERSCREEN_COMMIT | $REMOTE_KLIPPERSCREEN_COMMIT | "
|
echo -e "| 5) [KlipperScreen] | $LOCAL_KLIPPERSCREEN_COMMIT | $REMOTE_KLIPPERSCREEN_COMMIT | "
|
||||||
echo -e "| | | | "
|
echo -e "| | | | "
|
||||||
echo -e "| Other: |---------------|--------------| "
|
echo -e "| Other: |---------------|--------------| "
|
||||||
echo -e "| 6) [DWC2-for-Klipper] | $LOCAL_DWC2FK_COMMIT | $REMOTE_DWC2FK_COMMIT | "
|
echo -e "| 6) [PrettyGCode] | $LOCAL_PGC_COMMIT | $REMOTE_PGC_COMMIT | "
|
||||||
echo -e "| 7) [DWC2 Web UI] | $DWC2_LOCAL_VER | $DWC2_REMOTE_VER | "
|
echo -e "| 7) [Telegram Bot] | $LOCAL_MOONRAKER_TELEGRAM_BOT_COMMIT | $REMOTE_MOONRAKER_TELEGRAM_BOT_COMMIT | "
|
||||||
echo -e "| 8) [PrettyGCode] | $LOCAL_PGC_COMMIT | $REMOTE_PGC_COMMIT | "
|
|
||||||
echo -e "| 9) [Telegram Bot] | $LOCAL_MOONRAKER_TELEGRAM_BOT_COMMIT | $REMOTE_MOONRAKER_TELEGRAM_BOT_COMMIT | "
|
|
||||||
echo -e "| |------------------------------| "
|
echo -e "| |------------------------------| "
|
||||||
echo -e "| 10) [System] | $DISPLAY_SYS_UPDATE | "
|
echo -e "| 8) [System] | $DISPLAY_SYS_UPDATE | "
|
||||||
back_footer
|
back_footer
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -32,8 +30,8 @@ update_menu(){
|
|||||||
read_bb4u_stat
|
read_bb4u_stat
|
||||||
do_action "" "update_ui"
|
do_action "" "update_ui"
|
||||||
while true; do
|
while true; do
|
||||||
read -p "${cyan}Perform action:${default} " action; echo
|
read -p "${cyan}Perform action:${white} " action; echo
|
||||||
case "$action" in
|
case "${action}" in
|
||||||
0)
|
0)
|
||||||
do_action "toggle_backups" "update_ui";;
|
do_action "toggle_backups" "update_ui";;
|
||||||
1)
|
1)
|
||||||
@@ -47,14 +45,10 @@ update_menu(){
|
|||||||
5)
|
5)
|
||||||
do_action "update_klipperscreen" "update_ui";;
|
do_action "update_klipperscreen" "update_ui";;
|
||||||
6)
|
6)
|
||||||
do_action "update_dwc2fk" "update_ui";;
|
|
||||||
7)
|
|
||||||
do_action "update_dwc2" "update_ui";;
|
|
||||||
8)
|
|
||||||
do_action "update_pgc_for_klipper" "update_ui";;
|
do_action "update_pgc_for_klipper" "update_ui";;
|
||||||
9)
|
7)
|
||||||
do_action "update_MoonrakerTelegramBot" "update_ui";;
|
do_action "update_MoonrakerTelegramBot" "update_ui";;
|
||||||
10)
|
8)
|
||||||
do_action "update_system" "update_ui";;
|
do_action "update_system" "update_ui";;
|
||||||
a)
|
a)
|
||||||
do_action "update_all" "update_ui";;
|
do_action "update_all" "update_ui";;
|
||||||
|
|||||||
@@ -21,12 +21,6 @@ update_all(){
|
|||||||
if [ "$KLIPPER_UPDATE_AVAIL" = "true" ]; then
|
if [ "$KLIPPER_UPDATE_AVAIL" = "true" ]; then
|
||||||
echo -e "| ${cyan}● Klipper${default} |"
|
echo -e "| ${cyan}● Klipper${default} |"
|
||||||
fi
|
fi
|
||||||
if [ "$DWC2FK_UPDATE_AVAIL" = "true" ]; then
|
|
||||||
echo -e "| ${cyan}● DWC2-for-Klipper-Socket${default} |"
|
|
||||||
fi
|
|
||||||
if [ "$DWC2_UPDATE_AVAIL" = "true" ]; then
|
|
||||||
echo -e "| ${cyan}● Duet Web Control${default} |"
|
|
||||||
fi
|
|
||||||
if [ "$MOONRAKER_UPDATE_AVAIL" = "true" ]; then
|
if [ "$MOONRAKER_UPDATE_AVAIL" = "true" ]; then
|
||||||
echo -e "| ${cyan}● Moonraker${default} |"
|
echo -e "| ${cyan}● Moonraker${default} |"
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -55,11 +55,6 @@ upload_selection(){
|
|||||||
logfiles+=($mr_log)
|
logfiles+=($mr_log)
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
if ls /tmp/dwc2*.log 2>/dev/null 1>&2; then
|
|
||||||
for dwc_log in $(find /tmp/dwc2*.log); do
|
|
||||||
logfiles+=($dwc_log)
|
|
||||||
done
|
|
||||||
fi
|
|
||||||
|
|
||||||
### draw interface
|
### draw interface
|
||||||
i=0
|
i=0
|
||||||
|
|||||||
Reference in New Issue
Block a user