First commit

This commit is contained in:
Cyril 2024-03-10 21:45:05 +01:00
commit 7693c29676
102 changed files with 11831 additions and 0 deletions

View file

@ -0,0 +1,87 @@
#!/bin/sh
set -e
function customize_menu_ui_ke() {
top_line
title '[ CUSTOMIZE MENU ]' "${yellow}"
inner_line
hr
menu_option '1' 'Remove' 'Creality Web Interface'
menu_option '2' 'Restore' 'Creality Web Interface'
hr
menu_option '3' 'Install' 'Guppy Screen'
menu_option '4' 'Remove' 'Guppy Screen'
hr
menu_option '5' 'Install' 'Creality Dynamic Logos for Fluidd'
hr
inner_line
hr
bottom_menu_option 'b' 'Back to [Main Menu]' "${yellow}"
bottom_menu_option 'q' 'Exit' "${darkred}"
hr
version_line "$(get_script_version)"
bottom_line
}
function customize_menu_ke() {
clear
customize_menu_ui_ke
local customize_menu_opt
while true; do
read -p " ${white}Type your choice and validate with Enter: ${yellow}" customize_menu_opt
case "${customize_menu_opt}" in
1)
if [ ! -d "$FLUIDD_FOLDER" ] && [ ! -d "$MAINSAIL_FOLDER" ]; then
error_msg "Fluidd or Mainsail is needed, please install it first!"
elif [ ! -f "$CREALITY_WEB_FILE" ]; then
error_msg "Creality Web Interface is already removed!"
echo -e " ${darkred}Please restore Creality Web Interface first if you want to change the default Web Interface.${white}"
echo
else
run "remove_creality_web_interface" "customize_menu_ui_ke"
fi;;
2)
if [ -f "$CREALITY_WEB_FILE" ]; then
error_msg "Creality Web Interface is already present!"
else
run "restore_creality_web_interface" "customize_menu_ui_ke"
fi;;
3)
if [ -d "$GUPPY_SCREEN_FOLDER" ]; then
error_msg "Guppy Screen is already installed!"
echo -e " ${darkred}Please remove Guppy Screen first if you want to change the theme.${white}"
echo
elif [ -d "$IMP_SHAPERS_FOLDER" ]; then
error_msg "Please remove Improved Shapers Calibrations first, Guppy Screen already use it!"
elif [ ! -f /lib/ld-2.29.so ]; then
error_msg "Make sure you're running 1.3.x.x firmware version!"
elif [ ! -f "$KLIPPER_SHELL_FILE" ]; then
error_msg "Klipper Gcode Shell Command is needed, please install it first!"
else
run "install_guppy_screen" "customize_menu_ui_ke"
fi;;
4)
if [ ! -d "$GUPPY_SCREEN_FOLDER" ]; then
error_msg "Guppy Screen is not installed!"
else
run "remove_guppy_screen" "customize_menu_ui_ke"
fi;;
5)
if [ -f "$FLUIDD_LOGO_FILE" ]; then
error_msg "Creality Dynamic Logos for Fluidd are already installed!"
elif [ ! -d "$FLUIDD_FOLDER" ]; then
error_msg "Fluidd is needed, please install it first!"
else
run "install_creality_dynamic_logos" "customize_menu_ui_ke"
fi;;
B|b)
clear; main_menu; break;;
Q|q)
clear; exit 0;;
*)
error_msg "Please select a correct choice!";;
esac
done
customize_menu_ke
}

81
scripts/menu/KE/info_menu_KE.sh Executable file
View file

@ -0,0 +1,81 @@
#!/bin/sh
set -e
function check_folder_ke() {
local folder_path="$1"
if [ -d "$folder_path" ]; then
echo -e "${green}"
else
echo -e "${red}"
fi
}
function check_file_ke() {
local file_path="$1"
if [ -f "$file_path" ]; then
echo -e "${green}"
else
echo -e "${red}"
fi
}
function info_menu_ui_ke() {
top_line
title '[ INFORMATIONS MENU ]' "${yellow}"
inner_line
hr
subtitle '•ESSENTIALS:'
info_line "$(check_folder_ke "$MOONRAKER_FOLDER")" 'Moonraker & Nginx'
info_line "$(check_folder_ke "$FLUIDD_FOLDER")" 'Fluidd'
info_line "$(check_folder_ke "$MAINSAIL_FOLDER")" 'Mainsail'
hr
subtitle '•UTILITIES:'
info_line "$(check_file_ke "$ENTWARE_FILE")" 'Entware'
info_line "$(check_file_ke "$KLIPPER_SHELL_FILE")" 'Klipper Gcode Shell Command'
hr
subtitle '•IMPROVEMENTS:'
info_line "$(check_folder_ke "$IMP_SHAPERS_FOLDER")" 'Improved Shapers Calibrations'
info_line "$(check_file_ke "$SAVE_ZOFFSET_FILE")" 'Save Z-Offset Macros'
info_line "$(check_file_ke "$VIRTUAL_PINS_FILE")" 'Virtual Pins Support'
info_line "$(check_file_ke "$GIT_BACKUP_FILE")" 'Git Backup'
hr
subtitle '•CAMERA:'
info_line "$(check_file_ke "$TIMELAPSE_FILE")" 'Moonraker Timelapse'
hr
subtitle '•REMOTE ACCESS AND AI DETECTION:'
info_line "$(check_folder_ke "$OCTOEVERYWHERE_FOLDER")" 'OctoEverywhere'
info_line "$(check_folder_ke "$MOONRAKER_OBICO_FOLDER")" 'Obico'
info_line "$(check_folder_ke "$MOBILERAKER_COMPANION_FOLDER")" 'Mobileraker Companion'
hr
subtitle '•CUSTOMIZATION:'
info_line "$(check_file_ke "$CREALITY_WEB_FILE")" 'Creality Web Interface'
info_line "$(check_folder_ke "$GUPPY_SCREEN_FOLDER")" 'Guppy Screen'
info_line "$(check_file_ke "$FLUIDD_LOGO_FILE")" 'Creality Dynamic Logos for Fluidd'
hr
inner_line
hr
bottom_menu_option 'b' 'Back to [Main Menu]' "${yellow}"
bottom_menu_option 'q' 'Exit' "${darkred}"
hr
version_line "$(get_script_version)"
bottom_line
}
function info_menu_ke() {
clear
info_menu_ui_ke
local info_menu_opt
while true; do
read -p " ${white}Type your choice and validate with Enter: ${yellow}" info_menu_opt
case "${info_menu_opt}" in
B|b)
clear; main_menu; break;;
Q|q)
clear; exit 0;;
*)
error_msg "Please select a correct choice!";;
esac
done
info_menu_ke
}

View file

