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,77 @@
#!/bin/sh
set -e
function backup_klipper_config_files_message(){
top_line
title 'Backup Klipper configuration files' "${yellow}"
inner_line
hr
echo -e "${cyan}This allows to backup Klipper configuration files in a ${white}"
echo -e "${cyan}backup_config.tar.gz compressed file. ${white}"
hr
bottom_line
}
function restore_klipper_config_files_message(){
top_line
title 'Restore Klipper configuration files' "${yellow}"
inner_line
hr
echo -e "${cyan}This allows to restore Klipper configuration files from a ${white}"
echo -e "${cyan}backup_config.tar.gz compressed file. ${white}"
hr
bottom_line
}
function backup_klipper_config_files(){
backup_klipper_config_files_message
local yn
while true; do
backup_msg "Klipper configuration files" yn
case "${yn}" in
Y|y)
echo -e "${white}"
if [ -f "$KLIPPER_CONFIG_FOLDER"/backup_config.tar.gz ]; then
rm -f "$KLIPPER_CONFIG_FOLDER"/backup_config.tar.gz
fi
cd "$PRINTER_DATA_FOLDER"
echo -e "Info: Compressing files..."
tar -czvf "$KLIPPER_CONFIG_FOLDER"/backup_config.tar.gz config
ok_msg "Klipper configuration files have been saved successfully in ${yellow}/usr/data/printer_data/config ${green}folder!"
return;;
N|n)
error_msg "Backup canceled!"
return;;
*)
error_msg "Please select a correct choice!";;
esac
done
}
function restore_klipper_config_files(){
restore_klipper_config_files_message
local yn
while true; do
restore_msg "Klipper configuration files" yn
case "${yn}" in
Y|y)
echo -e "${white}"
cd "$PRINTER_DATA_FOLDER"
mv config/backup_config.tar.gz backup_config.tar.gz
if [ -d config ]; then
rm -rf config
fi
echo -e "Info: Restoring files..."
tar -xvf backup_config.tar.gz
mv backup_config.tar.gz config/backup_config.tar.gz
ok_msg "Klipper configuration files have been restored successfully!"
return;;
N|n)
error_msg "Restoration canceled!"
return;;
*)
error_msg "Please select a correct choice!";;
esac
done
}

View file

@ -0,0 +1,77 @@
#!/bin/sh
set -e
function backup_moonraker_database_message(){
top_line
title 'Backup Moonraker database' "${yellow}"
inner_line
hr
echo -e "${cyan}This allows to backup Moonraker database in a ${white}"
echo -e "${cyan}backup_database.tar.gz compressed file. ${white}"
hr
bottom_line
}
function restore_moonraker_database_message(){
top_line
title 'Restore Moonraker database' "${yellow}"
inner_line
hr
echo -e "${cyan}This allows to restore Moonraker database from a ${white}"
echo -e "${cyan}backup_database.tar.gz compressed file. ${white}"
hr
bottom_line
}
function backup_moonraker_database(){
backup_moonraker_database_message
local yn
while true; do
backup_msg "Moonraker database" yn
case "${yn}" in
Y|y)
echo -e "${white}"
if [ -f "$KLIPPER_CONFIG_FOLDER"/backup_database.tar.gz ]; then
rm -f "$KLIPPER_CONFIG_FOLDER"/backup_database.tar.gz
fi
cd "$PRINTER_DATA_FOLDER"
echo -e "Info: Compressing files..."
tar -czvf "$KLIPPER_CONFIG_FOLDER"/backup_database.tar.gz database
ok_msg "Moonraker database has been saved successfully in ${yellow}/usr/data/printer_data/config ${green}folder!"
return;;
N|n)
error_msg "Backup canceled!"
return;;
*)
error_msg "Please select a correct choice!";;
esac
done
}
function restore_moonraker_database(){
restore_moonraker_database_message
local yn
while true; do
restore_msg "Moonraker database" yn
case "${yn}" in
Y|y)
echo -e "${white}"
cd "$PRINTER_DATA_FOLDER"
mv config/backup_database.tar.gz backup_database.tar.gz
if [ -d database ]; then
rm -rf database
fi
echo -e "Info: Restoring files..."
tar -xvf backup_database.tar.gz
mv backup_database.tar.gz config/backup_database.tar.gz
ok_msg "Moonraker database has been restored successfully!"
return;;
N|n)
error_msg "Restoration canceled!"
return;;
*)
error_msg "Please select a correct choice!";;
esac
done
}

81
scripts/buzzer_support.sh Executable file
View file

@ -0,0 +1,81 @@
#!/bin/sh
set -e
function buzzer_support_message(){
top_line
title 'Buzzer Support' "${yellow}"
inner_line
hr
echo -e "${cyan}It allows to play sounds using the motherboard buzzer. ${white}"
hr
bottom_line
}
function install_buzzer_support(){
buzzer_support_message
local yn
while true; do
install_msg "Buzzer Support" yn
case "${yn}" in
Y|y)
echo -e "${white}"
if [ -f "$HS_CONFIG_FOLDER"/buzzer-support.cfg ]; then
rm -f "$HS_CONFIG_FOLDER"/buzzer-support.cfg
fi
if [ ! -d "$HS_CONFIG_FOLDER" ]; then
mkdir -p "$HS_CONFIG_FOLDER"
fi
echo -e "Info: Linking file..."
ln -sf "$BUZZER_URL" "$HS_CONFIG_FOLDER"/buzzer-support.cfg
if grep -q "include Helper-Script/buzzer-support" "$PRINTER_CFG" ; then
echo -e "Info: Buzzer Support configurations are already enabled in printer.cfg file..."
else
echo -e "Info: Adding Buzzer Support configurations in printer.cfg file..."
sed -i '/\[include printer_params\.cfg\]/a \[include Helper-Script/buzzer-support\.cfg\]' "$PRINTER_CFG"
fi
echo -e "Info: Restarting Klipper service..."
restart_klipper
ok_msg "Buzzer Support has been installed successfully!"
echo -e " You can now use ${yellow}BEEP ${white}command in your macros to play sound."
return;;
N|n)
error_msg "Installation canceled!"
return;;
*)
error_msg "Please select a correct choice!";;
esac
done
}
function remove_buzzer_support(){
buzzer_support_message
local yn
while true; do
remove_msg "Buzzer Support" yn
case "${yn}" in
Y|y)
echo -e "${white}"
echo -e "Info: Removing file..."
rm -f "$HS_CONFIG_FOLDER"/buzzer-support.cfg
if grep -q "include Helper-Script/buzzer-support" "$PRINTER_CFG" ; then
echo -e "Info: Removing Buzzer Support configurations in printer.cfg file..."
sed -i '/include Helper-Script\/buzzer-support\.cfg/d' "$PRINTER_CFG"
else
echo -e "Info: Buzzer Support configurations are already removed in printer.cfg file..."
fi
if [ ! -n "$(ls -A "$HS_CONFIG_FOLDER")" ]; then
rm -rf "$HS_CONFIG_FOLDER"
fi
echo -e "Info: Restarting Klipper service..."
restart_klipper
ok_msg "Buzzer Support has been removed successfully!"
return;;
N|n)
error_msg "Deletion canceled!"
return;;
*)
error_msg "Please select a correct choice!";;
esac
done
}

View file

@ -0,0 +1,81 @@
#!/bin/sh
set -e
function camera_settings_control_message(){
top_line
title 'Camera Settings Control' "${yellow}"
inner_line
hr
echo -e "${cyan}It allows to install needed macros to adjust camera ${white}"
echo -e "${cyan}settings like brightness, saturation, contrast, etc... ${white}"
hr
bottom_line
}
function install_camera_settings_control(){
camera_settings_control_message
local yn
while true; do
install_msg "Camera Settings Control" yn
case "${yn}" in
Y|y)
echo -e "${white}"
if [ -f "$HS_CONFIG_FOLDER"/camera-settings.cfg ]; then
rm -f "$HS_CONFIG_FOLDER"/camera-settings.cfg
fi
if [ ! -d "$HS_CONFIG_FOLDER" ]; then
mkdir -p "$HS_CONFIG_FOLDER"
fi
echo -e "Info: Linking file..."
cp "$CAMERA_SETTINGS_URL" "$HS_CONFIG_FOLDER"/camera-settings.cfg
if grep -q "include Helper-Script/camera-settings" "$PRINTER_CFG" ; then
echo -e "Info: Camera Settings configurations are already enabled in printer.cfg file..."
else
echo -e "Info: Adding Camera Settings configurations in printer.cfg file..."
sed -i '/\[include printer_params\.cfg\]/a \[include Helper-Script/camera-settings\.cfg\]' "$PRINTER_CFG"
fi
echo -e "Info: Restarting Klipper service..."
restart_klipper
ok_msg "Camera Settings Control has been installed successfully!"
return;;
N|n)
error_msg "Installation canceled!"
return;;
*)
error_msg "Please select a correct choice!";;
esac
done
}
function remove_camera_settings_control(){
camera_settings_control_message
local yn
while true; do
remove_msg "Camera Settings Control" yn
case "${yn}" in
Y|y)
echo -e "${white}"
echo -e "Info: Removing file..."
"$HS_CONFIG_FOLDER"/camera-settings.cfg
if grep -q "include Helper-Script/camera-settings" "$PRINTER_CFG" ; then
echo -e "Info: Removing Camera Settings configurations in printer.cfg file..."
sed -i '/include Helper-Script\/camera-settings\.cfg/d' "$PRINTER_CFG"
else
echo -e "Info: Camera Settings configurations are already removed in printer.cfg file..."
fi
if [ ! -n "$(ls -A "$HS_CONFIG_FOLDER")" ]; then
rm -rf "$HS_CONFIG_FOLDER"
fi
echo -e "Info: Restarting Klipper service..."
restart_klipper
ok_msg "Camera Settings Control has been removed successfully!"
return;;
N|n)
error_msg "Deletion canceled!"
return;;
*)
error_msg "Please select a correct choice!";;
esac
done
}

View file

@ -0,0 +1,39 @@
#!/bin/sh
set -e
function creality_dynamic_logos_message(){
top_line
title 'Creality Dynamic Logos for Fluidd' "${yellow}"
inner_line
hr
echo -e "${cyan}This allows to have the dynamic Creality logos on the Fluidd ${white}"
echo -e "${cyan}Web interface. ${white}"
hr
bottom_line
}
function install_creality_dynamic_logos(){
creality_dynamic_logos_message
local yn
while true; do
install_msg "Creality Dynamic Logos for Fluidd" yn
case "${yn}" in
Y|y)
echo -e "${white}"
echo -e "Info: Copying files..."
cp "$FLUIDD_LOGO_URL1" "$FLUIDD_FOLDER"/logo_creality_v1.svg
cp "$FLUIDD_LOGO_URL2" "$FLUIDD_FOLDER"/logo_creality_v2.svg
rm -f "$FLUIDD_FOLDER"/config.json
cp "$FLUIDD_LOGO_URL3" "$FLUIDD_FOLDER"/config.json
ok_msg "Creality Dynamic Logos for Fluidd have been installed successfully!"
echo -e " You can now select ${yellow}Creality V1 ${white}or ${yellow}Creality V2 ${white}theme in Fluidd settings."
return;;
N|n)
error_msg "Installation canceled!"
return;;
*)
error_msg "Please select a correct choice!";;
esac
done
}

138
scripts/creality_web_interface.sh Executable file
View file

@ -0,0 +1,138 @@
#!/bin/sh
set -e
function remove_creality_web_interface_message(){
top_line
title 'Remove Creality Web Interface' "${yellow}"
inner_line
hr
echo -e "${cyan}This allows to remove Creality Web Interface and replace ${white}"
echo -e "${cyan}it with Fluidd or Mainsail on port 80. ${white}"
hr
bottom_line
}
function restore_creality_web_interface_message(){
top_line
title 'Restore Creality Web Interface' "${yellow}"
inner_line
hr
echo -e "${cyan}This allows to restore Creality Web Interface on port 80. ${white}"
hr
bottom_line
}
function remove_creality_web_interface(){
remove_creality_web_interface_message
local yn
while true; do
remove_msg "Creality Web Interface" yn
case "${yn}" in
Y|y)
echo -e "${white}"
echo -e "Info: Disabling files..."
if [ -f /usr/bin/web-server ]; then
mv /usr/bin/web-server /usr/bin/web-server.disabled
fi
if [ -f /usr/bin/Monitor ]; then
mv /usr/bin/Monitor /usr/bin/Monitor.disabled
fi
echo -e "Info: Stopping services..."
set +e
killall -q Monitor
killall -q web-server
set -e
echo
if [ -d "$FLUIDD_FOLDER" ] && [ ! -d "$MAINSAIL_FOLDER" ]; then
echo -e "Info: Applying changes..."
sed -i '/listen 4408 default_server;/a \ listen 80;' /usr/data/nginx/nginx/nginx.conf
echo -e "Info: Restarting Nginx service..."
restart_nginx
ok_msg "Creality Web Interface has been removed successfully!"
echo -e " ${white}You can now connect to Fluidd Web Interface with ${yellow}http://$(check_ipaddress)${white}"
elif [ ! -d "$FLUIDD_FOLDER" ] && [ -d "$FLUIDD_FOLDER" ]; then
echo -e "Info: Applying changes..."
sed -i '/listen 4409 default_server;/a \ listen 80;' /usr/data/nginx/nginx/nginx.conf
echo -e "Info: Restarting Nginx service..."
restart_nginx
ok_msg "Creality Web Interface has been removed successfully!"
echo -e " ${white}You can now connect to Mainsail Web Interface with ${yellow}http://$(check_ipaddress)${white}"
elif [ -d "$FLUIDD_FOLDER" ] && [ -d "$FLUIDD_FOLDER" ]; then
local interface_choice
while true; do
read -p " ${white}Which Web Interface do you want to set as default (on port 80)? (${yellow}fluidd${white}/${yellow}mainsail${white}): ${yellow}" interface_choice
case "${interface_choice}" in
FLUIDD|fluidd)
echo -e "${white}"
echo -e "Info: Applying changes..."
sed -i '/listen 4408 default_server;/a \ listen 80;' /usr/data/nginx/nginx/nginx.conf
echo -e "Info: Restarting Nginx service..."
restart_nginx
ok_msg "Creality Web Interface has been removed successfully!"
echo -e " You can now connect to Fluidd Web Interface with ${yellow}http://$(check_ipaddress) ${white}or ${yellow}http://$(check_ipaddress):4408${white}"
break;;
MAINSAIL|mainsail)
echo -e "${white}"
echo -e "Info: Applying changes..."
sed -i '/listen 4409 default_server;/a \ listen 80;' /usr/data/nginx/nginx/nginx.conf
echo -e "Info: Restarting Nginx service..."
restart_nginx
ok_msg "Creality Web Interface has been removed successfully!"
echo -e " You can now connect to Mainsail Web Interface with ${yellow}http://$(check_ipaddress) ${white}or ${yellow}http://$(check_ipaddress):4409${white}"
break;;
*)
error_msg "Please select a correct choice!";;
esac
done
fi
return;;
N|n)
error_msg "Deletion canceled!"
return;;
*)
error_msg "Please select a correct choice!";;
esac
done
}
function restore_creality_web_interface(){
restore_creality_web_interface_message
local yn
while true; do
restore_msg "Creality Web Interface" yn
case "${yn}" in
Y|y)
echo -e "${white}"
echo -e "Info: Restoring files..."
if [ -f /usr/bin/web-server.disabled ] && [ -f "$INITD_FOLDER"/S99start_app ]; then
mv /usr/bin/web-server.disabled /usr/bin/web-server
fi
if [ -f /usr/bin/Monitor.disabled ] && [ ! -d "$GUPPY_SCREEN_FOLDER" ]; then
mv /usr/bin/Monitor.disabled /usr/bin/Monitor
fi
echo -e "Info: Restoring changes..."
sed -i '/listen 80;/d' /usr/data/nginx/nginx/nginx.conf
echo -e "Info: Restarting services..."
restart_nginx
set +e
killall -q Monitor
killall -q web-server
set -e
if [ -f /usr/bin/web-server.disabled ] && [ -f "$INITD_FOLDER"/S99start_app ]; then
/usr/bin/web-server > /dev/null 2>&1 &
fi
if [ -f /usr/bin/Monitor.disabled ] && [ ! -d "$GUPPY_SCREEN_FOLDER" ]; then
/usr/bin/Monitor > /dev/null 2>&1 &
fi
ok_msg "Creality Web Interface has been restored successfully!"
echo -e " You can now connect to Creality Web Interface with ${yellow}http://$(check_ipaddress) ${white}and with ${yellow}Creality Print${white}."
return;;
N|n)
error_msg "Restoration canceled!"
return;;
*)
error_msg "Please select a correct choice!";;
esac
done
}

