feat: KIAUH v4.0.0 (#191)

This commit is contained in:
th33xitus
2022-05-29 20:11:15 +02:00
committed by GitHub
parent 4bf9e8f0a8
commit fcf059df73
64 changed files with 6489 additions and 5889 deletions

View File

@@ -1,70 +1,64 @@
advanced_ui(){
#!/usr/bin/env bash
#=======================================================================#
# Copyright (C) 2020 - 2022 Dominik Willner <th33xitus@gmail.com> #
# #
# This file is part of KIAUH - Klipper Installation And Update Helper #
# https://github.com/th33xitus/kiauh #
# #
# This file may be distributed under the terms of the GNU GPLv3 license #
#=======================================================================#
set -e
function advanced_ui() {
top_border
echo -e "| ${yellow}~~~~~~~~~~~~~ [ Advanced Menu ] ~~~~~~~~~~~~~${default} | "
echo -e "| ${yellow}~~~~~~~~~~~~~ [ Advanced Menu ] ~~~~~~~~~~~~~${white} |"
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
echo -e "| Klipper & API: | Mainsail: |"
echo -e "| 1) [Rollback] | 6) [Theme installer] |"
echo -e "| | |"
echo -e "| Firmware: | System: |"
echo -e "| 2) [Build only] | 7) [Change hostname] |"
echo -e "| 3) [Flash only] | |"
echo -e "| 4) [Build + Flash] | Extras: |"
echo -e "| 5) [Get MCU ID] | 8) [G-Code Shell Command] |"
back_footer
}
advanced_menu(){
read_octoprint_service_status
function advanced_menu() {
do_action "" "advanced_ui"
local action
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;;
read -p "${cyan}####### Perform action:${white} " action
case "${action}" in
1)
do_action "switch_menu";;
do_action "rollback_menu" "advanced_menu";;
2)
do_action "load_klipper_state" "advanced_ui";;
3)
do_action "build_fw" "advanced_ui";;
3)
clear && print_header
do_action "init_flash_process" "advanced_ui";;
4)
clear && print_header
check_usergroup_dialout
do_action "select_flash_method" "advanced_ui";;
status_msg "Please wait..."
build_fw && init_flash_process
advanced_ui;;
5)
clear && print_header
check_usergroup_dialout
status_msg "Please wait..."
build_fw && select_flash_method
print_msg && clear_msg
select_mcu_connection
print_detected_mcu_to_screen
advanced_ui;;
6)
do_action "select_mcu_connection" "advanced_ui";;
do_action "ms_theme_installer_menu";;
7)
do_action "ms_theme_menu";;
8)
clear
print_header
create_custom_hostname && set_hostname
print_msg && clear_msg
set_custom_hostname
advanced_ui;;
9)
8)
do_action "setup_gcode_shell_command" "advanced_ui";;
10)
do_action "migration_menu";;
B|b)
clear; main_menu; break;;
*)
@@ -72,108 +66,4 @@ advanced_menu(){
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
}
}

View File