@ -0,0 +1,162 @@
#!/bin/sh
set -e
function install_menu_ui_ke() {
top_line
title '[ INSTALL MENU ]' "${yellow}"
inner_line
hr
subtitle '•ESSENTIALS:'
menu_option ' 1' 'Install' 'Moonraker and Nginx'
menu_option ' 2' 'Install' 'Fluidd (port 4408)'
menu_option ' 3' 'Install' 'Mainsail (port 4409)'
hr
subtitle '•UTILITIES:'
menu_option ' 4' 'Install' 'Entware'
menu_option ' 5' 'Install' 'Klipper Gcode Shell Command'
hr
subtitle '•IMPROVEMENTS:'
menu_option ' 6' 'Install' 'Improved Shapers Calibrations'
menu_option ' 7' 'Install' 'Save Z-Offset Macros'
menu_option ' 8' 'Install' 'Virtual Pins Support'
menu_option ' 9' 'Install' 'Git Backup'
hr
subtitle '•CAMERA:'
menu_option '10' 'Install' 'Moonraker Timelapse'
hr
subtitle '•REMOTE ACCESS AND AI DETECTION:'
menu_option '11' 'Install' 'OctoEverywhere'
menu_option '12' 'Install' 'Moonraker Obico'
menu_option '13' 'Install' 'Mobileraker Companion'
hr
inner_line
hr
bottom_menu_option 'b' 'Back to [Main Menu]' "${yellow}"
bottom_menu_option 'q' 'Exit' "${darkred}"
hr
version_line "$(get_script_version)"
bottom_line
}
function install_menu_ke() {
clear
install_menu_ui_ke
local install_menu_opt
while true; do
read -p " ${white}Type your choice and validate with Enter: ${yellow}" install_menu_opt
case "${install_menu_opt}" in
1)
if [ -d "$MOONRAKER_FOLDER" ]; then
error_msg "Moonraker and Nginx are already installed!"
else
run "install_moonraker_nginx" "install_menu_ui_ke"
fi;;
2)
if [ -d "$FLUIDD_FOLDER" ]; then
error_msg "Fluidd is already installed!"
elif [ ! -d "$MOONRAKER_FOLDER" ] && [ ! -d "$NGINX_FOLDER" ]; then
error_msg "Moonraker and Nginx are needed, please install them first!"
else
run "install_fluidd" "install_menu_ui_ke"
fi;;
3)
if [ -d "$MAINSAIL_FOLDER" ]; then
error_msg "Mainsail is already installed!"
elif [ ! -d "$MOONRAKER_FOLDER" ] && [ ! -d "$NGINX_FOLDER" ]; then
error_msg "Moonraker and Nginx are needed, please install them first!"
else
run "install_mainsail" "install_menu_ui_ke"
fi;;
4)
if [ -f "$ENTWARE_FILE" ]; then
error_msg "Entware is already installed!"
else
run "install_entware" "install_menu_ui_ke"
fi;;
5)
if [ -f "$KLIPPER_SHELL_FILE" ]; then
error_msg "Klipper Gcode Shell Command is already installed!"
else
run "install_gcode_shell_command" "install_menu_ui_ke"
fi;;
6)
if [ -d "$IMP_SHAPERS_FOLDER" ]; then
error_msg "Improved Shapers Calibrations are already installed!"
elif [ -d "$GUPPY_SCREEN_FOLDER" ]; then
error_msg "Guppy Screen already has these features!"
elif [ ! -f "$KLIPPER_SHELL_FILE" ]; then
error_msg "Klipper Gcode Shell Command is needed, please install it first!"
else
run "install_improved_shapers" "install_menu_ui_ke"
fi;;
7)
if [ -f "$SAVE_ZOFFSET_FILE" ]; then
error_msg "Save Z-Offset Macros are already installed!"
else
run "install_save_zoffset_macros" "install_menu_ui_ke"
fi;;
8)
if [ -f "$VIRTUAL_PINS_FILE" ]; then
error_msg "Virtual Pins Support is already installed!"
else
run "install_virtual_pins" "install_menu_ui_ke"
fi;;
9)
if [ -f "$GIT_BACKUP_FILE" ]; then
error_msg "Git Backup is already installed!"
elif [ ! -f "$ENTWARE_FILE" ]; then
error_msg "Entware is needed, please install it first!"
elif [ ! -f "$KLIPPER_SHELL_FILE" ]; then
error_msg "Klipper Gcode Shell Command is needed, please install it first!"
else
run "install_git_backup" "install_menu_ui_ke"
fi;;
10)
if [ -f "$TIMELAPSE_FILE" ]; then
error_msg "Moonraker Timelapse is already installed!"
elif [ ! -f "$ENTWARE_FILE" ]; then
error_msg "Entware is needed, please install it first!"
else
run "install_moonraker_timelapse" "install_menu_ui_ke"
fi;;
11)
if [ -d "$OCTOEVERYWHERE_FOLDER" ]; then
error_msg "OctoEverywhere is already installed!"
elif [ ! -d "$MOONRAKER_FOLDER" ]; then
error_msg "Moonraker and Nginx are needed, please install them first!"
elif [ ! -d "$FLUIDD_FOLDER" ] && [ ! -d "$MAINSAIL_FOLDER" ]; then
error_msg "Fluidd or Mainsail is needed, please install it first!"
elif [ ! -f "$ENTWARE_FILE" ]; then
error_msg "Entware is needed, please install it first!"
else
run "install_octoeverywhere" "install_menu_ui_ke"
fi;;
12)
if [ -d "$MOONRAKER_OBICO_FOLDER" ]; then
error_msg "Moonraker Obico is already installed!"
elif [ ! -d "$MOONRAKER_FOLDER" ]; then
error_msg "Moonraker and Nginx are needed, please install them first!"
elif [ ! -d "$FLUIDD_FOLDER" ] && [ ! -d "$MAINSAIL_FOLDER" ]; then
error_msg "Fluidd or Mainsail is needed, please install it first!"
elif [ ! -f "$ENTWARE_FILE" ]; then
error_msg "Entware is needed, please install it first!"
else
run "install_moonraker_obico" "install_menu_ui_ke"
fi;;
13)
if [ -d "$MOBILERAKER_COMPANION_FOLDER" ]; then
error_msg "Mobileraker Companion is already installed!"
else
run "install_mobileraker_companion" "install_menu_ui_ke"
fi;;
B|b)
clear; main_menu; break;;
Q|q)
clear; exit 0;;
*)
error_msg "Please select a correct choice!";;
esac
done
install_menu_ke
}

158
scripts/menu/KE/remove_menu_KE.sh Executable file
View file