91
scripts/custom_boot_display.sh Executable file
View file

@ -0,0 +1,91 @@
#!/bin/sh
set -e
function install_custom_boot_display_message(){
top_line
title 'Install Custom Boot Display' "${yellow}"
inner_line
hr
echo -e "${cyan}This allows to install a custom Creality-themed boot ${white}"
echo -e "${cyan}display. ${white}"
hr
bottom_line
}
function remove_custom_boot_display_message(){
top_line
title 'Remove Custom Boot Display' "${yellow}"
inner_line
hr
echo -e "${cyan}This allows to restore stock boot display. ${white}"
hr
bottom_line
}
function install_custom_boot_display(){
install_custom_boot_display_message
local yn
while true; do
install_msg "Custom Boot Display" yn
case "${yn}" in
Y|y)
echo -e "${white}"
local printer_choice
while true; do
read -p " ${white}Do you want install it for ${yellow}K1${white} or ${yellow}K1 Max${white}? (${yellow}k1${white}/${yellow}k1max${white}): ${yellow}" printer_choice
case "${printer_choice}" in
K1|k1)
echo -e "${white}"
echo -e "Info: Removing stock files..."
rm -rf "$BOOT_DISPLAY_FOLDER"/part0
rm -f "$BOOT_DISPLAY_FOLDER"/boot-display.conf
echo -e "Info: Extracting custom files..."
tar -xvf "$BOOT_DISPLAY_K1_URL" -C "$BOOT_DISPLAY_FOLDER"
break;;
K1MAX|k1max)
echo -e "${white}"
echo -e "Info: Removing stock files..."
rm -rf "$BOOT_DISPLAY_FOLDER"/part0
rm -f "$BOOT_DISPLAY_FOLDER"/boot-display.conf
echo -e "Info: Extracting custom files..."
tar -xvf "$BOOT_DISPLAY_K1M_URL" -C "$BOOT_DISPLAY_FOLDER"
break;;
*)
error_msg "Please select a correct choice!";;
esac
done
ok_msg "Custom Boot Display has been installed successfully!"
return;;
N|n)
error_msg "Installation canceled!"
return;;
*)
error_msg "Please select a correct choice!";;
esac
done
}
function remove_custom_boot_display(){
remove_custom_boot_display_message
local yn
while true; do
remove_msg "Custom Boot Display" yn
case "${yn}" in
Y|y)
echo -e "${white}"
echo -e "Info: Removing custom files..."
rm -rf "$BOOT_DISPLAY_FOLDER"/part0
rm -f "$BOOT_DISPLAY_FOLDER"/boot-display.conf
echo -e "Info: Extracting stock files..."
tar -xvf "$BOOT_DISPLAY_STOCK_URL" -C "$BOOT_DISPLAY_FOLDER"
ok_msg "Custom Boot Display has been removed successfully!"
return;;
N|n)
error_msg "Deletion canceled!"
return;;
*)
error_msg "Please select a correct choice!";;
esac
done
}

72
scripts/entware.sh Executable file
View file

@ -0,0 +1,72 @@
#!/bin/sh
set -e
function entware_message(){
top_line
title 'Entware' "${yellow}"
inner_line
hr
echo -e "${cyan}Entware is a software repository for devices which use Linux ${white}"
echo -e "${cyan}kernel. It allows packages to be added to your printer. ${white}"
hr
bottom_line
}
function install_entware(){
entware_message
local yn
while true; do
install_msg "Entware" yn
case "${yn}" in
Y|y)
echo -e "${white}"
echo -e "Info: Running Entware installer..."
set +e
chmod 755 "$ENTWARE_URL"
sh "$ENTWARE_URL"
set -e
ok_msg "Entware has been installed successfully!"
echo -e " Disconnect and reconnect SSH session, and you can now install packages with: ${yellow}opkg install <packagename>${white}"
return;;
N|n)
error_msg "Installation canceled!"
return;;
*)
error_msg "Please select a correct choice!";;
esac
done
}
function remove_entware(){
entware_message
local yn
while true; do
remove_msg "Entware" yn
case "${yn}" in
Y|y)
echo -e "${white}"
echo -e "Info: Removing startup script..."
rm -f /etc/init.d/S50unslung
echo -e "Info: Removing directories..."
rm -rf /usr/data/opt
if [ -L /opt ]; then
rm /opt
mkdir -p /opt
chmod 755 /opt
fi
echo -e "Info: Removing SFTP server symlink..."
[ -L /usr/libexec/sftp-server ] && rm /usr/libexec/sftp-server
echo -e "Info: Removing changes in system profile..."
rm -f /etc/profile.d/entware.sh
sed -i 's/\/opt\/bin:\/opt\/sbin:\/bin:/\/bin:/' /etc/profile
ok_msg "Entware has been removed successfully!"
return;;
N|n)
error_msg "Deletion canceled!"
return;;
*)
error_msg "Please select a correct choice!";;
esac
done
}

129
scripts/fans_control_macros.sh Executable file
View file

@ -0,0 +1,129 @@
#!/bin/sh
set -e
function fans_control_macros_message(){
top_line
title 'Fans Control Macros' "${yellow}"
inner_line
hr
echo -e "${cyan}This allows to control Motherboard fan from Web interfaces ${white}"
echo -e "${cyan}or with slicers. ${white}"
hr
bottom_line
}
function install_fans_control_macros(){
fans_control_macros_message
local yn
while true; do
install_msg "Fans Control Macros" yn
case "${yn}" in
Y|y)
echo -e "${white}"
if [ -f "$HS_CONFIG_FOLDER"/fans-control.cfg ]; then
rm -f "$HS_CONFIG_FOLDER"/fans-control.cfg
fi
if [ ! -d "$HS_CONFIG_FOLDER" ]; then
mkdir -p "$HS_CONFIG_FOLDER"
fi
echo -e "Info: Linking file..."
ln -sf "$FAN_CONTROLS_URL" "$HS_CONFIG_FOLDER"/fans-control.cfg
if grep -q "include Helper-Script/fans-control" "$PRINTER_CFG" ; then
echo -e "Info: Fans Control Macros configurations are already enabled in printer.cfg file..."
else
echo -e "Info: Adding Fans Control Macros configurations in printer.cfg file..."
sed -i '/\[include printer_params\.cfg\]/a \[include Helper-Script/fans-control\.cfg\]' "$PRINTER_CFG"
fi
if grep -q "\[duplicate_pin_override\]" "$PRINTER_CFG" ; then
echo -e "Info: Disabling [duplicate_pin_override] configuration in printer.cfg file..."
sed -i '/^\[duplicate_pin_override\]/,/^\s*$/ s/^\(\s*\)\([^#]\)/#\1\2/' "$PRINTER_CFG"
else
echo -e "Info: [duplicate_pin_override] configuration is already disabled in printer.cfg file..."
fi
if grep -q "\[temperature_fan chamber_fan\]" "$PRINTER_CFG" ; then
echo -e "Info: Disabling [temperature_fan chamber_fan] configuration in printer.cfg file..."
sed -i '/^\[temperature_fan chamber_fan\]/,/^\s*$/ s/^\(\s*\)\([^#]\)/#\1\2/' "$PRINTER_CFG"
else
echo -e "Info: [temperature_fan chamber_fan] configuration is already disabled in printer.cfg file..."
fi
if grep -q "\[gcode_macro M106\]" "$MACROS_CFG" ; then
echo -e "Info: Disabling [gcode_macro M106] in gcode_macro.cfg file..."
sed -i '/^\[gcode_macro M106\]/,/^\s*$/ s/^\(\s*\)\([^#]\)/#\1\2/' "$MACROS_CFG"
else
echo -e "Info: [gcode_macro M106] macro is already disabled in gcode_macro.cfg file..."
fi
if grep -q "\[gcode_macro M141\]" "$MACROS_CFG" ; then
echo -e "Info: Disabling [gcode_macro M141] in gcode_macro.cfg file..."
sed -i '/^\[gcode_macro M141\]/,/^\s*$/ s/^\(\s*\)\([^#]\)/#\1\2/' "$MACROS_CFG"
else
echo -e "Info: [gcode_macro M141] macro is already disabled in gcode_macro.cfg file..."
fi
echo -e "Info: Restarting Klipper service..."
restart_klipper
ok_msg "Fans Control Macros have been installed successfully!"
return;;
N|n)
error_msg "Installation canceled!"
return;;
*)
error_msg "Please select a correct choice!";;
esac
done
}
function remove_fans_control_macros(){
fans_control_macros_message
local yn
while true; do
remove_msg "Fans Control Macros" yn
case "${yn}" in
Y|y)
echo -e "${white}"
echo -e "Info: Removing file..."
rm -f "$HS_CONFIG_FOLDER"/fans-control.cfg
if grep -q "include Helper-Script/fans-control" "$PRINTER_CFG" ; then
echo -e "Info: Removing Fans Control Macros configurations in printer.cfg file..."
sed -i '/include Helper-Script\/fans-control\.cfg/d' "$PRINTER_CFG"
else
echo -e "Info: Fans Control Macros configurations are already removed in printer.cfg file..."
fi
if grep -q "#\[duplicate_pin_override\]" "$PRINTER_CFG" ; then
echo -e "Info: Enabling [duplicate_pin_override] in printer.cfg file..."
sed -i -e 's/^\s*#[[:space:]]*\[duplicate_pin_override\]/[duplicate_pin_override]/' -e '/^\[duplicate_pin_override\]/,/^\s*$/ s/^\(\s*\)#/\1/' "$PRINTER_CFG"
else
echo -e "Info: [duplicate_pin_override] is already enabled in printer.cfg file..."
fi
if grep -q "#\[temperature_fan chamber_fan\]" "$PRINTER_CFG" ; then
echo -e "Info: Enabling [temperature_fan chamber_fan] in printer.cfg file..."
sed -i -e 's/^\s*#[[:space:]]*\[temperature_fan chamber_fan\]/[temperature_fan chamber_fan]/' -e '/^\[temperature_fan chamber_fan\]/,/^\s*$/ s/^\(\s*\)#/\1/' "$PRINTER_CFG"
else
echo -e "Info: [temperature_fan chamber_fan] is already enabled in printer.cfg file..."
fi
if grep -q "#\[gcode_macro M106\]" "$MACROS_CFG" ; then
echo -e "Info: Enabling [gcode_macro M106] in gcode_macro.cfg file..."
sed -i -e 's/^\s*#[[:space:]]*\[gcode_macro M106\]/[gcode_macro M106]/' -e '/^\[gcode_macro M106\]/,/^\s*$/ s/^\(\s*\)#/\1/' "$MACROS_CFG"
else
echo -e "Info: [gcode_macro M106] is already enabled in gcode_macro.cfg file..."
fi
if grep -q "#\[gcode_macro M141\]" "$MACROS_CFG" ; then
echo -e "Info: Enabling [gcode_macro M141] in gcode_macro.cfg file..."
sed -i -e 's/^\s*#[[:space:]]*\[gcode_macro M141\]/[gcode_macro M141]/' -e '/^\[gcode_macro M141\]/,/^\s*$/ s/^\(\s*\)#/\1/' "$MACROS_CFG"
else
echo -e "Info: [gcode_macro M141] is already enabled in gcode_macro.cfg file..."
fi
if [ ! -n "$(ls -A "$HS_CONFIG_FOLDER")" ]; then
rm -rf "$HS_CONFIG_FOLDER"
fi
echo -e "Info: Restarting Klipper service..."
restart_klipper
ok_msg "Fans Control Macros have been removed successfully!"
return;;
N|n)
error_msg "Deletion canceled!"
return;;
*)
error_msg "Please select a correct choice!";;
esac
done
}

90
scripts/fluidd.sh Executable file
View file

@ -0,0 +1,90 @@
#!/bin/sh
set -e
function fluidd_message(){
top_line
title 'Fluidd' "${yellow}"
inner_line
hr
echo -e "${cyan}Fluidd is a free and open-source Klipper Web interface for ${white}"
echo -e "${cyan}managing your 3d printer. ${white}"
echo -e "${cyan}It will be accessible on port 4408. ${white}"
hr
bottom_line
}
function install_fluidd(){
fluidd_message
local yn
while true; do
install_msg "Fluidd" yn
case "${yn}" in
Y|y)
echo -e "${white}"
echo -e "Info: Downloading Fluidd file..."
"$CURL" -L "$FLUIDD_URL" -o "$USR_DATA"/fluidd.zip
echo -e "Info: Creating directory..."
if [ -d "$FLUIDD_FOLDER" ]; then
rm -rf "$FLUIDD_FOLDER"
fi
mkdir -p "$FLUIDD_FOLDER"
mv "$USR_DATA"/fluidd.zip "$FLUIDD_FOLDER"
echo -e "Info: Extracting files..."
unzip "$FLUIDD_FOLDER"/fluidd.zip -d "$FLUIDD_FOLDER"
echo -e "Info: Removing file..."
rm -f "$FLUIDD_FOLDER"/fluidd.zip
if grep -q "#\[update_manager fluidd\]" "$MOONRAKER_CFG" ; then
echo -e "Info: Enabling Fluidd configurations for Update Manager..."
sed -i -e 's/^\s*#[[:space:]]*\[update_manager fluidd\]/[update_manager fluidd]/' -e '/^\[update_manager fluidd\]/,/^\s*$/ s/^\(\s*\)#/\1/' "$MOONRAKER_CFG"
else
echo -e "Info: Fluidd configurations are already enabled for Update Manager..."
fi
echo -e "Info: Retarting Nginx service..."
restart_nginx
echo -e "Info: Restarting Moonraker service..."
stop_moonraker
start_moonraker
ok_msg "Fluidd has been installed successfully!"
echo -e " You can now connect to Fluidd Web Interface with ${yellow}http://$(check_ipaddress):4408${white}"
return;;
N|n)
error_msg "Installation canceled!"
return;;
*)
error_msg "Please select a correct choice!";;
esac
done
}
function remove_fluidd(){
fluidd_message
local yn
while true; do
remove_msg "Fluidd" yn
case "${yn}" in
Y|y)
echo -e "${white}"
echo -e "Info: Removing files..."
rm -rf "$FLUIDD_FOLDER"
if grep -q "\[update_manager fluidd\]" "$MOONRAKER_CFG" ; then
echo -e "Info: Disabling Fluidd configurations for Update Manager..."
sed -i '/^\[update_manager fluidd\]/,/^\s*$/ s/^\(\s*\)\([^#]\)/#\1\2/' "$MOONRAKER_CFG"
echo -e "Info: Retarting Nginx service..."
restart_nginx
echo -e "Info: Restarting Moonraker service..."
stop_moonraker
start_moonraker
else
echo -e "Info: Fluidd configurations are already disabled for Update Manager..."
fi
ok_msg "Fluidd has been removed successfully!"
return;;
N|n)
error_msg "Deletion canceled!"
return;;
*)
error_msg "Please select a correct choice!";;
esac
done
}