@@ -1,48 +1,59 @@
backup_ui(){
#!/usr/bin/env bash
#=======================================================================#
# Copyright (C) 2020 - 2022 Dominik Willner <th33xitus@gmail.com> #
# #
# This file is part of KIAUH - Klipper Installation And Update Helper #
# https://github.com/th33xitus/kiauh #
# #
# This file may be distributed under the terms of the GNU GPLv3 license #
#=======================================================================#
set -e
function backup_ui() {
top_border
echo -e "| $(title_msg "~~~~~~~~~~~~~~ [ Backup Menu ] ~~~~~~~~~~~~~~") | "
echo -e "| $(title_msg "~~~~~~~~~~~~~~ [ Backup Menu ] ~~~~~~~~~~~~~~") |"
hr
echo -e "| ${yellow}Backup location: ~/kiauh-backups${default} | "
echo -e "| ${yellow}INFO: Backups are located in '~/kiauh-backups'${white} |"
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] | "
echo -e "| Klipper & API: | Touchscreen GUI: |"
echo -e "| 1) [Klipper] | 7) [KlipperScreen] |"
echo -e "| 2) [Moonraker] | |"
echo -e "| 3) [Configuration Folder] | 3rd Party Webinterface: |"
echo -e "| 4) [Moonraker Database] | 8) [OctoPrint] |"
echo -e "| | |"
echo -e "| Klipper Webinterface: | Other: |"
echo -e "| 5) [Mainsail] | 9) [Telegram Bot] |"
echo -e "| 6) [Fluidd] | |"
back_footer
}
backup_menu(){
function backup_menu() {
do_action "" "backup_ui"
local action
while true; do
read -p "${cyan}Perform action:${default} " action; echo
case "$action" in
0)
do_action "backup_klipper_config_dir" "backup_ui";;
read -p "${cyan}####### Perform action:${white} " action
case "${action}" in
1)
do_action "backup_klipper" "backup_ui";;
2)
do_action "backup_moonraker" "backup_ui";;
3)
do_action "backup_moonraker_database" "backup_ui";;
do_action "backup_klipper_config_dir" "backup_ui";;
4)
do_action "backup_mainsail" "backup_ui";;
do_action "backup_moonraker_database" "backup_ui";;
5)
do_action "backup_fluidd" "backup_ui";;
do_action "backup_mainsail" "backup_ui";;
6)
do_action "backup_klipperscreen" "backup_ui";;
do_action "backup_fluidd" "backup_ui";;
7)
do_action "backup_dwc2" "backup_ui";;
do_action "backup_klipperscreen" "backup_ui";;
8)
do_action "backup_octoprint" "backup_ui";;
9)
do_action "backup_MoonrakerTelegramBot" "backup_ui";;
do_action "backup_telegram_bot" "backup_ui";;
B|b)
clear; main_menu; break;;
*)

View File