@ -0,0 +1,158 @@
#!/bin/sh
set -e
function remove_menu_ui_ke() {
top_line
title '[ REMOVE MENU ]' "${yellow}"
inner_line
hr
subtitle '•ESSENTIALS:'
menu_option ' 1' 'Remove' 'Moonraker and Nginx'
menu_option ' 2' 'Remove' 'Fluidd (port 4408)'
menu_option ' 3' 'Remove' 'Mainsail (port 4409)'
hr
subtitle '•UTILITIES:'
menu_option ' 4' 'Remove' 'Entware'
menu_option ' 5' 'Remove' 'Klipper Gcode Shell Command'
hr
subtitle '•IMPROVEMENTS:'
menu_option ' 6' 'Remove' 'Improved Shapers Calibrations'
menu_option ' 7' 'Remove' 'Save Z-Offset Macros'
menu_option ' 8' 'Remove' 'Virtual Pins Support'
menu_option ' 9' 'Remove' 'Git Backup'
hr
subtitle '•CAMERA:'
menu_option '10' 'Remove' 'Moonraker Timelapse'
hr
subtitle '•REMOTE ACCESS AND AI DETECTION:'
menu_option '11' 'Remove' 'OctoEverywhere'
menu_option '12' 'Remove' 'Moonraker Obico'
menu_option '13' 'Remove' 'Mobileraker Companion'
hr
inner_line
hr
bottom_menu_option 'b' 'Back to [Main Menu]' "${yellow}"
bottom_menu_option 'q' 'Exit' "${darkred}"
hr
version_line "$(get_script_version)"
bottom_line
}
function remove_menu_ke() {
clear
remove_menu_ui_ke
local remove_menu_opt
while true; do
read -p " ${white}Type your choice and validate with Enter: ${yellow}" remove_menu_opt
case "${remove_menu_opt}" in
1)
if [ ! -d "$MOONRAKER_FOLDER" ] && [ ! -d "$NGINX_FOLDER" ]; then
error_msg "Moonraker and Nginx are not installed!"
else
run "remove_moonraker_nginx" "remove_menu_ui_ke"
fi;;
2)
if [ ! -d "$FLUIDD_FOLDER" ]; then
error_msg "Fluidd is not installed!"
elif [ ! -f "$CREALITY_WEB_FILE" ]; then
error_msg "Creality Web Interface is removed!"
echo -e " ${darkred}Please restore Creality Web Interface first if you want to remove Fluidd.${white}"
echo
else
run "remove_fluidd" "remove_menu_ui_ke"
fi;;
3)
if [ ! -d "$MAINSAIL_FOLDER" ]; then
error_msg "Mainsail is not installed!"
elif [ ! -f "$CREALITY_WEB_FILE" ]; then
error_msg "Creality Web Interface is removed!"
echo -e " ${darkred}Please restore Creality Web Interface first if you want to remove Mainsail.${white}"
echo
else
run "remove_mainsail" "remove_menu_ui_ke"
fi;;
4)
if [ ! -f "$ENTWARE_FILE" ]; then
error_msg "Entware is not installed!"
elif [ -f "$TIMELAPSE_FILE" ]; then
error_msg "Entware is needed to use Moonraker Timelapse, please uninstall it first!"
elif [ -f "$GIT_BACKUP_FILE" ]; then
error_msg "Entware is needed to use Git Backup, please uninstall it first!"
elif [ -d "$OCTOEVERYWHERE_FOLDER" ]; then
error_msg "Entware is needed to use OctoEverywhere, please uninstall it first!"
elif [ -d "$MOONRAKER_OBICO_FOLDER" ]; then
error_msg "Entware is needed to use Moonraker Obico, please uninstall it first!"
else
run "remove_entware" "remove_menu_ui_ke"
fi;;
5)
if [ ! -f "$KLIPPER_SHELL_FILE" ]; then
error_msg "Klipper Gcode Shell Command is not installed!"
elif [ -d "$GUPPY_SCREEN_FOLDER" ]; then
error_msg "Klipper Gcode Shell Command is needed to use Guppy Screen, please uninstall it first!"
elif [ -d "$IMP_SHAPERS_FOLDER" ]; then
error_msg "Klipper Gcode Shell Command is needed to use Improved Shapers Calibrations, please uninstall it first!"
elif [ -d "$GIT_BACKUP_FOLDER" ]; then
error_msg "Klipper Gcode Shell Command is needed to use Git Backup, please uninstall it first!"
else
run "remove_gcode_shell_command" "remove_menu_ui_ke"
fi;;
6)
if [ ! -d "$IMP_SHAPERS_FOLDER" ]; then
error_msg "Improved Shapers Calibrations are not installed!"
else
run "remove_improved_shapers" "remove_menu_ui_ke"
fi;;
7)
if [ ! -f "$SAVE_ZOFFSET_FILE" ]; then
error_msg "Save Z-Offset Macros are not installed!"
else
run "remove_save_zoffset_macros" "remove_menu_ui_ke"
fi;;
8)
if [ ! -f "$VIRTUAL_PINS_FILE" ]; then
error_msg "Virtual Pins Support is not installed!"
else
run "remove_virtual_pins" "remove_menu_ui_ke"
fi;;
9)
if [ ! -f "$GIT_BACKUP_FILE" ]; then
error_msg "Git Backup is not installed!"
else
run "remove_git_backup" "remove_menu_ui_ke"
fi;;
10)
if [ ! -f "$TIMELAPSE_FILE" ]; then
error_msg "Moonraker Timelapse is not installed!"
else
run "remove_moonraker_timelapse" "remove_menu_ui_ke"
fi;;
11)
if [ ! -d "$OCTOEVERYWHERE_FOLDER" ]; then
error_msg "OctoEverywhere is not installed!"
else
run "remove_octoeverywhere" "remove_menu_ui_ke"
fi;;
12)
if [ ! -d "$MOONRAKER_OBICO_FOLDER" ]; then
error_msg "Moonraker Obico is not installed!"
else
run "remove_moonraker_obico" "remove_menu_ui_ke"
fi;;
13)
if [ ! -d "$MOBILERAKER_COMPANION_FOLDER" ]; then
error_msg "Mobileraker Companion is not installed!"
else
run "remove_mobileraker_companion" "remove_menu_ui_ke"
fi;;
B|b)
clear; main_menu; break;;
Q|q)
clear; exit 0;;
*)
error_msg "Please select a correct choice!";;
esac
done
remove_menu_ke
}

View file

@ -0,0 +1,95 @@
#!/bin/sh
set -e
function tools_menu_ui_ke() {
top_line
title '[ TOOLS MENU ]' "${yellow}"
inner_line
hr
menu_option ' 1' 'Prevent updating' 'Klipper configuration files'
menu_option ' 2' 'Allow updating' 'Klipper configuration files'
hr
menu_option ' 3' 'Restart' 'Nginx service'
menu_option ' 4' 'Restart' 'Moonraker service'
menu_option ' 5' 'Restart' 'Klipper service'
hr
menu_option ' 6' 'Update' 'Entware packages'
hr
menu_option ' 7' 'Clear' 'cache'
menu_option ' 8' 'Clear' 'logs files'
hr
menu_option ' 9' 'Restore' 'a previous firmware'
hr
menu_option '10' 'Reset' 'factory settings'
hr
inner_line
hr
bottom_menu_option 'b' 'Back to [Main Menu]' "${yellow}"
bottom_menu_option 'q' 'Exit' "${darkred}"
hr
version_line "$(get_script_version)"
bottom_line
}
function tools_menu_ke() {
clear
tools_menu_ui_ke
local tools_menu_opt
while true; do
read -p " ${white}Type your choice and validate with Enter: ${yellow}" tools_menu_opt
case "${tools_menu_opt}" in
1)
if [ -f "$INITD_FOLDER"/disabled.S55klipper_service ]; then
error_msg "Updating Klipper configuration files is already prevented!"
else
run "prevent_updating_klipper_files" "tools_menu_ui_ke"
fi;;
2)
if [ ! -f "$INITD_FOLDER"/disabled.S55klipper_service ]; then
error_msg "Updating Klipper configuration files is already allowed!"
else
run "allow_updating_klipper_files" "tools_menu_ui_ke"
fi;;
3)
if [ ! -d "$NGINX_FOLDER" ]; then
error_msg "Nginx is not installed!"
else
run "restart_nginx_action" "tools_menu_ui_ke"
fi;;
4)
if [ ! -d "$MOONRAKER_FOLDER" ]; then
error_msg "Moonraker is not installed!"
else
run "restart_moonraker_action" "tools_menu_ui_ke"
fi;;
5)
if [ ! -f "$INITD_FOLDER"/S55klipper_service ]; then
error_msg "Klipper service is not present!"
else
run "restart_klipper_action" "tools_menu_ui_ke"
fi;;
6)
if [ ! -f "$ENTWARE_FILE" ]; then
error_msg "Entware is not installed!"
else
run "update_entware_packages" "tools_menu_ui_ke"
fi;;
7)
run "clear_cache" "tools_menu_ui_ke";;
8)
run "clear_logs" "tools_menu_ui_ke";;
9)
run "restore_previous_firmware" "tools_menu_ui_ke";;
10)
run "reset_factory_settings" "tools_menu_ui_ke";;
B|b)
clear; main_menu; break;;
Q|q)
clear; exit 0;;
*)
error_msg "Please select a correct choice!";;
esac
done
tools_menu_ke
}

View file

@ -0,0 +1,57 @@
#!/bin/sh
set -e
function backup_restore_menu_ui() {
top_line
title '[ BACKUP & RESTORE MENU ]' "${yellow}"
inner_line
hr
menu_option '1' 'Backup' 'Klipper configuration files'
menu_option '2' 'Restore' 'Klipper configuration files'
hr
menu_option '3' 'Backup' 'Moonraker database'
menu_option '4' 'Restore' 'Moonraker database'
hr
inner_line
hr
bottom_menu_option 'b' 'Back to [Main Menu]' "${yellow}"
bottom_menu_option 'q' 'Exit' "${darkred}"
hr
version_line "$(get_script_version)"
bottom_line
}
function backup_restore_menu() {
clear
backup_restore_menu_ui
local backup_restore_menu_opt
while true; do
read -p " ${white}Type your choice and validate with Enter: ${yellow}" backup_restore_menu_opt
case "${backup_restore_menu_opt}" in
1)
run "backup_klipper_config_files" "backup_restore_menu_ui";;
2)
if [ ! -f "$KLIPPER_CONFIG_FOLDER"/backup_config.tar.gz ]; then
error_msg "Please backup Klipper configuration files before restore!"
else
run "restore_klipper_config_files" "backup_restore_menu_ui"
fi;;
3)
run "backup_moonraker_database" "backup_restore_menu_ui";;
4)
if [ ! -f "$KLIPPER_CONFIG_FOLDER"/backup_database.tar.gz ]; then
error_msg "Please backup Moonraker database before restore!"
else
run "restore_moonraker_database" "backup_restore_menu_ui"
fi;;
B|b)
clear; main_menu; break;;
Q|q)
clear; exit 0;;
*)
error_msg "Please select a correct choice!";;
esac
done
backup_restore_menu
}

106
scripts/menu/customize_menu.sh Executable file
View file