62
scripts/gcode_shell_command.sh Executable file
View file

@ -0,0 +1,62 @@
#!/bin/sh
set -e
function gcode_shell_command_message(){
top_line
title 'Klipper Gcode Shell Command' "${yellow}"
inner_line
hr
echo -e "${cyan}After installing this extension you can execute Linux ${white}"
echo -e "${cyan}commands or even scripts from Klipper with custom commands ${white}"
echo -e "${cyan}defined in your configuration files. ${white}"
hr
bottom_line
}
function install_gcode_shell_command(){
gcode_shell_command_message
local yn
while true; do
install_msg "Klipper Gcode Shell Command" yn
case "${yn}" in
Y|y)
echo -e "${white}"
echo -e "Info: Linking file..."
ln -sf "$KLIPPER_SHELL_URL" "$KLIPPER_EXTRAS_FOLDER"/gcode_shell_command.py
echo -e "Info: Restarting Klipper service..."
restart_klipper
ok_msg "Klipper Gcode Shell Command has been installed successfully!"
return;;
N|n)
error_msg "Installation canceled!"
return;;
*)
error_msg "Please select a correct choice!";;
esac
done
}
function remove_gcode_shell_command(){
gcode_shell_command_message
local yn
while true; do
remove_msg "Klipper Gcode Shell Command" yn
case "${yn}" in
Y|y)
echo -e "${white}"
echo -e "Info: Removing files..."
rm -f "$KLIPPER_EXTRAS_FOLDER"/gcode_shell_command.py
rm -f "$KLIPPER_EXTRAS_FOLDER"/gcode_shell_command.pyc
echo -e "Info: Restarting Klipper service..."
restart_klipper
ok_msg "Klipper Gcode Shell Command has been removed successfully!"
return;;
N|n)
error_msg "Deletion canceled!"
return;;
*)
error_msg "Please select a correct choice!";;
esac
done
}

91
scripts/git_backup.sh Executable file
View file

@ -0,0 +1,91 @@
#!/bin/sh
set -e
function git_backup_message(){
top_line
title 'Git Backup' "${yellow}"
inner_line
hr
echo -e "${cyan}It allows to watch Klipper configuration folder and ${white}"
echo -e "${cyan}automatically backup to GitHub whenever a change is made in ${white}"
echo -e "${cyan}that directory. ${white}"
hr
bottom_line
}
function install_git_backup(){
git_backup_message
local yn
while true; do
install_msg "Git Backup" yn
case "${yn}" in
Y|y)
echo -e "${white}"
if [ -f "$HS_CONFIG_FOLDER"/git-backup.cfg ]; then
rm -f "$HS_CONFIG_FOLDER"/git-backup.cfg
fi
if [ ! -d "$HS_CONFIG_FOLDER" ]; then
mkdir -p "$HS_CONFIG_FOLDER"
fi
echo -e "Info: Running Git Backup installer..."
chmod 755 "$GIT_BACKUP_INSTALLER"
sh "$GIT_BACKUP_INSTALLER" -i
echo -e "Info: Linking file..."
ln -sf "$GIT_BACKUP_URL"/git-backup.cfg "$HS_CONFIG_FOLDER"/git-backup.cfg
if grep -q "include Helper-Script/git-backup" "$PRINTER_CFG" ; then
echo -e "Info: Git Backup configurations are already enabled in printer.cfg file..."
else
echo -e "Info: Adding Git Backup configurations in printer.cfg file..."
sed -i '/\[include printer_params\.cfg\]/a \[include Helper-Script/git-backup\.cfg\]' "$PRINTER_CFG"
fi
echo -e "Info: Restarting Klipper service..."
restart_klipper
ok_msg "Git Backup has been installed and configured successfully!"
return;;
N|n)
error_msg "Installation canceled!"
return;;
*)
error_msg "Please select a correct choice!";;
esac
done
}
function remove_git_backup(){
git_backup_message
local yn
while true; do
remove_msg "Git Backup" yn
case "${yn}" in
Y|y)
echo -e "${white}"
echo -e "Info: Removing files..."
rm -f "$HS_CONFIG_FOLDER"/git-backup.cfg
rm -f "INITD_FOLDER"/S52Git-Backup
if grep -q "include Helper-Script/git-backup" "$PRINTER_CFG" ; then
echo -e "Info: Removing Git Backup configurations in printer.cfg file..."
sed -i '/include Helper-Script\/git-backup\.cfg/d' "$PRINTER_CFG"
else
echo -e "Info: Git Backup configurations are already removed in printer.cfg file..."
fi
if [ -f "$ENTWARE_FILE" ]; then
echo -e "Info: Removing packages..."
"$ENTWARE_FILE" --autoremove remove inotifywait
"$ENTWARE_FILE" --autoremove remove procps-ng-pkill
fi
if [ ! -n "$(ls -A "$HS_CONFIG_FOLDER")" ]; then
rm -rf "$HS_CONFIG_FOLDER"
fi
echo -e "Info: Restarting Klipper service..."
restart_klipper
ok_msg "Git Backup has been removed successfully!"
return;;
N|n)
error_msg "Deletion canceled!"
return;;
*)
error_msg "Please select a correct choice!";;
esac
done
}

250
scripts/guppy_screen.sh Executable file
View file