@@ -1,39 +1,52 @@
#!/usr/bin/env bash
#=======================================================================#
# Copyright (C) 2020 - 2022 Dominik Willner <th33xitus@gmail.com> #
# #
# This file is part of KIAUH - Klipper Installation And Update Helper #
# https://github.com/th33xitus/kiauh #
# #
# This file may be distributed under the terms of the GNU GPLv3 license #
#=======================================================================#
set -e
#ui total width = 57 chars
top_border(){
function top_border() {
echo -e "/=======================================================\\"
}
bottom_border(){
function bottom_border() {
echo -e "\=======================================================/"
}
blank_line(){
function blank_line() {
echo -e "| |"
}
hr(){
function hr() {
echo -e "|-------------------------------------------------------|"
}
quit_footer(){
function quit_footer() {
hr
echo -e "| ${red}Q) Quit${default} |"
echo -e "| ${red}Q) Quit${white} |"
bottom_border
}
back_footer(){
function back_footer() {
hr
echo -e "| ${green}B) « Back${default} |"
echo -e "| ${green}B) « Back${white} |"
bottom_border
}
back_help_footer(){
function back_help_footer() {
hr
echo -e "| ${green}B) « Back${default} | ${yellow}H) Help [?]${default} |"
echo -e "| ${green}B) « Back${white} | ${yellow}H) Help [?]${white} |"
bottom_border
}
print_header(){
function print_header() {
top_border
echo -e "| $(title_msg "~~~~~~~~~~~~~~~~~ [ KIAUH ] ~~~~~~~~~~~~~~~~~") |"
echo -e "| $(title_msg " Klipper Installation And Update Helper ") |"
@@ -41,35 +54,17 @@ 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
}
################################################################################
#******************************************************************************#
################################################################################
### TODO: rework other menus to make use of the following functions too and make them more readable
do_action(){
function do_action() {
clear && print_header
### $1 is the action the user wants to fire
$1
print_msg && clear_msg
# print_msg && clear_msg
### $2 is the menu the user usually gets directed back to after an action is completed
$2
}
deny_action(){
function deny_action() {
clear && print_header
print_unkown_cmd
print_msg && clear_msg
print_error "Invalid command!"
$1
}

View File

@@ -1,49 +1,62 @@
install_ui(){
#!/usr/bin/env bash
#=======================================================================#
# Copyright (C) 2020 - 2022 Dominik Willner <th33xitus@gmail.com> #
# #
# This file is part of KIAUH - Klipper Installation And Update Helper #
# https://github.com/th33xitus/kiauh #
# #
# This file may be distributed under the terms of the GNU GPLv3 license #
#=======================================================================#
set -e
function install_ui() {
top_border
echo -e "| ${green}~~~~~~~~~~~ [ Installation Menu ] ~~~~~~~~~~~${default} | "
echo -e "| ${green}~~~~~~~~~~~ [ Installation Menu ] ~~~~~~~~~~~${white} |"
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. | "
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] | "
echo -e "| Firmware & API: | 3rd Party Webinterface: |"
echo -e "| 1) [Klipper] | 6) [OctoPrint] |"
echo -e "| 2) [Moonraker] | |"
echo -e "| | Other: |"
echo -e "| Klipper Webinterface: | 7) [PrettyGCode] |"
echo -e "| 3) [Mainsail] | 8) [Telegram Bot] |"
echo -e "| 4) [Fluidd] | |"
echo -e "| | Webcam Streamer: |"
echo -e "| Touchscreen GUI: | 9) [MJPG-Streamer] |"
echo -e "| 5) [KlipperScreen] | |"
back_footer
}
install_menu(){
do_action "" "install_ui"
function install_menu() {
clear && print_header
install_ui
local action
while true; do
read -p "${cyan}Perform action:${default} " action; echo
case "$action" in
read -p "${cyan}####### Perform action:${white} " action
case "${action}" in
1)
do_action "klipper_setup_dialog" "install_ui";;
do_action "select_klipper_python_version" "install_ui";;
2)
do_action "moonraker_setup_dialog" "install_ui";;
3)
do_action "install_webui mainsail" "install_ui";;
do_action "install_mainsail" "install_ui";;
4)
do_action "install_webui fluidd" "install_ui";;
do_action "install_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)
7)
do_action "install_pgc_for_klipper" "install_ui";;
8)
do_action "telegram_bot_setup_dialog" "install_ui";;
9)
do_action "install_MoonrakerTelegramBot" "install_ui";;
10)
do_action "install_mjpg-streamer" "install_ui";;
B|b)
clear; main_menu; break;;
@@ -53,3 +66,33 @@ install_menu(){
done
install_menu
}
function select_klipper_python_version() {
top_border
echo -e "| Please select the preferred Python version. | "
echo -e "| The recommended version is Python 2.7. | "
blank_line
echo -e "| Installing Klipper with Python 3 is officially not | "
echo -e "| recommended and should be considered as experimental. | "
hr
echo -e "| 1) [Python 2.7] (recommended) | "
echo -e "| 2) [Python 3.x] ${yellow}(experimental)${white} | "
back_footer
while true; do
read -p "${cyan}###### Select Python version:${white} " action
case "${action}" in
1)
select_msg "Python 2.7"
klipper_setup_dialog "python2"
break;;
2)
select_msg "Python 3.x"
klipper_setup_dialog "python3"
break;;
B|b)
clear; install_menu; break;;
*)
error_msg "Invalid Input!\n";;
esac
done
}

View File