@ -0,0 +1,106 @@
#!/bin/sh
set -e
function customize_menu_ui() {
top_line
title '[ CUSTOMIZE MENU ]' "${yellow}"
inner_line
hr
menu_option '1' 'Install' 'Custom Boot Display'
menu_option '2' 'Remove' 'Custom Boot Display'
hr
menu_option '3' 'Remove' 'Creality Web Interface'
menu_option '4' 'Restore' 'Creality Web Interface'
hr
menu_option '5' 'Install' 'Guppy Screen'
menu_option '6' 'Remove' 'Guppy Screen'
hr
menu_option '7' 'Install' 'Creality Dynamic Logos for Fluidd'
hr
inner_line
hr
bottom_menu_option 'b' 'Back to [Main Menu]' "${yellow}"
bottom_menu_option 'q' 'Exit' "${darkred}"
hr
version_line "$(get_script_version)"
bottom_line
}
function customize_menu() {
clear
customize_menu_ui
local customize_menu_opt
while true; do
read -p " ${white}Type your choice and validate with Enter: ${yellow}" customize_menu_opt
case "${customize_menu_opt}" in
1)
if [ -f "$BOOT_DISPLAY_FILE" ]; then
error_msg "Custom Boot Display is already installed!"
elif [ ! -d "$BOOT_DISPLAY_FOLDER" ]; then
error_msg "Please use latest firmware to install Custom Boot Display!"
else
run "install_custom_boot_display" "customize_menu_ui"
fi;;
2)
if [ ! -f "$BOOT_DISPLAY_FILE" ]; then
error_msg "Custom Boot Display is not installed!"
elif [ ! -d "$BOOT_DISPLAY_FOLDER" ]; then
error_msg "Please use latest firmware to restore Stock Boot Display!"
else
run "remove_custom_boot_display" "customize_menu_ui"
fi;;
3)
if [ ! -d "$FLUIDD_FOLDER" ] && [ ! -d "$MAINSAIL_FOLDER" ]; then
error_msg "Fluidd or Mainsail is needed, please install it first!"
elif [ ! -f "$CREALITY_WEB_FILE" ]; then
error_msg "Creality Web Interface is already removed!"
echo -e " ${darkred}Please restore Creality Web Interface first if you want to change the default Web Interface.${white}"
echo
else
run "remove_creality_web_interface" "customize_menu_ui"
fi;;
4)
if [ -f "$CREALITY_WEB_FILE" ]; then
error_msg "Creality Web Interface is already present!"
else
run "restore_creality_web_interface" "customize_menu_ui"
fi;;
5)
if [ -d "$GUPPY_SCREEN_FOLDER" ]; then
error_msg "Guppy Screen is already installed!"
echo -e " ${darkred}Please remove Guppy Screen first if you want to change the theme.${white}"
echo
elif [ -d "$IMP_SHAPERS_FOLDER" ]; then
error_msg "Please remove Improved Shapers Calibrations first, Guppy Screen already use it!"
elif [ ! -f /lib/ld-2.29.so ]; then
error_msg "Make sure you're running 1.3.x.x firmware version!"
elif [ ! -f "$KLIPPER_SHELL_FILE" ]; then
error_msg "Klipper Gcode Shell Command is needed, please install it first!"
else
run "install_guppy_screen" "customize_menu_ui"
fi;;
6)
if [ ! -d "$GUPPY_SCREEN_FOLDER" ]; then
error_msg "Guppy Screen is not installed!"
else
run "remove_guppy_screen" "customize_menu_ui"
fi;;
7)
if [ -f "$FLUIDD_LOGO_FILE" ]; then
error_msg "Creality Dynamic Logos for Fluidd are already installed!"
elif [ ! -d "$FLUIDD_FOLDER" ]; then
error_msg "Fluidd is needed, please install it first!"
else
run "install_creality_dynamic_logos" "customize_menu_ui"
fi;;
B|b)
clear; main_menu; break;;
Q|q)
clear; exit 0;;
*)
error_msg "Please select a correct choice!";;
esac
done
customize_menu
}

197
scripts/menu/functions.sh Executable file
View file

