Whiptail #138
4
.gitignore
vendored
4
.gitignore
vendored
@@ -1 +1,3 @@
|
||||
kiauh.ini
|
||||
kiauh.ini
|
||||
.idea
|
||||
kiauh.iml
|
||||
146
kiauh.sh
146
kiauh.sh
@@ -1,104 +1,88 @@
|
||||
#!/bin/bash
|
||||
clear
|
||||
set -e
|
||||
|
||||
### set color variables
|
||||
green=$(echo -en "\e[92m")
|
||||
yellow=$(echo -en "\e[93m")
|
||||
red=$(echo -en "\e[91m")
|
||||
cyan=$(echo -en "\e[96m")
|
||||
default=$(echo -en "\e[39m")
|
||||
|
||||
### sourcing all additional scripts
|
||||
SRCDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )"/.. && pwd )"
|
||||
for script in "${SRCDIR}/kiauh/scripts/"*.sh; do . $script; done
|
||||
for script in "${SRCDIR}/kiauh/scripts/ui/"*.sh; do . $script; done
|
||||
|
||||
### set important directories
|
||||
#klipper
|
||||
KLIPPER_DIR=${HOME}/klipper
|
||||
KLIPPY_ENV=${HOME}/klippy-env
|
||||
#nginx
|
||||
NGINX_SA=/etc/nginx/sites-available
|
||||
NGINX_SE=/etc/nginx/sites-enabled
|
||||
NGINX_CONFD=/etc/nginx/conf.d
|
||||
#moonraker
|
||||
MOONRAKER_DIR=${HOME}/moonraker
|
||||
MOONRAKER_ENV=${HOME}/moonraker-env
|
||||
#mainsail
|
||||
MAINSAIL_DIR=${HOME}/mainsail
|
||||
#fluidd
|
||||
FLUIDD_DIR=${HOME}/fluidd
|
||||
#dwc2
|
||||
DWC2FK_DIR=${HOME}/dwc2-for-klipper-socket
|
||||
DWC_ENV_DIR=${HOME}/dwc-env
|
||||
DWC2_DIR=${HOME}/duetwebcontrol
|
||||
#octoprint
|
||||
OCTOPRINT_DIR=${HOME}/OctoPrint
|
||||
#KlipperScreen
|
||||
KLIPPERSCREEN_DIR=${HOME}/KlipperScreen
|
||||
KLIPPERSCREEN_ENV_DIR=${HOME}/.KlipperScreen-env
|
||||
#MoonrakerTelegramBot
|
||||
MOONRAKER_TELEGRAM_BOT_DIR=${HOME}/moonraker-telegram-bot
|
||||
MOONRAKER_TELEGRAM_BOT_ENV_DIR=${HOME}/moonraker-telegram-bot-env
|
||||
#misc
|
||||
INI_FILE=${HOME}/.kiauh.ini
|
||||
BACKUP_DIR=${HOME}/kiauh-backups
|
||||
|
||||
### set github repos
|
||||
KLIPPER_REPO=https://github.com/Klipper3d/klipper.git
|
||||
ARKSINE_REPO=https://github.com/Arksine/klipper.git
|
||||
DMBUTYUGIN_REPO=https://github.com/dmbutyugin/klipper.git
|
||||
DWC2FK_REPO=https://github.com/Stephan3/dwc2-for-klipper-socket.git
|
||||
KLIPPERSCREEN_REPO=https://github.com/jordanruthe/KlipperScreen.git
|
||||
NLEF_REPO=https://github.com/nlef/moonraker-telegram-bot.git
|
||||
#branches
|
||||
BRANCH_SCURVE_SMOOTHING=dmbutyugin/scurve-smoothing
|
||||
BRANCH_SCURVE_SHAPING=dmbutyugin/scurve-shaping
|
||||
|
||||
### set some messages
|
||||
warn_msg(){
|
||||
warn_msg() {
|
||||
echo -e "${red}<!!!!> $1${default}"
|
||||
}
|
||||
status_msg(){
|
||||
echo; echo -e "${yellow}###### $1${default}"
|
||||
status_msg() {
|
||||
echo
|
||||
echo -e "${yellow}###### $1${default}"
|
||||
}
|
||||
ok_msg(){
|
||||
ok_msg() {
|
||||
echo -e "${green}>>>>>> $1${default}"
|
||||
}
|
||||
title_msg(){
|
||||
title_msg() {
|
||||
echo -e "${cyan}$1${default}"
|
||||
}
|
||||
get_date(){
|
||||
get_date() {
|
||||
current_date=$(date +"%y%m%d-%H%M")
|
||||
}
|
||||
print_unkown_cmd(){
|
||||
print_unkown_cmd() {
|
||||
ERROR_MSG="Invalid command!"
|
||||
}
|
||||
|
||||
print_msg(){
|
||||
if [[ "$ERROR_MSG" != "" ]]; then
|
||||
echo -e "${red}"
|
||||
echo -e "#########################################################"
|
||||
echo -e " $ERROR_MSG "
|
||||
echo -e "#########################################################"
|
||||
echo -e "${default}"
|
||||
#######################################
|
||||
# description Display an error or a confirmation
|
||||
# Globals:
|
||||
# CONFIRM_MSG
|
||||
# ERROR_MSG
|
||||
# KIAUH_TITLE
|
||||
# KIAUH_WHIPTAIL_NORMAL_WIDTH
|
||||
# KIAUH_WHIPTAIL_SINGLE_LINE_HEIGHT
|
||||
# Arguments:
|
||||
# None
|
||||
#######################################
|
||||
print_msg() {
|
||||
if [[ $ERROR_MSG != "" ]]; then
|
||||
whiptail --title "$KIAUH_TITLE" --msgbox "$ERROR_MSG" \
|
||||
"$KIAUH_WHIPTAIL_SINGLE_LINE_HEIGHT" "$KIAUH_WHIPTAIL_NORMAL_WIDTH"
|
||||
fi
|
||||
# TODO Maybe confirm_msg can be yesno box
|
||||
if [ "$CONFIRM_MSG" != "" ]; then
|
||||
echo -e "${green}"
|
||||
echo -e "#########################################################"
|
||||
echo -e " $CONFIRM_MSG "
|
||||
echo -e "#########################################################"
|
||||
echo -e "${default}"
|
||||
whiptail --title "$KIAUH_TITLE" --msgbox "$CONFIRM_MSG" \
|
||||
"$KIAUH_WHIPTAIL_SINGLE_LINE_HEIGHT" "$KIAUH_WHIPTAIL_NORMAL_WIDTH"
|
||||
fi
|
||||
}
|
||||
|
||||
clear_msg(){
|
||||
clear_msg() {
|
||||
unset CONFIRM_MSG
|
||||
unset ERROR_MSG
|
||||
}
|
||||
|
||||
check_euid
|
||||
init_ini
|
||||
kiauh_status
|
||||
main_menu
|
||||
function main() {
|
||||
### Gettext Configuration
|
||||
alias GETTEXT='gettext "KIAUH"'
|
||||
|
||||
#clear
|
||||
# TODO set -e cause whiptail to force an exit because it use stderr, need a workaround here
|
||||
# set -e
|
||||
### set color variables
|
||||
green=$(echo -en "\e[92m")
|
||||
|
||||
yellow=$(echo -en "\e[93m")
|
||||
|
||||
red=$(echo -en "\e[91m")
|
||||
|
||||
cyan=$(echo -en "\e[96m")
|
||||
|
||||
default=$(echo -en "\e[39m")
|
||||
|
||||
### sourcing all additional scripts
|
||||
SRCDIR="$(cd "$(dirname "${BASH_SOURCE[0]}")"/.. && pwd)"
|
||||
|
||||
for script in "${SRCDIR}/kiauh/scripts/constants/"*.sh; do . $script; done
|
||||
|
||||
for script in "${SRCDIR}/kiauh/scripts/"*.sh; do . $script; done
|
||||
|
||||
for script in "${SRCDIR}/kiauh/scripts/ui/"*.sh; do . $script; done
|
||||
|
||||
check_euid
|
||||
|
||||
init_ini
|
||||
|
||||
kiauh_status
|
||||
|
||||
main_menu
|
||||
|
||||
}
|
||||
|
||||
main "$@"
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
#!/bin/bash
|
||||
check_for_backup_dir(){
|
||||
if [ ! -d $BACKUP_DIR ]; then
|
||||
status_msg "Create KIAUH backup directory ..."
|
||||
|
||||
55
scripts/constants/constants.sh
Executable file
55
scripts/constants/constants.sh
Executable file
@@ -0,0 +1,55 @@
|
||||
#!/bin/bash
|
||||
### set important directories
|
||||
|
||||
# klipper
|
||||
readonly KLIPPER_DIR=${HOME}/klipper
|
||||
readonly KLIPPY_ENV=${HOME}/klippy-env
|
||||
#nginx
|
||||
readonly NGINX_SA=/etc/nginx/sites-available
|
||||
readonly NGINX_SE=/etc/nginx/sites-enabled
|
||||
readonly NGINX_CONFD=/etc/nginx/conf.d
|
||||
#moonraker
|
||||
readonly MOONRAKER_DIR=${HOME}/moonraker
|
||||
readonly MOONRAKER_ENV=${HOME}/moonraker-env
|
||||
readonly MOONRAKER_REPO="https://github.com/Arksine/moonraker.git"
|
||||
#mainsail
|
||||
readonly MAINSAIL_DIR=${HOME}/mainsail
|
||||
#fluidd
|
||||
readonly FLUIDD_DIR=${HOME}/fluidd
|
||||
#dwc2
|
||||
readonly DWC2FK_DIR=${HOME}/dwc2-for-klipper-socket
|
||||
readonly DWC_ENV_DIR=${HOME}/dwc-env
|
||||
readonly DWC2_DIR=${HOME}/duetwebcontrol
|
||||
#octoprint
|
||||
readonly OCTOPRINT_DIR=${HOME}/OctoPrint
|
||||
readonly OCTOPRINT_ENV_DIR=${HOME}/OctoPrint/env
|
||||
#KlipperScreen
|
||||
readonly KLIPPERSCREEN_DIR=${HOME}/KlipperScreen
|
||||
readonly KLIPPERSCREEN_ENV_DIR=${HOME}/.KlipperScreen-env
|
||||
#MoonrakerTelegramBot
|
||||
readonly MOONRAKER_TELEGRAM_BOT_DIR=${HOME}/moonraker-telegram-bot
|
||||
readonly MOONRAKER_TELEGRAM_BOT_ENV_DIR=${HOME}/moonraker-telegram-bot-env
|
||||
#misc
|
||||
readonly INI_FILE=${HOME}/.kiauh.ini
|
||||
readonly BACKUP_DIR=${HOME}/kiauh-backups
|
||||
readonly SYSTEMD_DIR=/etc/systemd/system
|
||||
|
||||
### set github repos
|
||||
readonly KLIPPER_REPO=https://github.com/Klipper3d/klipper.git
|
||||
readonly ARKSINE_REPO=https://github.com/Arksine/klipper.git
|
||||
readonly DMBUTYUGIN_REPO=https://github.com/dmbutyugin/klipper.git
|
||||
readonly DWC2FK_REPO=https://github.com/Stephan3/dwc2-for-klipper-socket.git
|
||||
readonly KLIPPERSCREEN_REPO=https://github.com/jordanruthe/KlipperScreen.git
|
||||
readonly NLEF_REPO=https://github.com/nlef/moonraker-telegram-bot.git
|
||||
#branches
|
||||
readonly BRANCH_SCURVE_SMOOTHING=dmbutyugin/scurve-smoothing
|
||||
readonly BRANCH_SCURVE_SHAPING=dmbutyugin/scurve-shaping
|
||||
|
||||
### Webcam
|
||||
readonly WEBCAMD_SRC="https://raw.githubusercontent.com/raymondh2/MainsailOS/master/src/modules/mjpgstreamer/filesystem/root/usr/local/bin/webcamd"
|
||||
readonly WEBCAM_TXT_SRC="https://raw.githubusercontent.com/raymondh2/MainsailOS/master/src/modules/mjpgstreamer/filesystem/home/pi/klipper_config/webcam.txt"
|
||||
|
||||
###Whiptail
|
||||
readonly KIAUH_WHIPTAIL_NORMAL_WIDTH=70
|
||||
readonly KIAUH_WHIPTAIL_NORMAL_HEIGHT=24
|
||||
readonly KIAUH_WHIPTAIL_SINGLE_LINE_HEIGHT=7
|
||||
7
scripts/constants/strings.sh
Normal file
7
scripts/constants/strings.sh
Normal file
@@ -0,0 +1,7 @@
|
||||
# shellcheck shell=bash
|
||||
|
||||
### Universal Strings
|
||||
# Universal
|
||||
KIAUH_TITLE="KIAUH - Klipper Installation And Update Helper"
|
||||
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
# 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
|
||||
@@ -49,7 +48,7 @@ create_virtualenv()
|
||||
# Step 4: Install startup script
|
||||
install_script(){
|
||||
report_status "Installing system start script..."
|
||||
sudo /bin/sh -c "cat > $SYSTEMDDIR/dwc.service" << EOF
|
||||
sudo /bin/sh -c "cat > $SYSTEMD_DIR/dwc.service" << EOF
|
||||
#Systemd service file for DWC
|
||||
[Unit]
|
||||
Description=dwc_webif
|
||||
|
||||
@@ -1,15 +1,12 @@
|
||||
### base variables
|
||||
SYSTEMDDIR="/etc/systemd/system"
|
||||
#!/bin/bash
|
||||
|
||||
# setting up some frequently used functions
|
||||
|
||||
check_euid(){
|
||||
if [ "$EUID" -eq 0 ]
|
||||
then
|
||||
echo -e "${red}"
|
||||
top_border
|
||||
echo -e "| !!! THIS SCRIPT MUST NOT RAN AS ROOT !!! |"
|
||||
bottom_border
|
||||
echo -e "${default}"
|
||||
whiptail --title "$KIAUH_TITLE" --msgbox "!!! THIS SCRIPT MUST NOT RAN AS ROOT !!!"\
|
||||
"$KIAUH_WHIPTAIL_SINGLE_LINE_HEIGHT" "$KIAUH_WHIPTAIL_NORMAL_WIDTH"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
@@ -97,33 +94,33 @@ set_klipper_cfg_path(){
|
||||
fi
|
||||
|
||||
### handle single klipper instance service file
|
||||
if [ -f $SYSTEMDDIR/klipper.service ]; then
|
||||
if [ -f $SYSTEMD_DIR/klipper.service ]; then
|
||||
status_msg "Configuring Klipper for new path ..."
|
||||
sudo sed -i -r "/ExecStart=/ s| (.+)\/printer.cfg| $new_klipper_cfg_loc/printer.cfg|" $SYSTEMDDIR/klipper.service
|
||||
sudo sed -i -r "/ExecStart=/ s| (.+)\/printer.cfg| $new_klipper_cfg_loc/printer.cfg|" $SYSTEMD_DIR/klipper.service
|
||||
ok_msg "OK!"
|
||||
fi
|
||||
### handle multi klipper instance service file
|
||||
if ls $SYSTEMDDIR/klipper-*.service 2>/dev/null 1>&2; then
|
||||
if ls $SYSTEMD_DIR/klipper-*.service 2>/dev/null 1>&2; then
|
||||
status_msg "Configuring Klipper for new path ..."
|
||||
for service in $(find $SYSTEMDDIR/klipper-*.service); do
|
||||
for service in $(find $SYSTEMD_DIR/klipper-*.service); do
|
||||
sudo sed -i -r "/ExecStart=/ s| (.+)\/printer_| $new_klipper_cfg_loc/printer_|" $service
|
||||
done
|
||||
ok_msg "OK!"
|
||||
fi
|
||||
|
||||
### handle single moonraker instance service and moonraker.conf file
|
||||
if [ -f $SYSTEMDDIR/moonraker.service ]; then
|
||||
if [ -f $SYSTEMD_DIR/moonraker.service ]; then
|
||||
status_msg "Configuring Moonraker for new path ..."
|
||||
sudo sed -i -r "/ExecStart=/ s|-c (.+)\/moonraker\.conf|-c $new_klipper_cfg_loc/moonraker.conf|" $SYSTEMDDIR/moonraker.service
|
||||
sudo sed -i -r "/ExecStart=/ s|-c (.+)\/moonraker\.conf|-c $new_klipper_cfg_loc/moonraker.conf|" $SYSTEMD_DIR/moonraker.service
|
||||
|
||||
### replace old file path with new one in moonraker.conf
|
||||
sed -i -r "/config_path:/ s|config_path:.*|config_path: $new_klipper_cfg_loc|" $new_klipper_cfg_loc/moonraker.conf
|
||||
ok_msg "OK!"
|
||||
fi
|
||||
### handle multi moonraker instance service file
|
||||
if ls $SYSTEMDDIR/moonraker-*.service 2>/dev/null 1>&2; then
|
||||
if ls $SYSTEMD_DIR/moonraker-*.service 2>/dev/null 1>&2; then
|
||||
status_msg "Configuring Moonraker for new path ..."
|
||||
for service in $(find $SYSTEMDDIR/moonraker-*.service); do
|
||||
for service in $(find $SYSTEMD_DIR/moonraker-*.service); do
|
||||
sudo sed -i -r "/ExecStart=/ s|-c (.+)\/printer_|-c $new_klipper_cfg_loc/printer_|" $service
|
||||
done
|
||||
### replace old file path with new one in moonraker.conf
|
||||
@@ -148,7 +145,7 @@ source_kiauh_ini(){
|
||||
|
||||
do_action_service(){
|
||||
shopt -s extglob # enable extended globbing
|
||||
SERVICES="$SYSTEMDDIR/$2?(-*([0-9])).service"
|
||||
SERVICES="$SYSTEMD_DIR/$2?(-*([0-9])).service"
|
||||
### set a variable for the ok and status messages
|
||||
[ "$1" == "start" ] && ACTION1="started" && ACTION2="Starting"
|
||||
[ "$1" == "stop" ] && ACTION1="stopped" && ACTION2="Stopping"
|
||||
@@ -459,3 +456,9 @@ init_ini(){
|
||||
fi
|
||||
fetch_webui_ports
|
||||
}
|
||||
|
||||
check_kiauh_version() {
|
||||
cd ${SRCDIR}/kiauh
|
||||
KIAUH_VER=$(git describe HEAD --always --tags | cut -d "-" -f 1,2)
|
||||
KIAUH_VER="$(printf "%-20s" "$KIAUH_VER")"
|
||||
}
|
||||
@@ -1,5 +1,4 @@
|
||||
### base variables
|
||||
SYSTEMDDIR="/etc/systemd/system"
|
||||
DWC_ENV="${HOME}/dwc-env"
|
||||
DWC2_DIR="${HOME}/duetwebcontrol"
|
||||
|
||||
@@ -194,7 +193,7 @@ create_dwc_virtualenv()
|
||||
|
||||
create_single_dwc_startscript(){
|
||||
### create systemd service file
|
||||
sudo /bin/sh -c "cat > ${SYSTEMDDIR}/dwc.service" << DWC
|
||||
sudo /bin/sh -c "cat > ${SYSTEMD_DIR}/dwc.service" << DWC
|
||||
[Unit]
|
||||
Description=DuetWebControl
|
||||
After=network.target
|
||||
@@ -212,7 +211,7 @@ DWC
|
||||
|
||||
create_multi_dwc_startscript(){
|
||||
### create systemd service file
|
||||
sudo /bin/sh -c "cat > ${SYSTEMDDIR}/dwc-$INSTANCE.service" << DWC
|
||||
sudo /bin/sh -c "cat > ${SYSTEMD_DIR}/dwc-$INSTANCE.service" << DWC
|
||||
[Unit]
|
||||
Description=DuetWebControl
|
||||
After=network.target
|
||||
|
||||
@@ -1,7 +1,4 @@
|
||||
### base variables
|
||||
SYSTEMDDIR="/etc/systemd/system"
|
||||
KLIPPY_ENV="${HOME}/klippy-env"
|
||||
KLIPPER_DIR="${HOME}/klipper"
|
||||
#!/bin/bash
|
||||
|
||||
klipper_setup_dialog(){
|
||||
status_msg "Initializing Klipper installation ..."
|
||||
@@ -121,7 +118,7 @@ create_klipper_service(){
|
||||
P_CFG="$CFG_PATH/printer.cfg"
|
||||
P_CFG_SRC="${SRCDIR}/kiauh/resources/printer.cfg"
|
||||
KL_SERV_SRC="${SRCDIR}/kiauh/resources/klipper.service"
|
||||
KL_SERV_TARGET="$SYSTEMDDIR/klipper.service"
|
||||
KL_SERV_TARGET="$SYSTEMD_DIR/klipper.service"
|
||||
|
||||
write_kl_service(){
|
||||
[ ! -d $CFG_PATH ] && mkdir -p $CFG_PATH
|
||||
@@ -156,7 +153,7 @@ create_klipper_service(){
|
||||
while [ $i -le $INSTANCE_COUNT ]; do
|
||||
### rewrite default variables for multi instance cases
|
||||
CFG_PATH="$klipper_cfg_loc/printer_$i"
|
||||
KL_SERV_TARGET="$SYSTEMDDIR/klipper-$i.service"
|
||||
KL_SERV_TARGET="$SYSTEMD_DIR/klipper-$i.service"
|
||||
P_TMP="/tmp/printer-$i"
|
||||
P_CFG="$CFG_PATH/printer.cfg"
|
||||
KL_LOG="${HOME}/klipper_logs/klippy-$i.log"
|
||||
|
||||
@@ -1,15 +1,12 @@
|
||||
### base variables
|
||||
SYSTEMDDIR="/etc/systemd/system"
|
||||
WEBCAMD_SRC="https://raw.githubusercontent.com/raymondh2/MainsailOS/master/src/modules/mjpgstreamer/filesystem/root/usr/local/bin/webcamd"
|
||||
WEBCAM_TXT_SRC="https://raw.githubusercontent.com/raymondh2/MainsailOS/master/src/modules/mjpgstreamer/filesystem/home/pi/klipper_config/webcam.txt"
|
||||
#!/bin/bash
|
||||
|
||||
install_mjpg-streamer(){
|
||||
install_mjpg_streamer(){
|
||||
### checking dependencies
|
||||
check_klipper_cfg_path
|
||||
|
||||
### set default values
|
||||
MJPG_SERV_SRC="${SRCDIR}/kiauh/resources/webcamd.service"
|
||||
MJPG_SERV_TARGET="$SYSTEMDDIR/webcamd.service"
|
||||
MJPG_SERV_TARGET="$SYSTEMD_DIR/webcamd.service"
|
||||
WEBCAM_TXT="$klipper_cfg_loc/webcam.txt"
|
||||
|
||||
### if there is a webcamd.service -> exit
|
||||
@@ -109,4 +106,4 @@ EOF
|
||||
echo -e " ${cyan}● Webcam URL:${default} $WEBCAM_IP"
|
||||
echo -e " ${cyan}● Webcam URL:${default} $WEBCAM_URL"
|
||||
echo
|
||||
}
|
||||
}
|
||||
@@ -1,10 +1,6 @@
|
||||
### base variables
|
||||
SYSTEMDDIR="/etc/systemd/system"
|
||||
MOONRAKER_ENV="${HOME}/moonraker-env"
|
||||
MOONRAKER_DIR="${HOME}/moonraker"
|
||||
MOONRAKER_REPO="https://github.com/Arksine/moonraker.git"
|
||||
#!/bin/bash
|
||||
|
||||
system_check_moonraker(){
|
||||
system_check_moonraker() {
|
||||
### python 3 check
|
||||
status_msg "Your Python 3 version is: $(python3 --version)"
|
||||
major=$(python3 --version | cut -d" " -f2 | cut -d"." -f1)
|
||||
@@ -18,7 +14,7 @@ system_check_moonraker(){
|
||||
fi
|
||||
}
|
||||
|
||||
moonraker_setup_dialog(){
|
||||
moonraker_setup_dialog() {
|
||||
status_msg "Initializing Moonraker installation ..."
|
||||
|
||||
### checking system for python3.7+
|
||||
@@ -32,13 +28,13 @@ moonraker_setup_dialog(){
|
||||
|
||||
shopt -s extglob # enable extended globbing
|
||||
### check for existing moonraker service installations
|
||||
FILE="$SYSTEMDDIR/moonraker?(-*([0-9])).service"
|
||||
FILE="$SYSTEMD_DIR/moonraker?(-*([0-9])).service"
|
||||
if ls $FILE 2>/dev/null 1>&2; then
|
||||
ERROR_MSG="At least one Moonraker service is already installed!" && return 0
|
||||
fi
|
||||
|
||||
### check for existing klipper service installations
|
||||
FILE="$SYSTEMDDIR/klipper?(-*([0-9])).service"
|
||||
FILE="$SYSTEMD_DIR/klipper?(-*([0-9])).service"
|
||||
if ! ls $FILE 2>/dev/null 1>&2; then
|
||||
ERROR_MSG="Klipper service not found, please install Klipper first!" && return 0
|
||||
fi
|
||||
@@ -56,36 +52,39 @@ moonraker_setup_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 Moonraker instance per Klipper instance. | "
|
||||
bottom_border
|
||||
echo
|
||||
read -p "${cyan}###### Create $INSTANCE_COUNT Moonraker instances? (Y/n):${default} " yn
|
||||
case "$yn" in
|
||||
Y|y|Yes|yes|"")
|
||||
echo -e "###### > Yes"
|
||||
status_msg "Creating $INSTANCE_COUNT Moonraker instances ..."
|
||||
moonraker_setup
|
||||
break;;
|
||||
N|n|No|no)
|
||||
echo -e "###### > No"
|
||||
warn_msg "Exiting Moonraker setup ..."
|
||||
echo
|
||||
break;;
|
||||
*)
|
||||
print_unkown_cmd
|
||||
print_msg && clear_msg;;
|
||||
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 Moonraker instance per Klipper instance. | "
|
||||
bottom_border
|
||||
echo
|
||||
read -p "${cyan}###### Create $INSTANCE_COUNT Moonraker instances? (Y/n):${default} " yn
|
||||
case "$yn" in
|
||||
Y | y | Yes | yes | "")
|
||||
echo -e "###### > Yes"
|
||||
status_msg "Creating $INSTANCE_COUNT Moonraker instances ..."
|
||||
moonraker_setup
|
||||
break
|
||||
;;
|
||||
N | n | No | no)
|
||||
echo -e "###### > No"
|
||||
warn_msg "Exiting Moonraker setup ..."
|
||||
echo
|
||||
break
|
||||
;;
|
||||
*)
|
||||
print_unkown_cmd
|
||||
print_msg && clear_msg
|
||||
;;
|
||||
esac
|
||||
done
|
||||
}
|
||||
|
||||
moonraker_setup(){
|
||||
moonraker_setup() {
|
||||
### checking dependencies
|
||||
dep=(wget curl unzip dfu-util virtualenv)
|
||||
### additional deps for kiauh compatibility for armbian
|
||||
@@ -116,10 +115,11 @@ moonraker_setup(){
|
||||
print_msg && clear_msg
|
||||
|
||||
### display moonraker ips to the user
|
||||
print_mr_ip_list; echo
|
||||
print_mr_ip_list
|
||||
echo
|
||||
}
|
||||
|
||||
install_moonraker_packages(){
|
||||
install_moonraker_packages() {
|
||||
### read PKGLIST from official install script
|
||||
status_msg "Reading dependencies..."
|
||||
install_script="${HOME}/moonraker/scripts/install-moonraker.sh"
|
||||
@@ -138,13 +138,13 @@ install_moonraker_packages(){
|
||||
sudo apt-get install --yes ${PKGARR[@]}
|
||||
}
|
||||
|
||||
create_moonraker_virtualenv(){
|
||||
create_moonraker_virtualenv() {
|
||||
status_msg "Installing python virtual environment..."
|
||||
|
||||
### If venv exists and user prompts a rebuild, then do so
|
||||
if [ -d ${MOONRAKER_ENV} ] && [ $REBUILD_ENV = "y" ]; then
|
||||
if [ -d "${MOONRAKER_ENV}" ] && [ $REBUILD_ENV = "y" ]; then
|
||||
status_msg "Removing old virtualenv"
|
||||
rm -rf ${MOONRAKER_ENV}
|
||||
rm -rf "${MOONRAKER_ENV}"
|
||||
fi
|
||||
|
||||
if [ ! -d ${MOONRAKER_ENV} ]; then
|
||||
@@ -156,7 +156,7 @@ create_moonraker_virtualenv(){
|
||||
${MOONRAKER_ENV}/bin/pip install -r ${MOONRAKER_DIR}/scripts/moonraker-requirements.txt
|
||||
}
|
||||
|
||||
create_moonraker_service(){
|
||||
create_moonraker_service() {
|
||||
### get config directory
|
||||
source_kiauh_ini
|
||||
|
||||
@@ -168,18 +168,18 @@ create_moonraker_service(){
|
||||
MR_LOG="${HOME}/klipper_logs/moonraker.log"
|
||||
MR_CONF="$CFG_PATH/moonraker.conf"
|
||||
MR_SERV_SRC="${SRCDIR}/kiauh/resources/moonraker.service"
|
||||
MR_SERV_TARGET="$SYSTEMDDIR/moonraker.service"
|
||||
MR_SERV_TARGET="$SYSTEMD_DIR/moonraker.service"
|
||||
|
||||
write_mr_service(){
|
||||
write_mr_service() {
|
||||
if [ ! -f $MR_SERV_TARGET ]; then
|
||||
status_msg "Creating Moonraker Service $i ..."
|
||||
sudo cp $MR_SERV_SRC $MR_SERV_TARGET
|
||||
sudo sed -i "s|%INST%|$i|" $MR_SERV_TARGET
|
||||
sudo sed -i "s|%USER%|${USER}|" $MR_SERV_TARGET
|
||||
sudo sed -i "s|%MR_ENV%|$MR_ENV|" $MR_SERV_TARGET
|
||||
sudo sed -i "s|%MR_DIR%|$MR_DIR|" $MR_SERV_TARGET
|
||||
sudo sed -i "s|%MR_LOG%|$MR_LOG|" $MR_SERV_TARGET
|
||||
sudo sed -i "s|%MR_CONF%|$MR_CONF|" $MR_SERV_TARGET
|
||||
sudo cp $MR_SERV_SRC $MR_SERV_TARGET
|
||||
sudo sed -i "s|%INST%|$i|" $MR_SERV_TARGET
|
||||
sudo sed -i "s|%USER%|${USER}|" $MR_SERV_TARGET
|
||||
sudo sed -i "s|%MR_ENV%|$MR_ENV|" $MR_SERV_TARGET
|
||||
sudo sed -i "s|%MR_DIR%|$MR_DIR|" $MR_SERV_TARGET
|
||||
sudo sed -i "s|%MR_LOG%|$MR_LOG|" $MR_SERV_TARGET
|
||||
sudo sed -i "s|%MR_CONF%|$MR_CONF|" $MR_SERV_TARGET
|
||||
fi
|
||||
}
|
||||
|
||||
@@ -196,7 +196,7 @@ create_moonraker_service(){
|
||||
while [ $i -le $INSTANCE_COUNT ]; do
|
||||
### rewrite default variables for multi instance cases
|
||||
CFG_PATH="$klipper_cfg_loc/printer_$i"
|
||||
MR_SERV_TARGET="$SYSTEMDDIR/moonraker-$i.service"
|
||||
MR_SERV_TARGET="$SYSTEMD_DIR/moonraker-$i.service"
|
||||
MR_CONF="$CFG_PATH/moonraker.conf"
|
||||
MR_LOG="${HOME}/klipper_logs/moonraker-$i.log"
|
||||
### write multi instance service
|
||||
@@ -207,7 +207,7 @@ create_moonraker_service(){
|
||||
### launching instance
|
||||
do_action_service "start" "moonraker-$i"
|
||||
### raise values by 1
|
||||
i=$((i+1))
|
||||
i=$((i + 1))
|
||||
done
|
||||
unset i
|
||||
|
||||
@@ -221,7 +221,7 @@ create_moonraker_service(){
|
||||
fi
|
||||
}
|
||||
|
||||
create_moonraker_conf(){
|
||||
create_moonraker_conf() {
|
||||
### get config directory
|
||||
source_kiauh_ini
|
||||
|
||||
@@ -238,7 +238,7 @@ create_moonraker_conf(){
|
||||
IP=$(hostname -I | cut -d" " -f1)
|
||||
LAN="$(hostname -I | cut -d" " -f1 | cut -d"." -f1-2).0.0/16"
|
||||
|
||||
write_mr_conf(){
|
||||
write_mr_conf() {
|
||||
[ ! -d $CFG_PATH ] && mkdir -p $CFG_PATH
|
||||
if [ ! -f $MR_CONF ]; then
|
||||
status_msg "Creating moonraker.conf in $CFG_PATH ..."
|
||||
@@ -281,14 +281,14 @@ create_moonraker_conf(){
|
||||
mr_ip_list+=("$IP:$PORT")
|
||||
|
||||
### raise values by 1
|
||||
PORT=$((PORT+1))
|
||||
i=$((i+1))
|
||||
PORT=$((PORT + 1))
|
||||
i=$((i + 1))
|
||||
done
|
||||
unset PORT && unset i
|
||||
fi
|
||||
}
|
||||
|
||||
print_mr_ip_list(){
|
||||
print_mr_ip_list() {
|
||||
i=1
|
||||
for ip in ${mr_ip_list[@]}; do
|
||||
echo -e " ${cyan}● Instance $i:${default} $ip"
|
||||
|
||||
4
scripts/install_moonraker-telegram-bot.sh → scripts/install_moonraker_telegram_bot.sh
Normal file → Executable file
4
scripts/install_moonraker-telegram-bot.sh → scripts/install_moonraker_telegram_bot.sh
Normal file → Executable file
@@ -1,4 +1,6 @@
|
||||
install_MoonrakerTelegramBot(){
|
||||
#!/bin/bash
|
||||
|
||||
install_moonraker_telegram_bot(){
|
||||
source_kiauh_ini
|
||||
#MoonrakerTelegramBot main installation
|
||||
MoonrakerTelegramBot_setup
|
||||
@@ -1,47 +1,4 @@
|
||||
### base variables
|
||||
SYSTEMDDIR="/etc/systemd/system"
|
||||
OCTOPRINT_ENV="${HOME}/OctoPrint"
|
||||
|
||||
octoprint_setup_dialog(){
|
||||
status_msg "Initializing OctoPrint installation ..."
|
||||
|
||||
### 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
|
||||
|
||||
### 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 OctoPrint instance per Klipper instance. | "
|
||||
bottom_border
|
||||
echo
|
||||
read -p "${cyan}###### Create $INSTANCE_COUNT OctoPrint instances? (Y/n):${default} " yn
|
||||
case "$yn" in
|
||||
Y|y|Yes|yes|"")
|
||||
echo -e "###### > Yes"
|
||||
status_msg "Creating $INSTANCE_COUNT OctoPrint instances ..."
|
||||
octoprint_setup
|
||||
break;;
|
||||
N|n|No|no)
|
||||
echo -e "###### > No"
|
||||
warn_msg "Exiting OctoPrint setup ..."
|
||||
echo
|
||||
break;;
|
||||
*)
|
||||
print_unkown_cmd
|
||||
print_msg && clear_msg;;
|
||||
esac
|
||||
done
|
||||
}
|
||||
#!/bin/bash
|
||||
|
||||
octoprint_dependencies(){
|
||||
dep=(
|
||||
@@ -66,9 +23,9 @@ octoprint_setup(){
|
||||
add_reboot_permission
|
||||
|
||||
### create and activate the virtualenv
|
||||
[ ! -d $OCTOPRINT_ENV ] && mkdir -p $OCTOPRINT_ENV
|
||||
[ ! -d $OCTOPRINT_DIR ] && mkdir -p $OCTOPRINT_DIR
|
||||
status_msg "Set up virtualenv ..."
|
||||
cd $OCTOPRINT_ENV
|
||||
cd $OCTOPRINT_DIR
|
||||
virtualenv --python=python3 venv
|
||||
source venv/bin/activate
|
||||
|
||||
@@ -103,7 +60,7 @@ add_to_groups(){
|
||||
|
||||
create_single_octoprint_startscript(){
|
||||
### create single instance systemd service file
|
||||
sudo /bin/sh -c "cat > ${SYSTEMDDIR}/octoprint.service" << OCTOPRINT
|
||||
sudo /bin/sh -c "cat > ${SYSTEMD_DIR}/octoprint.service" << OCTOPRINT
|
||||
[Unit]
|
||||
Description=Starts OctoPrint on startup
|
||||
After=network-online.target
|
||||
@@ -114,7 +71,7 @@ Environment="LC_ALL=C.UTF-8"
|
||||
Environment="LANG=C.UTF-8"
|
||||
Type=simple
|
||||
User=$USER
|
||||
ExecStart=${OCTOPRINT_ENV}/venv/bin/octoprint --basedir ${BASEDIR} --config ${CONFIG_YAML} --port=${PORT} serve
|
||||
ExecStart=${OCTOPRINT_DIR}/venv/bin/octoprint --basedir ${BASEDIR} --config ${CONFIG_YAML} --port=${PORT} serve
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
@@ -123,7 +80,7 @@ OCTOPRINT
|
||||
|
||||
create_multi_octoprint_startscript(){
|
||||
### create multi instance systemd service file
|
||||
sudo /bin/sh -c "cat > ${SYSTEMDDIR}/octoprint-$INSTANCE.service" << OCTOPRINT
|
||||
sudo /bin/sh -c "cat > ${SYSTEMD_DIR}/octoprint-$INSTANCE.service" << OCTOPRINT
|
||||
[Unit]
|
||||
Description=Starts OctoPrint instance $INSTANCE on startup
|
||||
After=network-online.target
|
||||
@@ -134,7 +91,7 @@ Environment="LC_ALL=C.UTF-8"
|
||||
Environment="LANG=C.UTF-8"
|
||||
Type=simple
|
||||
User=$USER
|
||||
ExecStart=${OCTOPRINT_ENV}/venv/bin/octoprint --basedir ${BASEDIR} --config ${CONFIG_YAML} --port=${PORT} serve
|
||||
ExecStart=${OCTOPRINT_DIR}/venv/bin/octoprint --basedir ${BASEDIR} --config ${CONFIG_YAML} --port=${PORT} serve
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
#!/bin/bash
|
||||
|
||||
### base variables
|
||||
PGC_FOR_KLIPPER_REPO="https://github.com/Kragrathea/pgcode"
|
||||
PGC_DIR="${HOME}/pgcode"
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
### base variables
|
||||
SYSTEMDDIR="/etc/systemd/system"
|
||||
#!/bin/bash
|
||||
|
||||
get_theme_list(){
|
||||
theme_csv_url="https://raw.githubusercontent.com/meteyou/mainsail/develop/docs/_data/themes.csv"
|
||||
@@ -21,47 +20,6 @@ get_theme_list(){
|
||||
done <<< $theme_csv
|
||||
}
|
||||
|
||||
ms_theme_ui(){
|
||||
top_border
|
||||
echo -e "| ${red}~~~~~~~~ [ Mainsail Theme Installer ] ~~~~~~~${default} | "
|
||||
hr
|
||||
echo -e "| ${green}A preview of each Mainsail theme can be found here:${default} | "
|
||||
echo -e "| https://docs.mainsail.xyz/theming/themes | "
|
||||
blank_line
|
||||
echo -e "| ${yellow}Important note:${default} | "
|
||||
echo -e "| Installing a theme from this menu will overwrite an | "
|
||||
echo -e "| already installed theme or modified custom.css file! | "
|
||||
hr
|
||||
#echo -e "| Theme: | "
|
||||
# dynamically generate the themelist from a csv file
|
||||
get_theme_list
|
||||
echo -e "| | "
|
||||
echo -e "| R) [Remove Theme] | "
|
||||
#echo -e "| | "
|
||||
back_footer
|
||||
}
|
||||
|
||||
ms_theme_menu(){
|
||||
ms_theme_ui
|
||||
while true; do
|
||||
read -p "${cyan}Install theme:${default} " a; echo
|
||||
if [ $a = "b" ] || [ $a = "B" ]; then
|
||||
clear && advanced_menu && break
|
||||
elif [ $a = "r" ] || [ $a = "R" ]; then
|
||||
ms_theme_delete
|
||||
ms_theme_menu
|
||||
elif [ $a -le ${#t_url[@]} ]; then
|
||||
ms_theme_install "${t_auth[$a]}" "${t_url[$a]}" "${t_name[$a]}" "${t_note[$a]}"
|
||||
ms_theme_menu
|
||||
else
|
||||
clear && print_header
|
||||
ERROR_MSG="Invalid command!" && print_msg && clear_msg
|
||||
ms_theme_menu
|
||||
fi
|
||||
done
|
||||
ms_theme_menu
|
||||
}
|
||||
|
||||
check_select_printer(){
|
||||
unset printer_num
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
#!/bin/bash
|
||||
|
||||
set_nginx_cfg(){
|
||||
if [ "$SET_NGINX_CFG" = "true" ]; then
|
||||
#check for dependencies
|
||||
|
||||
@@ -1,39 +1,13 @@
|
||||
### base variables
|
||||
SYSTEMDDIR="/etc/systemd/system"
|
||||
#!/bin/bash
|
||||
|
||||
remove_klipper(){
|
||||
#TODO The logic to Ask if you want to remove moonraker should be outside of remove_klipper
|
||||
shopt -s extglob # enable extended globbing
|
||||
### ask the user if he wants to uninstall moonraker too.
|
||||
###? currently usefull if the user wants to switch from single-instance to multi-instance
|
||||
FILE="$SYSTEMDDIR/moonraker?(-*([0-9])).service"
|
||||
FILE="$SYSTEMD_DIR/moonraker?(-*([0-9])).service"
|
||||
if ls $FILE 2>/dev/null 1>&2; then
|
||||
while true; do
|
||||
unset REM_MR
|
||||
top_border
|
||||
echo -e "| Do you want to remove Moonraker afterwards? |"
|
||||
echo -e "| |"
|
||||
echo -e "| This is useful in case you want to switch from a |"
|
||||
echo -e "| single-instance to a multi-instance installation, |"
|
||||
echo -e "| which makes a re-installation of Moonraker necessary. |"
|
||||
echo -e "| |"
|
||||
echo -e "| If for any other reason you only want to uninstall |"
|
||||
echo -e "| Klipper, please select 'No' and continue. |"
|
||||
bottom_border
|
||||
read -p "${cyan}###### Remove Moonraker afterwards? (y/N):${default} " yn
|
||||
case "$yn" in
|
||||
Y|y|Yes|yes)
|
||||
echo -e "###### > Yes"
|
||||
REM_MR="true"
|
||||
break;;
|
||||
N|n|No|no|"")
|
||||
echo -e "###### > No"
|
||||
REM_MR="false"
|
||||
break;;
|
||||
*)
|
||||
print_unkown_cmd
|
||||
print_msg && clear_msg;;
|
||||
esac
|
||||
done
|
||||
remove_moonraker_yesno
|
||||
fi
|
||||
|
||||
### remove "legacy" klipper init.d service
|
||||
@@ -47,7 +21,7 @@ remove_klipper(){
|
||||
fi
|
||||
|
||||
### remove all klipper services
|
||||
FILE="$SYSTEMDDIR/klipper?(-*([0-9])).service"
|
||||
FILE="$SYSTEMD_DIR/klipper?(-*([0-9])).service"
|
||||
if ls $FILE 2>/dev/null 1>&2; then
|
||||
status_msg "Removing Klipper Services ..."
|
||||
for service in $(ls $FILE | cut -d"/" -f5)
|
||||
@@ -55,7 +29,7 @@ remove_klipper(){
|
||||
status_msg "Removing $service ..."
|
||||
sudo systemctl stop $service
|
||||
sudo systemctl disable $service
|
||||
sudo rm -f $SYSTEMDDIR/$service
|
||||
sudo rm -f $SYSTEMD_DIR/$service
|
||||
ok_msg "Done!"
|
||||
done
|
||||
### reloading units
|
||||
@@ -128,7 +102,7 @@ remove_moonraker(){
|
||||
fi
|
||||
|
||||
### remove all moonraker services
|
||||
FILE="$SYSTEMDDIR/moonraker?(-*([0-9])).service"
|
||||
FILE="$SYSTEMD_DIR/moonraker?(-*([0-9])).service"
|
||||
if ls $FILE 2>/dev/null 1>&2; then
|
||||
status_msg "Removing Moonraker Services ..."
|
||||
for service in $(ls $FILE | cut -d"/" -f5)
|
||||
@@ -136,7 +110,7 @@ remove_moonraker(){
|
||||
status_msg "Removing $service ..."
|
||||
sudo systemctl stop $service
|
||||
sudo systemctl disable $service
|
||||
sudo rm -f $SYSTEMDDIR/$service
|
||||
sudo rm -f $SYSTEMD_DIR/$service
|
||||
ok_msg "Done!"
|
||||
done
|
||||
### reloading units
|
||||
@@ -207,7 +181,7 @@ remove_dwc2(){
|
||||
status_msg "Removing $service ..."
|
||||
sudo systemctl stop $service
|
||||
sudo systemctl disable $service
|
||||
sudo rm -f $SYSTEMDDIR/$service
|
||||
sudo rm -f $SYSTEMD_DIR/$service
|
||||
ok_msg "Done!"
|
||||
done
|
||||
### reloading units
|
||||
@@ -327,7 +301,7 @@ remove_octoprint(){
|
||||
status_msg "Removing $service ..."
|
||||
sudo systemctl stop $service
|
||||
sudo systemctl disable $service
|
||||
sudo rm -f $SYSTEMDDIR/$service
|
||||
sudo rm -f $SYSTEMD_DIR/$service
|
||||
ok_msg "OctoPrint Service removed!"
|
||||
done
|
||||
### reloading units
|
||||
@@ -397,7 +371,7 @@ remove_klipperscreen(){
|
||||
status_msg "Removing KlipperScreen service ..."
|
||||
sudo systemctl stop KlipperScreen
|
||||
sudo systemctl disable moonraker
|
||||
sudo rm -f $SYSTEMDDIR/KlipperScreen.service
|
||||
sudo rm -f $SYSTEMD_DIR/KlipperScreen.service
|
||||
###reloading units
|
||||
sudo systemctl daemon-reload
|
||||
sudo systemctl reset-failed
|
||||
@@ -440,7 +414,7 @@ remove_MoonrakerTelegramBot(){
|
||||
status_msg "Removing MoonrakerTelegramBot service ..."
|
||||
sudo systemctl stop moonraker-telegram-bot
|
||||
sudo systemctl disable moonraker-telegram-bot
|
||||
sudo rm -f $SYSTEMDDIR/moonraker-telegram-bot.service
|
||||
sudo rm -f $SYSTEMD_DIR/moonraker-telegram-bot.service
|
||||
###reloading units
|
||||
sudo systemctl daemon-reload
|
||||
sudo systemctl reset-failed
|
||||
@@ -465,10 +439,10 @@ remove_MoonrakerTelegramBot(){
|
||||
|
||||
remove_mjpg-streamer(){
|
||||
### remove MJPG-Streamer service
|
||||
if [ -e $SYSTEMDDIR/webcamd.service ]; then
|
||||
if [ -e $SYSTEMD_DIR/webcamd.service ]; then
|
||||
status_msg "Removing MJPG-Streamer service ..."
|
||||
sudo systemctl stop webcamd && sudo systemctl disable webcamd
|
||||
sudo rm -f $SYSTEMDDIR/webcamd.service
|
||||
sudo rm -f $SYSTEMD_DIR/webcamd.service
|
||||
###reloading units
|
||||
sudo systemctl daemon-reload
|
||||
sudo systemctl reset-failed
|
||||
|
||||
@@ -20,7 +20,7 @@ save_klipper_state(){
|
||||
|
||||
load_klipper_state(){
|
||||
source_kiauh_ini
|
||||
print_branch
|
||||
get_branch
|
||||
cd $KLIPPER_DIR
|
||||
CURRENT_COMMIT=$(git rev-parse --short=8 HEAD)
|
||||
if [ "$GET_BRANCH" = "origin/master" ] || [ "$GET_BRANCH" = "master" ]; then
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
#!/bin/bash
|
||||
|
||||
kiauh_status(){
|
||||
if [ -d "${SRCDIR}/kiauh/.git" ]; then
|
||||
cd ${SRCDIR}/kiauh
|
||||
@@ -50,11 +52,11 @@ klipper_status(){
|
||||
|
||||
### display status
|
||||
if [ "$kcount" == "${#klipper_data[*]}" ]; then
|
||||
KLIPPER_STATUS="$(printf "${green}Installed: %-5s${default}" $SERVICE_FILE_COUNT)"
|
||||
KLIPPER_STATUS="$(printf "Installed: %-5s" $SERVICE_FILE_COUNT)"
|
||||
elif [ "$kcount" == 0 ]; then
|
||||
KLIPPER_STATUS="${red}Not installed!${default} "
|
||||
KLIPPER_STATUS="Not installed!"
|
||||
else
|
||||
KLIPPER_STATUS="${yellow}Incomplete!${default} "
|
||||
KLIPPER_STATUS="Incomplete!"
|
||||
fi
|
||||
}
|
||||
|
||||
@@ -82,11 +84,11 @@ dwc2_status(){
|
||||
done
|
||||
|
||||
if [ "$dcount" == "${#dwc_data[*]}" ]; then
|
||||
DWC2_STATUS="$(printf "${green}Installed: %-5s${default}" $SERVICE_FILE_COUNT)"
|
||||
DWC2_STATUS="$(printf "Installed: %-5s" $SERVICE_FILE_COUNT)"
|
||||
elif [ "$dcount" == 0 ]; then
|
||||
DWC2_STATUS="${red}Not installed!${default} "
|
||||
DWC2_STATUS="Not installed!"
|
||||
else
|
||||
DWC2_STATUS="${yellow}Incomplete!${default} "
|
||||
DWC2_STATUS="Incomplete!"
|
||||
fi
|
||||
}
|
||||
|
||||
@@ -114,11 +116,11 @@ moonraker_status(){
|
||||
|
||||
### display status
|
||||
if [ "$mrcount" == "${#moonraker_data[*]}" ]; then
|
||||
MOONRAKER_STATUS="$(printf "${green}Installed: %-5s${default}" $SERVICE_FILE_COUNT)"
|
||||
MOONRAKER_STATUS="$(printf "Installed: %-5s" $SERVICE_FILE_COUNT)"
|
||||
elif [ "$mrcount" == 0 ]; then
|
||||
MOONRAKER_STATUS="${red}Not installed!${default} "
|
||||
MOONRAKER_STATUS="Not installed!"
|
||||
else
|
||||
MOONRAKER_STATUS="${yellow}Incomplete!${default} "
|
||||
MOONRAKER_STATUS="Incomplete!"
|
||||
fi
|
||||
}
|
||||
|
||||
@@ -137,11 +139,11 @@ mainsail_status(){
|
||||
fi
|
||||
done
|
||||
if [ "$mcount" == "${#mainsail_data[*]}" ]; then
|
||||
MAINSAIL_STATUS="${green}Installed!${default} "
|
||||
MAINSAIL_STATUS="Installed!"
|
||||
elif [ "$mcount" == 0 ]; then
|
||||
MAINSAIL_STATUS="${red}Not installed!${default} "
|
||||
MAINSAIL_STATUS="Not installed!"
|
||||
else
|
||||
MAINSAIL_STATUS="${yellow}Incomplete!${default} "
|
||||
MAINSAIL_STATUS="Incomplete!"
|
||||
fi
|
||||
}
|
||||
|
||||
@@ -160,11 +162,11 @@ fluidd_status(){
|
||||
fi
|
||||
done
|
||||
if [ "$fcount" == "${#fluidd_data[*]}" ]; then
|
||||
FLUIDD_STATUS="${green}Installed!${default} "
|
||||
FLUIDD_STATUS="Installed!"
|
||||
elif [ "$fcount" == 0 ]; then
|
||||
FLUIDD_STATUS="${red}Not installed!${default} "
|
||||
FLUIDD_STATUS="Not installed!"
|
||||
else
|
||||
FLUIDD_STATUS="${yellow}Incomplete!${default} "
|
||||
FLUIDD_STATUS="Incomplete!"
|
||||
fi
|
||||
}
|
||||
|
||||
@@ -190,11 +192,11 @@ octoprint_status(){
|
||||
|
||||
### display status
|
||||
if [ "$ocount" == "${#octoprint_data[*]}" ]; then
|
||||
OCTOPRINT_STATUS="$(printf "${green}Installed: %-5s${default}" $SERVICE_FILE_COUNT)"
|
||||
OCTOPRINT_STATUS="$(printf "Installed: %-5s" $SERVICE_FILE_COUNT)"
|
||||
elif [ "$ocount" == 0 ]; then
|
||||
OCTOPRINT_STATUS="${red}Not installed!${default} "
|
||||
OCTOPRINT_STATUS="Not installed!"
|
||||
else
|
||||
OCTOPRINT_STATUS="${yellow}Incomplete!${default} "
|
||||
OCTOPRINT_STATUS="Incomplete!"
|
||||
fi
|
||||
}
|
||||
|
||||
@@ -220,15 +222,15 @@ klipperscreen_status(){
|
||||
fi
|
||||
done
|
||||
if [ "$klsccount" == "${#klipperscreen_data[*]}" ]; then
|
||||
KLIPPERSCREEN_STATUS="${green}Installed!${default} "
|
||||
KLIPPERSCREEN_STATUS="Installed!"
|
||||
elif [ "$klsccount" == 0 ]; then
|
||||
KLIPPERSCREEN_STATUS="${red}Not installed!${default} "
|
||||
KLIPPERSCREEN_STATUS="Not installed!"
|
||||
else
|
||||
KLIPPERSCREEN_STATUS="${yellow}Incomplete!${default} "
|
||||
KLIPPERSCREEN_STATUS="Incomplete!"
|
||||
fi
|
||||
}
|
||||
|
||||
MoonrakerTelegramBot_status(){
|
||||
update_moonraker_telegram_bot_status(){
|
||||
mtbcount=0
|
||||
MoonrakerTelegramBot_data=(
|
||||
SERVICE
|
||||
@@ -250,11 +252,11 @@ MoonrakerTelegramBot_status(){
|
||||
fi
|
||||
done
|
||||
if [ "$mtbcount" == "${#MoonrakerTelegramBot_data[*]}" ]; then
|
||||
MOONRAKER_TELEGRAM_BOT_STATUS="${green}Installed!${default} "
|
||||
MOONRAKER_TELEGRAM_BOT_STATUS="Installed!"
|
||||
elif [ "$mtbcount" == 0 ]; then
|
||||
MOONRAKER_TELEGRAM_BOT_STATUS="${red}Not installed!${default} "
|
||||
MOONRAKER_TELEGRAM_BOT_STATUS="Not installed!"
|
||||
else
|
||||
MOONRAKER_TELEGRAM_BOT_STATUS="${yellow}Incomplete!${default} "
|
||||
MOONRAKER_TELEGRAM_BOT_STATUS="Incomplete!"
|
||||
fi
|
||||
}
|
||||
|
||||
@@ -288,12 +290,12 @@ read_branch(){
|
||||
}
|
||||
|
||||
#prints the current klipper branch in the main menu
|
||||
print_branch(){
|
||||
get_branch(){
|
||||
read_branch
|
||||
if [ ! -z "$GET_BRANCH" ]; then
|
||||
PRINT_BRANCH="$(printf "%-16s" "$GET_BRANCH")"
|
||||
else
|
||||
PRINT_BRANCH="${red}--------------${default} "
|
||||
PRINT_BRANCH="--------------"
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
#!/bin/bash
|
||||
|
||||
switch_to_master(){
|
||||
cd $KLIPPER_DIR
|
||||
status_msg "Switching...Please wait ..."; echo
|
||||
|
||||
@@ -1,177 +1,63 @@
|
||||
advanced_ui(){
|
||||
top_border
|
||||
echo -e "| ${yellow}~~~~~~~~~~~~~ [ Advanced Menu ] ~~~~~~~~~~~~~${default} | "
|
||||
hr
|
||||
if [ ! "$OPRINT_SERVICE_STATUS" == "" ]; then
|
||||
echo -e "| 0) $OPRINT_SERVICE_STATUS| "
|
||||
hr
|
||||
echo -e "| | | "
|
||||
fi
|
||||
echo -e "| Klipper: | Mainsail: | "
|
||||
echo -e "| 1) [Switch Branch] | 7) [Theme installer] | "
|
||||
echo -e "| 2) [Rollback] | | "
|
||||
echo -e "| | System: | "
|
||||
echo -e "| Firmware: | 8) [Change hostname] | "
|
||||
echo -e "| 3) [Build only] | | "
|
||||
echo -e "| 4) [Flash only] | Extensions: | "
|
||||
echo -e "| 5) [Build + Flash] | 9) [Shell Command] | "
|
||||
echo -e "| 6) [Get MCU ID] | | "
|
||||
echo -e "| | CustomPiOS: | "
|
||||
echo -e "| | 10) [Migration Helper] | "
|
||||
back_footer
|
||||
}
|
||||
#!/bin/bash
|
||||
|
||||
advanced_menu(){
|
||||
read_octoprint_service_status
|
||||
do_action "" "advanced_ui"
|
||||
|
||||
local menu_options=(
|
||||
"1" " "
|
||||
"2" "Switch Klipper Branch"
|
||||
"3" "Rollback Klipper"
|
||||
"4" "Build Firmware"
|
||||
"5" "Flash Firmware"
|
||||
"6" "Build and Flash Firmware"
|
||||
"7" "Get MCU ID"
|
||||
"8" "Install Mainsail Theme"
|
||||
"9" "Change System Hostname"
|
||||
"10" "Run Shell Command"
|
||||
"11" "CustomPiOS Migration Helper"
|
||||
)
|
||||
|
||||
while true; do
|
||||
read -p "${cyan}Perform action:${default} " action; echo
|
||||
case "$action" in
|
||||
0)
|
||||
clear
|
||||
print_header
|
||||
toggle_octoprint_service
|
||||
read_octoprint_service_status
|
||||
print_msg && clear_msg
|
||||
advanced_ui;;
|
||||
1)
|
||||
do_action "switch_menu";;
|
||||
2)
|
||||
do_action "load_klipper_state" "advanced_ui";;
|
||||
3)
|
||||
do_action "build_fw" "advanced_ui";;
|
||||
4)
|
||||
do_action "select_flash_method" "advanced_ui";;
|
||||
5)
|
||||
clear && print_header
|
||||
status_msg "Please wait..."
|
||||
build_fw
|
||||
select_flash_method
|
||||
print_msg && clear_msg
|
||||
advanced_ui;;
|
||||
6)
|
||||
do_action "select_mcu_connection" "advanced_ui";;
|
||||
7)
|
||||
do_action "ms_theme_menu";;
|
||||
8)
|
||||
clear
|
||||
print_header
|
||||
create_custom_hostname && set_hostname
|
||||
print_msg && clear_msg
|
||||
advanced_ui;;
|
||||
9)
|
||||
do_action "setup_gcode_shell_command" "advanced_ui";;
|
||||
10)
|
||||
do_action "migration_menu";;
|
||||
B|b)
|
||||
clear; main_menu; break;;
|
||||
*)
|
||||
deny_action "advanced_ui";;
|
||||
esac
|
||||
done
|
||||
advanced_menu
|
||||
}
|
||||
|
||||
#############################################################
|
||||
#############################################################
|
||||
|
||||
switch_ui(){
|
||||
top_border
|
||||
echo -e "| $(title_msg "~~~~~~~~~ [ Switch Klipper Branch ] ~~~~~~~~~") |"
|
||||
bottom_border
|
||||
echo
|
||||
echo -e " $(title_msg "Active Branch: ")${green}$GET_BRANCH${default}"
|
||||
echo
|
||||
top_border
|
||||
echo -e "| | "
|
||||
echo -e "| KevinOConnor: | "
|
||||
echo -e "| 1) [--> master] | "
|
||||
echo -e "| | "
|
||||
echo -e "| dmbutyugin: | "
|
||||
echo -e "| 2) [--> scurve-shaping] | "
|
||||
echo -e "| 3) [--> scurve-smoothing] | "
|
||||
back_footer
|
||||
}
|
||||
|
||||
switch_menu(){
|
||||
if [ -d $KLIPPER_DIR ]; then
|
||||
read_branch
|
||||
do_action "" "switch_ui"
|
||||
while true; do
|
||||
read -p "${cyan}Perform action:${default} " action; echo
|
||||
case "$action" in
|
||||
1)
|
||||
clear
|
||||
print_header
|
||||
switch_to_master
|
||||
read_branch
|
||||
print_msg && clear_msg
|
||||
switch_ui;;
|
||||
2)
|
||||
clear
|
||||
print_header
|
||||
switch_to_scurve_shaping
|
||||
read_branch
|
||||
print_msg && clear_msg
|
||||
switch_ui;;
|
||||
3)
|
||||
clear
|
||||
print_header
|
||||
switch_to_scurve_smoothing
|
||||
read_branch
|
||||
print_msg && clear_msg
|
||||
switch_ui;;
|
||||
4)
|
||||
clear
|
||||
print_header
|
||||
switch_to_moonraker
|
||||
read_branch
|
||||
print_msg && clear_msg
|
||||
switch_ui;;
|
||||
B|b)
|
||||
clear; advanced_menu; break;;
|
||||
*)
|
||||
deny_action "switch_ui";;
|
||||
esac
|
||||
done
|
||||
else
|
||||
ERROR_MSG="No Klipper directory found! Download Klipper first!"
|
||||
fi
|
||||
}
|
||||
|
||||
#############################################################
|
||||
#############################################################
|
||||
|
||||
migration_ui(){
|
||||
top_border
|
||||
echo -e "| $(title_msg "~~~~~~~~~ [ CustomPiOS Migration ] ~~~~~~~~~~") | "
|
||||
hr
|
||||
echo -e "| This function will help you to migrate a vanilla | "
|
||||
echo -e "| MainsailOS or FluiddPi image to a newer state. | "
|
||||
blank_line
|
||||
echo -e "| Only use this function if you use MainsailOS 0.4.0 | "
|
||||
echo -e "| or lower, or FluiddPi v1.13.0 or lower. | "
|
||||
blank_line
|
||||
echo -e "| Please have a look at the KIAUH changelog for more | "
|
||||
echo -e "| details on what this function will do. | "
|
||||
hr
|
||||
echo -e "| | "
|
||||
echo -e "| 1) [Migrate MainsailOS] | "
|
||||
echo -e "| 2) [Migrate FluiddPi] | "
|
||||
echo -e "| | "
|
||||
back_footer
|
||||
}
|
||||
|
||||
migration_menu(){
|
||||
print_msg && clear_msg
|
||||
migration_ui
|
||||
while true; do
|
||||
read -p "${cyan}Perform action:${default} " action; echo
|
||||
case "$action" in
|
||||
1) migrate_custompios "mainsail"; migration_menu;;
|
||||
2) migrate_custompios "fluiddpi"; migration_menu;;
|
||||
B|b) clear; advanced_menu; break;;
|
||||
*) print_unkown_cmd; migration_menu;;
|
||||
esac
|
||||
done
|
||||
read_octoprint_service_status
|
||||
menu_options[2]="Current OctoPrint Status: $OPRINT_SERVICE_STATUS"
|
||||
|
||||
if [ ! "$OPRINT_SERVICE_STATUS" == "" ]; then
|
||||
local menu
|
||||
menu=$(whiptail --title "Advanced Menu" --cancel-button "Back" --notags --menu "Perform Action:"\
|
||||
"$KIAUH_WHIPTAIL_NORMAL_HEIGHT" "$KIAUH_WHIPTAIL_NORMAL_WIDTH" 8 "${menu_options[@]}" 3>&1 1>&2 2>&3)
|
||||
else
|
||||
local menu
|
||||
menu=$(whiptail --title "Advanced Menu" --cancel-button "Back" --notags --menu "Perform Action:"\
|
||||
"$KIAUH_WHIPTAIL_NORMAL_HEIGHT" "$KIAUH_WHIPTAIL_NORMAL_WIDTH" 8 "${menu_options[@]:2}" 3>&1 1>&2 2>&3)
|
||||
fi
|
||||
|
||||
local out=$?
|
||||
if [ $out -eq 1 ]; then
|
||||
break
|
||||
elif [ $out -eq 0 ]; then
|
||||
case "$menu" in
|
||||
1) clear
|
||||
print_header
|
||||
toggle_octoprint_service
|
||||
read_octoprint_service_status
|
||||
print_msg && clear_msg;;
|
||||
2) do_action "switch_menu" ;;
|
||||
3) do_action "load_klipper_state";;
|
||||
4) do_action "build_fw" ;;
|
||||
5) do_action "select_flash_method" ;;
|
||||
6) clear && print_header
|
||||
status_msg "Please wait..."
|
||||
build_fw
|
||||
select_flash_method
|
||||
print_msg && clear_msg;;
|
||||
7) do_action "select_mcu_connection" ;;
|
||||
8) do_action "select_flash_method" ;;
|
||||
9) do_action "ms_theme_menu";;
|
||||
10) do_action "setup_gcode_shell_command" ;;
|
||||
11) migration_menu;;
|
||||
esac
|
||||
else
|
||||
# Unexpected event, no clue what happened
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
@@ -1,53 +1,44 @@
|
||||
backup_ui(){
|
||||
top_border
|
||||
echo -e "| $(title_msg "~~~~~~~~~~~~~~ [ Backup Menu ] ~~~~~~~~~~~~~~") | "
|
||||
hr
|
||||
echo -e "| ${yellow}Backup location: ~/kiauh-backups${default} | "
|
||||
hr
|
||||
echo -e "| Configuration folder: | Klipper Webinterface: | "
|
||||
echo -e "| 0) [Klipper configs] | 4) [Mainsail] | "
|
||||
echo -e "| | 5) [Fluidd] | "
|
||||
echo -e "| Firmware: | | "
|
||||
echo -e "| 1) [Klipper] | HDMI Screen: | "
|
||||
echo -e "| | 6) [KlipperScreen] | "
|
||||
echo -e "| Klipper API: | | "
|
||||
echo -e "| 2) [Moonraker] | Other: | "
|
||||
echo -e "| 3) [Moonraker DB] | 7) [Duet Web Control] | "
|
||||
echo -e "| | 8) [OctoPrint] | "
|
||||
echo -e "| | 9) [MoonrakerTelegramBot] | "
|
||||
back_footer
|
||||
}
|
||||
#!/bin/bash
|
||||
|
||||
backup_menu(){
|
||||
do_action "" "backup_ui"
|
||||
|
||||
local menu_options=(
|
||||
"1" "Klipper configs"
|
||||
"2" "Klipper"
|
||||
"3" "Moonraker"
|
||||
"4" "Moonraker DB"
|
||||
"5" "Mainsail"
|
||||
"6" "KlipperScreen"
|
||||
"7" "Duet Web Control"
|
||||
"8" "OctoPrint"
|
||||
"9" "MoonrakerTelegramBot"
|
||||
)
|
||||
|
||||
local menu_str="Backup location: ~/kiauh-backups"
|
||||
while true; do
|
||||
read -p "${cyan}Perform action:${default} " action; echo
|
||||
case "$action" in
|
||||
0)
|
||||
do_action "backup_klipper_config_dir" "backup_ui";;
|
||||
1)
|
||||
do_action "backup_klipper" "backup_ui";;
|
||||
2)
|
||||
do_action "backup_moonraker" "backup_ui";;
|
||||
3)
|
||||
do_action "backup_moonraker_database" "backup_ui";;
|
||||
4)
|
||||
do_action "backup_mainsail" "backup_ui";;
|
||||
5)
|
||||
do_action "backup_fluidd" "backup_ui";;
|
||||
6)
|
||||
do_action "backup_klipperscreen" "backup_ui";;
|
||||
7)
|
||||
do_action "backup_dwc2" "backup_ui";;
|
||||
8)
|
||||
do_action "backup_octoprint" "backup_ui";;
|
||||
9)
|
||||
do_action "backup_MoonrakerTelegramBot" "backup_ui";;
|
||||
B|b)
|
||||
clear; main_menu; break;;
|
||||
*)
|
||||
deny_action "backup_ui";;
|
||||
esac
|
||||
done
|
||||
backup_menu
|
||||
local menu
|
||||
menu=$(whiptail --title "Backup Menu" --cancel-button "Back" --notags --menu "$menu_str\n\nPerform Action:"\
|
||||
"$KIAUH_WHIPTAIL_NORMAL_HEIGHT" "$KIAUH_WHIPTAIL_NORMAL_WIDTH" 8 "${menu_options[@]}" 3>&1 1>&2 2>&3)
|
||||
|
||||
local out=$?
|
||||
if [ $out -eq 1 ]; then
|
||||
break
|
||||
elif [ $out -eq 0 ]; then
|
||||
case "$menu" in
|
||||
0) do_action "backup_klipper_config_dir";;
|
||||
1) do_action "backup_klipper";;
|
||||
2) do_action "backup_moonraker";;
|
||||
3) do_action "backup_moonraker_database";;
|
||||
4) do_action "backup_mainsail";;
|
||||
5) do_action "backup_fluidd";;
|
||||
6) do_action "backup_klipperscreen";;
|
||||
7) do_action "backup_dwc2";;
|
||||
8) do_action "backup_octoprint";;
|
||||
9) do_action "backup_MoonrakerTelegramBot";;
|
||||
esac
|
||||
else
|
||||
# Unexpected event, no clue what happened
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
#!/bin/bash
|
||||
#ui total width = 57 chars
|
||||
top_border(){
|
||||
echo -e "/=======================================================\\"
|
||||
@@ -41,18 +42,6 @@ print_header(){
|
||||
bottom_border
|
||||
}
|
||||
|
||||
kiauh_update_msg(){
|
||||
top_border
|
||||
echo -e "|${green} New KIAUH update available! ${default}| "
|
||||
hr
|
||||
echo -e "|${green} View Changelog: https://git.io/JnmlX ${default}| "
|
||||
blank_line
|
||||
echo -e "|${yellow} It is recommended to keep KIAUH up to date. Updates ${default}| "
|
||||
echo -e "|${yellow} usually contain bugfixes, important changes or new ${default}| "
|
||||
echo -e "|${yellow} features. Please consider updating! ${default}| "
|
||||
bottom_border
|
||||
}
|
||||
|
||||
################################################################################
|
||||
#******************************************************************************#
|
||||
################################################################################
|
||||
@@ -60,11 +49,8 @@ kiauh_update_msg(){
|
||||
|
||||
do_action(){
|
||||
clear && print_header
|
||||
### $1 is the action the user wants to fire
|
||||
$1
|
||||
print_msg && clear_msg
|
||||
### $2 is the menu the user usually gets directed back to after an action is completed
|
||||
$2
|
||||
}
|
||||
|
||||
deny_action(){
|
||||
@@ -73,3 +59,5 @@ deny_action(){
|
||||
print_msg && clear_msg
|
||||
$1
|
||||
}
|
||||
|
||||
|
||||
36
scripts/ui/install_interface_menu.sh
Executable file
36
scripts/ui/install_interface_menu.sh
Executable file
@@ -0,0 +1,36 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# Brief description of your script
|
||||
|
||||
install_interface_menu(){
|
||||
|
||||
local menu_options=(
|
||||
"1" "Mainsail - lightweight & responsive web interface for Klipper"
|
||||
"2" "Fluidd - a free and open-source Klipper web interface for managing your 3d printer"
|
||||
"3" "KlipperScreen - a touchscreen GUI that interfaces with Klipper via Moonraker"
|
||||
"4" "Duet Web Control - a fully-responsive HTML5-based web interface for RepRapFirmware"
|
||||
"5" "OctoPrint - a snappy web interface for controlling consumer 3D printers."
|
||||
)
|
||||
local menu_str="Select an interface to install, you can install multiple interfaces."
|
||||
|
||||
while true; do
|
||||
local menu
|
||||
menu=$(whiptail --title "Install Interface" --cancel-button "Back" --notags --menu "$menu_str\n\nPerform Action:" \
|
||||
"$KIAUH_WHIPTAIL_NORMAL_HEIGHT" "$KIAUH_WHIPTAIL_NORMAL_WIDTH" 8 "${menu_options[@]}" 3>&1 1>&2 2>&3)
|
||||
local out=$?
|
||||
if [ $out -eq 1 ]; then
|
||||
break
|
||||
elif [ $out -eq 0 ]; then
|
||||
case "$menu" in
|
||||
1) do_action "install_webui mainsail";;
|
||||
2) do_action "install_webui fluidd";;
|
||||
3) do_action "install_klipperscreen";;
|
||||
4) do_action "dwc_setup_dialog";;
|
||||
5) do_action "octoprint_setup_dialog";;
|
||||
esac
|
||||
else
|
||||
# Unexpected event, no clue what happened
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
}
|
||||
@@ -1,55 +1,31 @@
|
||||
install_ui(){
|
||||
top_border
|
||||
echo -e "| ${green}~~~~~~~~~~~ [ Installation Menu ] ~~~~~~~~~~~${default} | "
|
||||
hr
|
||||
echo -e "| You need this menu usually only for installing | "
|
||||
echo -e "| all necessary dependencies for the various | "
|
||||
echo -e "| functions on a completely fresh system. | "
|
||||
hr
|
||||
echo -e "| Firmware: | Touchscreen GUI: | "
|
||||
echo -e "| 1) [Klipper] | 5) [KlipperScreen] | "
|
||||
echo -e "| | | "
|
||||
echo -e "| Klipper API: | Other: | "
|
||||
echo -e "| 2) [Moonraker] | 6) [Duet Web Control] | "
|
||||
echo -e "| | 7) [OctoPrint] | "
|
||||
echo -e "| Klipper Webinterface: | 8) [PrettyGCode] | "
|
||||
echo -e "| 3) [Mainsail] | 9) [Telegram Bot] | "
|
||||
echo -e "| 4) [Fluidd] | | "
|
||||
echo -e "| | Webcam: | "
|
||||
echo -e "| | 10) [MJPG-Streamer] | "
|
||||
back_footer
|
||||
}
|
||||
#!/bin/bash
|
||||
|
||||
install_menu(){
|
||||
do_action "" "install_ui"
|
||||
local menu_options=(
|
||||
"1" "Klipper"
|
||||
"2" "Klipper API(Moonraker)"
|
||||
"3" "Interfaces"
|
||||
"4" "Other"
|
||||
)
|
||||
local menu_str="You need this menu usually only for installing all necessary dependencies for the various functions on a completely fresh system."
|
||||
|
||||
while true; do
|
||||
read -p "${cyan}Perform action:${default} " action; echo
|
||||
case "$action" in
|
||||
1)
|
||||
do_action "klipper_setup_dialog" "install_ui";;
|
||||
2)
|
||||
do_action "moonraker_setup_dialog" "install_ui";;
|
||||
3)
|
||||
do_action "install_webui mainsail" "install_ui";;
|
||||
4)
|
||||
do_action "install_webui fluidd" "install_ui";;
|
||||
5)
|
||||
do_action "install_klipperscreen" "install_ui";;
|
||||
6)
|
||||
do_action "dwc_setup_dialog" "install_ui";;
|
||||
7)
|
||||
do_action "octoprint_setup_dialog" "install_ui";;
|
||||
8)
|
||||
do_action "install_pgc_for_klipper" "install_ui";;
|
||||
9)
|
||||
do_action "install_MoonrakerTelegramBot" "install_ui";;
|
||||
10)
|
||||
do_action "install_mjpg-streamer" "install_ui";;
|
||||
B|b)
|
||||
clear; main_menu; break;;
|
||||
*)
|
||||
deny_action "install_ui";;
|
||||
esac
|
||||
local menu
|
||||
menu=$(whiptail --title "Install" --cancel-button "Back" --notags --menu "$menu_str\n\nPerform Action:" \
|
||||
"$KIAUH_WHIPTAIL_NORMAL_HEIGHT" "$KIAUH_WHIPTAIL_NORMAL_WIDTH" 8 "${menu_options[@]}" 3>&1 1>&2 2>&3)
|
||||
local out=$?
|
||||
if [ $out -eq 1 ]; then
|
||||
break
|
||||
elif [ $out -eq 0 ]; then
|
||||
case "$menu" in
|
||||
1) do_action "klipper_setup_dialog";;
|
||||
2) do_action "moonraker_setup_dialog";;
|
||||
3) install_interface_menu;;
|
||||
4) install_other_menu;;
|
||||
esac
|
||||
else
|
||||
# Unexpected event, no clue what happened
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
install_menu
|
||||
}
|
||||
|
||||
33
scripts/ui/install_other_menu.sh
Executable file
33
scripts/ui/install_other_menu.sh
Executable file
@@ -0,0 +1,33 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# Brief description of your script
|
||||
|
||||
install_other_menu(){
|
||||
|
||||
local menu_options=(
|
||||
#TODO WIP
|
||||
"1" "PrettyGCode - "
|
||||
"2" "Klipper Telegram Bot - "
|
||||
"3" "Webcam MJPG-Streamer - Use MJPG-Streamer with webcam"
|
||||
)
|
||||
local menu_str="Select an option to install."
|
||||
|
||||
while true; do
|
||||
local menu
|
||||
menu=$(whiptail --title "Install Other" --cancel-button "Back" --notags --menu "$menu_str\n\nPerform Action:" \
|
||||
"$KIAUH_WHIPTAIL_NORMAL_HEIGHT" "$KIAUH_WHIPTAIL_NORMAL_WIDTH" 8 "${menu_options[@]}" 3>&1 1>&2 2>&3)
|
||||
local out=$?
|
||||
if [ $out -eq 1 ]; then
|
||||
break
|
||||
elif [ $out -eq 0 ]; then
|
||||
case "$menu" in
|
||||
1) do_action "install_pgc_for_klipper";;
|
||||
2) do_action "install_MoonrakerTelegramBot";;
|
||||
3) do_action "install_mjpg-streamer";;
|
||||
esac
|
||||
else
|
||||
# Unexpected event, no clue what happened
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
}
|
||||
28
scripts/ui/kiauh_update_yesno.sh
Executable file
28
scripts/ui/kiauh_update_yesno.sh
Executable file
@@ -0,0 +1,28 @@
|
||||
#!/bin/bash
|
||||
#######################################
|
||||
# description Advise user to update KIAUH
|
||||
# Globals:
|
||||
# KIAUH_WHIPTAIL_NORMAL_HEIGHT
|
||||
# KIAUH_WHIPTAIL_NORMAL_WIDTH
|
||||
# RET
|
||||
# Arguments:
|
||||
# None
|
||||
#######################################
|
||||
kiauh_update_yesno() {
|
||||
whiptail --title "New KIAUH update available!" \
|
||||
--yesno \
|
||||
"View Changelog: https://git.io/JnmlX
|
||||
|
||||
It is recommended to keep KIAUH up to date. Updates usually contain bugfixes, \
|
||||
important changes or new features. Please consider updating!
|
||||
|
||||
Do you want to update now?" \
|
||||
"$KIAUH_WHIPTAIL_NORMAL_HEIGHT" "$KIAUH_WHIPTAIL_NORMAL_WIDTH"
|
||||
|
||||
local out=$?
|
||||
if [ $out -eq 0 ]; then
|
||||
do_action "update_kiauh"
|
||||
else
|
||||
return
|
||||
fi
|
||||
}
|
||||
@@ -1,92 +1,65 @@
|
||||
main_ui(){
|
||||
#[ $KIAUH_UPDATE_REMIND="true" ] && kiauh_update_reminder
|
||||
top_border
|
||||
echo -e "| $(title_msg "~~~~~~~~~~~~~~~ [ Main Menu ] ~~~~~~~~~~~~~~~") |"
|
||||
hr
|
||||
echo -e "| 0) [Upload Log] | Klipper: $KLIPPER_STATUS|"
|
||||
echo -e "| | Branch: ${cyan}$PRINT_BRANCH${default}|"
|
||||
echo -e "| 1) [Install] | |"
|
||||
echo -e "| 2) [Update] | Moonraker: $MOONRAKER_STATUS|"
|
||||
echo -e "| 3) [Remove] | |"
|
||||
echo -e "| 4) [Advanced] | Mainsail: $MAINSAIL_STATUS|"
|
||||
echo -e "| 5) [Backup] | Fluidd: $FLUIDD_STATUS|"
|
||||
echo -e "| | KlipperScreen: $KLIPPERSCREEN_STATUS|"
|
||||
echo -e "| 6) [Settings] | Telegram Bot: $MOONRAKER_TELEGRAM_BOT_STATUS|"
|
||||
echo -e "| | |"
|
||||
echo -e "| | DWC2: $DWC2_STATUS|"
|
||||
echo -e "| ${cyan}$KIAUH_VER${default}| Octoprint: $OCTOPRINT_STATUS|"
|
||||
quit_footer
|
||||
}
|
||||
#!/bin/bash
|
||||
|
||||
print_kiauh_version(){
|
||||
cd ${SRCDIR}/kiauh
|
||||
KIAUH_VER=$(git describe HEAD --always --tags | cut -d "-" -f 1,2)
|
||||
KIAUH_VER="$(printf "%-20s" "$KIAUH_VER")"
|
||||
}
|
||||
|
||||
kiauh_update_dialog(){
|
||||
kiauh_update_msg
|
||||
read -p "${cyan}Do you want to update now? (Y/n):${default} " yn
|
||||
while true; do
|
||||
case "$yn" in
|
||||
Y|y|Yes|yes|"")
|
||||
do_action "update_kiauh"
|
||||
break;;
|
||||
N|n|No|no) break;;
|
||||
*)
|
||||
deny_action "kiauh_update_dialog";;
|
||||
esac
|
||||
done
|
||||
}
|
||||
|
||||
main_menu(){
|
||||
print_header
|
||||
main_menu() {
|
||||
#print KIAUH update msg if update available
|
||||
if [ "$KIAUH_UPDATE_AVAIL" = "true" ]; then
|
||||
kiauh_update_dialog
|
||||
fi
|
||||
#check install status
|
||||
print_kiauh_version
|
||||
klipper_status
|
||||
moonraker_status
|
||||
dwc2_status
|
||||
fluidd_status
|
||||
mainsail_status
|
||||
octoprint_status
|
||||
klipperscreen_status
|
||||
MoonrakerTelegramBot_status
|
||||
print_branch
|
||||
print_msg && clear_msg
|
||||
main_ui
|
||||
while true; do
|
||||
read -p "${cyan}Perform action:${default} " action; echo
|
||||
case "$action" in
|
||||
"start klipper") do_action_service "start" "klipper"; main_ui;;
|
||||
"stop klipper") do_action_service "stop" "klipper"; main_ui;;
|
||||
"restart klipper") do_action_service "restart" "klipper"; main_ui;;
|
||||
"start moonraker") do_action_service "start" "moonraker"; main_ui;;
|
||||
"stop moonraker") do_action_service "stop" "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;;
|
||||
"stop octoprint") do_action_service "stop" "octoprint"; main_ui;;
|
||||
"restart octoprint") do_action_service "restart" "octoprint"; main_ui;;
|
||||
update) do_action "update_kiauh" "main_ui";;
|
||||
0) do_action "upload_selection" "main_ui";;
|
||||
1) clear && install_menu && break;;
|
||||
2) clear && update_menu && break;;
|
||||
3) clear && remove_menu && break;;
|
||||
4) clear && advanced_menu && break;;
|
||||
5) clear && backup_menu && break;;
|
||||
6) clear && settings_menu && break;;
|
||||
Q|q)
|
||||
echo -e "${green}###### Happy printing! ######${default}"; echo
|
||||
exit -1;;
|
||||
*)
|
||||
deny_action "main_ui";;
|
||||
esac
|
||||
local menu_options=(
|
||||
"1" "Install"
|
||||
"2" "Update"
|
||||
"3" "Remove"
|
||||
"4" "Advanced Settings"
|
||||
"5" "Backup"
|
||||
"6" "Settings"
|
||||
"7" "Upload Log"
|
||||
"8" "Service"
|
||||
)
|
||||
|
||||
# Ask for update only once
|
||||
if [ "$KIAUH_UPDATE_AVAIL" = "true" ]; then
|
||||
kiauh_update_yesno
|
||||
fi
|
||||
|
||||
while true; do
|
||||
#check install status
|
||||
#TODO it is install status, introduce a "service status" for service menu is probably a good idea, refactor required
|
||||
check_kiauh_version
|
||||
klipper_status
|
||||
moonraker_status
|
||||
dwc2_status
|
||||
fluidd_status
|
||||
mainsail_status
|
||||
octoprint_status
|
||||
klipperscreen_status
|
||||
update_moonraker_telegram_bot_status
|
||||
get_branch
|
||||
print_msg && clear_msg
|
||||
|
||||
local menu_str="Klipper: $KLIPPER_STATUS Branch: $PRINT_BRANCH\n
|
||||
Moonraker: $MOONRAKER_STATUS\n
|
||||
Mainsail: $MAINSAIL_STATUS Fluidd: $FLUIDD_STATUS
|
||||
KlipperScreen: $KLIPPERSCREEN_STATUS Telegram Bot: $MOONRAKER_TELEGRAM_BOT_STATUS
|
||||
DWC2: $DWC2_STATUS OctoPrint: $OCTOPRINT_STATUS"
|
||||
|
||||
local menu
|
||||
menu=$(whiptail --title "$KIAUH_TITLE $KIAUH_VER" --cancel-button "Finish" --notags --menu "$menu_str\n\nChoose an option:" \
|
||||
"$KIAUH_WHIPTAIL_NORMAL_HEIGHT" "$KIAUH_WHIPTAIL_NORMAL_WIDTH" 8 "${menu_options[@]}" 3>&1 1>&2 2>&3)
|
||||
local out=$?
|
||||
if [ $out -eq 1 ]; then
|
||||
break
|
||||
elif [ $out -eq 0 ]; then
|
||||
case "$menu" in
|
||||
1) install_menu ;;
|
||||
2) update_menu ;;
|
||||
3) remove_menu ;;
|
||||
4) advanced_menu ;;
|
||||
5) backup_menu ;;
|
||||
6) settings_menu ;;
|
||||
7) upload_selection ;;
|
||||
8) service_menu;;
|
||||
esac
|
||||
else
|
||||
# Unexpected event, no clue what happened
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
clear; main_menu
|
||||
echo -e "${green}###### Happy printing! ######${default}"; echo
|
||||
}
|
||||
|
||||
29
scripts/ui/migration_menu.sh
Normal file
29
scripts/ui/migration_menu.sh
Normal file
@@ -0,0 +1,29 @@
|
||||
#!/bin/bash
|
||||
|
||||
migration_menu(){
|
||||
local menu_options=(
|
||||
"1" "Migrate MainsailOS"
|
||||
"2" "Migrate FluiddPi"
|
||||
)
|
||||
local menu_str="This function will help you to migrate a vanilla MainsailOS or FluiddPi image to a newer state.
|
||||
Only use this function if you use MainsailOS 0.4.0 or lower, or FluiddPi v1.13.0 or lower.
|
||||
Please have a look at the KIAUH changelog for more details on what this function will do."
|
||||
|
||||
while true; do
|
||||
local menu
|
||||
menu=$(whiptail --title "CustomPiOS Migration" --cancel-button "Back" --notags --menu "$menu_str\n\nPerform Action:" \
|
||||
"$KIAUH_WHIPTAIL_NORMAL_HEIGHT" "$KIAUH_WHIPTAIL_NORMAL_WIDTH" 8 "${menu_options[@]}" 3>&1 1>&2 2>&3)
|
||||
local out=$?
|
||||
if [ $out -eq 1 ]; then
|
||||
break
|
||||
elif [ $out -eq 0 ]; then
|
||||
case "$menu" in
|
||||
1) migrate_custompios "mainsail";;
|
||||
2) migrate_custompios "fluiddpi";;
|
||||
esac
|
||||
else
|
||||
# Unexpected event, no clue what happened
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
}
|
||||
30
scripts/ui/octoprint_setup_dialog.sh
Executable file
30
scripts/ui/octoprint_setup_dialog.sh
Executable file
@@ -0,0 +1,30 @@
|
||||
#!/bin/bash
|
||||
octoprint_setup_dialog(){
|
||||
status_msg "Initializing OctoPrint installation ..."
|
||||
|
||||
### 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
|
||||
|
||||
whiptail --title "Install OctoPrint" \
|
||||
--yesno \
|
||||
"$INSTANCE_COUNT Klipper instances were found!
|
||||
|
||||
You need one OctoPrint instance per Klipper instance.
|
||||
|
||||
Create $INSTANCE_COUNT OctoPrint instances?" \
|
||||
"$KIAUH_WHIPTAIL_NORMAL_HEIGHT" "$KIAUH_WHIPTAIL_NORMAL_WIDTH"
|
||||
|
||||
local out=$?
|
||||
if [ $out -eq 0 ]; then
|
||||
status_msg "Creating $INSTANCE_COUNT OctoPrint instances ..."
|
||||
octoprint_setup
|
||||
else
|
||||
whiptail --title "$KIAUH_TITLE" --msgbox "Exiting OctoPrint Install" \
|
||||
"$KIAUH_WHIPTAIL_SINGLE_LINE_HEIGHT" "$KIAUH_WHIPTAIL_NORMAL_WIDTH"
|
||||
return
|
||||
fi
|
||||
}
|
||||
36
scripts/ui/remove_interface_menu.sh
Executable file
36
scripts/ui/remove_interface_menu.sh
Executable file
@@ -0,0 +1,36 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# Brief description of your script
|
||||
|
||||
remove_interface_menu(){
|
||||
|
||||
local menu_options=(
|
||||
"1" "Mainsail - lightweight & responsive web interface for Klipper"
|
||||
"2" "Fluidd - a free and open-source Klipper web interface for managing your 3d printer"
|
||||
"3" "KlipperScreen - a touchscreen GUI that interfaces with Klipper via Moonraker"
|
||||
"4" "Duet Web Control - a fully-responsive HTML5-based web interface for RepRapFirmware"
|
||||
"5" "OctoPrint - a snappy web interface for controlling consumer 3D printers."
|
||||
)
|
||||
local menu_str="Select an interface to install, you can install multiple interfaces."
|
||||
|
||||
while true; do
|
||||
local menu
|
||||
menu=$(whiptail --title "Install Interface" --cancel-button "Back" --notags --menu "$menu_str\n\nPerform Action:" \
|
||||
"$KIAUH_WHIPTAIL_NORMAL_HEIGHT" "$KIAUH_WHIPTAIL_NORMAL_WIDTH" 8 "${menu_options[@]}" 3>&1 1>&2 2>&3)
|
||||
local out=$?
|
||||
if [ $out -eq 1 ]; then
|
||||
break
|
||||
elif [ $out -eq 0 ]; then
|
||||
case "$menu" in
|
||||
1) do_action "install_webui mainsail";;
|
||||
2) do_action "install_webui fluidd";;
|
||||
3) do_action "install_klipperscreen";;
|
||||
4) do_action "dwc_setup_dialog";;
|
||||
5) do_action "octoprint_setup_dialog";;
|
||||
esac
|
||||
else
|
||||
# Unexpected event, no clue what happened
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
}
|
||||
@@ -1,58 +1,37 @@
|
||||
remove_ui(){
|
||||
top_border
|
||||
echo -e "| ${red}~~~~~~~~~~~~~~ [ Remove Menu ] ~~~~~~~~~~~~~~${default} | "
|
||||
hr
|
||||
echo -e "| Directories which remain untouched: | "
|
||||
echo -e "| --> Your printer configuration directory | "
|
||||
echo -e "| --> ~/kiauh-backups | "
|
||||
echo -e "| You need remove them manually if you wish so. | "
|
||||
hr
|
||||
echo -e "| Firmware: | Touchscreen GUI: | "
|
||||
echo -e "| 1) [Klipper] | 5) [KlipperScreen] | "
|
||||
echo -e "| | | "
|
||||
echo -e "| Klipper API: | Other: | "
|
||||
echo -e "| 2) [Moonraker] | 6) [Duet Web Control] | "
|
||||
echo -e "| | 7) [OctoPrint] | "
|
||||
echo -e "| Klipper Webinterface: | 8) [PrettyGCode] | "
|
||||
echo -e "| 3) [Mainsail] | 9) [Telegram Bot] | "
|
||||
echo -e "| 4) [Fluidd] | | "
|
||||
echo -e "| | 10) [MJPG-Streamer] | "
|
||||
echo -e "| | 11) [NGINX] | "
|
||||
back_footer
|
||||
}
|
||||
#!/bin/bash
|
||||
|
||||
remove_menu(){
|
||||
do_action "" "remove_ui"
|
||||
#TODO Currently it's a "dumb" remove page, looking for a "smart" one
|
||||
local menu_options=(
|
||||
"1" "Klipper"
|
||||
"2" "Klipper API(Moonraker)"
|
||||
"3" "Interfaces"
|
||||
"4" "Other"
|
||||
)
|
||||
local menu_str="Directories which remain untouched:
|
||||
|
||||
Your printer configuration directory
|
||||
~/kiauh-backups
|
||||
|
||||
You need remove them manually if you wish so."
|
||||
|
||||
while true; do
|
||||
read -p "${cyan}Perform action:${default} " action; echo
|
||||
case "$action" in
|
||||
1)
|
||||
do_action "remove_klipper" "remove_ui";;
|
||||
2)
|
||||
do_action "remove_moonraker" "remove_ui";;
|
||||
3)
|
||||
do_action "remove_mainsail" "remove_ui";;
|
||||
4)
|
||||
do_action "remove_fluidd" "remove_ui";;
|
||||
5)
|
||||
do_action "remove_klipperscreen" "remove_ui";;
|
||||
6)
|
||||
do_action "remove_dwc2" "remove_ui";;
|
||||
7)
|
||||
do_action "remove_octoprint" "remove_ui";;
|
||||
8)
|
||||
do_action "remove_prettygcode" "remove_ui";;
|
||||
9)
|
||||
do_action "remove_MoonrakerTelegramBot" "remove_ui";;
|
||||
10)
|
||||
do_action "remove_mjpg-streamer" "remove_ui";;
|
||||
11)
|
||||
do_action "remove_nginx" "remove_ui";;
|
||||
B|b)
|
||||
clear; main_menu; break;;
|
||||
*)
|
||||
deny_action "remove_ui";;
|
||||
esac
|
||||
local menu
|
||||
menu=$(whiptail --title "Remove Menu" --cancel-button "Back" --notags --menu "$menu_str\n\nPerform Action:" \
|
||||
"$KIAUH_WHIPTAIL_NORMAL_HEIGHT" "$KIAUH_WHIPTAIL_NORMAL_WIDTH" 8 "${menu_options[@]}" 3>&1 1>&2 2>&3)
|
||||
local out=$?
|
||||
if [ $out -eq 1 ]; then
|
||||
break
|
||||
elif [ $out -eq 0 ]; then
|
||||
case "$menu" in
|
||||
1) do_action "remove_klipper";;
|
||||
2) do_action "remove_moonraker";;
|
||||
3) remove_interface_menu;;
|
||||
4) remove_other_menu;;
|
||||
esac
|
||||
else
|
||||
# Unexpected event, no clue what happened
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
remove_menu
|
||||
}
|
||||
|
||||
17
scripts/ui/remove_moonraker_yesno.sh
Executable file
17
scripts/ui/remove_moonraker_yesno.sh
Executable file
@@ -0,0 +1,17 @@
|
||||
#!/bin/bash
|
||||
remove_moonraker_yesno(){
|
||||
whiptail --title "Remove" \
|
||||
--yesno \
|
||||
"Do you want to remove Moonraker afterwards?
|
||||
|
||||
This is useful in case you want to switch from a single-instance to a multi-instance installation, which makes a re-installation of Moonraker necessary.
|
||||
|
||||
If for any other reason you only want to uninstall Klipper, please select 'No' and continue." \
|
||||
"$KIAUH_WHIPTAIL_NORMAL_HEIGHT" "$KIAUH_WHIPTAIL_NORMAL_WIDTH"
|
||||
|
||||
local out=$?
|
||||
if [ $out -eq 0 ]; then
|
||||
REM_MR="true"
|
||||
else
|
||||
REM_MR="false"
|
||||
}
|
||||
34
scripts/ui/remove_other_menu.sh
Executable file
34
scripts/ui/remove_other_menu.sh
Executable file
@@ -0,0 +1,34 @@
|
||||
#!/bin/bash
|
||||
# Brief description of your script
|
||||
|
||||
remove_other_menu() {
|
||||
|
||||
local menu_options=(
|
||||
#TODO WIP
|
||||
"1" "PrettyGCode - "
|
||||
"2" "Klipper Telegram Bot - "
|
||||
"3" "Webcam MJPG-Streamer - Use MJPG-Streamer with webcam"
|
||||
"4" "Nginx"
|
||||
)
|
||||
local menu_str="Select an option to install."
|
||||
|
||||
while true; do
|
||||
local menu
|
||||
menu=$(whiptail --title "Remove Other" --cancel-button "Back" --notags --menu "$menu_str\n\nPerform Action:" \
|
||||
"$KIAUH_WHIPTAIL_NORMAL_HEIGHT" "$KIAUH_WHIPTAIL_NORMAL_WIDTH" 8 "${menu_options[@]}" 3>&1 1>&2 2>&3)
|
||||
local out=$?
|
||||
if [ $out -eq 1 ]; then
|
||||
break
|
||||
elif [ $out -eq 0 ]; then
|
||||
case "$menu" in
|
||||
1) do_action "remove_pgc_for_klipper" ;;
|
||||
2) do_action "remove_MoonrakerTelegramBot" ;;
|
||||
3) do_action "remove_mjpg-streamer" ;;
|
||||
4) do_action "remove_nginx" ;;
|
||||
esac
|
||||
else
|
||||
# Unexpected event, no clue what happened
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
}
|
||||
48
scripts/ui/service_menu.sh
Executable file
48
scripts/ui/service_menu.sh
Executable file
@@ -0,0 +1,48 @@
|
||||
#!/bin/bash
|
||||
|
||||
service_menu(){
|
||||
local menu_options=(
|
||||
"1" "Start Klipper"
|
||||
"2" "Stop Klipper"
|
||||
"3" "Restart Klipper"
|
||||
"4" "Start Moonraker"
|
||||
"5" "Stop Moonraker"
|
||||
"6" "Restart Moonraker"
|
||||
"7" "Start Duet Web Control"
|
||||
"8" "Stop Duet Web Control"
|
||||
"9" "Restart Duet Web Control"
|
||||
"10" "Start Octoprint"
|
||||
"11" "Stop Octoprint"
|
||||
"12" "Restart Octoprint"
|
||||
)
|
||||
|
||||
local menu_str="Start/stop/restart services"
|
||||
|
||||
while true; do
|
||||
local menu
|
||||
menu=$(whiptail --title "Service Menu" --cancel-button "Back" --notags --menu "$menu_str\n\nPerform Action:" \
|
||||
"$KIAUH_WHIPTAIL_NORMAL_HEIGHT" "$KIAUH_WHIPTAIL_NORMAL_WIDTH" 8 "${menu_options[@]}" 3>&1 1>&2 2>&3)
|
||||
local out=$?
|
||||
if [ $out -eq 1 ]; then
|
||||
break
|
||||
elif [ $out -eq 0 ]; then
|
||||
case "$menu" in
|
||||
1) do_action_service "start" "klipper";;
|
||||
2) do_action_service "stop" "klipper";;
|
||||
3) do_action_service "restart" "klipper";;
|
||||
4) do_action_service "start" "moonraker";;
|
||||
5) do_action_service "stop" "moonraker";;
|
||||
6) do_action_service "restart" "moonraker";;
|
||||
7)do_action_service "start" "dwc";;
|
||||
8)do_action_service "stop" "dwc";;
|
||||
9)do_action_service "restart" "dwc";;
|
||||
10)do_action_service "start" "octoprint";;
|
||||
11)do_action_service "stop" "octoprint";;
|
||||
12)do_action_service "restart" "octoprint";;
|
||||
esac
|
||||
else
|
||||
# Unexpected event, no clue what happened
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
}
|
||||
@@ -1,3 +1,5 @@
|
||||
#!/bin/bash
|
||||
|
||||
settings_ui(){
|
||||
source_kiauh_ini
|
||||
top_border
|
||||
|
||||
96
scripts/ui/switch_menu.sh
Executable file
96
scripts/ui/switch_menu.sh
Executable file
@@ -0,0 +1,96 @@
|
||||
#!/bin/bash
|
||||
|
||||
switch_ui(){
|
||||
SWITCH_MENU_STR="Active Branch: $GET_BRANCH"
|
||||
SWITCH_MENU=$(whiptail --title "Switch Klipper Branch" --cancel-button "Back" --menu "$SWITCH_MENU_STR\n\nSelect a Branch Owner:"\
|
||||
"$KIAUH_WHIPTAIL_NORMAL_HEIGHT" "$KIAUH_WHIPTAIL_NORMAL_WIDTH" 8\
|
||||
"1 Klipper3D" "Official Klipper3D"\
|
||||
"2 dmbutyugin" "dmbutyugin S-Curve Acceleration"\
|
||||
"3 Custom" "Pick a custom branch" 3>&1 1>&2 2>&3)
|
||||
|
||||
OUT=$SWITCH_MENU
|
||||
case "$OUT" in
|
||||
1\ *) Something;;
|
||||
2\ *) install_menu ;;
|
||||
3\ *) echo "Custom Branch" ;;
|
||||
esac
|
||||
|
||||
KILPPER3D_MENU_STR="Active Branch: $GET_BRANCH"
|
||||
KILPPER3D_MENU=$(whiptail --title "Switch Klipper Branch" --cancel-button "Back" --menu "$KILPPER3D_MENU_STR\n\nSelect a Branch:"\
|
||||
"$KIAUH_WHIPTAIL_NORMAL_HEIGHT" "$KIAUH_WHIPTAIL_NORMAL_WIDTH" 8\
|
||||
"1 master" "Official Klipper with rolling update")
|
||||
|
||||
OUT=$KILPPER3D_MENU
|
||||
case "$OUT" in
|
||||
1\ *) Something;;
|
||||
esac
|
||||
|
||||
DMBUTYUGIN_MENU_STR="Active Branch: $GET_BRANCH"
|
||||
DMBUTYUGIN_MENU=$(whiptail --title "Switch Klipper Branch" --cancel-button "Back" --menu "$DMBUTYUGIN_MENU\n\nSelect a Branch:"\
|
||||
"$KIAUH_WHIPTAIL_NORMAL_HEIGHT" "$KIAUH_WHIPTAIL_NORMAL_WIDTH" 8\
|
||||
"1 scurve-shaping" "Official Klipper with rolling update"\
|
||||
"2 scurve-smoothing" "Pick a custom branch/tag" 3>&1 1>&2 2>&3)
|
||||
|
||||
OUT=$DMBUTYUGIN_MENU
|
||||
case "$OUT" in
|
||||
1\ *) Something;;
|
||||
2\ *) install_menu ;;
|
||||
esac
|
||||
|
||||
|
||||
CUSTOM_BRANCH_MENU_MENU=$(whiptail --title "Switch Klipper Branch" --cancel-button "Back" --inputbox "Paste the link of a Klipper Git repository:"\
|
||||
"$KIAUH_WHIPTAIL_NORMAL_HEIGHT" "$KIAUH_WHIPTAIL_NORMAL_WIDTH" "github.com/Klipper3d/klipper" 3>&1 1>&2 2>&3)
|
||||
|
||||
OUT=$CUSTOM_BRANCH_MENU_MENU
|
||||
case "$OUT" in
|
||||
1\ *) Something;;
|
||||
2\ *) install_menu ;;
|
||||
esac
|
||||
}
|
||||
# TODO Automatically list the available branches of an account or allow type in custom
|
||||
|
||||
switch_menu(){
|
||||
if [ -d $KLIPPER_DIR ]; then
|
||||
read_branch
|
||||
do_action "" "switch_ui"
|
||||
while true; do
|
||||
read -p "${cyan}Perform action:${default} " action; echo
|
||||
case "$action" in
|
||||
1)
|
||||
clear
|
||||
print_header
|
||||
switch_to_master
|
||||
read_branch
|
||||
print_msg && clear_msg
|
||||
switch_ui;;
|
||||
2)
|
||||
clear
|
||||
print_header
|
||||
switch_to_scurve_shaping
|
||||
read_branch
|
||||
print_msg && clear_msg
|
||||
switch_ui;;
|
||||
3)
|
||||
clear
|
||||
print_header
|
||||
switch_to_scurve_smoothing
|
||||
read_branch
|
||||
print_msg && clear_msg
|
||||
switch_ui;;
|
||||
4)
|
||||
clear
|
||||
print_header
|
||||
switch_to_moonraker
|
||||
read_branch
|
||||
print_msg && clear_msg
|
||||
switch_ui;;
|
||||
B|b)
|
||||
clear; advanced_menu; break;;
|
||||
*)
|
||||
deny_action "switch_ui";;
|
||||
esac
|
||||
done
|
||||
else
|
||||
ERROR_MSG="No Klipper directory found! Download Klipper first!"
|
||||
fi
|
||||
}
|
||||
69
scripts/ui/theme_menu.sh
Executable file
69
scripts/ui/theme_menu.sh
Executable file
@@ -0,0 +1,69 @@
|
||||
#!/bin/bash
|
||||
|
||||
ms_theme_ui(){
|
||||
top_border
|
||||
echo -e "| ${red}~~~~~~~~ [ Mainsail Theme Installer ] ~~~~~~~${default} | "
|
||||
hr
|
||||
echo -e "| ${green}A preview of each Mainsail theme can be found here:${default} | "
|
||||
echo -e "| https://docs.mainsail.xyz/theming/themes | "
|
||||
blank_line
|
||||
echo -e "| ${yellow}Important note:${default} | "
|
||||
echo -e "| Installing a theme from this menu will overwrite an | "
|
||||
echo -e "| already installed theme or modified custom.css file! | "
|
||||
hr
|
||||
#echo -e "| Theme: | "
|
||||
# dynamically generate the themelist from a csv file
|
||||
get_theme_list
|
||||
echo -e "| | "
|
||||
echo -e "| R) [Remove Theme] | "
|
||||
#echo -e "| | "
|
||||
back_footer
|
||||
}
|
||||
|
||||
ms_theme_menu(){
|
||||
|
||||
local menu_options=(
|
||||
"1" "Migrate MainsailOS"
|
||||
"2" "Migrate FluiddPi"
|
||||
)
|
||||
local menu_str="This function will help you to migrate a vanilla MainsailOS or FluiddPi image to a newer state.
|
||||
Only use this function if you use MainsailOS 0.4.0 or lower, or FluiddPi v1.13.0 or lower.
|
||||
Please have a look at the KIAUH changelog for more details on what this function will do."
|
||||
|
||||
while true; do
|
||||
local menu
|
||||
menu=$(whiptail --title "Mainsail Theme Installer" --cancel-button "Back" --notags --menu "$menu_str\n\nInstall/Remove Theme:" \
|
||||
"$KIAUH_WHIPTAIL_NORMAL_HEIGHT" "$KIAUH_WHIPTAIL_NORMAL_WIDTH" 8 "${menu_options[@]}" 3>&1 1>&2 2>&3)
|
||||
local out=$?
|
||||
if [ $out -eq 1 ]; then
|
||||
break
|
||||
elif [ $out -eq 0 ]; then
|
||||
case "$menu" in
|
||||
1) migrate_custompios "mainsail";;
|
||||
2) migrate_custompios "fluiddpi";;
|
||||
esac
|
||||
else
|
||||
# Unexpected event, no clue what happened
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
|
||||
ms_theme_ui
|
||||
while true; do
|
||||
read -p "${cyan}Install theme:${default} " a; echo
|
||||
if [ $a = "b" ] || [ $a = "B" ]; then
|
||||
clear && advanced_menu && break
|
||||
elif [ $a = "r" ] || [ $a = "R" ]; then
|
||||
ms_theme_delete
|
||||
ms_theme_menu
|
||||
elif [ $a -le ${#t_url[@]} ]; then
|
||||
ms_theme_install "${t_auth[$a]}" "${t_url[$a]}" "${t_name[$a]}" "${t_note[$a]}"
|
||||
ms_theme_menu
|
||||
else
|
||||
clear && print_header
|
||||
ERROR_MSG="Invalid command!" && print_msg && clear_msg
|
||||
ms_theme_menu
|
||||
fi
|
||||
done
|
||||
ms_theme_menu
|
||||
}
|
||||
@@ -1,4 +1,7 @@
|
||||
#!/bin/bash
|
||||
|
||||
update_ui(){
|
||||
# TODO Try to match the width so we can use the menu text to show local and remote version
|
||||
ui_print_versions
|
||||
top_border
|
||||
echo -e "| ${green}~~~~~~~~~~~~~~ [ Update Menu ] ~~~~~~~~~~~~~~${default} | "
|
||||
|
||||
24
scripts/ui/upload_yesno.sh
Executable file
24
scripts/ui/upload_yesno.sh
Executable file
@@ -0,0 +1,24 @@
|
||||
#!/bin/bash
|
||||
|
||||
upload_yesno(){
|
||||
whiptail --title "Upload Agreement" \
|
||||
--yesno \
|
||||
"The following function will help to quickly upload logs for debugging purposes. With confirming this dialog, you agree that during that process your logs will be uploaded to: http://paste.c-net.org/
|
||||
|
||||
PLEASE NOTE:
|
||||
|
||||
Be aware that logs can contain network information, private data like usernames, filenames, or other information you may not want to make public.
|
||||
|
||||
Do ${red}NOT${default} use this function if you don't agree!
|
||||
|
||||
Do you accept?" \
|
||||
"$KIAUH_WHIPTAIL_NORMAL_HEIGHT" "$KIAUH_WHIPTAIL_NORMAL_WIDTH"
|
||||
|
||||
local out=$?
|
||||
if [ $out -eq 0 ]; then
|
||||
sed -i "/logupload_accepted=/s/false/true/" $INI_FILE
|
||||
clear && print_header && upload_selection
|
||||
else
|
||||
return
|
||||
fi
|
||||
}
|
||||
@@ -1,3 +1,5 @@
|
||||
#!/bin/bash
|
||||
|
||||
update_kiauh(){
|
||||
if [ "$KIAUH_UPDATE_AVAIL" = "true" ]; then
|
||||
status_msg "Updating KIAUH ..."
|
||||
@@ -75,7 +77,7 @@ update_log_paths(){
|
||||
source_kiauh_ini
|
||||
LPATH="${HOME}/klipper_logs"
|
||||
[ ! -d "$LPATH" ] && mkdir -p "$LPATH"
|
||||
FILE="$SYSTEMDDIR/$1?(-*([0-9])).service"
|
||||
FILE="$SYSTEMD_DIR/$1?(-*([0-9])).service"
|
||||
for file in $(ls $FILE); do
|
||||
[ "$1" == "klipper" ] && LOG="klippy"
|
||||
[ "$1" == "moonraker" ] && LOG="moonraker"
|
||||
|
||||
@@ -1,44 +1,9 @@
|
||||
accept_upload_conditions(){
|
||||
while true; do
|
||||
top_border
|
||||
echo -e "| ${red}~~~~~~~~~~~ [ Upload Agreement ] ~~~~~~~~~~~~${default} |"
|
||||
hr
|
||||
echo -e "| The following function will help to quickly upload |"
|
||||
echo -e "| logs for debugging purposes. With confirming this |"
|
||||
echo -e "| dialog, you agree that during that process your logs |"
|
||||
echo -e "| will be uploaded to: ${yellow}http://paste.c-net.org/${default} |"
|
||||
hr
|
||||
echo -e "| ${red}PLEASE NOTE:${default} |"
|
||||
echo -e "| Be aware that logs can contain network information, |"
|
||||
echo -e "| private data like usernames, filenames, or other |"
|
||||
echo -e "| information you may not want to make public. |"
|
||||
blank_line
|
||||
echo -e "| Do ${red}NOT${default} use this function if you don't agree! |"
|
||||
bottom_border
|
||||
read -p "${cyan}Do you accept? (Y/n):${default} " yn
|
||||
case "$yn" in
|
||||
Y|y|Yes|yes|"")
|
||||
sed -i "/logupload_accepted=/s/false/true/" $INI_FILE
|
||||
clear && print_header && upload_selection
|
||||
;;
|
||||
N|n|No|no)
|
||||
clear
|
||||
main_menu
|
||||
break
|
||||
;;
|
||||
*)
|
||||
clear
|
||||
print_header
|
||||
print_unkown_cmd
|
||||
print_msg && clear_msg
|
||||
accept_upload_conditions;;
|
||||
esac
|
||||
done
|
||||
}
|
||||
#!/bin/bash
|
||||
|
||||
upload_selection(){
|
||||
source_kiauh_ini
|
||||
[ "$logupload_accepted" = "false" ] && accept_upload_conditions
|
||||
# TODO Whiptail probably changed logic here
|
||||
[ "$logupload_accepted" = "false" ] && upload_yesno
|
||||
|
||||
### find all suitable logfiles for klipper
|
||||
logfiles=()
|
||||
|
||||
Reference in New Issue
Block a user