@@ -1,89 +1,124 @@
main_ui(){
#[ $KIAUH_UPDATE_REMIND="true" ] && kiauh_update_reminder
#!/usr/bin/env bash
#=======================================================================#
# Copyright (C) 2020 - 2022 Dominik Willner <th33xitus@gmail.com> #
# #
# This file is part of KIAUH - Klipper Installation And Update Helper #
# https://github.com/th33xitus/kiauh #
# #
# This file may be distributed under the terms of the GNU GPLv3 license #
#=======================================================================#
set -e
function main_ui() {
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|"
echo -e "| 0) [Log-Upload] | Klipper: $(print_status "klipper")|"
echo -e "| | Repo: $(print_klipper_repo)|"
echo -e "| 1) [Install] | |"
echo -e "| 2) [Update] | Moonraker: $(print_status "moonraker")|"
echo -e "| 3) [Remove] | |"
echo -e "| 4) [Advanced] | Mainsail: $(print_status "mainsail")|"
echo -e "| 5) [Backup] | Fluidd: $(print_status "fluidd")|"
echo -e "| | KlipperScreen: $(print_status "klipperscreen")|"
echo -e "| 6) [Settings] | Telegram Bot: $(print_status "telegram_bot")|"
echo -e "| | |"
echo -e "| $(print_kiauh_version)| Octoprint: $(print_status "octoprint")|"
quit_footer
}
print_kiauh_version(){
cd ${SRCDIR}/kiauh
KIAUH_VER=$(git describe HEAD --always --tags | cut -d "-" -f 1,2)
KIAUH_VER="$(printf "%-20s" "$KIAUH_VER")"
function get_kiauh_version() {
local version
cd "${KIAUH_SRCDIR}"
version="$(git describe HEAD --always --tags | cut -d "-" -f 1,2)"
echo "${version}"
}
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
function print_kiauh_version() {
local version
version="$(printf "%-18s" "$(get_kiauh_version)")"
echo "${cyan}${version}${white}"
}
main_menu(){
print_header
#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
function print_status() {
local status component="${1}"
status=$(get_"${component}"_status)
if [[ ${status} == "Not installed!" ]]; then
status="${red}${status}${white}"
elif [[ ${status} == "Incomplete!" ]]; then
status="${yellow}${status}${white}"
else
status="${green}${status}${white}"
fi
printf "%-28s" "${status}"
}
function print_klipper_repo() {
read_kiauh_ini
local repo klipper_status
klipper_status=$(get_klipper_status)
repo=$(echo "${custom_klipper_repo}" | sed "s/https:\/\/github\.com\///" | sed "s/\.git$//")
repo="${repo^^}"
if [[ ${klipper_status} == "Not installed!" ]]; then
repo="${red}-${white}"
elif [[ -n ${repo} && ${repo} != "KLIPPER3D/KLIPPER" ]]; then
repo="${cyan}custom${white}"
else
repo="${cyan}Klipper3d/klipper${white}"
fi
printf "%-28s" "${repo}"
}
function main_menu() {
print_header && main_ui
local action
while true; do
read -p "${cyan}Perform action:${default} " action; echo
case "$action" in
read -p "${cyan}####### Perform action:${white} " action
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;;
0)clear && print_header
upload_selection
break;;
1)clear && print_header
install_menu
break;;
2) clear && print_header
update_menu
break;;
3) clear && print_header
remove_menu
break;;
4)clear && print_header
advanced_menu
break;;
5)clear && print_header
backup_menu
break;;
6)clear && print_header
settings_menu
break;;
Q|q)
echo -e "${green}###### Happy printing! ######${default}"; echo
exit -1;;
echo -e "${green}###### Happy printing! ######${white}"; echo
exit 0;;
*)
deny_action "main_ui";;
esac

View File