@ -0,0 +1,250 @@
#!/bin/sh
set -e
function guppy_screen_message(){
top_line
title 'Guppy Screen' "${yellow}"
inner_line
hr
echo -e "${cyan}Guppy Screen is a touch UI for Klipper using APIs exposed by ${white}"
echo -e "${cyan}Moonraker. It replace Creality touch UI. ${white}"
hr
bottom_line
}
function install_guppy_screen(){
guppy_screen_message
local yn
while true; do
install_msg "Guppy Screen" yn
case "${yn}" in
Y|y)
echo -e "${white}"
if [ -f "$USR_DATA"/guppyscreen.tar.gz ]; then
rm -f "$USR_DATA"/guppyscreen.tar.gz
fi
if [ $K1 -eq 1 ]; then
local theme_choice
while true; do
read -p " Do you want to install it with ${green}Material Design ${white}or ${green}Z-Bolt ${white}theme? (${yellow}material${white}/${yellow}zbolt${white}): ${yellow}" theme_choice
case "${theme_choice}" in
MATERIAL|material)
echo -e "${white}"
echo -e "Info: Downloading Guppy Screen..."
"$CURL" -L https://github.com/ballaswag/guppyscreen/releases/latest/download/guppyscreen.tar.gz -o "$USR_DATA"/guppyscreen.tar.gz
break;;
ZBOLT|zbolt)
echo -e "${white}"
echo -e "Info: Downloading Guppy Screen..."
"$CURL" -L https://github.com/ballaswag/guppyscreen/releases/latest/download/guppyscreen-zbolt.tar.gz -o "$USR_DATA"/guppyscreen.tar.gz
break;;
*)
error_msg "Please select a correct choice!";;
esac
done
else
echo -e "Info: Downloading Guppy Screen..."
"$CURL" -L https://github.com/ballaswag/guppyscreen/releases/latest/download/guppyscreen-smallscreen.tar.gz -o "$USR_DATA"/guppyscreen.tar.gz
fi
echo -e "Info: Installing files..."
tar -xvf "$USR_DATA"/guppyscreen.tar.gz -C "$USR_DATA"
rm -f "$USR_DATA"/guppyscreen.tar.gz
if [ ! -d "$HS_BACKUP_FOLDER"/guppyscreen ]; then
echo -e "Info: Backing up original file..."
mkdir -p "$HS_BACKUP_FOLDER"/guppyscreen
mv "$INITD_FOLDER"/S12boot_display "$HS_BACKUP_FOLDER"/guppyscreen
cp "$INITD_FOLDER"/S50dropbear "$HS_BACKUP_FOLDER"/guppyscreen
cp "$INITD_FOLDER"/S99start_app "$HS_BACKUP_FOLDER"/guppyscreen
fi
if [ ! -f "$HS_BACKUP_FOLDER"/guppyscreen/ft2font.cpython-38-mipsel-linux-gnu.so ]; then
mv /usr/lib/python3.8/site-packages/matplotlib/ft2font.cpython-38-mipsel-linux-gnu.so "$HS_BACKUP_FOLDER"/guppyscreen
fi
local yn
while true; do
echo
echo -e " ${white}Do you want to disable all Creality services ?"
echo -e " ${yellow}Benefits: ${white}\e[97mFrees up system resources on your K1 for critical services such as Klipper (recommended)${white}"
echo -e " ${yellow}Disadvantages: ${white}\e[97mDisabling all Creality services breaks Creality Cloud and Creality Print${white}"
echo
read -p " Do you want to disable all Creality Services? (${yellow}y${white}/${yellow}n${white}): ${yellow}" yn
case "${yn}" in
Y|y)
echo -e "${white}"
echo -e "Info: Disabling Creality services..."
rm -f "$INITD_FOLDER"/S99start_app
set +e
killall -q master-server
killall -q audio-server
killall -q wifi-server
killall -q app-server
killall -q upgrade-server
killall -q web-server
set -e
break;;
N|n)
break;;
*)
error_msg "Please select a correct choice!";;
esac
done
if [ ! -d "/usr/lib/python3.8/site-packages/matplotlib-2.2.3-py3.8.egg-info" ]; then
echo -e "Info: mathplotlib ft2font module is not replaced. PSD graphs might not work..."
else
echo -e "Info: Replacing mathplotlib ft2font module to generate PSD graphs..."
cp "$GUPPY_SCREEN_FOLDER"/k1_mods/ft2font.cpython-38-mipsel-linux-gnu.so /usr/lib/python3.8/site-packages/matplotlib/ft2font.cpython-38-mipsel-linux-gnu.so
fi
echo -e "Info: Setting up Guppy Screen..."
cp "$GUPPY_SCREEN_FOLDER"/k1_mods/S50dropbear "$INITD_FOLDER"/S50dropbear
cp "$GUPPY_SCREEN_FOLDER"/k1_mods/S99guppyscreen "$INITD_FOLDER"/S99guppyscreen
ln -sf "$GUPPY_SCREEN_FOLDER"/k1_mods/calibrate_shaper_config.py "$KLIPPER_EXTRAS_FOLDER"/calibrate_shaper_config.py
ln -sf "$GUPPY_SCREEN_FOLDER"/k1_mods/guppy_module_loader.py "$KLIPPER_EXTRAS_FOLDER"/guppy_module_loader.py
ln -sf "$GUPPY_SCREEN_FOLDER"/k1_mods/guppy_config_helper.py "$KLIPPER_EXTRAS_FOLDER"/guppy_config_helper.py
ln -sf "$GUPPY_SCREEN_FOLDER"/k1_mods/tmcstatus.py "$KLIPPER_EXTRAS_FOLDER"/tmcstatus.py
ln -sf "$GUPPY_SCREEN_FOLDER"/k1_mods/respawn/libeinfo.so.1 /lib/libeinfo.so.1
ln -sf "$GUPPY_SCREEN_FOLDER"/k1_mods/respawn/librc.so.1 /lib/librc.so.1
mkdir -p "$KLIPPER_CONFIG_FOLDER"/GuppyScreen/scripts
cp "$GUPPY_SCREEN_FOLDER"/scripts/*.cfg "$KLIPPER_CONFIG_FOLDER"/GuppyScreen
cp "$GUPPY_SCREEN_FOLDER"/scripts/*.py "$KLIPPER_CONFIG_FOLDER"/GuppyScreen/scripts
ln -sf "$GUPPY_SCREEN_URL1" "$KLIPPER_CONFIG_FOLDER"/GuppyScreen/guppy_update.cfg
chmod 775 "$GUPPY_SCREEN_URL2"
if grep -q "include GuppyScreen" "$PRINTER_CFG" ; then
echo -e "Info: Guppy Screen configurations are already enabled in printer.cfg file."
else
echo -e "Info: Adding Guppy Screen configurations in printer.cfg file..."
sed -i '/\[include printer_params\.cfg\]/a \[include GuppyScreen/*\.cfg\]' "$PRINTER_CFG"
fi
if grep -q 'variable_autotune_shapers:' "$MACROS_CFG" ; then
echo -e "Info: Disabling stock configuration in gcode_macro.cfg file..."
sed -i 's/variable_autotune_shapers:/#&/' "$MACROS_CFG"
else
echo -e "Info: Stock configuration is already disabled in gcode_macro.cfg file..."
fi
if grep -q '\[gcode_macro INPUTSHAPER\]' "$MACROS_CFG" ; then
echo -e "Info: Replacing stock configuration in gcode_macro.cfg file..."
sed -i 's/SHAPER_CALIBRATE AXIS=y/SHAPER_CALIBRATE/' "$MACROS_CFG"
else
echo -e "Info: Stock configuration is already replaced in gcode_macro.cfg file..."
fi
sync
echo -e "Info: Restarting Moonraker service..."
stop_moonraker
start_moonraker
echo -e "Info: Restarting Klipper service..."
restart_klipper
echo -e "Info: Disabling services..."
if [ -f /usr/bin/Monitor ]; then
mv /usr/bin/Monitor /usr/bin/Monitor.disable
fi
if [ -f /usr/bin/display-server ]; then
mv /usr/bin/display-server /usr/bin/display-server.disable
fi
set +e
killall -q Monitor
killall -q display-server
set -e
echo -e "Info: Starting Guppy Screen service..."
/etc/init.d/S99guppyscreen restart &> /dev/null
sleep 1
ps auxw | grep guppyscreen | grep -v sh | grep -v grep
ok_msg "Guppy Screen has been installed successfully!"
return;;
N|n)
error_msg "Installation canceled!"
return;;
*)
error_msg "Please select a correct choice!";;
esac
done
}
function remove_guppy_screen(){
guppy_screen_message
local yn
while true; do
remove_msg "Guppy Screen" yn
case "${yn}" in
Y|y)
echo -e "${white}"
echo -e "Info: Restoring backup files..."
if [ -d "$HS_BACKUP_FOLDER"/guppyscreen ]; then
cp "$HS_BACKUP_FOLDER"/guppyscreen/S12boot_display "$INITD_FOLDER"/S12boot_display
cp "$HS_BACKUP_FOLDER"/guppyscreen/S50dropbear "$INITD_FOLDER"/S50dropbear
cp "$HS_BACKUP_FOLDER"/guppyscreen/S99start_app "$INITD_FOLDER"/S99start_app
rm -rf "$HS_BACKUP_FOLDER"/guppyscreen
fi
if [ ! -n "$(ls -A "$HS_BACKUP_FOLDER")" ]; then
rm -rf "$HS_BACKUP_FOLDER"
fi
echo -e "Info: Stopping Guppy Screen Service..."
[ -f "$INITD_FOLDER"/S99guppyscreen ] && "$INITD_FOLDER"/S99guppyscreen stop &> /dev/null
set +e
killall -q guppyscreen
set -e
echo -e "Info: Removing files..."
rm -f "$KLIPPER_EXTRAS_FOLDER"/calibrate_shaper_config.py
rm -f "$KLIPPER_EXTRAS_FOLDER"/calibrate_shaper_config.pyc
rm -f "$KLIPPER_EXTRAS_FOLDER"/guppy_module_loader.py
rm -f "$KLIPPER_EXTRAS_FOLDER"/guppy_module_loader.pyc
rm -f "$KLIPPER_EXTRAS_FOLDER"/guppy_config_helper.py
rm -f "$KLIPPER_EXTRAS_FOLDER"/guppy_config_helper.pyc
rm -f "$KLIPPER_EXTRAS_FOLDER"/tmcstatus.py
rm -f "$KLIPPER_EXTRAS_FOLDER"/tmcstatus.pyc
rm -f "$INITD_FOLDER"/S99guppyscreen
rm -f /lib/libeinfo.so.1
rm -f /lib/librc.so.1
rm -rf "$GUPPY_SCREEN_FOLDER"
rm -rf "$KLIPPER_CONFIG_FOLDER"/GuppyScreen
if grep -q "include GuppyScreen/*" "$PRINTER_CFG" ; then
echo -e "Info: Removing Guppy Screen configurations in printer.cfg file..."
sed -i '/\[include GuppyScreen\/\*\.cfg\]/d' "$PRINTER_CFG"
else
echo -e "Info: Guppy Screen configurations are already removed in printer.cfg file..."
fi
if grep -q "#variable_autotune_shapers:" "$MACROS_CFG"; then
echo -e "Info: Enabling stock configuration in gcode_macro.cfg file..."
sed -i 's/#variable_autotune_shapers:/variable_autotune_shapers:/' "$MACROS_CFG"
else
echo -e "Info: Stock configuration is already enabled in gcode_macro.cfg file..."
fi
if grep -q '\[gcode_macro INPUTSHAPER\]' "$MACROS_CFG" ; then
echo -e "Info: Restoring stock configuration in gcode_macro.cfg file..."
sed -i 's/SHAPER_CALIBRATE/SHAPER_CALIBRATE AXIS=y/' "$MACROS_CFG"
else
echo -e "Info: Stock configuration is already restored in gcode_macro.cfg file..."
fi
echo -e "Info: Restarting Moonraker service..."
stop_moonraker
start_moonraker
echo -e "Info: Restarting Klipper service..."
restart_klipper
echo -e "Info: Restoring services..."
if [ -f /usr/bin/Monitor.disable ]; then
mv /usr/bin/Monitor.disable /usr/bin/Monitor
fi
if [ -f /usr/bin/display-server.disable ]; then
mv /usr/bin/display-server.disable /usr/bin/display-server
fi
echo -e "Info: Restarting Creality services..."
set +e
/usr/bin/Monitor > /dev/null 2>&1 &
/usr/bin/display-server > /dev/null 2>&1 &
/usr/bin/master-server > /dev/null 2>&1 &
/usr/bin/audio-server > /dev/null 2>&1 &
/usr/bin/wifi-server > /dev/null 2>&1 &
/usr/bin/app-server > /dev/null 2>&1 &
/usr/bin/upgrade-server > /dev/null 2>&1 &
if [ -f /usr/bin/web-server ]; then
/usr/bin/web-server > /dev/null 2>&1 &
fi
set -e
ok_msg "Guppy Screen has been removed successfully!"
return;;
N|n)
error_msg "Deletion canceled!"
return;;
*)
error_msg "Please select a correct choice!";;
esac
done
}

140
scripts/improved_shapers.sh Executable file
View file

@ -0,0 +1,140 @@
#!/bin/sh
set -e
function improved_shapers_message(){
top_line
title 'Improved Shapers Calibrations' "${yellow}"
inner_line
hr
echo -e "${cyan}It allows to calibrate Input Shaper, Belts Tension and ${white}"
echo -e "${cyan}generate Graphs. ${white}"
hr
bottom_line
}
function install_improved_shapers(){
improved_shapers_message
local yn
while true; do
install_msg "Improved Shapers Calibrations" yn
case "${yn}" in
Y|y)
echo -e "${white}"
echo -e "Info: Backing up original file..."
if [ ! -d "$HS_BACKUP_FOLDER"/improved-shapers ]; then
mkdir -p "$HS_BACKUP_FOLDER"/improved-shapers
fi
if [ ! -f "$HS_BACKUP_FOLDER"/ft2font.cpython-38-mipsel-linux-gnu.so ]; then
mv /usr/lib/python3.8/site-packages/matplotlib/ft2font.cpython-38-mipsel-linux-gnu.so "$HS_BACKUP_FOLDER"/improved-shapers
fi
echo -e "Info: Linking files..."
ln -sf "$IMP_SHAPERS_URL"/calibrate_shaper_config.py "$KLIPPER_EXTRAS_FOLDER"/calibrate_shaper_config.py
if [ ! -d "/usr/lib/python3.8/site-packages/matplotlib-2.2.3-py3.8.egg-info" ]; then
echo -e "Info: mathplotlib ft2font module is not replaced. PSD graphs might not work..."
else
echo -e "Info: Replacing mathplotlib ft2font module to generate PSD graphs..."
cp "$IMP_SHAPERS_URL"/ft2font.cpython-38-mipsel-linux-gnu.so /usr/lib/python3.8/site-packages/matplotlib/ft2font.cpython-38-mipsel-linux-gnu.so
fi
if [ -f "$HS_CONFIG_FOLDER"/improved-shapers ]; then
rm -rf "$HS_CONFIG_FOLDER"/improved-shapers
fi
if [ ! -d "$HS_CONFIG_FOLDER"/improved-shapers/scripts ]; then
mkdir -p "$HS_CONFIG_FOLDER"/improved-shapers/scripts
fi
cp "$IMP_SHAPERS_URL"/scripts/*.py "$HS_CONFIG_FOLDER"/improved-shapers/scripts
ln -sf "$IMP_SHAPERS_URL"/improved-shapers.cfg "$HS_CONFIG_FOLDER"/improved-shapers/improved-shapers.cfg
if grep -q 'variable_autotune_shapers:' "$MACROS_CFG" ; then
echo -e "Info: Disabling [gcode_macro AUTOTUNE_SHAPERS] configurations in gcode_macro.cfg file..."
sed -i 's/variable_autotune_shapers:/#&/' "$MACROS_CFG"
else
echo -e "Info: [gcode_macro AUTOTUNE_SHAPERS] configurations are already disabled in gcode_macro.cfg file..."
fi
if [ $K1 -eq 1 ]; then
if grep -q '\[gcode_macro INPUTSHAPER\]' "$MACROS_CFG" ; then
echo -e "Info: Replacing [gcode_macro INPUTSHAPER] configurations in gcode_macro.cfg file..."
sed -i 's/SHAPER_CALIBRATE AXIS=y/SHAPER_CALIBRATE/' "$MACROS_CFG"
else
echo -e "Info: [gcode_macro INPUTSHAPER] configurations are already replaced in gcode_macro.cfg file..."
fi
fi
if grep -q "include Helper-Script/improved-shapers/improved-shapers" "$PRINTER_CFG" ; then
echo -e "Info: Improved Shapers Calibration configurations are already enabled in printer.cfg file..."
else
echo -e "Info: Adding Improved Shapers Calibration configurations in printer.cfg file..."
sed -i '/\[include printer_params\.cfg\]/a \[include Helper-Script/improved-shapers/improved-shapers\.cfg\]' "$PRINTER_CFG"
fi
echo -e "Info: Restarting Moonraker service..."
stop_moonraker
start_moonraker
echo -e "Info: Restarting Klipper service..."
restart_klipper
ok_msg "Improved Shapers Calibrations have been installed successfully!"
return;;
N|n)
error_msg "Installation canceled!"
return;;
*)
error_msg "Please select a correct choice!";;
esac
done
}
function remove_improved_shapers(){
improved_shapers_message
local yn
while true; do
remove_msg "Improved Shapers Calibrations" yn
case "${yn}" in
Y|y)
echo -e "${white}"
echo -e "Info: Restoring original file..."
if [ -f "$HS_BACKUP_FOLDER"/ft2font.cpython-38-mipsel-linux-gnu.so ]; then
mv "$HS_BACKUP_FOLDER"/improved-shapers/ft2font.cpython-38-mipsel-linux-gnu.so /usr/lib/python3.8/site-packages/matplotlib
rm -rf "$HS_BACKUP_FOLDER"/improved-shapers
fi
if [ ! -n "$(ls -A "$HS_BACKUP_FOLDER")" ]; then
rm -rf "$HS_BACKUP_FOLDER"
fi
echo -e "Info: Removing files..."
rm -rf "$IMP_SHAPERS_FOLDER"
rm -f "$KLIPPER_EXTRAS_FOLDER"/calibrate_shaper_config.py
rm -f "$KLIPPER_EXTRAS_FOLDER"/calibrate_shaper_config.pyc
if grep -q "#variable_autotune_shapers:" "$MACROS_CFG"; then
echo -e "Info: Restoring [gcode_macro AUTOTUNE_SHAPERS] configurations in gcode_macro.cfg file..."
sed -i 's/#variable_autotune_shapers:/variable_autotune_shapers:/' "$MACROS_CFG"
else
echo -e "Info: [gcode_macro AUTOTUNE_SHAPERS] configurations are already restored in gcode_macro.cfg file..."
fi
if [ $K1 -eq 1 ]; then
if grep -q '\[gcode_macro INPUTSHAPER\]' "$MACROS_CFG" ; then
echo -e "Info: Restoring [gcode_macro INPUTSHAPER] configurations in gcode_macro.cfg file..."
sed -i 's/SHAPER_CALIBRATE/SHAPER_CALIBRATE AXIS=y/' "$MACROS_CFG"
else
echo -e "Info: [gcode_macro INPUTSHAPER] configurations are already restored in gcode_macro.cfg file..."
fi
fi
if grep -q "include Helper-Script/improved-shapers/improved-shapers" "$PRINTER_CFG" ; then
echo -e "Info: Removing Improved Shapers Calibrations in printer.cfg file..."
sed -i '/include Helper-Script\/improved-shapers\/improved-shapers\.cfg/d' "$PRINTER_CFG"
else
echo -e "Info: Improved Shapers Calibrations are already removed in printer.cfg file..."
fi
if [ ! -n "$(ls -A "$HS_CONFIG_FOLDER")" ]; then
rm -rf "$HS_CONFIG_FOLDER"
fi
echo -e "Info: Restarting Moonraker service..."
stop_moonraker
start_moonraker
echo -e "Info: Restarting Klipper service..."
restart_klipper
ok_msg "Improved Shapers Calibrations have been removed successfully!"
return;;
N|n)
error_msg "Deletion canceled!"
return;;
*)
error_msg "Please select a correct choice!";;
esac
done
}

126
scripts/kamp.sh Executable file
View file

@ -0,0 +1,126 @@
#!/bin/sh
set -e
function kamp_message(){
top_line
title 'Klipper Adaptive Meshing & Purging' "${yellow}"
inner_line
hr
echo -e "${cyan}KAMP is an extension that allows to generate a mesh and ${white}"
echo -e "${cyan}purge line only in the area you really need it. ${white}"
hr
bottom_line
}
function install_kamp(){
kamp_message
local yn
while true; do
install_msg "Klipper Adaptive Meshing & Purging" yn
case "${yn}" in
Y|y)
echo -e "${white}"
if [ -d "$HS_CONFIG_FOLDER"/KAMP ]; then
rm -rf "$HS_CONFIG_FOLDER"/KAMP
fi
if [ -f "$HS_CONFIG_FOLDER"/KAMP_Settings.cfg ]; then
rm -f "$HS_CONFIG_FOLDER"/KAMP_Settings.cfg
fi
echo -e "Info: Creating directories..."
if [ ! -d "$HS_CONFIG_FOLDER" ]; then
mkdir -p "$HS_CONFIG_FOLDER"
fi
mkdir -p "$HS_CONFIG_FOLDER"/KAMP
echo -e "Info: Linking files..."
ln -sf "$KAMP_URL"/Adaptive_Meshing.cfg "$KAMP_FOLDER"/Adaptive_Meshing.cfg
ln -sf "$KAMP_URL"/Line_Purge.cfg "$KAMP_FOLDER"/Line_Purge.cfg
ln -sf "$KAMP_URL"/Prusa_Slicer.cfg "$KAMP_FOLDER"/Prusa_Slicer.cfg
ln -sf "$KAMP_URL"/Smart_Park.cfg "$KAMP_FOLDER"/Smart_Park.cfg
ln -sf "$KAMP_URL"/Start_Print.cfg "$KAMP_FOLDER"/Start_Print.cfg
cp "$KAMP_URL"/KAMP_Settings.cfg "$KAMP_FOLDER"/KAMP_Settings.cfg
if grep -q "include Helper-Script/KAMP/KAMP_Settings" "$PRINTER_CFG" ; then
echo -e "Info: KAMP configurations are already enabled in printer.cfg file..."
else
echo -e "Info: Adding KAMP configurations in printer.cfg file..."
sed -i '/\[include printer_params\.cfg\]/a [include Helper-Script/KAMP/KAMP_Settings.cfg]' "$PRINTER_CFG"
fi
if grep -q "\[gcode_macro START_PRINT\]" "$MACROS_CFG" ; then
echo -e "Info: Disabling [gcode_macro START_PRINT] in gcode_macro.cfg file..."
sed -i '/\[gcode_macro START_PRINT\]/,/^\s*CX_PRINT_DRAW_ONE_LINE/ { /^\s*$/d }' "$MACROS_CFG"
sed -i '/^\[gcode_macro START_PRINT\]/,/^\s*$/ s/^\(\s*\)\([^#]\)/#\1\2/' "$MACROS_CFG"
else
echo -e "Info: [gcode_macro START_PRINT] is already disabled in gcode_macro.cfg file..."
fi
echo
local yn_prusa
while true; do
read -p " Do you want to enable needed macros for PrusaSlicer? (${yellow}y${white}/${yellow}n${white}): ${yellow}" yn_prusa
case "${yn_prusa}" in
Y|y)
echo -e "${white}"
if grep -q "#\[include Prusa_Slicer.cfg\]" "$KAMP_FOLDER"/KAMP_Settings.cfg ; then
echo -e "Info: Enabling [include Prusa_Slicer.cfg] in KAMP_Settings.cfg file..."
sed -i 's/^#\[include Prusa_Slicer\.cfg\]/[include Prusa_Slicer.cfg]/' "$KAMP_FOLDER"/KAMP_Settings.cfg
else
echo -e "Info: [include Prusa_Slicer.cfg] is already enabled in KAMP_Settings.cfg file..."
fi
break;;
N|n)
echo -e "${white}"
break;;
*)
error_msg "Please select a correct choice!";;
esac
done
echo -e "Info: Restarting Klipper service..."
restart_klipper
ok_msg "Klipper Adaptive Meshing & Purging has been installed successfully!"
echo -e " Make sure Label Objects setting is enabled in your slicer."
return;;
N|n)
error_msg "Installation canceled!"
return;;
*)
error_msg "Please select a correct choice!";;
esac
done
}
function remove_kamp(){
kamp_message
local yn
while true; do
remove_msg "Klipper Adaptive Meshing & Purging" yn
case "${yn}" in
Y|y)
echo -e "${white}"
echo -e "Info: Removing files..."
rm -rf "$HS_CONFIG_FOLDER"/KAMP
if grep -q "include Helper-Script/KAMP/KAMP_Settings" "$PRINTER_CFG" ; then
echo -e "Info: Removing KAMP configurations in printer.cfg file..."
sed -i '/include Helper-Script\/KAMP\/KAMP_Settings\.cfg/d' "$PRINTER_CFG"
else
echo -e "Info: KAMP configurations are already removed in printer.cfg file..."
fi
if grep -q "#\[gcode_macro START_PRINT\]" "$MACROS_CFG" ; then
echo -e "Info: Enabling [gcode_macro START_PRINT] in gcode_macro.cfg file..."
sed -i -e 's/^\s*#[[:space:]]*\[gcode_macro START_PRINT\]/[gcode_macro START_PRINT]/' -e '/^\[gcode_macro START_PRINT\]/,/^\s*$/ s/^\(\s*\)#/\1/' "$MACROS_CFG"
else
echo -e "Info: [gcode_macro START_PRINT] is already enabled in gcode_macro.cfg file..."
fi
if [ ! -n "$(ls -A "$HS_CONFIG_FOLDER")" ]; then
rm -rf "$HS_CONFIG_FOLDER"
fi
echo -e "Info: Restarting Klipper service..."
restart_klipper
ok_msg "Klipper Adaptive Meshing & Purging has been removed successfully!"
return;;
N|n)
error_msg "Deletion canceled!"
return;;
*)
error_msg "Please select a correct choice!";;
esac
done
}

117
scripts/m600_support.sh Executable file
View file

@ -0,0 +1,117 @@
#!/bin/sh
set -e
function m600_support_message(){
top_line
title 'M600 Support' "${yellow}"
inner_line
hr
echo -e "${cyan}It allows to use M600 command in your slicer to change ${white}"
echo -e "${cyan}filament. ${white}"
hr
bottom_line
}
function install_m600_support(){
m600_support_message
local yn
while true; do
install_msg "M600 Support" yn
case "${yn}" in
Y|y)
echo -e "${white}"
if [ -f "$HS_CONFIG_FOLDER"/M600-support.cfg ]; then
rm -f "$HS_CONFIG_FOLDER"/M600-support.cfg
fi
if [ ! -d "$HS_CONFIG_FOLDER" ]; then
mkdir -p "$HS_CONFIG_FOLDER"
fi
echo -e "Info: Linking file..."
ln -sf "$M600_SUPPORT_URL" "$HS_CONFIG_FOLDER"/M600-support.cfg
if grep -q "include Helper-Script/M600-support" "$PRINTER_CFG" ; then
echo -e "Info: M600 Support configurations are already enabled in printer.cfg file..."
else
echo -e "Info: Adding M600 Support configurations in printer.cfg file..."
sed -i '/\[include printer_params\.cfg\]/a \[include Helper-Script/M600-support\.cfg\]' "$PRINTER_CFG"
fi
if grep -q "\[idle_timeout\]" "$PRINTER_CFG" ; then
echo -e "Info: Disabling [idle_timeout] configurations in printer.cfg file..."
sed -i '/^\[idle_timeout\]/,/^\s*$/ s/^\(\s*\)\([^#]\)/#\1\2/' "$PRINTER_CFG"
else
echo -e "Info: [idle_timeout] configurations are already disabled in printer.cfg file..."
fi
if grep -q "\[filament_switch_sensor filament_sensor\]" "$PRINTER_CFG" ; then
echo -e "Info: Disabling [filament_switch_sensor] configurations in printer.cfg file..."
sed -i '/^\[filament_switch_sensor filament_sensor\]/,/^\s*$/ s/^\(\s*\)\([^#]\)/#\1\2/' "$PRINTER_CFG"
else
echo -e "Info: [filament_switch_sensor] configurations are already disabled in printer.cfg file..."
fi
if grep -q "\[gcode_macro RESUME\]" "$MACROS_CFG" ; then
echo -e "Info: Disabling [gcode_macro RESUME] in gcode_macro.cfg file..."
sed -i '/^\[gcode_macro RESUME\]/,/^\s*$/ s/^\(\s*\)\([^#]\)/#\1\2/' "$MACROS_CFG"
else
echo -e "Info: [gcode_macro RESUME] is already disabled in gcode_macro.cfg file..."
fi
echo -e "Info: Restarting Klipper service..."
restart_klipper
ok_msg "M600 Support has been installed successfully!"
return;;
N|n)
error_msg "Installation canceled!"
return;;
*)
error_msg "Please select a correct choice!";;
esac
done
}
function remove_m600_support(){
m600_support_message
local yn
while true; do
remove_msg "M600 Support" yn
case "${yn}" in
Y|y)
echo -e "${white}"
echo -e "Info: Removing file..."
rm -f "$HS_CONFIG_FOLDER"/M600-support.cfg
if grep -q "include Helper-Script/M600-support" "$PRINTER_CFG" ; then
echo -e "Info: Removing M600 Support configurations in printer.cfg file..."
sed -i '/include Helper-Script\/M600-support\.cfg/d' "$PRINTER_CFG"
else
echo -e "Info: M600 Support configurations are already removed in printer.cfg file..."
fi
if grep -q "#\[idle_timeout\]" "$PRINTER_CFG" ; then
echo -e "Info: Enabling [idle_timeout] configurations in printer.cfg file..."
sed -i -e 's/^\s*#[[:space:]]*\[idle_timeout\]/[idle_timeout]/' -e '/^\[idle_timeout\]/,/^\s*$/ s/^\(\s*\)#/\1/' "$PRINTER_CFG"
else
echo -e "Info: [idle_timeout] configurations are already enabled in printer.cfg file..."
fi
if grep -q "#\[filament_switch_sensor filament_sensor\]" "$PRINTER_CFG" ; then
echo -e "Info: Enabling [filament_switch_sensor] configurations in printer.cfg file..."
sed -i -e 's/^\s*#[[:space:]]*\[filament_switch_sensor filament_sensor\]/[filament_switch_sensor filament_sensor]/' -e '/^\[filament_switch_sensor filament_sensor\]/,/^\s*$/ s/^\(\s*\)#/\1/' "$PRINTER_CFG"
else
echo -e "Info: [filament_switch_sensor] configurations are already enabled in printer.cfg file..."
fi
if grep -q "#\[gcode_macro RESUME\]" "$MACROS_CFG" ; then
echo -e "Info: Enabling [gcode_macro RESUME] in gcode_macro.cfg file..."
sed -i -e 's/^\s*#[[:space:]]*\[gcode_macro RESUME\]/[gcode_macro RESUME]/' -e '/^\[gcode_macro RESUME\]/,/^\s*$/ s/^\(\s*\)#/\1/' "$MACROS_CFG"
else
echo -e "Info: [gcode_macro RESUME] is already enabled in gcode_macro.cfg file..."
fi
if [ ! -n "$(ls -A "$HS_CONFIG_FOLDER")" ]; then
rm -rf "$HS_CONFIG_FOLDER"
fi
echo -e "Info: Restarting Klipper service..."
restart_klipper
ok_msg "M600 Support has been removed successfully!"
return;;
N|n)
error_msg "Deletion canceled!"
return;;
*)
error_msg "Please select a correct choice!";;
esac
done
}

91
scripts/mainsail.sh Executable file
View file

@ -0,0 +1,91 @@
#!/bin/sh
set -e
function mainsail_message(){
top_line
title 'Mainsail' "${yellow}"
inner_line
hr
echo -e "${cyan}Mainsail makes Klipper more accessible by adding a ${white}"
echo -e "${cyan}lightweight, responsive web user interface, centred around ${white}"
echo -e "${cyan}an intuitive and consistent design philosophy. ${white}"
echo -e "${cyan}It will be accessible on port 4409. ${white}"
hr
bottom_line
}
function install_mainsail(){
mainsail_message
local yn
while true; do
install_msg "Mainsail" yn
case "${yn}" in
Y|y)
echo -e "${white}"
echo -e "Info: Downloading Mainsail file..."
"$CURL" -L "$MAINSAIL_URL" -o "$USR_DATA"/mainsail.zip
echo -e "Info: Creating directory..."
if [ -d "$MAINSAIL_FOLDER" ]; then
rm -rf "$MAINSAIL_FOLDER"
fi
mkdir -p "$MAINSAIL_FOLDER"
mv "$USR_DATA"/mainsail.zip "$MAINSAIL_FOLDER"
echo -e "Info: Extracting files..."
unzip "$MAINSAIL_FOLDER"/mainsail.zip -d "$MAINSAIL_FOLDER"
echo -e "Info: Removing file..."
rm -f "$MAINSAIL_FOLDER"/mainsail.zip
if grep -q "#\[update_manager mainsail\]" "$MOONRAKER_CFG" ; then
echo -e "Info: Enabling Mainsail configurations for Update Manager..."
sed -i -e 's/^\s*#[[:space:]]*\[update_manager mainsail\]/[update_manager mainsail]/' -e '/^\[update_manager mainsail\]/,/^\s*$/ s/^\(\s*\)#/\1/' "$MOONRAKER_CFG"
else
echo -e "Info: Mainsail configurations are already enabled for Update Manager..."
fi
echo -e "Info: Retarting Nginx service..."
restart_nginx
echo -e "Info: Restarting Moonraker service..."
stop_moonraker
start_moonraker
ok_msg "Mainsail has been installed successfully!"
echo -e " You can now connect to Mainsail Web Interface with ${yellow}http://$(check_ipaddress):4409${white}"
return;;
N|n)
error_msg "Installation canceled!"
return;;
*)
error_msg "Please select a correct choice!";;
esac
done
}
function remove_mainsail(){
mainsail_message
local yn
while true; do
remove_msg "Mainsail" yn
case "${yn}" in
Y|y)
echo -e "${white}"
echo -e "Info: Removing files..."
rm -rf "$MAINSAIL_FOLDER"
if grep -q "\[update_manager mainsail\]" "$MOONRAKER_CFG" ; then
echo -e "Info: Disabling Mainsail configurations for Update Manager..."
sed -i '/^\[update_manager mainsail\]/,/^\s*$/ s/^\(\s*\)\([^#]\)/#\1\2/' "$MOONRAKER_CFG"
echo -e "Info: Retarting Nginx service..."
restart_nginx
echo -e "Info: Restarting Moonraker service..."
stop_moonraker
start_moonraker
else
echo -e "Info: Mainsail configurations are already disabled for Update Manager..."
fi
ok_msg "Mainsail has been removed successfully!"
return;;
N|n)
error_msg "Deletion canceled!"
return;;
*)
error_msg "Please select a correct choice!";;
esac
done
}

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
}

View file

@ -0,0 +1,83 @@
#!/bin/sh
set -e
function mobileraker_companion_message(){
top_line
title 'Mobileraker Companion' "${yellow}"
inner_line
hr
echo -e "${cyan}Mobileraker Companion allows to push notification for ${white}"
echo -e "${cyan}Klipper using Moonraker for Mobileraker phone App. ${white}"
hr
bottom_line
}
function install_mobileraker_companion(){
mobileraker_companion_message
local yn
while true; do
install_msg "Mobileraker Companion" yn
case "${yn}" in
Y|y)
echo -e "${white}"
echo -e "Info: Downloading Mobileraker Companion..."
git config --global http.sslVerify false
git clone "$MOBILERAKER_COMPANION_URL" "$MOBILERAKER_COMPANION_FOLDER"
echo -e "Info: Running Mobileraker Companion installer..."
sh "$MOBILERAKER_COMPANION_FOLDER"/scripts/install.sh
echo
if grep -q "#\[update_manager mobileraker\]" "$MOONRAKER_CFG" ; then
echo -e "Info: Enabling Mobileraker Companion configurations for Update Manager..."
sed -i -e 's/^\s*#[[:space:]]*\[update_manager mobileraker\]/[update_manager mobileraker]/' -e '/^\[update_manager mobileraker\]/,/^\s*$/ s/^\(\s*\)#/\1/' "$MOONRAKER_CFG"
else
echo -e "Info: Mobileraker Companion configurations are already enabled for Update Manager..."
fi
echo -e "Info: Restarting Moonraker service..."
stop_moonraker
start_moonraker
echo -e "Info: Restarting Klipper service..."
restart_klipper
ok_msg "Mobileraker Companion has been installed successfully!"
return;;
N|n)
error_msg "Installation canceled!"
return;;
*)
error_msg "Please select a correct choice!";;
esac
done
}
function remove_mobileraker_companion(){
mobileraker_companion_message
local yn
while true; do
remove_msg "Mobileraker Companion" yn
case "${yn}" in
Y|y)
echo -e "${white}"
echo -e "Info: Running Mobileraker Companion uninstaller..."
sh "$MOBILERAKER_COMPANION_FOLDER"/scripts/install.sh -uninstall
echo
if grep -q "\[update_manager mobileraker\]" "$MOONRAKER_CFG" ; then
echo -e "Info: Disabling Mobileraker Companion configurations for Update Manager..."
sed -i '/^\[update_manager mobileraker\]/,/^\s*$/ s/^\(\s*\)\([^#]\)/#\1\2/' "$MOONRAKER_CFG"
else
echo -e "Info: Mobileraker Companion configurations are already disabled for Update Manager..."
fi
echo -e "Info: Restarting Moonraker service..."
stop_moonraker
start_moonraker
echo -e "Info: Restarting Klipper service..."
restart_klipper
ok_msg "Mobileraker Companion has been removed successfully!"
return;;
N|n)
error_msg "Deletion canceled!"
return;;
*)
error_msg "Please select a correct choice!";;
esac
done
}

107
scripts/moonraker_nginx.sh Executable file
View file

@ -0,0 +1,107 @@
#!/bin/sh
set -e
function moonraker_nginx_message(){
top_line
title 'Moonraker and Nginx' "${yellow}"
inner_line
hr
echo -e "${cyan}Moonraker is a Python 3 based web server that exposes APIs ${white}"
echo -e "${cyan}with which client applications may use to interact with ${white}"
echo -e "${cyan}Klipper firmware. ${white}"
echo -e "${cyan}Nginx is a web server that can also be used as a reverse ${white}"
echo -e "${cyan}proxy, load balancer, mail proxy and HTTP cache. ${white}"
hr
bottom_line
}
function install_moonraker_nginx(){
moonraker_nginx_message
local yn
while true; do
install_msg "Moonraker and Nginx" yn
case "${yn}" in
Y|y)
echo -e "${white}"
echo -e "Info: Extracting files..."
tar -xvf "$MOONRAKER_URL1" -C "$USR_DATA"
echo -e "Info: Copying services files..."
if [ ! -f "$INITD_FOLDER"/S50nginx ]; then
cp "$NGINX_SERVICE_URL" "$INITD_FOLDER"/S50nginx
chmod +x "$INITD_FOLDER"/S50nginx
fi
if [ ! -f "$INITD_FOLDER"/S56moonraker_service ]; then
cp "$MOONRAKER_SERVICE_URL" "$INITD_FOLDER"/S56moonraker_service
chmod +x "$INITD_FOLDER"/S56moonraker_service
fi
echo -e "Info: Copying Moonraker configuration file..."
cp "$MOONRAKER_URL2" "$KLIPPER_CONFIG_FOLDER"/moonraker.conf
if [ -f "$PRINTER_DATA_FOLDER"/moonraker.asvc ]; then
rm -f "$PRINTER_DATA_FOLDER"/moonraker.asvc
fi
cp "$MOONRAKER_URL3" "$PRINTER_DATA_FOLDER"/moonraker.asvc
echo -e "Info: Applying changes from official repo..."
cd "$MOONRAKER_FOLDER"/moonraker
git stash; git checkout master; git pull
echo -e "Info: Installing Supervisor Lite..."
chmod 755 "$SUPERVISOR_URL"
ln -sf "$SUPERVISOR_URL" "$SUPERVISOR_FILE"
echo -e "Info: Installing Host Controls Support..."
chmod 755 "$SUDO_URL"
chmod 755 "$SYSTEMCTL_URL"
ln -sf "$SUDO_URL" "$SUDO_FILE"
ln -sf "$SYSTEMCTL_URL" "$SYSTEMCTL_FILE"
echo -e "Info: Installing necessary packages..."
cd "$MOONRAKER_FOLDER"/moonraker-env/bin
python3 -m pip install --no-cache-dir pyserial-asyncio==0.6
echo -e "Info: Starting Nginx service..."
start_nginx
echo -e "Info: Starting Moonraker service..."
start_moonraker
ok_msg "Moonraker and Nginx have been installed successfully!"
return;;
N|n)
error_msg "Installation canceled!"
return;;
*)
error_msg "Please select a correct choice!";;
esac
done
}
function remove_moonraker_nginx(){
moonraker_nginx_message
local yn
while true; do
remove_msg "Moonraker and Nginx" yn
case "${yn}" in
Y|y)
echo -e "${white}"
echo -e "Info: Stopping Moonraker and Nginx services..."
cd /overlay/upper
stop_moonraker
stop_nginx
echo -e "Info: Removing files..."
rm -f "$INITD_FOLDER"/S50nginx
rm -f "$INITD_FOLDER"/S56moonraker_service
rm -f "$KLIPPER_CONFIG_FOLDER"/moonraker.conf
rm -f "$KLIPPER_CONFIG_FOLDER"/.moonraker.conf.bkp
rm -f "$PRINTER_DATA_FOLDER"/.moonraker.uuid
rm -f "$PRINTER_DATA_FOLDER"/moonraker.asvc
rm -rf "$PRINTER_DATA_FOLDER"/comms
rm -rf "$NGINX_FOLDER"
rm -rf "$MOONRAKER_FOLDER"
rm -f "$SUPERVISOR_FILE"
rm -f "$SUDO_FILE"
rm -f "$SYSTEMCTL_FILE"
ok_msg "Moonraker and Nginx have been removed successfully!"
return;;
N|n)
error_msg "Deletion canceled!"
return;;
*)
error_msg "Please select a correct choice!";;
esac
done
}

90
scripts/moonraker_obico.sh Executable file
View file

@ -0,0 +1,90 @@
#!/bin/sh
set -e
function moonraker_obico_message(){
top_line
title 'Moonraker Obico' "${yellow}"
inner_line
hr
echo -e "${cyan}Obico is a Moonraker plugin that allows you to monitor and ${white}"
echo -e "${cyan}control your 3D printer from anywhere. ${white}"
hr
bottom_line
}
function install_moonraker_obico(){
moonraker_obico_message
local yn
while true; do
install_msg "Moonraker Obico" yn
case "${yn}" in
Y|y)
echo -e "${white}"
if [ -d "$MOONRAKER_OBICO_FOLDER" ]; then
echo -e "Info: Moonraker Obico is already installed. Download skipped."
else
echo -e "Info: Downloading Moonraker Obico..."
git config --global http.sslVerify false
git clone "$MOONRAKER_OBICO_URL" "$MOONRAKER_OBICO_FOLDER"
fi
echo -e "Info: Running Moonraker Obico installer..."
cd "$MOONRAKER_OBICO_FOLDER"
sh ./scripts/install_creality.sh -k
ok_msg "Moonraker Obico has been installed successfully!"
return;;
N|n)
error_msg "Installation canceled!"
return;;
*)
error_msg "Please select a correct choice!";;
esac
done
}
function remove_moonraker_obico(){
moonraker_obico_message
local yn
while true; do
remove_msg "Moonraker Obico" yn
case "${yn}" in
Y|y)
echo -e "${white}"
if grep -q "include moonraker_obico_macros" "$PRINTER_CFG" ; then
echo -e "Info: Removing Moonraker Obico configurations in printer.cfg file..."
sed -i '/include moonraker_obico_macros\.cfg/d' "$PRINTER_CFG"
else
echo -e "Info: Moonraker Obico configurations are already removed in printer.cfg file..."
fi
if grep -q "\[include moonraker-obico-update.cfg\]" "$MOONRAKER_CFG" ; then
echo -e "Info: Removing Moonraker Obico configurations in moonraker.conf file..."
sed -i '/include moonraker-obico-update\.cfg/d' "$MOONRAKER_CFG"
else
echo -e "Info: Moonraker Obico configurations are already removed in moonraker.conf file..."
fi
echo -e "Info: Removing files..."
rm -rf "$MOONRAKER_OBICO_FOLDER"
rm -rf /usr/data/moonraker-obico-env
rm -f "$KLIPPER_CONFIG_FOLDER"/moonraker-obico-update.cfg
rm -f "$KLIPPER_CONFIG_FOLDER"/config/moonraker-obico.cfg
rm -f /etc/init.d/S99moonraker_obico
if [ -f "$ENTWARE_FILE" ]; then
echo -e "Info: Removing packages..."
"$ENTWARE_FILE" --autoremove remove python3
"$ENTWARE_FILE" --autoremove remove python3-pip
fi
echo -e "Info: Restarting Moonraker service..."
stop_moonraker
start_moonraker
echo -e "Info: Restarting Klipper service..."
restart_klipper
ok_msg "Moonraker Obico has been removed successfully!"
return;;
N|n)
error_msg "Deletion canceled!"
return;;
*)
error_msg "Please select a correct choice!";;
esac
done
}

101
scripts/moonraker_timelapse.sh Executable file
View file

@ -0,0 +1,101 @@
#!/bin/sh
set -e
function moonraker_timelapse_message(){
top_line
title 'Moonraker Timelapse' "${yellow}"
inner_line
hr
echo -e "${cyan}Moonraker Timelapse is a 3rd party Moonraker component to ${white}"
echo -e "${cyan}create timelapse of 3D prints. ${white}"
hr
bottom_line
}
function install_moonraker_timelapse(){
moonraker_timelapse_message
local yn
while true; do
install_msg "Moonraker Timelapse" yn
case "${yn}" in
Y|y)
echo -e "${white}"
if [ -f "$HS_CONFIG_FOLDER"/timelapse.cfg ]; then
rm -f "$HS_CONFIG_FOLDER"/timelapse.cfg
fi
if [ ! -d "$HS_CONFIG_FOLDER" ]; then
mkdir -p "$HS_CONFIG_FOLDER"
fi
echo -e "Info: Linking file..."
ln -sf "$TIMELAPSE_URL1" "$TIMELAPSE_FILE"
ln -sf "$TIMELAPSE_URL2" "$HS_CONFIG_FOLDER"/timelapse.cfg
if grep -q "include Helper-Script/timelapse" "$PRINTER_CFG" ; then
echo -e "Info: Moonraker Timelapse configurations are already enabled in printer.cfg file..."
else
echo -e "Info: Adding Moonraker Timelapse configurations in printer.cfg file..."
sed -i '/\[include printer_params\.cfg\]/a \[include Helper-Script/timelapse\.cfg\]' "$PRINTER_CFG"
fi
if grep -q "#\[timelapse\]" "$MOONRAKER_CFG" ; then
echo -e "Info: Enabling Moonraker Timelapse configurations in moonraker.conf file..."
sed -i -e 's/^\s*#[[:space:]]*\[timelapse\]/[timelapse]/' -e '/^\[timelapse\]/,/^\s*$/ s/^\(\s*\)#/\1/' "$MOONRAKER_CFG"
else
echo -e "Info: Moonraker Timelapse configurations are already enabled in moonraker.conf file..."
fi
echo -e "Info: Updating ffmpeg..."
"$ENTWARE_FILE" update && "$ENTWARE_FILE" upgrade ffmpeg
echo -e "Info: Restarting Klipper service..."
restart_klipper
ok_msg "Moonraker Timelapse has been installed successfully!"
return;;
N|n)
error_msg "Installation canceled!"
return;;
*)
error_msg "Please select a correct choice!";;
esac
done
}
function remove_moonraker_timelapse(){
moonraker_timelapse_message
local yn
while true; do
remove_msg "Moonraker Timelapse" yn
case "${yn}" in
Y|y)
echo -e "${white}"
echo -e "Info: Removing files..."
rm -f "$HS_CONFIG_FOLDER"/timelapse.cfg
rm -f /usr/data/moonraker/moonraker/moonraker/components/timelapse.py
rm -f /usr/data/moonraker/moonraker/moonraker/components/timelapse.pyc
if [ -f /opt/bin/ffmpeg ]; then
"$ENTWARE_FILE" --autoremove remove ffmpeg
fi
if grep -q "include Helper-Script/timelapse" "$PRINTER_CFG" ; then
echo -e "Info: Removing Moonraker Timelapse configurations in printer.cfg file..."
sed -i '/include Helper-Script\/timelapse\.cfg/d' "$PRINTER_CFG"
else
echo -e "Info: Moonraker Timelapse configurations are already removed in printer.cfg file..."
fi
if grep -q "\[timelapse\]" "$MOONRAKER_CFG" ; then
echo -e "Info: Disabling Moonraker Timelapse configurations in moonraker.conf file..."
sed -i '/^\[timelapse\]/,/^\s*$/ s/^\(\s*\)\([^#]\)/#\1\2/' "$MOONRAKER_CFG"
else
echo -e "Info: Moonraker Timelapse configurations are already disabled in moonraker.conf file..."
fi
if [ ! -n "$(ls -A "$HS_CONFIG_FOLDER")" ]; then
rm -rf "$HS_CONFIG_FOLDER"
fi
echo -e "Info: Restarting Klipper service..."
restart_klipper
ok_msg "Moonraker Timelapse has been removed successfully!"
return;;
N|n)
error_msg "Deletion canceled!"
return;;
*)
error_msg "Please select a correct choice!";;
esac
done
}

View file

@ -0,0 +1,85 @@
#!/bin/sh
set -e
function nozzle_cleaning_fan_control_message(){
top_line
title 'Nozzle Cleaning Fan Control' "${yellow}"
inner_line
hr
echo -e "${cyan}This is an Klipper extension to control fans during nozzle ${white}"
echo -e "${cyan}cleaning. ${white}"
hr
bottom_line
}
function install_nozzle_cleaning_fan_control(){
nozzle_cleaning_fan_control_message
local yn
while true; do
install_msg "Nozzle Cleaning Fan Control" yn
case "${yn}" in
Y|y)
echo -e "${white}"
if [ -d "NOZZLE_CLEANING_FOLDER" ]; then
rm -rf "NOZZLE_CLEANING_FOLDER"
fi
mkdir -p "$NOZZLE_CLEANING_FOLDER"
echo -e "Info: Linking files..."
ln -sf "$NOZZLE_CLEANING_URL1" "$NOZZLE_CLEANING_FOLDER"/__init__.py
ln -sf "$NOZZLE_CLEANING_URL2" "$NOZZLE_CLEANING_FOLDER"/prtouch_v2_fan.pyc
if [ ! -d "$HS_CONFIG_FOLDER" ]; then
mkdir -p "$HS_CONFIG_FOLDER"
fi
ln -sf "$NOZZLE_CLEANING_URL3" "$HS_CONFIG_FOLDER"/nozzle-cleaning-fan-control.cfg
if grep -q "include Helper-Script/nozzle-cleaning-fan-control" "$PRINTER_CFG" ; then
echo -e "Info: Nozzle Cleaning Fan Control configurations are already enabled in printer.cfg file..."
else
echo -e "Info: Adding Nozzle Cleaning Fan Control configurations in printer.cfg file..."
sed -i '/\[include printer_params\.cfg\]/a \[include Helper-Script/nozzle-cleaning-fan-control\.cfg\]' "$PRINTER_CFG"
fi
echo -e "Info: Restarting Klipper service..."
restart_klipper
ok_msg "Nozzle Cleaning Fan Control has been installed successfully!"
return;;
N|n)
error_msg "Installation canceled!"
return;;
*)
error_msg "Please select a correct choice!";;
esac
done
}
function remove_nozzle_cleaning_fan_control(){
nozzle_cleaning_fan_control_message
local yn
while true; do
remove_msg "Nozzle Cleaning Fan Control" yn
case "${yn}" in
Y|y)
echo -e "${white}"
echo -e "Info: Removing files..."
rm -rf "$NOZZLE_CLEANING_FOLDER"
rm -f "$HS_CONFIG_FOLDER"/nozzle-cleaning-fan-control.cfg
if grep -q "include Helper-Script/nozzle-cleaning-fan-control" "$PRINTER_CFG" ; then
echo -e "Info: Removing Nozzle Cleaning Fan Control configurations in printer.cfg file..."
sed -i '/include Helper-Script\/nozzle-cleaning-fan-control\.cfg/d' "$PRINTER_CFG"
else
echo -e "Info: Nozzle Cleaning Fan Control configurations are already removed in printer.cfg file..."
fi
if [ ! -n "$(ls -A "$HS_CONFIG_FOLDER")" ]; then
rm -rf "$HS_CONFIG_FOLDER"
fi
echo -e "Info: Restarting Klipper service..."
restart_klipper
ok_msg "Nozzle Cleaning Fan Control has been removed successfully!"
return;;
N|n)
error_msg "Deletion canceled!"
return;;
*)
error_msg "Please select a correct choice!";;
esac
done
}

66
scripts/octoeverywhere.sh Executable file
View file

@ -0,0 +1,66 @@
#!/bin/sh
set -e
function octoeverywhere_message(){
top_line
title 'OctoEverywhere' "${yellow}"
inner_line
hr
echo -e "${cyan}Cloud empower your Klipper printers with free, private, and ${white}"
echo -e "${cyan}unlimited remote access to your full web control portal from ${white}"
echo -e "${cyan}anywhere! ${white}"
hr
bottom_line
}
function install_octoeverywhere(){
octoeverywhere_message
local yn
while true; do
install_msg "OctoEverywhere" yn
case "${yn}" in
Y|y)
echo -e "${white}"
if [ -d "$OCTOEVERYWHERE_FOLDER" ]; then
echo -e "Info: OctoEverywhere is already installed. Download skipped."
else
echo -e "Info: Downloading OctoEverywhere..."
git config --global http.sslVerify false
git clone "$OCTOEVERYWHERE_URL" "$OCTOEVERYWHERE_FOLDER"
fi
echo -e "Info: Running OctoEverywhere installer..."
cd "$OCTOEVERYWHERE_FOLDER"
sh ./install.sh
ok_msg "OctoEverywhere has been installed successfully!"
return;;
N|n)
error_msg "Installation canceled!"
return;;
*)
error_msg "Please select a correct choice!";;
esac
done
}
function remove_octoeverywhere(){
octoeverywhere_message
local yn
while true; do
remove_msg "OctoEverywhere" yn
case "${yn}" in
Y|y)
echo -e "${white}"
echo -e "Info: Running OctoEverywhere installer..."
cd "$OCTOEVERYWHERE_FOLDER"
sh ./uninstall.sh
ok_msg "OctoEverywhere has been removed successfully!"
return;;
N|n)
error_msg "Deletion canceled!"
return;;
*)
error_msg "Please select a correct choice!";;
esac
done
}

173
scripts/paths.sh Executable file
View file

@ -0,0 +1,173 @@
#!/bin/sh
set -e
function set_paths() {
# Colors #
white=`echo -en "\033[m"`
blue=`echo -en "\033[36m"`
cyan=`echo -en "\033[1;36m"`
yellow=`echo -en "\033[1;33m"`
green=`echo -en "\033[01;32m"`
darkred=`echo -en "\033[31m"`
red=`echo -en "\033[01;31m"`
# System #
CURL="${HELPER_SCRIPT_FOLDER}/files/fixes/curl"
INITD_FOLDER="/etc/init.d"
USR_DATA="/usr/data"
PRINTER_DATA_FOLDER="$USR_DATA/printer_data"
# Helper Script #
HS_FILES="${HELPER_SCRIPT_FOLDER}/files"
HS_CONFIG_FOLDER="$PRINTER_DATA_FOLDER/config/Helper-Script"
HS_BACKUP_FOLDER="$USR_DATA/helper-script-backup"
# Configuration Files #
MOONRAKER_CFG="${PRINTER_DATA_FOLDER}/config/moonraker.conf"
PRINTER_CFG="${PRINTER_DATA_FOLDER}/config/printer.cfg"
MACROS_CFG="${PRINTER_DATA_FOLDER}/config/gcode_macro.cfg"
# Moonraker #
MOONRAKER_FOLDER="${USR_DATA}/moonraker"
MOONRAKER_URL1="${HS_FILES}/moonraker/moonraker.tar.gz"
MOONRAKER_URL2="${HS_FILES}/moonraker/moonraker.conf"
MOONRAKER_URL3="${HS_FILES}/moonraker/moonraker.asvc"
MOONRAKER_SERVICE_URL="${HS_FILES}/services/S56moonraker_service"
# Nginx #
NGINX_FOLDER="${USR_DATA}/nginx"
NGINX_SERVICE_URL="${HS_FILES}/services/S50nginx"
# Supervisor Lite #
SUPERVISOR_FILE="/usr/bin/supervisorctl"
SUPERVISOR_URL="${HS_FILES}/fixes/supervisorctl"
# Host Controls Support #
SYSTEMCTL_FILE="/usr/bin/systemctl"
SYSTEMCTL_URL="${HS_FILES}/fixes/systemctl"
SUDO_FILE="/usr/bin/sudo"
SUDO_URL="${HS_FILES}/fixes/sudo"
# Klipper #
KLIPPER_EXTRAS_FOLDER="/usr/share/klipper/klippy/extras"
KLIPPER_CONFIG_FOLDER="${PRINTER_DATA_FOLDER}/config"
KLIPPER_KLIPPY_FOLDER="/usr/share/klipper/klippy"
KLIPPER_SERVICE_URL="${HS_FILES}/services/S55klipper_service"
KLIPPER_GCODE_URL="${HS_FILES}/fixes/gcode.py"
# Fluidd #
FLUIDD_FOLDER="${USR_DATA}/fluidd"
FLUIDD_URL="https://github.com/fluidd-core/fluidd/releases/latest/download/fluidd.zip"
# Mainsail #
MAINSAIL_FOLDER="${USR_DATA}/mainsail"
MAINSAIL_URL="https://github.com/mainsail-crew/mainsail/releases/latest/download/mainsail.zip"
# Entware #
ENTWARE_FILE="/opt/bin/opkg"
ENTWARE_URL="${HS_FILES}/entware/generic.sh"
# Klipper Gcode Shell Command #
KLIPPER_SHELL_FILE="${KLIPPER_EXTRAS_FOLDER}/gcode_shell_command.py"
KLIPPER_SHELL_URL="${HS_FILES}/gcode-shell-command/gcode_shell_command.py"
# Klipper Adaptive Meshing & Purging #
KAMP_FOLDER="${HS_CONFIG_FOLDER}/KAMP"
KAMP_URL="${HS_FILES}/kamp"
# Buzzer Support #
BUZZER_FILE="${HS_CONFIG_FOLDER}/buzzer-support.cfg"
BUZZER_URL="${HS_FILES}/buzzer-support/buzzer-support.cfg"
# Nozzle Cleaning Fan Control #
NOZZLE_CLEANING_FOLDER="${KLIPPER_EXTRAS_FOLDER}/prtouch_v2_fan"
NOZZLE_CLEANING_URL1="${HS_FILES}/nozzle-cleaning-fan-control/__init__.py"
NOZZLE_CLEANING_URL2="${HS_FILES}/nozzle-cleaning-fan-control/prtouch_v2_fan.pyc"
NOZZLE_CLEANING_URL3="${HS_FILES}/nozzle-cleaning-fan-control/nozzle-cleaning-fan-control.cfg"
# Fans Control Macros #
FAN_CONTROLS_FILE="${HS_CONFIG_FOLDER}/fans-control.cfg"
FAN_CONTROLS_URL="${HS_FILES}/macros/fans-control.cfg"
# Improved Shapers Calibrations #
IMP_SHAPERS_FOLDER="${HS_CONFIG_FOLDER}/improved-shapers"
IMP_SHAPERS_URL="${HS_FILES}/improved-shapers/"
# Useful Macros #
USEFUL_MACROS_FILE="${HS_CONFIG_FOLDER}/useful-macros.cfg"
USEFUL_MACROS_URL="${HS_FILES}/macros/useful-macros.cfg"
# Save Z-Offset Macros #
SAVE_ZOFFSET_FILE="${HS_CONFIG_FOLDER}/save-zoffset.cfg"
SAVE_ZOFFSET_URL="${HS_FILES}/macros/save-zoffset.cfg"
# Screws Tilt Adjust Support #
SCREWS_ADJUST_FILE="${HS_CONFIG_FOLDER}/screws-tilt-adjust.cfg"
SCREWS_ADJUST_URL="${HS_FILES}/screws-tilt-adjust/screws_tilt_adjust.py"
SCREWS_ADJUST_K1_URL="${HS_FILES}/screws-tilt-adjust/screws-tilt-adjust-k1.cfg"
SCREWS_ADJUST_K1M_URL="${HS_FILES}/screws-tilt-adjust/screws-tilt-adjust-k1max.cfg"
# Virtual Pins Support #
VIRTUAL_PINS_FILE="${KLIPPER_EXTRAS_FOLDER}/virtual_pins.py"
VIRTUAL_PINS_URL="${HS_FILES}/klipper-virtual-pins/virtual_pins.py"
# M600 Support #
M600_SUPPORT_FILE="${HS_CONFIG_FOLDER}/M600-support.cfg"
M600_SUPPORT_URL="${HS_FILES}/macros/M600-support.cfg"
# Git Backup #
GIT_BACKUP_INSTALLER="${HS_FILES}/git-backup/git-backup.sh"
GIT_BACKUP_FILE="${HS_CONFIG_FOLDER}/git-backup.cfg"
GIT_BACKUP_URL="${HS_FILES}/git-backup/git-backup.cfg"
# Moonraker Timelapse #
TIMELAPSE_FILE="${USR_DATA}/moonraker/moonraker/moonraker/components/timelapse.py"
TIMELAPSE_URL1="${HS_FILES}/moonraker-timelapse/timelapse.py"
TIMELAPSE_URL2="${HS_FILES}/moonraker-timelapse/timelapse.cfg"
# Camera Settings Control #
CAMERA_SETTINGS_FILE="${HS_CONFIG_FOLDER}/camera-settings.cfg"
CAMERA_SETTINGS_URL="${HS_FILES}/camera-settings/camera-settings.cfg"
# OctoEverywhere #
OCTOEVERYWHERE_FOLDER="${USR_DATA}/octoeverywhere"
OCTOEVERYWHERE_URL="https://github.com/QuinnDamerell/OctoPrint-OctoEverywhere.git"
# Moonraker Obico #
MOONRAKER_OBICO_FOLDER="${USR_DATA}/moonraker-obico"
MOONRAKER_OBICO_URL="https://github.com/TheSpaghettiDetective/moonraker-obico.git"
# Mobileraker Companion #
MOBILERAKER_COMPANION_FOLDER="${USR_DATA}/mobileraker_companion"
MOBILERAKER_COMPANION_URL="https://github.com/Clon1998/mobileraker_companion.git"
# Custom Boot Display #
BOOT_DISPLAY_FOLDER="/etc/boot-display"
BOOT_DISPLAY_FILE="${BOOT_DISPLAY_FOLDER}/part0/pic_100.jpg"
BOOT_DISPLAY_K1_URL="${HS_FILES}/boot-display/k1_boot_display.tar.gz"
BOOT_DISPLAY_K1M_URL="${HS_FILES}/boot-display/k1max_boot_display.tar.gz"
BOOT_DISPLAY_STOCK_URL="${HS_FILES}/boot-display/stock_boot_display.tar.gz"
# Creality Web Interface #
CREALITY_WEB_FILE="/usr/bin/web-server"
# Guppy Screen #
GUPPY_SCREEN_FOLDER="${USR_DATA}/guppyscreen"
GUPPY_SCREEN_URL1="${HS_FILES}/guppy-screen/guppy_update.cfg"
GUPPY_SCREEN_URL2="${HS_FILES}/guppy-screen/guppy-update.sh"
# Creality Dynamic Logos for Fluidd #
FLUIDD_LOGO_FILE="${USR_DATA}/fluidd/logo_creality_v2.svg"
FLUIDD_LOGO_URL1="${HS_FILES}/fluidd-logos/logo_creality_v1.svg"
FLUIDD_LOGO_URL2="${HS_FILES}/fluidd-logos/logo_creality_v2.svg"
FLUIDD_LOGO_URL3="${HS_FILES}/fluidd-logos/config.json"
}
function set_permissions() {
chmod +x "$CURL" >/dev/null 2>&1 &
}

81
scripts/save_zoffset_macros.sh Executable file
View file

@ -0,0 +1,81 @@
#!/bin/sh
set -e
function save_zoffset_macros_message(){
top_line
title 'Save Z-Offset Macros' "${yellow}"
inner_line
hr
echo -e "${cyan}It allows to save and load the the Z-Offset automatically. ${white}"
hr
bottom_line
}
function install_save_zoffset_macros(){
save_zoffset_macros_message
local yn
while true; do
install_msg "Save Z-Offset Macros" yn
case "${yn}" in
Y|y)
echo -e "${white}"
if [ -f "$HS_CONFIG_FOLDER"/save-zoffset.cfg ]; then
rm -f "$HS_CONFIG_FOLDER"/save-zoffset.cfg
fi
if [ ! -d "$HS_CONFIG_FOLDER" ]; then
mkdir -p "$HS_CONFIG_FOLDER"
fi
echo -e "Info: Linking file..."
ln -sf "$SAVE_ZOFFSET_URL" "$HS_CONFIG_FOLDER"/save-zoffset.cfg
if grep -q "include Helper-Script/save-zoffset" "$PRINTER_CFG" ; then
echo -e "Info: Save Z-Offset Macros configurations are already enabled in printer.cfg file..."
else
echo -e "Info: Adding Save Z-Offset Macros configurations in printer.cfg file..."
sed -i '/\[include printer_params\.cfg\]/a \[include Helper-Script/save-zoffset\.cfg\]' "$PRINTER_CFG"
fi
echo -e "Info: Restarting Klipper service..."
restart_klipper
ok_msg "Save Z-Offset Macros have been installed successfully!"
return;;
N|n)
error_msg "Installation canceled!"
return;;
*)
error_msg "Please select a correct choice!";;
esac
done
}
function remove_save_zoffset_macros(){
save_zoffset_macros_message
local yn
while true; do
remove_msg "Save Z-Offset Macros" yn
case "${yn}" in
Y|y)
echo -e "${white}"
echo -e "Info: Removing file..."
rm -f "$HS_CONFIG_FOLDER"/save-zoffset.cfg
rm -f "$HS_CONFIG_FOLDER"/variables.cfg
if grep -q "include Helper-Script/save-zoffset" "$PRINTER_CFG" ; then
echo -e "Info: Removing Save Z-Offset Macros configurations in printer.cfg file..."
sed -i '/include Helper-Script\/save-zoffset\.cfg/d' "$PRINTER_CFG"
else
echo -e "Info: Save Z-Offset Macros configurations are already removed in printer.cfg file..."
fi
if [ ! -n "$(ls -A "$HS_CONFIG_FOLDER")" ]; then
rm -rf "$HS_CONFIG_FOLDER"
fi
echo -e "Info: Restarting Klipper service..."
restart_klipper
ok_msg "Save Z-Offset Macros have been removed successfully!"
return;;
N|n)
error_msg "Deletion canceled!"
return;;
*)
error_msg "Please select a correct choice!";;
esac
done
}

116
scripts/screws_tilt_adjust.sh Executable file
View file

@ -0,0 +1,116 @@
#!/bin/sh
set -e
function screws_tilt_adjust_message(){
top_line
title 'Screws Tilt Adjust Support' "${yellow}"
inner_line
hr
echo -e "${cyan}It allows to add support for Screws Tilt Adjust ${white}"
echo -e "${cyan}functionality. ${white}"
hr
bottom_line
}
function install_screws_tilt_adjust(){
screws_tilt_adjust_message
local yn
while true; do
install_msg "Screws Tilt Adjust Support" yn
case "${yn}" in
Y|y)
echo -e "${white}"
if [ -f "$HS_CONFIG_FOLDER"/screws-tilt-adjust.cfg ]; then
rm -f "$HS_CONFIG_FOLDER"/screws-tilt-adjust.cfg
fi
if [ ! -d "$HS_CONFIG_FOLDER" ]; then
mkdir -p "$HS_CONFIG_FOLDER"
fi
echo -e "Info: Backing up original file..."
if [ ! -d "$HS_BACKUP_FOLDER"/screws-tilt-adjust ]; then
mkdir -p "$HS_BACKUP_FOLDER"/screws-tilt-adjust
fi
if [ -f "$KLIPPER_EXTRAS_FOLDER"/screws_tilt_adjust.py ]; then
mv "$KLIPPER_EXTRAS_FOLDER"/screws_tilt_adjust.py "$HS_BACKUP_FOLDER"/screws-tilt-adjust
mv "$KLIPPER_EXTRAS_FOLDER"/screws_tilt_adjust.pyc "$HS_BACKUP_FOLDER"/screws-tilt-adjust
fi
echo
local printer_choice
while true; do
read -p " ${white}Do you want install it for ${yellow}K1${white} or ${yellow}K1 Max${white}? (${yellow}k1${white}/${yellow}k1max${white}): ${yellow}" printer_choice
case "${printer_choice}" in
K1|k1)
echo -e "${white}"
echo -e "Info: Linking files..."
ln -sf "$SCREWS_ADJUST_K1_URL" "$HS_CONFIG_FOLDER"/screws-tilt-adjust.cfg
break;;
K1MAX|k1max)
echo -e "${white}"
echo -e "Info: Linking files..."
ln -sf "$SCREWS_ADJUST_K1M_URL" "$HS_CONFIG_FOLDER"/screws-tilt-adjust.cfg
break;;
*)
error_msg "Please select a correct choice!";;
esac
done
ln -sf "$SCREWS_ADJUST_URL" "$KLIPPER_EXTRAS_FOLDER"/screws_tilt_adjust.py
if grep -q "include Helper-Script/screws-tilt-adjust" "$PRINTER_CFG" ; then
echo -e "Info: Screws Tilt Adjust Support configurations are already enabled in printer.cfg file..."
else
echo -e "Info: Adding Screws Tilt Adjust Support configurations in printer.cfg file..."
sed -i '/\[include printer_params\.cfg\]/a \[include Helper-Script/screws-tilt-adjust\.cfg\]' "$PRINTER_CFG"
fi
echo -e "Info: Restarting Klipper service..."
restart_klipper
ok_msg "Screws Tilt Adjust Support has been installed successfully!"
return;;
N|n)
error_msg "Installation canceled!"
return;;
*)
error_msg "Please select a correct choice!";;
esac
done
}
function remove_screws_tilt_adjust(){
screws_tilt_adjust_message
local yn
while true; do
remove_msg "Screws Tilt Adjust Support" yn
case "${yn}" in
Y|y)
echo -e "${white}"
echo -e "Info: Restoring files..."
if [ -f "$HS_BACKUP_FOLDER"/screws-tilt-adjust/screws_tilt_adjust.py ]; then
mv "$HS_BACKUP_FOLDER"/screws-tilt-adjust/screws_tilt_adjust.py "$KLIPPER_EXTRAS_FOLDER"
mv "$HS_BACKUP_FOLDER"/screws-tilt-adjust/screws_tilt_adjust.pyc "$KLIPPER_EXTRAS_FOLDER"
rm -rf "$HS_BACKUP_FOLDER"/screws-tilt-adjust
fi
if [ ! -n "$(ls -A "$HS_BACKUP_FOLDER")" ]; then
rm -rf "$HS_BACKUP_FOLDER"
fi
echo -e "Info: Removing file..."
rm -f "$HS_CONFIG_FOLDER"/screws-tilt-adjust.cfg
if grep -q "include Helper-Script/screws-tilt-adjust" "$PRINTER_CFG" ; then
echo -e "Info: Removing Screws Tilt Adjust Support configurations in printer.cfg file..."
sed -i '/include Helper-Script\/screws-tilt-adjust\.cfg/d' "$PRINTER_CFG"
else
echo -e "Info: Screws Tilt Adjust Support configurations are already removed in printer.cfg file..."
fi
if [ ! -n "$(ls -A "$HS_CONFIG_FOLDER")" ]; then
rm -rf "$HS_CONFIG_FOLDER"
fi
echo -e "Info: Restarting Klipper service..."
restart_klipper
ok_msg "Screws Tilt Adjust Support has been removed successfully!"
return;;
N|n)
error_msg "Deletion canceled!"
return;;
*)
error_msg "Please select a correct choice!";;
esac
done
}

330
scripts/tools.sh Executable file
View file

@ -0,0 +1,330 @@
#!/bin/sh
set -e
function prevent_updating_klipper_files_message(){
top_line
title 'Prevent updating Klipper configuration files' "${yellow}"
inner_line
hr
echo -e "${cyan}This prevents updating Klipper configuration files when ${white}"
echo -e "${cyan}Klipper restarts. ${white}"
hr
bottom_line
}
function allow_updating_klipper_files_message(){
top_line
title 'Allow updating Klipper configuration files' "${yellow}"
inner_line
hr
echo -e "${cyan}This allows updating Klipper configuration files when ${white}"
echo -e "${cyan}Klipper restarts. ${white}"
hr
bottom_line
}
function printing_gcode_from_folder_message(){
top_line
title 'Fix printing Gcode files from folder' "${yellow}"
inner_line
hr
echo -e "${cyan}From Fluidd or Mainsail it's possible to classify your Gcode ${white}"
echo -e "${cyan}files in folders but by default it's not possible to start ${white}"
echo -e "${cyan}a print from a folder. This fix allows that. ${white}"
hr
bottom_line
}
function restore_previous_firmware_message(){
top_line
title 'Restore a previous firmware' "${yellow}"
inner_line
hr
echo -e "${cyan}To restore a previous firmware, follow these steps and ${white}"
echo -e "${cyan}validate your choice: ${white}"
echo -e " │ │"
echo -e "${cyan}1. ${white}Copy the firmware (.img) you want to update to the root ${white}"
echo -e " │ of a USB drive. ${white}"
echo -e "${cyan}2. ${white}Make sure there is only this file on the USB drive. ${white}"
echo -e "${cyan}3. ${white}Insert the USB drive into the printer. ${white}"
hr
bottom_line
}
function reset_factory_settings_message(){
top_line
title 'Reset factory settings' "${yellow}"
inner_line
hr
echo -e "${cyan}This the best way to reset the printer to its factory ${white}"
echo -e "${cyan}settings. ${white}"
echo -e "${cyan}Note that the Factory Reset function in the screen menu ${white}"
echo -e "${cyan}settings only performs a partial reset. ${white}"
hr
echo -e "${cyan}Note: After factory reset all features already been ${white}"
echo -e "${cyan}installed with Creality Helper Script must be reinstalled ${white}"
echo -e "${cyan}and it's necessary to reconnect your printer to your network ${white}"
echo -e "${cyan} from screen settings in `Settings` → `Network` tab. ${white}"
hr
bottom_line
}
function prevent_updating_klipper_files(){
prevent_updating_klipper_files_message
local yn
while true; do
read -p "${white} Do you want to prevent updating ${green}Klipper configuration files ${white}? (${yellow}y${white}/${yellow}n${white}): ${yellow}" yn
case "${yn}" in
Y|y)
echo -e "${white}"
echo -e "Info: Backup file..."
mv "$INITD_FOLDER"/S55klipper_service "$INITD_FOLDER"/disabled.S55klipper_service
echo -e "Info: Copying file..."
cp "$KLIPPER_SERVICE_URL" "$INITD_FOLDER"/S55klipper_service
echo -e "Info: Applying permissions..."
chmod 755 "$INITD_FOLDER"/S55klipper_service
echo -e "Info: Restarting Klipper service..."
restart_klipper
ok_msg "Klipper configuration files will no longer be updated when Klipper restarts!"
return;;
N|n)
error_msg "Preventing canceled!"
return;;
*)
error_msg "Please select a correct choice!";;
esac
done
}
function allow_updating_klipper_files(){
allow_updating_klipper_files_message
local yn
while true; do
read -p "${white} Do you want to allow updating ${green}Klipper configuration files ${white}? (${yellow}y${white}/${yellow}n${white}): ${yellow}" yn
case "${yn}" in
Y|y)
echo -e "${white}"
echo -e "Info: Restoring file..."
rm -f /etc/init.d/S55klipper_service
mv "$INITD_FOLDER"/disabled.S55klipper_service "$INITD_FOLDER"/S55klipper_service
echo -e "Info: Restarting Klipper service..."
restart_klipper
ok_msg "Klipper configuration files will be updated when Klipper restarts!"
return;;
N|n)
error_msg "Authorization canceled!"
return;;
*)
error_msg "Please select a correct choice!";;
esac
done
}
function printing_gcode_from_folder(){
printing_gcode_from_folder_message
local yn
while true; do
read -p "${white} Do you want to apply fix for ${green}printing Gcode files from folder ${white}? (${yellow}y${white}/${yellow}n${white}): ${yellow}" yn
case "${yn}" in
Y|y)
echo -e "${white}"
echo -e "Info: Deleting files..."
if [ -f "$KLIPPER_KLIPPY_FOLDER"/gcode.py ]; then
rm -f "$KLIPPER_KLIPPY_FOLDER"/gcode.py
rm -f "$KLIPPER_KLIPPY_FOLDER"/gcode.pyc
fi
echo -e "Info: Linking files..."
ln -sf "$KLIPPER_GCODE_URL" "$KLIPPER_KLIPPY_FOLDER"/gcode.py
echo -e "Info: Restarting Klipper service..."
restart_klipper
ok_msg "Fix has been applied successfully!"
return;;
N|n)
error_msg "Installation canceled!"
return;;
*)
error_msg "Please select a correct choice!";;
esac
done
}
function restart_nginx_action(){
echo
local yn
while true; do
restart_msg "Nginx service" yn
case "${yn}" in
Y|y)
echo -e "${white}"
stop_nginx
start_nginx
ok_msg "Nginx service has been restarted successfully!"
return;;
N|n)
error_msg "Restart canceled!"
return;;
*)
error_msg "Please select a correct choice!";;
esac
done
}
function restart_moonraker_action(){
echo
local yn
while true; do
restart_msg "Moonraker service" yn
case "${yn}" in
Y|y)
echo -e "${white}"
stop_moonraker
start_moonraker
ok_msg "Moonraker service has been restarted successfully!"
return;;
N|n)
error_msg "Restart canceled!"
return;;
*)
error_msg "Please select a correct choice!";;
esac
done
}
function restart_klipper_action(){
echo
local yn
while true; do
restart_msg "Klipper service" yn
case "${yn}" in
Y|y)
echo -e "${white}"
restart_klipper
ok_msg "Klipper service has been restarted successfully!"
return;;
N|n)
error_msg "Restart canceled!"
return;;
*)
error_msg "Please select a correct choice!";;
esac
done
}
function update_entware_packages(){
echo
local yn
while true; do
read -p "${white} Are you sure you want to update ${green}Entware packages ${white}? (${yellow}y${white}/${yellow}n${white}): ${yellow}" yn
case "${yn}" in
Y|y)
echo -e "${white}"
echo -e "Info: Updating packages list..."
"$ENTWARE_FILE" update
echo -e "Info: Updating packages..."
"$ENTWARE_FILE" upgrade
ok_msg "Entware packages have been updated!"
return;;
N|n)
error_msg "Updating canceled!"
return;;
*)
error_msg "Please select a correct choice!";;
esac
done
}
function clear_cache(){
echo
local yn
while true; do
read -p "${white} Are you sure you want to ${green}clear cache ${white}? (${yellow}y${white}/${yellow}n${white}): ${yellow}" yn
case "${yn}" in
Y|y)
echo -e "${white}"
echo -e "Info: Clearing root partition cache..."
rm -rf /root/.cache
echo -e "Info: Clearing git cache..."
cd "${HELPER_SCRIPT_FOLDER}"
git gc --aggressive --prune=all
ok_msg "Cache has been cleared!"
return;;
N|n)
error_msg "Clearing cache canceled!"
return;;
*)
error_msg "Please select a correct choice!";;
esac
done
}
function clear_logs(){
echo
local yn
while true; do
read -p "${white} Are you sure you want to clear ${green}logs files ${white}? (${yellow}y${white}/${yellow}n${white}): ${yellow}" yn
case "${yn}" in
Y|y)
echo -e "${white}"
echo -e "Info: Clearing logs files..."
rm -f "$USR_DATA"/creality/userdata/log/*.log
rm -f "$USR_DATA"/creality/userdata/log/*.gz
rm -f "$USR_DATA"/creality/userdata/fault_code/*
rm -f "$PRINTER_DATA_FOLDER"/logs/*
ok_msg "Logs files have been cleared!"
return;;
N|n)
error_msg "Clearing logs files canceled!"
return;;
*)
error_msg "Please select a correct choice!";;
esac
done
}
function restore_previous_firmware(){
restore_previous_firmware_message
local yn
while true; do
read -p "${white} Do you want to restore a previous firmware ? (${yellow}y${white}/${yellow}n${white}): ${yellow}" yn
case "${yn}" in
Y|y)
if ls /tmp/udisk/sda1/*.img 1> /dev/null 2>&1; then
echo -e "${white}"
echo "Info: Restoring firmware..."
rm -rf /overlay/upper/*
/etc/ota_bin/local_ota_update.sh /tmp/udisk/sda1/*.img
ok_msg "Firmware has been restored! Please reboot your printer."
exit 0
else
error_msg "No .img file found on the USB drive. Restoration canceled!"
fi
return;;
N|n)
error_msg "Restoration canceled!"
return;;
*)
error_msg "Please select a correct choice!";;
esac
done
}
function reset_factory_settings(){
reset_factory_settings_message
local yn
while true; do
read -p "${white} Are you sure you want to ${green}reset factory settings ${white}? (${yellow}y${white}/${yellow}n${white}): ${yellow}" yn
case "${yn}" in
Y|y)
echo -e "${white}"
echo -e "Info: Restoration..."
echo "all" | nc -U /var/run/wipe.sock
;;
N|n)
error_msg "Reset canceled!"
return;;
*)
error_msg "Please select a correct choice!";;
esac
done
}

82
scripts/useful_macros.sh Executable file
View file

@ -0,0 +1,82 @@
#!/bin/sh
set -e
function useful_macros_message(){
top_line
title 'Useful Macros' "${yellow}"
inner_line
hr
echo -e "${cyan}It allows to use some usefull macros like Bed Leveling, PID, ${white}"
echo -e "${cyan}stress test or backup and restore Klipper configurations ${white}"
echo -e "${cyan}files and Moonraker database. ${white}"
hr
bottom_line
}
function install_useful_macros(){
useful_macros_message
local yn
while true; do
install_msg "Useful Macros" yn
case "${yn}" in
Y|y)
echo -e "${white}"
if [ -f "$HS_CONFIG_FOLDER"/useful-macros.cfg ]; then
rm -f "$HS_CONFIG_FOLDER"/useful-macros.cfg
fi
if [ ! -d "$HS_CONFIG_FOLDER" ]; then
mkdir -p "$HS_CONFIG_FOLDER"
fi
echo -e "Info: Linking file..."
ln -sf "$USEFUL_MACROS_URL" "$HS_CONFIG_FOLDER"/useful-macros.cfg
if grep -q "include Helper-Script/useful-macros" "$PRINTER_CFG" ; then
echo -e "Info: Useful Macros configurations are already enabled in printer.cfg file..."
else
echo -e "Info: Adding Useful Macros configurations in printer.cfg file..."
sed -i '/\[include printer_params\.cfg\]/a \[include Helper-Script/useful-macros\.cfg\]' "$PRINTER_CFG"
fi
echo -e "Info: Restarting Klipper service..."
restart_klipper
ok_msg "Useful Macros have been installed successfully!"
return;;
N|n)
error_msg "Installation canceled!"
return;;
*)
error_msg "Please select a correct choice!";;
esac
done
}
function remove_useful_macros(){
useful_macros_message
local yn
while true; do
remove_msg "Useful Macros" yn
case "${yn}" in
Y|y)
echo -e "${white}"
echo -e "Info: Removing file..."
rm -f "$HS_CONFIG_FOLDER"/useful-macros.cfg
if grep -q "include Helper-Script/useful-macros" "$PRINTER_CFG" ; then
echo -e "Info: Removing Useful Macros configurations in printer.cfg file..."
sed -i '/include Helper-Script\/useful-macros\.cfg/d' "$PRINTER_CFG"
else
echo -e "Info: Useful Macros configurations are already removed in printer.cfg file..."
fi
if [ ! -n "$(ls -A "$HS_CONFIG_FOLDER")" ]; then
rm -rf "$HS_CONFIG_FOLDER"
fi
echo -e "Info: Restarting Klipper service..."
restart_klipper
ok_msg "Useful Macros have been removed successfully!"
return;;
N|n)
error_msg "Deletion canceled!"
return;;
*)
error_msg "Please select a correct choice!";;
esac
done
}

73
scripts/virtual_pins.sh Executable file
View file

@ -0,0 +1,73 @@
#!/bin/sh
set -e
function virtual_pins_message(){
top_line
title 'Virtual Pins Support' "${yellow}"
inner_line
hr
echo -e "${cyan}It allows usage of virtual (simulated) pins in Klipper ${white}"
echo -e "${cyan}configurations files. ${white}"
hr
bottom_line
}
function install_virtual_pins(){
virtual_pins_message
local yn
while true; do
install_msg "Virtual Pins Support" yn
case "${yn}" in
Y|y)
echo -e "${white}"
echo -e "Info: Linking file..."
ln -sf "$VIRTUAL_PINS_URL" "$VIRTUAL_PINS_FILE"
if grep -q "[virtual_pins]" "$PRINTER_CFG" ; then
echo -e "Info: Adding [virtual_pins] configuration in printer.cfg file..."
sed -i '/\[include sensorless.cfg\]/i [virtual_pins]' "$PRINTER_CFG"
else
echo -e "Info: [virtual_pins] configuration is already enabled in printer.cfg file..."
fi
echo -e "Info: Restarting Klipper service..."
restart_klipper
ok_msg "Virtual Pins Support has been installed successfully!"
return;;
N|n)
error_msg "Installation canceled!"
return;;
*)
error_msg "Please select a correct choice!";;
esac
done
}
function remove_virtual_pins(){
virtual_pins_message
local yn
while true; do
remove_msg "Virtual Pins Support" yn
case "${yn}" in
Y|y)
echo -e "${white}"
echo -e "Info: Removing file..."
rm -f "$KLIPPER_EXTRAS_FOLDER"/virtual_pins.py
rm -f "$KLIPPER_EXTRAS_FOLDER"/virtual_pins.pyc
if grep -q "[virtual_pins]" "$PRINTER_CFG" ; then
echo -e "Info: Removing [virtual_pins] configuration in printer.cfg file..."
sed -i '/\[virtual_pins\]/d' "$PRINTER_CFG"
else
echo -e "Info: [virtual_pins] configuration is already removed in printer.cfg file..."
fi
echo -e "Info: Restarting Klipper service..."
restart_klipper
ok_msg "Virtual Pins Support has been removed successfully!"
return;;
N|n)
error_msg "Deletion canceled!"
return;;
*)
error_msg "Please select a correct choice!";;
esac
done
}