Whiptail #141
66
kiauh.sh
66
kiauh.sh
@@ -1,6 +1,11 @@
|
||||
#!/bin/bash
|
||||
clear
|
||||
set -e
|
||||
|
||||
### 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")
|
||||
@@ -11,51 +16,10 @@ 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
|
||||
|
||||
### 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(){
|
||||
echo -e "${red}<!!!!> $1${default}"
|
||||
@@ -78,18 +42,12 @@ print_unkown_cmd(){
|
||||
|
||||
print_msg(){
|
||||
if [[ "$ERROR_MSG" != "" ]]; then
|
||||
echo -e "${red}"
|
||||
echo -e "#########################################################"
|
||||
echo -e " $ERROR_MSG "
|
||||
echo -e "#########################################################"
|
||||
echo -e "${default}"
|
||||
whiptail --title "$KIAUH_TITLE" --msgbox "$ERROR_MSG"\
|
||||
"$KIAUH_WHIPTAIL_SINGLE_LINE_HEIGHT" "$KIAUH_WHIPTAIL_NORMAL_WIDTH"
|
||||
fi
|
||||
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
|
||||
}
|
||||
|
||||
|
||||
50
scripts/constants/constants.sh
Executable file
50
scripts/constants/constants.sh
Executable file
@@ -0,0 +1,50 @@
|
||||
#!/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
|
||||
#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
|
||||
|
||||
###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,11 @@
|
||||
### 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 +93,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 +144,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 +455,9 @@ init_ini(){
|
||||
fi
|
||||
fetch_webui_ports
|
||||
}
|
||||
|
||||
print_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,5 +1,4 @@
|
||||
### base variables
|
||||
SYSTEMDDIR="/etc/systemd/system"
|
||||
KLIPPY_ENV="${HOME}/klippy-env"
|
||||
KLIPPER_DIR="${HOME}/klipper"
|
||||
|
||||
@@ -121,7 +120,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 +155,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,5 +1,4 @@
|
||||
### 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"
|
||||
|
||||
@@ -9,7 +8,7 @@ install_mjpg-streamer(){
|
||||
|
||||
### 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
|
||||
|
||||
@@ -1,8 +1,4 @@
|
||||
### 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(){
|
||||
### python 3 check
|
||||
@@ -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
|
||||
@@ -168,7 +164,7 @@ 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(){
|
||||
if [ ! -f $MR_SERV_TARGET ]; then
|
||||
@@ -196,7 +192,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
|
||||
|
||||
@@ -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=(
|
||||
@@ -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
|
||||
@@ -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
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
### base variables
|
||||
SYSTEMDDIR="/etc/systemd/system"
|
||||
|
||||
get_theme_list(){
|
||||
theme_csv_url="https://raw.githubusercontent.com/meteyou/mainsail/develop/docs/_data/themes.csv"
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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,11 +222,11 @@ 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
|
||||
}
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
@@ -293,7 +295,7 @@ print_branch(){
|
||||
if [ ! -z "$GET_BRANCH" ]; then
|
||||
PRINT_BRANCH="$(printf "%-16s" "$GET_BRANCH")"
|
||||
else
|
||||
PRINT_BRANCH="${red}--------------${default} "
|
||||
PRINT_BRANCH="--------------"
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
@@ -138,40 +138,3 @@ switch_menu(){
|
||||
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
|
||||
}
|
||||
|
||||
@@ -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
|
||||
}
|
||||
27
scripts/ui/kiauh_update_yesno.sh
Normal file
27
scripts/ui/kiauh_update_yesno.sh
Normal file
@@ -0,0 +1,27 @@
|
||||
#######################################
|
||||
# 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,61 @@
|
||||
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")
|
||||
|
||||
if [ "$KIAUH_UPDATE_AVAIL" = "true" ]; then
|
||||
kiauh_update_dialog
|
||||
fi
|
||||
|
||||
while true; do
|
||||
#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
|
||||
|
||||
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,3 +1,4 @@
|
||||
#!/bin/bash
|
||||
remove_ui(){
|
||||
top_border
|
||||
echo -e "| ${red}~~~~~~~~~~~~~~ [ Remove Menu ] ~~~~~~~~~~~~~~${default} | "
|
||||
@@ -22,37 +23,37 @@ remove_ui(){
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
24
scripts/ui/upload_yesno.sh
Normal file
24
scripts/ui/upload_yesno.sh
Normal 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
|
||||
}
|
||||
@@ -75,7 +75,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,8 @@
|
||||
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
|
||||
[ "$logupload_accepted" = "false" ] && upload_yesno
|
||||
|
||||
### find all suitable logfiles for klipper
|
||||
logfiles=()
|
||||
|
||||
Reference in New Issue
Block a user