@@ -1,31 +1,42 @@
remove_ui(){
#!/usr/bin/env bash
#=======================================================================#
# Copyright (C) 2020 - 2022 Dominik Willner <th33xitus@gmail.com> #
# #
# This file is part of KIAUH - Klipper Installation And Update Helper #
# https://github.com/th33xitus/kiauh #
# #
# This file may be distributed under the terms of the GNU GPLv3 license #
#=======================================================================#
set -e
function remove_ui() {
top_border
echo -e "| ${red}~~~~~~~~~~~~~~ [ Remove Menu ] ~~~~~~~~~~~~~~${default} | "
echo -e "| ${red}~~~~~~~~~~~~~~ [ Remove Menu ] ~~~~~~~~~~~~~~${white} |"
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. | "
echo -e "| ${yellow}INFO: Configurations and/or any backups will be kept!${white} |"
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] | "
echo -e "| Firmware & API: | 3rd Party Webinterface: |"
echo -e "| 1) [Klipper] | 6) [OctoPrint] |"
echo -e "| 2) [Moonraker] | |"
echo -e "| | Webcam Streamer: |"
echo -e "| Klipper Webinterface: | 7) [MJPG-Streamer] |"
echo -e "| 3) [Mainsail] | |"
echo -e "| 4) [Fluidd] | Other: |"
echo -e "| | 8) [PrettyGCode] |"
echo -e "| Touchscreen GUI: | 9) [Telegram Bot] |"
echo -e "| 5) [KlipperScreen] | 10) [NGINX] |"
back_footer
}
remove_menu(){
function remove_menu() {
do_action "" "remove_ui"
local action
while true; do
read -p "${cyan}Perform action:${default} " action; echo
case "$action" in
read -p "${cyan}####### Perform action:${white} " action
case "${action}" in
1)
do_action "remove_klipper" "remove_ui";;
2)
@@ -37,16 +48,14 @@ remove_menu(){
5)
do_action "remove_klipperscreen" "remove_ui";;
6)
do_action "remove_dwc2" "remove_ui";;
7)
do_action "remove_octoprint" "remove_ui";;
7)
do_action "remove_mjpg-streamer" "remove_ui";;
8)
do_action "remove_prettygcode" "remove_ui";;
9)
do_action "remove_MoonrakerTelegramBot" "remove_ui";;
do_action "remove_telegram_bot" "remove_ui";;
10)
do_action "remove_mjpg-streamer" "remove_ui";;
11)
do_action "remove_nginx" "remove_ui";;
B|b)
clear; main_menu; break;;

View File