@ -0,0 +1,197 @@
#!/bin/sh
set -e
function top_line() {
echo -e "${white}"
echo -e " ┌──────────────────────────────────────────────────────────────┐"
}
function hr() {
echo -e " │ │"
}
function inner_line() {
echo -e " ├──────────────────────────────────────────────────────────────┤"
}
function bottom_line() {
echo -e " └──────────────────────────────────────────────────────────────┘"
echo -e "${white}"
}
function blank_line() {
echo -e " "
}
function title() {
local text=$1
local color=$2
local max_length=62
local text_length=${#text}
local padding_left=$(((max_length - text_length) / 2))
local padding_right=$((max_length - text_length - padding_left))
printf " │%*s${color}%s${white}%*s│\n" $padding_left '' "$text" $padding_right ''
}
function subtitle() {
local menu_text1=$1
local max_length=61
local padding=$((max_length - ${#menu_text1}))
printf "${blue}${menu_text1}%-${padding}s${white}│\n" ''
}
function main_menu_option() {
local menu_number=$1
local menu_text1=$2
local menu_text2=$3
local max_length=56
local total_text_length=$(( ${#menu_text1} + ${#menu_text2} ))
local padding=$((max_length - total_text_length))
printf "${yellow}${menu_number}${white}) ${green}${menu_text1} ${white}${menu_text2}%-${padding}s${white}│\n" ''
}
function menu_option() {
local menu_number=$1
local menu_text1=$2
local menu_text2=$3
local max_length=60
local total_text_length=$(( ${#menu_text1} + ${#menu_text2} + ${#menu_number} + 4 ))
local padding=$((max_length - total_text_length))
printf "${yellow}${menu_number}${white}) ${white}${menu_text1} ${green}${menu_text2}%-${padding}s${white}│\n" ''
}
function bottom_menu_option() {
local menu_number=$1
local menu_text=$2
local color=$3
local max_length=57
local padding=$((max_length - ${#menu_text}))
printf "$color${menu_number}${white}) ${white}${menu_text}%-${padding}s${white}│\n" ''
}
function info_line() {
local status=$1
local text=$2
local color=$3
local max_length=66
local total_text_length=$(( ${#status} + ${#text} ))
local padding=$((max_length - total_text_length))
printf "$color${status} ${white}${text}%-${padding}s${white}│\n" ''
}
function system_line() {
local title="$1"
local value="$2"
local max_length=61
local title_length=${#title}
local separator=": "
local value_length=${#value}
local value_padding=$((max_length - title_length - ${#separator} - value_length))
printf "${green}%s${white}%s${white}\e[97m%s%-*s%s${white}│\n" "$title" "$separator" "$value" $value_padding ''
}
function install_msg() {
read -p "${white} Are you sure you want to install ${green}${1} ${white}? (${yellow}y${white}/${yellow}n${white}): ${yellow}" $2
}
function remove_msg() {
read -p "${white} Are you sure you want to remove ${green}${1} ${white}? (${yellow}y${white}/${yellow}n${white}): ${yellow}" $2
}
function restore_msg() {
read -p "${white} Are you sure you want to restore ${green}${1} ${white}? (${yellow}y${white}/${yellow}n${white}): ${yellow}" $2
}
function backup_msg() {
read -p "${white} Are you sure you want to backup ${green}${1} ${white}? (${yellow}y${white}/${yellow}n${white}): ${yellow}" $2
}
function restart_msg() {
read -p "${white} Are you sure you want to restart ${green}${1} ${white}? (${yellow}y${white}/${yellow}n${white}): ${yellow}" $2
}
function ok_msg() {
echo
echo -e "${white}${green}${1}${white}"
echo
}
function error_msg() {
echo
echo -e "${white}${darkred}${1}${white}"
echo
}
function run() {
clear
# $1 - Action performed
$1
# $2 - Menu launched after action is completed
$2
}
function check_ipaddress() {
eth0_ip=$(ip -4 addr show eth0 2>/dev/null | grep -o -E '(inet\s)([0-9]+\.){3}[0-9]+' | cut -d ' ' -f 2 | head -n 1)
wlan0_ip=$(ip -4 addr show wlan0 | grep -o -E '(inet\s)([0-9]+\.){3}[0-9]+' | cut -d ' ' -f 2 | head -n 1)
if [ -n "$eth0_ip" ]; then
echo -e "$eth0_ip"
elif [ -n "$wlan0_ip" ]; then
echo -e "$wlan0_ip"
else
echo -e "xxx.xxx.xxx.xxx"
fi
}
function start_moonraker() {
set +e
/etc/init.d/S56moonraker_service start
sleep 1
set -e
}
function stop_moonraker() {
set +e
/etc/init.d/S56moonraker_service stop
sleep 1
set -e
}
function start_nginx() {
set +e
/etc/init.d/S50nginx start
sleep 1
set -e
}
function stop_nginx() {
set +e
/etc/init.d/S50nginx stop
sleep 1
set -e
}
function restart_nginx() {
set +e
/etc/init.d/S50nginx restart
sleep 1
set -e
}
function start_klipper() {
set +e
/etc/init.d/S55klipper_service start
set -e
}
function stop_klipper() {
set +e
/etc/init.d/S55klipper_service stop
set -e
}
function restart_klipper() {
set +e
/etc/init.d/S55klipper_service restart
set -e
}

90
scripts/menu/info_menu.sh Executable file
View file

@ -0,0 +1,90 @@
#!/bin/sh
set -e
function check_folder() {
local folder_path="$1"
if [ -d "$folder_path" ]; then
echo -e "${green}"
else
echo -e "${red}"
fi
}
function check_file() {
local file_path="$1"
if [ -f "$file_path" ]; then
echo -e "${green}"
else
echo -e "${red}"
fi
}
function info_menu_ui() {
top_line
title '[ INFORMATIONS MENU ]' "${yellow}"
inner_line
hr
subtitle '•ESSENTIALS:'
info_line "$(check_folder "$MOONRAKER_FOLDER")" 'Moonraker & Nginx'
info_line "$(check_folder "$FLUIDD_FOLDER")" 'Fluidd'
info_line "$(check_folder "$MAINSAIL_FOLDER")" 'Mainsail'
hr
subtitle '•UTILITIES:'
info_line "$(check_file "$ENTWARE_FILE")" 'Entware'
info_line "$(check_file "$KLIPPER_SHELL_FILE")" 'Klipper Gcode Shell Command'
hr
subtitle '•IMPROVEMENTS:'
info_line "$(check_folder "$KAMP_FOLDER")" 'Klipper Adaptive Meshing & Purging'
info_line "$(check_file "$BUZZER_FILE")" 'Buzzer Support'
info_line "$(check_folder "$NOZZLE_CLEANING_FOLDER")" 'Nozzle Cleaning Fan Control'
info_line "$(check_file "$FAN_CONTROLS_FILE")" 'Fans Control Macros'
info_line "$(check_folder "$IMP_SHAPERS_FOLDER")" 'Improved Shapers Calibrations'
info_line "$(check_file "$USEFUL_MACROS_FILE")" 'Useful Macros'
info_line "$(check_file "$SAVE_ZOFFSET_FILE")" 'Save Z-Offset Macros'
info_line "$(check_file "$SCREWS_ADJUST_FILE")" 'Screws Tilt Adjust Support'
info_line "$(check_file "$VIRTUAL_PINS_FILE")" 'Virtual Pins Support'
info_line "$(check_file "$M600_SUPPORT_FILE")" 'M600 Support'
info_line "$(check_file "$GIT_BACKUP_FILE")" 'Git Backup'
hr
subtitle '•CAMERA:'
info_line "$(check_file "$TIMELAPSE_FILE")" 'Moonraker Timelapse'
info_line "$(check_file "$CAMERA_SETTINGS_FILE")" 'Camera Settings Control'
hr
subtitle '•REMOTE ACCESS AND AI DETECTION:'
info_line "$(check_folder "$OCTOEVERYWHERE_FOLDER")" 'OctoEverywhere'
info_line "$(check_folder "$MOONRAKER_OBICO_FOLDER")" 'Obico'
info_line "$(check_folder "$MOBILERAKER_COMPANION_FOLDER")" 'Mobileraker Companion'
hr
subtitle '•CUSTOMIZATION:'
info_line "$(check_file "$BOOT_DISPLAY_FILE")" 'Custom Boot Display'
info_line "$(check_file "$CREALITY_WEB_FILE")" 'Creality Web Interface'
info_line "$(check_folder "$GUPPY_SCREEN_FOLDER")" 'Guppy Screen'
info_line "$(check_file "$FLUIDD_LOGO_FILE")" 'Creality Dynamic Logos for Fluidd'
hr
inner_line
hr
bottom_menu_option 'b' 'Back to [Main Menu]' "${yellow}"
bottom_menu_option 'q' 'Exit' "${darkred}"
hr
version_line "$(get_script_version)"
bottom_line
}
function info_menu() {
clear
info_menu_ui
local info_menu_opt
while true; do
read -p " ${white}Type your choice and validate with Enter: ${yellow}" info_menu_opt
case "${info_menu_opt}" in
B|b)
clear; main_menu; break;;
Q|q)
clear; exit 0;;
*)
error_msg "Please select a correct choice!";;
esac
done
info_menu
}

228
scripts/menu/install_menu.sh Executable file
View file

@ -0,0 +1,228 @@
#!/bin/sh
set -e
function install_menu_ui() {
top_line
title '[ INSTALL MENU ]' "${yellow}"
inner_line
hr
subtitle '•ESSENTIALS:'
menu_option ' 1' 'Install' 'Moonraker and Nginx'
menu_option ' 2' 'Install' 'Fluidd (port 4408)'
menu_option ' 3' 'Install' 'Mainsail (port 4409)'
hr
subtitle '•UTILITIES:'
menu_option ' 4' 'Install' 'Entware'
menu_option ' 5' 'Install' 'Klipper Gcode Shell Command'
hr
subtitle '•IMPROVEMENTS:'
menu_option ' 6' 'Install' 'Klipper Adaptive Meshing & Purging'
menu_option ' 7' 'Install' 'Buzzer Support'
menu_option ' 8' 'Install' 'Nozzle Cleaning Fan Control'
menu_option ' 9' 'Install' 'Fans Control Macros'
menu_option '10' 'Install' 'Improved Shapers Calibrations'
menu_option '11' 'Install' 'Useful Macros'
menu_option '12' 'Install' 'Save Z-Offset Macros'
menu_option '13' 'Install' 'Screws Tilt Adjust Support'
menu_option '14' 'Install' 'Virtual Pins Support'
menu_option '15' 'Install' 'M600 Support'
menu_option '16' 'Install' 'Git Backup'
hr
subtitle '•CAMERA:'
menu_option '17' 'Install' 'Moonraker Timelapse'
menu_option '18' 'Install' 'Camera Settings Control'
hr
subtitle '•REMOTE ACCESS AND AI DETECTION:'
menu_option '19' 'Install' 'OctoEverywhere'
menu_option '20' 'Install' 'Moonraker Obico'
menu_option '21' 'Install' 'Mobileraker Companion'
hr
inner_line
hr
bottom_menu_option 'b' 'Back to [Main Menu]' "${yellow}"
bottom_menu_option 'q' 'Exit' "${darkred}"
hr
version_line "$(get_script_version)"
bottom_line
}
function install_menu() {
clear
install_menu_ui
local install_menu_opt
while true; do
read -p " ${white}Type your choice and validate with Enter: ${yellow}" install_menu_opt
case "${install_menu_opt}" in
1)
if [ -d "$MOONRAKER_FOLDER" ]; then
error_msg "Moonraker and Nginx are already installed!"
else
run "install_moonraker_nginx" "install_menu_ui"
fi;;
2)
if [ -d "$FLUIDD_FOLDER" ]; then
error_msg "Fluidd is already installed!"
elif [ ! -d "$MOONRAKER_FOLDER" ] && [ ! -d "$NGINX_FOLDER" ]; then
error_msg "Moonraker and Nginx are needed, please install them first!"
else
run "install_fluidd" "install_menu_ui"
fi;;
3)
if [ -d "$MAINSAIL_FOLDER" ]; then
error_msg "Mainsail is already installed!"
elif [ ! -d "$MOONRAKER_FOLDER" ] && [ ! -d "$NGINX_FOLDER" ]; then
error_msg "Moonraker and Nginx are needed, please install them first!"
else
run "install_mainsail" "install_menu_ui"
fi;;
4)
if [ -f "$ENTWARE_FILE" ]; then
error_msg "Entware is already installed!"
else
run "install_entware" "install_menu_ui"
fi;;
5)
if [ -f "$KLIPPER_SHELL_FILE" ]; then
error_msg "Klipper Gcode Shell Command is already installed!"
else
run "install_gcode_shell_command" "install_menu_ui"
fi;;
6)
if [ -d "$KAMP_FOLDER" ]; then
error_msg "Klipper Adaptive Meshing & Purging is already installed!"
elif [ ! -f "$VIRTUAL_PINS_FILE" ]; then
error_msg "Virtual Pins Support is needed, please install it first!"
else
run "install_kamp" "install_menu_ui"
fi;;
7)
if [ -f "$BUZZER_FILE" ]; then
error_msg "Buzzer Support is already installed!"
elif [ ! -f "$KLIPPER_SHELL_FILE" ]; then
error_msg "Klipper Gcode Shell Command is needed, please install it first!"
else
run "install_buzzer_support" "install_menu_ui"
fi;;
8)
if [ -d "$NOZZLE_CLEANING_FOLDER" ]; then
error_msg "Nozzle Cleaning Fan Control is already installed!"
else
run "install_nozzle_cleaning_fan_control" "install_menu_ui"
fi;;
9)
if [ -f "$FAN_CONTROLS_FILE" ]; then
error_msg "Fans Control Macros are already installed!"
else
run "install_fans_control_macros" "install_menu_ui"
fi;;
10)
if [ -d "$IMP_SHAPERS_FOLDER" ]; then
error_msg "Improved Shapers Calibrations are already installed!"
elif [ -d "$GUPPY_SCREEN_FOLDER" ]; then
error_msg "Guppy Screen already has these features!"
elif [ ! -f "$KLIPPER_SHELL_FILE" ]; then
error_msg "Klipper Gcode Shell Command is needed, please install it first!"
else
run "install_improved_shapers" "install_menu_ui"
fi;;
11)
if [ -f "$USEFUL_MACROS_FILE" ]; then
error_msg "Useful Macros are already installed!"
elif [ ! -f "$KLIPPER_SHELL_FILE" ]; then
error_msg "Klipper Gcode Shell Command is needed, please install it first!"
else
run "install_useful_macros" "install_menu_ui"
fi;;
12)
if [ -f "$SAVE_ZOFFSET_FILE" ]; then
error_msg "Save Z-Offset Macros are already installed!"
else
run "install_save_zoffset_macros" "install_menu_ui"
fi;;
13)
if [ -f "$SCREWS_ADJUST_FILE" ]; then
error_msg "Screws Tilt Adjust Support is already installed!"
else
run "install_screws_tilt_adjust" "install_menu_ui"
fi;;
14)
if [ -f "$VIRTUAL_PINS_FILE" ]; then
error_msg "Virtual Pins Support is already installed!"
else
run "install_virtual_pins" "install_menu_ui"
fi;;
15)
if [ -f "$M600_SUPPORT_FILE" ]; then
error_msg "M600 Support is already installed!"
else
run "install_m600_support" "install_menu_ui"
fi;;
16)
if [ -f "$GIT_BACKUP_FILE" ]; then
error_msg "Git Backup is already installed!"
elif [ ! -f "$ENTWARE_FILE" ]; then
error_msg "Entware is needed, please install it first!"
elif [ ! -f "$KLIPPER_SHELL_FILE" ]; then
error_msg "Klipper Gcode Shell Command is needed, please install it first!"
else
run "install_git_backup" "install_menu_ui"
fi;;
17)
if [ -f "$TIMELAPSE_FILE" ]; then
error_msg "Moonraker Timelapse is already installed!"
elif [ ! -f "$ENTWARE_FILE" ]; then
error_msg "Entware is needed, please install it first!"
else
run "install_moonraker_timelapse" "install_menu_ui"
fi;;
18)
if [ -f "$CAMERA_SETTINGS_FILE" ]; then
error_msg "Camera Settings Control is already installed!"
elif v4l2-ctl --list-devices | grep -q 'CCX2F3299'; then
error_msg "You have the new hardware version of the camera and it's not compatible!"
elif [ ! -f "$KLIPPER_SHELL_FILE" ]; then
error_msg "Klipper Gcode Shell Command is needed, please install it first!"
else
run "install_camera_settings_control" "install_menu_ui"
fi;;
19)
if [ -d "$OCTOEVERYWHERE_FOLDER" ]; then
error_msg "OctoEverywhere is already installed!"
elif [ ! -d "$MOONRAKER_FOLDER" ]; then
error_msg "Moonraker and Nginx are needed, please install them first!"
elif [ ! -d "$FLUIDD_FOLDER" ] && [ ! -d "$MAINSAIL_FOLDER" ]; then
error_msg "Fluidd or Mainsail is needed, please install it first!"
elif [ ! -f "$ENTWARE_FILE" ]; then
error_msg "Entware is needed, please install it first!"
else
run "install_octoeverywhere" "install_menu_ui"
fi;;
20)
if [ -d "$MOONRAKER_OBICO_FOLDER" ]; then
error_msg "Moonraker Obico is already installed!"
elif [ ! -d "$MOONRAKER_FOLDER" ]; then
error_msg "Moonraker and Nginx are needed, please install them first!"
elif [ ! -d "$FLUIDD_FOLDER" ] && [ ! -d "$MAINSAIL_FOLDER" ]; then
error_msg "Fluidd or Mainsail is needed, please install it first!"
elif [ ! -f "$ENTWARE_FILE" ]; then
error_msg "Entware is needed, please install it first!"
else
run "install_moonraker_obico" "install_menu_ui"
fi;;
21)
if [ -d "$MOBILERAKER_COMPANION_FOLDER" ]; then
error_msg "Mobileraker Companion is already installed!"
else
run "install_mobileraker_companion" "install_menu_ui"
fi;;
B|b)
clear; main_menu; break;;
Q|q)
clear; exit 0;;
*)
error_msg "Please select a correct choice!";;
esac
done
install_menu
}

