feature: remove option for tornado and nginx

This commit is contained in:
th33xitus
2020-07-18 20:30:49 +02:00
parent fed882298e
commit 28d7a4aeda
3 changed files with 48 additions and 2 deletions

View File

@@ -265,6 +265,18 @@ remove_menu(){
remove_octoprint
print_msg && CONFIRM_MSG="" && ERROR_MSG=""
remove_ui;;
5)
clear
print_header
remove_tornado
print_msg && CONFIRM_MSG="" && ERROR_MSG=""
remove_ui;;
6)
clear
print_header
remove_nginx
print_msg && CONFIRM_MSG="" && ERROR_MSG=""
remove_ui;;
Q|q)
clear; main_menu; break;;
*)

View File

@@ -26,6 +26,20 @@ remove_klipper(){
fi
}
remove_tornado(){
data_arr=(
$TORNADO_DIR1
$TORNADO_DIR2
)
print_error "Tornado" && data_count=()
if [ "$ERROR_MSG" = "" ]; then
status_msg "Removing Tornado from klippy-env ..."
PYTHONDIR=$KLIPPY_ENV_DIR
$PYTHONDIR/bin/pip uninstall tornado -y
CONFIRM_MSG=" Tornado successfully removed!"
fi
}
remove_dwc2(){
data_arr=(
$DWC2FK_DIR
@@ -118,6 +132,8 @@ remove_octoprint(){
$OCTOPRINT_CFG_DIR
${HOME}/octoprint.log
/etc/sudoers.d/octoprint-shutdown
/etc/nginx/sites-available/octoprint
/etc/nginx/sites-enabled/octoprint
)
print_error "OctoPrint" && data_count=()
if [ "$ERROR_MSG" = "" ]; then
@@ -140,4 +156,22 @@ remove_octoprint(){
fi
CONFIRM_MSG=" OctoPrint successfully removed!"
fi
}
remove_nginx(){
if [[ $(dpkg-query -f'${Status}' --show nginx 2>/dev/null) = *\ installed ]] ; then
status_msg "Stopping and removing Nginx Service ..."
if [ -e /etc/init.d/nginx ]; then
sudo /etc/init.d/nginx stop && ok_msg "Nginx Service stopped!"
sudo rm /etc/init.d/nginx && ok_msg "Nginx Service removed!"
fi
if [ -e /etc/default/nginx ]; then
sudo rm /etc/default/nginx
fi
status_msg "Purging Nginx from system ..."
sudo apt-get purge nginx nginx-common -y
CONFIRM_MSG=" Nginx successfully removed!"
else
ERROR_MSG=" Looks like Nginx was already removed!\n Skipping..."
fi
}

View File

@@ -94,8 +94,8 @@ remove_ui(){
echo -e "| --> ~/kiauh-backups | "
echo -e "| You need remove them manually if you wish so. | "
hr
echo -e "| 1) [Klipper] | | "
echo -e "| 2) [DWC2-for-Klipper] | | "
echo -e "| 1) [Klipper] | 5) [Tornado] | "
echo -e "| 2) [DWC2-for-Klipper] | 6) [Nginx] | "
echo -e "| 3) [Mainsail] | | "
echo -e "| 4) [Octoprint] | | "
quit_footer