@@ -1,44 +1,191 @@
settings_ui(){
source_kiauh_ini
top_border
echo -e "| $(title_msg "~~~~~~~~~~~~ [ KIAUH Settings ] ~~~~~~~~~~~~~") | "
hr
echo -e "| ${red}Caution:${default} | "
echo -e "| When you change the config folder, be aware that ALL | "
echo -e "| Klipper and Moonraker services will be STOPPED, | "
echo -e "| reconfigured and then restarted again. | "
blank_line
echo -e "| ${red}DO NOT change the folder during printing!${default} | "
hr
blank_line
echo -e "| ${cyan}● Current Klipper config folder:${default} | "
printf "|%-55s|\n" " $klipper_cfg_loc"
blank_line
hr
if [ -z $klipper_cfg_loc ]; then
echo -e "| ${red}N/A) Install Klipper with KIAUH first to unlock!${default} | "
#!/usr/bin/env bash
#=======================================================================#
# Copyright (C) 2020 - 2022 Dominik Willner <th33xitus@gmail.com> #
# #
# This file is part of KIAUH - Klipper Installation And Update Helper #
# https://github.com/th33xitus/kiauh #
# #
# This file may be distributed under the terms of the GNU GPLv3 license #
#=======================================================================#
set -e
function settings_ui() {
read_kiauh_ini "${FUNCNAME[0]}"
local custom_cfg_loc="${custom_klipper_cfg_loc}"
local custom_repo="${custom_klipper_repo}"
local custom_branch="${custom_klipper_repo_branch}"
local ms_pre_rls="${mainsail_install_unstable}"
local fl_pre_rls="${fluidd_install_unstable}"
local bbu="${backup_before_update}"
### config location
if [[ -z ${custom_cfg_loc} ]]; then
custom_cfg_loc="${cyan}${KLIPPER_CONFIG}${white}"
else
echo -e "| 1) Change config folder | "
custom_cfg_loc="${cyan}${custom_cfg_loc}${white}"
fi
back_footer
### custom repository
custom_repo=$(echo "${custom_repo}" | sed "s/https:\/\/github\.com\///" | sed "s/\.git$//" )
if [[ -z ${custom_repo} ]]; then
custom_repo="${cyan}Klipper3D/klipper${white}"
else
custom_repo="${cyan}${custom_repo}${white}"
fi
### custom repository branch
if [[ -z ${custom_branch} ]]; then
custom_branch="${cyan}master${white}"
else
custom_branch="${cyan}${custom_branch}${white}"
fi
### webinterface stable toggle
if [[ ${ms_pre_rls} == "false" ]]; then
ms_pre_rls="${red}${ms_pre_rls}${white}"
else
ms_pre_rls="${green}${ms_pre_rls}${white}"
fi
if [[ ${fl_pre_rls} == "false" ]]; then
fl_pre_rls="${red}${fl_pre_rls}${white}"
else
fl_pre_rls="${green}${fl_pre_rls}${white}"
fi
### backup before update toggle
if [[ "${bbu}" == "false" ]]; then
bbu="${red}${bbu}${white}"
else
bbu="${green}${bbu}${white}"
fi
top_border
echo -e "| $(title_msg "~~~~~~~~~~~~ [ KIAUH Settings ] ~~~~~~~~~~~~~") |"
hr
echo -e "| Klipper: |"
echo -e "| ● Config folder: |"
printf "| %-60s|\n" "${custom_cfg_loc}"
echo -e "| ● Repository: |"
printf "| %-70s|\n" "${custom_repo} (${custom_branch})"
hr
echo -e "| Install unstable releases: |"
printf "| Mainsail: %-29sFluidd: %-27s|\n" "${ms_pre_rls}" "${fl_pre_rls}"
hr
printf "| Backup before updating: %-42s|\n" "${bbu}"
hr
echo -e "| 1) Change Klipper config folder location |"
echo -e "| 2) Set custom Klipper repository |"
blank_line
if [[ ${mainsail_install_unstable} == "false" ]]; then
echo -e "| 3) ${green}Allow${white} unstable Mainsail releases |"
else
echo -e "| 3) ${red}Disallow${white} unstable Mainsail releases |"
fi
if [[ ${fluidd_install_unstable} == "false" ]]; then
echo -e "| 4) ${green}Allow${white} unstable Fluidd releases |"
else
echo -e "| 4) ${red}Disallow${white} unstable Fluidd releases |"
fi
blank_line
if [[ ${backup_before_update} == "false" ]]; then
echo -e "| 5) ${green}Enable${white} automatic backups before updates |"
else
echo -e "| 5) ${red}Disable${white} automatic backups before updates |"
fi
back_help_footer
}
settings_menu(){
do_action "" "settings_ui"
function show_settings_help() {
local default_cfg="${cyan}${HOME}/klipper_config${white}"
top_border
echo -e "| ~~~~~~ < ? > Help: KIAUH Settings < ? > ~~~~~~ |"
hr
echo -e "| ${cyan}Klipper config folder:${white} |"
echo -e "| The location of your printer.cfg and all other config |"
echo -e "| files that gets used during installation of Klipper |"
echo -e "| and all other components which need that location. |"
echo -e "| It is not recommended to change this location. |"
echo -e "| Be advised, that negative side effects could occur. |"
blank_line
printf "| Default: %-55s|\n" "${default_cfg}"
blank_line
hr
echo -e "| ${cyan}Install unstable releases:${white} |"
echo -e "| If set to ${green}true${white}, KIAUH installs/updates the software |"
echo -e "| with the latest, currently available release. |"
echo -e "| ${yellow}This will include alpha, beta and rc releases!${white} |"
blank_line
echo -e "| If set to ${red}false${white}, KIAUH installs/updates the software |"
echo -e "| with the most recent stable release. |"
blank_line
echo -e "| Default: ${red}false${white} |"
blank_line
hr
echo -e "| ${cyan}Backup before updating:${white} |"
echo -e "| If set to true, KIAUH will automatically create a |"
echo -e "| backup from the corresponding component you are about |"
echo -e "| to update before actually updating it, preserving the |"
echo -e "| current state of the component in a safe location. |"
echo -e "| All backups are stored in '~/kiauh_backups'. |"
blank_line
echo -e "| Default: ${red}false${white} |"
blank_line
back_footer
local choice
while true; do
read -p "${cyan}Perform action:${default} " action; echo
case "$action" in
1)
if [ ! -z $klipper_cfg_loc ]; then
do_action "change_klipper_cfg_path" "settings_ui"
else
deny_action "settings_ui"
fi;;
read -p "${cyan}###### Please select:${white} " choice
case "${choice}" in
B|b)
clear; main_menu; break;;
clear && print_header
settings_menu
break;;
*)
deny_action "show_settings_help";;
esac
done
}
function settings_menu() {
clear && print_header
settings_ui
local action
while true; do
read -p "${cyan}####### Perform action:${white} " action
case "${action}" in
1)
clear && print_header
change_klipper_cfg_folder
settings_ui;;
2)
clear && print_header
change_klipper_repo_menu
settings_ui;;
3)
switch_mainsail_releasetype
settings_menu;;
4)
switch_fluidd_releasetype
settings_menu;;
5)
toggle_backup_before_update
settings_menu;;
B|b)
clear
main_menu
break;;
H|h)
clear && print_header
show_settings_help
break;;
*)
deny_action "settings_ui";;
esac
done
settings_ui
}