121
scripts/menu/main_menu.sh Executable file
View file

@ -0,0 +1,121 @@
#!/bin/sh
set -e
if /usr/bin/get_sn_mac.sh model 2>&1 | grep -iq "K1"; then K1=1; else K1=0; fi
function get_script_version() {
local version
cd "${HELPER_SCRIPT_FOLDER}"
version="$(git describe HEAD --always --tags | sed 's/-.*//')"
echo "${cyan}${version}${white}"
}
function version_line() {
local content="$1"
local content_length="${#content}"
local width=$((73))
local padding_length=$((width - content_length - 3))
printf " │ %*s%s%s\n" $padding_length '' "$content" " │"
}
function script_title() {
local title
if [ $K1 -eq 0 ]; then
title="KE"
else
title="K1"
fi
echo "${title}"
}
function fw_version() {
local firmware
if [ $K1 -eq 0 ]; then
firmware="1.1.0.12"
else
firmware="1.3.3.5"
fi
echo "${firmware}"
}
function main_menu_ui() {
top_line
title "• HELPER SCRIPT FOR CREALITY $(script_title) SERIES •" "${blue}"
title "Copyright © Cyril Guislain (Guilouz)" "${white}"
inner_line
title "/!\\ ONLY USE IT WITH FIRMWARE $(fw_version) AND ABOVE /!\\" "${darkred}"
inner_line
hr
main_menu_option '1' '[Install]' 'Menu'
main_menu_option '2' '[Remove]' 'Menu'
main_menu_option '3' '[Customize]' 'Menu'
main_menu_option '4' '[Backup & Restore]' 'Menu'
main_menu_option '5' '[Tools]' 'Menu'
main_menu_option '6' '[Informations]' 'Menu'
main_menu_option '7' '[System]' 'Menu'
hr
inner_line
hr
bottom_menu_option 'q' 'Exit' "${darkred}"
hr
version_line "$(get_script_version)"
bottom_line
}
function main_menu() {
clear
main_menu_ui
local main_menu_opt
while true; do
read -p "${white} Type your choice and validate with Enter: ${yellow}" main_menu_opt
case "${main_menu_opt}" in
1) clear
if [ $K1 -eq 0 ]; then
install_menu_ke
else
install_menu
fi
break;;
2) clear
if [ $K1 -eq 0 ]; then
remove_menu_ke
else
remove_menu
fi
break;;
3) clear
if [ $K1 -eq 0 ]; then
customize_menu_ke
else
customize_menu
fi
break;;
4) clear
backup_restore_menu
break;;
5) clear
if [ $K1 -eq 0 ]; then
tools_menu_ke
else
tools_menu
fi
main_ui;;
6) clear
if [ $K1 -eq 0 ]; then
info_menu_ke
else
info_menu
fi
break;;
7) clear
system_menu
break;;
Q|q)
clear; exit 0;;
*)
error_msg "Please select a correct choice!";;
esac
done
main_menu
}