View File

@@ -1,39 +1,49 @@
update_ui(){
ui_print_versions
#!/usr/bin/env bash
#=======================================================================#
# Copyright (C) 2020 - 2022 Dominik Willner <th33xitus@gmail.com> #
# #
# This file is part of KIAUH - Klipper Installation And Update Helper #
# https://github.com/th33xitus/kiauh #
# #
# This file may be distributed under the terms of the GNU GPLv3 license #
#=======================================================================#
set -e
function update_ui() {
top_border
echo -e "| ${green}~~~~~~~~~~~~~~ [ Update Menu ] ~~~~~~~~~~~~~~${default} | "
echo -e "| ${green}~~~~~~~~~~~~~~ [ Update Menu ] ~~~~~~~~~~~~~~${white} |"
hr
echo -e "| 0) $BB4U_STATUS| "
hr
echo -e "| a) [Update all] | | | "
echo -e "| | Local Vers: | Remote Vers: | "
echo -e "| Klipper/Klipper API: |---------------|--------------| "
echo -e "| 1) [Klipper] | $LOCAL_COMMIT | $REMOTE_COMMIT | "
echo -e "| 2) [Moonraker] | $LOCAL_MOONRAKER_COMMIT | $REMOTE_MOONRAKER_COMMIT | "
echo -e "| | | | "
echo -e "| Klipper Webinterface: |---------------|--------------| "
echo -e "| 3) [Mainsail] | $MAINSAIL_LOCAL_VER | $MAINSAIL_REMOTE_VER | "
echo -e "| 4) [Fluidd] | $FLUIDD_LOCAL_VER | $FLUIDD_REMOTE_VER | "
echo -e "| | | | "
echo -e "| Touchscreen GUI: |---------------|--------------| "
echo -e "| 5) [KlipperScreen] | $LOCAL_KLIPPERSCREEN_COMMIT | $REMOTE_KLIPPERSCREEN_COMMIT | "
echo -e "| | | | "
echo -e "| Other: |---------------|--------------| "
echo -e "| 6) [DWC2-for-Klipper] | $LOCAL_DWC2FK_COMMIT | $REMOTE_DWC2FK_COMMIT | "
echo -e "| 7) [DWC2 Web UI] | $DWC2_LOCAL_VER | $DWC2_REMOTE_VER | "
echo -e "| 8) [PrettyGCode] | $LOCAL_PGC_COMMIT | $REMOTE_PGC_COMMIT | "
echo -e "| 9) [Telegram Bot] | $LOCAL_MOONRAKER_TELEGRAM_BOT_COMMIT | $REMOTE_MOONRAKER_TELEGRAM_BOT_COMMIT | "
echo -e "| |------------------------------| "
echo -e "| 10) [System] | $DISPLAY_SYS_UPDATE | "
echo -e "| a) [Update all] | | |"
echo -e "| | Installed: | Latest: |"
echo -e "| Klipper & API: |---------------|--------------|"
echo -e "| 1) [Klipper] |$(compare_klipper_versions)|"
echo -e "| 2) [Moonraker] |$(compare_moonraker_versions)|"
echo -e "| | | |"
echo -e "| Klipper Webinterface: |---------------|--------------|"
echo -e "| 3) [Mainsail] |$(compare_mainsail_versions)|"
echo -e "| 4) [Fluidd] |$(compare_fluidd_versions)|"
echo -e "| | | |"
echo -e "| Touchscreen GUI: |---------------|--------------|"
echo -e "| 5) [KlipperScreen] |$(compare_klipperscreen_versions)|"
echo -e "| | | |"
echo -e "| Other: |---------------|--------------|"
echo -e "| 6) [PrettyGCode] |$(compare_prettygcode_versions)|"
echo -e "| 7) [Telegram Bot] |$(compare_telegram_bot_versions)|"
echo -e "| |------------------------------|"
echo -e "| 8) [System] | $(check_system_updates) |"
back_footer
}
update_menu(){
read_bb4u_stat
function update_menu() {
unset update_arr
do_action "" "update_ui"
local action
while true; do
read -p "${cyan}Perform action:${default} " action; echo
case "$action" in
read -p "${cyan}####### Perform action:${white} " action
case "${action}" in
0)
do_action "toggle_backups" "update_ui";;
1)
@@ -47,14 +57,10 @@ update_menu(){
5)
do_action "update_klipperscreen" "update_ui";;
6)
do_action "update_dwc2fk" "update_ui";;
7)
do_action "update_dwc2" "update_ui";;
8)
do_action "update_pgc_for_klipper" "update_ui";;
9)
do_action "update_MoonrakerTelegramBot" "update_ui";;
10)
7)
do_action "update_telegram_bot" "update_ui";;
8)
do_action "update_system" "update_ui";;
a)
do_action "update_all" "update_ui";;
@@ -66,3 +72,60 @@ update_menu(){
done
update_menu
}
function update_all() {
while true; do
if (( ${#update_arr[@]} == 0 )); then
print_confirm "Everything is already up-to-date!"
echo; break
fi
echo
top_border
echo -e "| The following installations will be updated: |"
if [[ "${KLIPPER_UPDATE_AVAIL}" = "true" ]]; then
echo -e "| ${cyan}● Klipper${white} |"
fi
if [[ "${MOONRAKER_UPDATE_AVAIL}" = "true" ]]; then
echo -e "| ${cyan}● Moonraker${white} |"
fi
if [[ "${MAINSAIL_UPDATE_AVAIL}" = "true" ]]; then
echo -e "| ${cyan}● Mainsail${white} |"
fi
if [[ "${FLUIDD_UPDATE_AVAIL}" = "true" ]]; then
echo -e "| ${cyan}● Fluidd${white} |"
fi
if [[ "${KLIPPERSCREEN_UPDATE_AVAIL}" = "true" ]]; then
echo -e "| ${cyan}● KlipperScreen${white} |"
fi
if [[ "${PGC_UPDATE_AVAIL}" = "true" ]]; then
echo -e "| ${cyan}● PrettyGCode for Klipper${white} |"
fi
if [[ "${MOONRAKER_TELEGRAM_BOT_UPDATE_AVAIL}" = "true" ]]; then
echo -e "| ${cyan}● MoonrakerTelegramBot${white} |"
fi
if [[ "${SYS_UPDATE_AVAIL}" = "true" ]]; then
echo -e "| ${cyan}● System${white} |"
fi
bottom_border
local yn
if (( ${#update_arr[@]} != 0 )); then
read -p "${cyan}###### Do you want to proceed? (Y/n):${white} " yn
case "${yn}" in
Y|y|Yes|yes|"")
for update in "${update_arr[@]}"
do
#shellcheck disable=SC2250
$update
done
break;;
N|n|No|no)
break;;
*)
print_unkown_cmd
print_msg && clear_msg;;
esac
fi
done
}