220
scripts/menu/remove_menu.sh Executable file
View file

@ -0,0 +1,220 @@
#!/bin/sh
set -e
function remove_menu_ui() {
top_line
title '[ REMOVE MENU ]' "${yellow}"
inner_line
hr
subtitle '•ESSENTIALS:'
menu_option ' 1' 'Remove' 'Moonraker and Nginx'
menu_option ' 2' 'Remove' 'Fluidd (port 4408)'
menu_option ' 3' 'Remove' 'Mainsail (port 4409)'
hr
subtitle '•UTILITIES:'
menu_option ' 4' 'Remove' 'Entware'
menu_option ' 5' 'Remove' 'Klipper Gcode Shell Command'
hr
subtitle '•IMPROVEMENTS:'
menu_option ' 6' 'Remove' 'Klipper Adaptive Meshing & Purging'
menu_option ' 7' 'Remove' 'Buzzer Support'
menu_option ' 8' 'Remove' 'Nozzle Cleaning Fan Control'
menu_option ' 9' 'Remove' 'Fans Control Macros'
menu_option '10' 'Remove' 'Improved Shapers Calibrations'
menu_option '11' 'Remove' 'Useful Macros'
menu_option '12' 'Remove' 'Save Z-Offset Macros'
menu_option '13' 'Remove' 'Screws Tilt Adjust Support'
menu_option '14' 'Remove' 'Virtual Pins Support'
menu_option '15' 'Remove' 'M600 Support'
menu_option '16' 'Remove' 'Git Backup'
hr
subtitle '•CAMERA:'
menu_option '17' 'Remove' 'Moonraker Timelapse'
menu_option '18' 'Remove' 'Camera Settings Control'
hr
subtitle '•REMOTE ACCESS AND AI DETECTION:'
menu_option '19' 'Remove' 'OctoEverywhere'
menu_option '20' 'Remove' 'Moonraker Obico'
menu_option '21' 'Remove' 'Mobileraker Companion'
hr
inner_line
hr
bottom_menu_option 'b' 'Back to [Main Menu]' "${yellow}"
bottom_menu_option 'q' 'Exit' "${darkred}"
hr
version_line "$(get_script_version)"
bottom_line
}
function remove_menu() {
clear
remove_menu_ui
local remove_menu_opt
while true; do
read -p " ${white}Type your choice and validate with Enter: ${yellow}" remove_menu_opt
case "${remove_menu_opt}" in
1)
if [ ! -d "$MOONRAKER_FOLDER" ] && [ ! -d "$NGINX_FOLDER" ]; then
error_msg "Moonraker and Nginx are not installed!"
else
run "remove_moonraker_nginx" "remove_menu_ui"
fi;;
2)
if [ ! -d "$FLUIDD_FOLDER" ]; then
error_msg "Fluidd is not installed!"
elif [ ! -f "$CREALITY_WEB_FILE" ]; then
error_msg "Creality Web Interface is removed!"
echo -e " ${darkred}Please restore Creality Web Interface first if you want to remove Fluidd.${white}"
echo
else
run "remove_fluidd" "remove_menu_ui"
fi;;
3)
if [ ! -d "$MAINSAIL_FOLDER" ]; then
error_msg "Mainsail is not installed!"
elif [ ! -f "$CREALITY_WEB_FILE" ]; then
error_msg "Creality Web Interface is removed!"
echo -e " ${darkred}Please restore Creality Web Interface first if you want to remove Mainsail.${white}"
echo
else
run "remove_mainsail" "remove_menu_ui"
fi;;
4)
if [ ! -f "$ENTWARE_FILE" ]; then
error_msg "Entware is not installed!"
elif [ -f "$TIMELAPSE_FILE" ]; then
error_msg "Entware is needed to use Moonraker Timelapse, please uninstall it first!"
elif [ -f "$GIT_BACKUP_FILE" ]; then
error_msg "Entware is needed to use Git Backup, please uninstall it first!"
elif [ -d "$OCTOEVERYWHERE_FOLDER" ]; then
error_msg "Entware is needed to use OctoEverywhere, please uninstall it first!"
elif [ -d "$MOONRAKER_OBICO_FOLDER" ]; then
error_msg "Entware is needed to use Moonraker Obico, please uninstall it first!"
else
run "remove_entware" "remove_menu_ui"
fi;;
5)
if [ ! -f "$KLIPPER_SHELL_FILE" ]; then
error_msg "Klipper Gcode Shell Command is not installed!"
elif [ -f "$BUZZER_FILE" ]; then
error_msg "Klipper Gcode Shell Command is needed to use Buzzer Support, please uninstall it first!"
elif [ -f "$CAMERA_SETTINGS_FILE" ]; then
error_msg "Klipper Gcode Shell Command is needed to use Camera Settings Control, please uninstall it first!"
elif [ -d "$GUPPY_SCREEN_FOLDER" ]; then
error_msg "Klipper Gcode Shell Command is needed to use Guppy Screen, please uninstall it first!"
elif [ -d "$IMP_SHAPERS_FOLDER" ]; then
error_msg "Klipper Gcode Shell Command is needed to use Improved Shapers Calibrations, please uninstall it first!"
elif [ -d "$GIT_BACKUP_FOLDER" ]; then
error_msg "Klipper Gcode Shell Command is needed to use Git Backup, please uninstall it first!"
elif [ -f "$USEFUL_MACROS_FILE" ]; then
error_msg "Klipper Gcode Shell Command is needed to use Useful Macros, please uninstall it first!"
else
run "remove_gcode_shell_command" "remove_menu_ui"
fi;;
6)
if [ ! -d "$KAMP_FOLDER" ]; then
error_msg "Klipper Adaptive Meshing & Purging is not installed!"
else
run "remove_kamp" "remove_menu_ui"
fi;;
7)
if [ ! -f "$BUZZER_FILE" ]; then
error_msg "Buzzer Support is not installed!"
else
run "remove_buzzer_support" "remove_menu_ui"
fi;;
8)
if [ ! -d "$NOZZLE_CLEANING_FOLDER" ]; then
error_msg "Nozzle Cleaning Fan Control is not installed!"
else
run "remove_nozzle_cleaning_fan_control" "remove_menu_ui"
fi;;
9)
if [ ! -f "$FAN_CONTROLS_FILE" ]; then
error_msg "Fans Control Macros are not installed!"
else
run "remove_fans_control_macros" "remove_menu_ui"
fi;;
10)
if [ ! -d "$IMP_SHAPERS_FOLDER" ]; then
error_msg "Improved Shapers Calibrations are not installed!"
else
run "remove_improved_shapers" "remove_menu_ui"
fi;;
11)
if [ ! -f "$USEFUL_MACROS_FILE" ]; then
error_msg "Useful Macros are not installed!"
else
run "remove_useful_macros" "remove_menu_ui"
fi;;
12)
if [ ! -f "$SAVE_ZOFFSET_FILE" ]; then
error_msg "Save Z-Offset Macros are not installed!"
else
run "remove_save_zoffset_macros" "remove_menu_ui"
fi;;
13)
if [ ! -f "$SCREWS_ADJUST_FILE" ]; then
error_msg "Screws Tilt Adjust Support is not installed!"
else
run "remove_screws_tilt_adjust" "remove_menu_ui"
fi;;
14)
if [ ! -f "$VIRTUAL_PINS_FILE" ]; then
error_msg "Virtual Pins Support is not installed!"
else
run "remove_virtual_pins" "remove_menu_ui"
fi;;
15)
if [ ! -f "$M600_SUPPORT_FILE" ]; then
error_msg "M600 Support is not installed!"
else
run "remove_m600_support" "remove_menu_ui"
fi;;
16)
if [ ! -f "$GIT_BACKUP_FILE" ]; then
error_msg "Git Backup is not installed!"
else
run "remove_git_backup" "remove_menu_ui"
fi;;
17)
if [ ! -f "$TIMELAPSE_FILE" ]; then
error_msg "Moonraker Timelapse is not installed!"
else
run "remove_moonraker_timelapse" "remove_menu_ui"
fi;;
18)
if [ ! -f "$CAMERA_SETTINGS_FILE" ]; then
error_msg "Camera Settings Control is not installed!"
else
run "remove_camera_settings_control" "remove_menu_ui"
fi;;
19)
if [ ! -d "$OCTOEVERYWHERE_FOLDER" ]; then
error_msg "OctoEverywhere is not installed!"
else
run "remove_octoeverywhere" "remove_menu_ui"
fi;;
20)
if [ ! -d "$MOONRAKER_OBICO_FOLDER" ]; then
error_msg "Moonraker Obico is not installed!"
else
run "remove_moonraker_obico" "remove_menu_ui"
fi;;
21)
if [ ! -d "$MOBILERAKER_COMPANION_FOLDER" ]; then
error_msg "Mobileraker Companion is not installed!"
else
run "remove_mobileraker_companion" "remove_menu_ui"
fi;;
B|b)
clear; main_menu; break;;
Q|q)
clear; exit 0;;
*)
error_msg "Please select a correct choice!";;
esac
done
remove_menu
}

80
scripts/menu/system_menu.sh Executable file
View file

@ -0,0 +1,80 @@
#!/bin/sh
set -e
function check_fw_version() {
file="/usr/data/creality/userdata/config/system_version.json"
if [ -e "$file" ]; then
cat "$file" | jq -r '.sys_version'
else
echo -e "N/A"
fi
}
function check_connection() {
eth0_ip=$(ip -4 addr show eth0 2>/dev/null | grep -o -E '(inet\s)([0-9]+\.){3}[0-9]+' | cut -d ' ' -f 2 | head -n 1)
wlan0_ip=$(ip -4 addr show wlan0 | grep -o -E '(inet\s)([0-9]+\.){3}[0-9]+' | cut -d ' ' -f 2 | head -n 1)
if [ -n "$eth0_ip" ]; then
echo -e "$eth0_ip (ETHERNET)"
elif [ -n "$wlan0_ip" ]; then
echo -e "$wlan0_ip (WLAN)"
else
echo -e "xxx.xxx.xxx.xxx"
fi
}
function system_menu_ui() {
memfree=`cat /proc/meminfo | grep MemFree | awk {'print $2'}`
memtotal=`cat /proc/meminfo | grep MemTotal | awk {'print $2'}`
pourcent=$((($memfree * 100)/$memtotal))
diskused=`df -h | grep /dev/mmcblk0p10 | awk {'print $3 " / " $2 " (" $4 " available)" '}`
process=`ps ax | wc -l | tr -d " "`
uptime=`cat /proc/uptime | cut -f1 -d.`
upDays=$((uptime/60/60/24))
upHours=$((uptime/60/60%24))
upMins=$((uptime/60%60))
load=`cat /proc/loadavg | awk {'print $1 " (1 min.) / " $2 " (5 min.) / " $3 " (15 min.)"'}`
device_sn=$(cat /usr/data/creality/userdata/config/system_config.json | grep -o '"device_sn":"[^"]*' | awk -F '"' '{print $4}')
mac_address=$(cat /usr/data/creality/userdata/config/system_config.json | grep -o '"device_mac":"[^"]*' | awk -F '"' '{print $4}' | sed 's/../&:/g; s/:$//')
top_line
title '[ SYSTEM MENU ]' "${yellow}"
inner_line
hr
system_line " System" "$(uname -s) (Kernel $(uname -r))" "${green}"
system_line " Firmware" "$(check_fw_version)"
system_line " Hostname" "$(uname -n)"
system_line " Device SN" "$device_sn"
system_line " IP Address" "$(check_connection)"
system_line "MAC Address" "$mac_address"
system_line " RAM Usage" "$(($memfree/1024)) MB / $(($memtotal/1024)) MB ($pourcent% available)"
system_line " Disk Usage" "$diskused"
system_line " Uptime" "$upDays days $upHours hours $upMins minutes"
system_line " Processes" "$process running process"
system_line "System Load" "$load"
hr
inner_line
hr
bottom_menu_option 'b' 'Back to [Main Menu]' "${yellow}"
bottom_menu_option 'q' 'Exit' "${darkred}"
hr
version_line "$(get_script_version)"
bottom_line
}
function system_menu() {
clear
system_menu_ui
local system_menu_opt
while true; do
read -p " ${white}Type your choice and validate with Enter: ${yellow}" system_menu_opt
case "${system_menu_opt}" in
B|b)
clear; main_menu; break;;
Q|q)
clear; exit 0;;
*)
error_msg "Please select a correct choice!";;
esac
done
system_menu
}

100
scripts/menu/tools_menu.sh Executable file
View file

@ -0,0 +1,100 @@
#!/bin/sh
set -e
function tools_menu_ui() {
top_line
title '[ TOOLS MENU ]' "${yellow}"
inner_line
hr
menu_option ' 1' 'Prevent updating' 'Klipper configuration files'
menu_option ' 2' 'Allow updating' 'Klipper configuration files'
menu_option ' 3' 'Fix' 'printing Gcode files from folder'
hr
menu_option ' 4' 'Restart' 'Nginx service'
menu_option ' 5' 'Restart' 'Moonraker service'
menu_option ' 6' 'Restart' 'Klipper service'
hr
menu_option ' 7' 'Update' 'Entware packages'
hr
menu_option ' 8' 'Clear' 'cache'
menu_option ' 9' 'Clear' 'logs files'
hr
menu_option '10' 'Restore' 'a previous firmware'
hr
menu_option '11' 'Reset' 'factory settings'
hr
inner_line
hr
bottom_menu_option 'b' 'Back to [Main Menu]' "${yellow}"
bottom_menu_option 'q' 'Exit' "${darkred}"
hr
version_line "$(get_script_version)"
bottom_line
}
function tools_menu() {
clear
tools_menu_ui
local tools_menu_opt
while true; do
read -p " ${white}Type your choice and validate with Enter: ${yellow}" tools_menu_opt
case "${tools_menu_opt}" in
1)
if [ -f "$INITD_FOLDER"/disabled.S55klipper_service ]; then
error_msg "Updating Klipper configuration files is already prevented!"
else
run "prevent_updating_klipper_files" "tools_menu_ui"
fi;;
2)
if [ ! -f "$INITD_FOLDER"/disabled.S55klipper_service ]; then
error_msg "Updating Klipper configuration files is already allowed!"
else
run "allow_updating_klipper_files" "tools_menu_ui"
fi;;
3)
if [ -f "$KLIPPER_KLIPPY_FOLDER"/gcode.py ]; then
run "printing_gcode_from_folder" "tools_menu_ui"
fi;;
4)
if [ ! -d "$NGINX_FOLDER" ]; then
error_msg "Nginx is not installed!"
else
run "restart_nginx_action" "tools_menu_ui"
fi;;
5)
if [ ! -d "$MOONRAKER_FOLDER" ]; then
error_msg "Moonraker is not installed!"
else
run "restart_moonraker_action" "tools_menu_ui"
fi;;
6)
if [ ! -f "$INITD_FOLDER"/S55klipper_service ]; then
error_msg "Klipper service is not present!"
else
run "restart_klipper_action" "tools_menu_ui"
fi;;
7)
if [ ! -f "$ENTWARE_FILE" ]; then
error_msg "Entware is not installed!"
else
run "update_entware_packages" "tools_menu_ui"
fi;;
8)
run "clear_cache" "tools_menu_ui";;
9)
run "clear_logs" "tools_menu_ui";;
10)
run "restore_previous_firmware" "tools_menu_ui";;
11)
run "reset_factory_settings" "tools_menu_ui";;
B|b)
clear; main_menu; break;;
Q|q)
clear; exit 0;;
*)
error_msg "Please select a correct choice!";;
esac
done
tools_menu
}