mirror of
https://github.com/dw-0/kiauh.git
synced 2025-12-14 02:54:28 +05:00
feat: check for apache2 and prompt for action
This commit is contained in:
@@ -33,7 +33,7 @@ dwc_setup_dialog(){
|
|||||||
|
|
||||||
### ask user how to handle OctoPrint, Haproxy and Lighttpd
|
### ask user how to handle OctoPrint, Haproxy and Lighttpd
|
||||||
process_octoprint_dialog_dwc2
|
process_octoprint_dialog_dwc2
|
||||||
process_haproxy_lighttpd_dialog
|
process_services_dialog
|
||||||
|
|
||||||
### instance confirmation dialog
|
### instance confirmation dialog
|
||||||
while true; do
|
while true; do
|
||||||
|
|||||||
@@ -23,6 +23,11 @@ system_check_webui(){
|
|||||||
if [[ $(dpkg-query -f'${Status}' --show lighttpd 2>/dev/null) = *\ installed ]]; then
|
if [[ $(dpkg-query -f'${Status}' --show lighttpd 2>/dev/null) = *\ installed ]]; then
|
||||||
LIGHTTPD_FOUND="true"
|
LIGHTTPD_FOUND="true"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
### check system for an installed apache2 service
|
||||||
|
if [[ $(dpkg-query -f'${Status}' --show apache2 2>/dev/null) = *\ installed ]]; then
|
||||||
|
APACHE2_FOUND="true"
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
get_user_selection_mjpg-streamer(){
|
get_user_selection_mjpg-streamer(){
|
||||||
@@ -93,11 +98,11 @@ install_webui(){
|
|||||||
dependency_check
|
dependency_check
|
||||||
### check if moonraker is already installed
|
### check if moonraker is already installed
|
||||||
system_check_webui
|
system_check_webui
|
||||||
### ask user how to handle OctoPrint, Haproxy and Lighttpd if found
|
### ask user how to handle OctoPrint, Haproxy, Lighttpd, Apache2 if found
|
||||||
process_octoprint_dialog
|
process_octoprint_dialog
|
||||||
process_haproxy_lighttpd_dialog
|
process_services_dialog
|
||||||
### process possible disruptive services
|
### process possible disruptive services
|
||||||
process_haproxy_lighttpd_services
|
process_disruptive_services
|
||||||
|
|
||||||
[ $1 == "mainsail" ] && IF_NAME1="Mainsail" && IF_NAME2="Mainsail "
|
[ $1 == "mainsail" ] && IF_NAME1="Mainsail" && IF_NAME2="Mainsail "
|
||||||
[ $1 == "fluidd" ] && IF_NAME1="Fluidd" && IF_NAME2="Fluidd "
|
[ $1 == "fluidd" ] && IF_NAME1="Fluidd" && IF_NAME2="Fluidd "
|
||||||
@@ -483,7 +488,7 @@ process_octoprint_dialog(){
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
process_haproxy_lighttpd_services(){
|
process_disruptive_services(){
|
||||||
#handle haproxy service
|
#handle haproxy service
|
||||||
if [ "$DISABLE_HAPROXY" = "true" ] || [ "$REMOVE_HAPROXY" = "true" ]; then
|
if [ "$DISABLE_HAPROXY" = "true" ] || [ "$REMOVE_HAPROXY" = "true" ]; then
|
||||||
if systemctl is-active haproxy -q; then
|
if systemctl is-active haproxy -q; then
|
||||||
@@ -523,11 +528,31 @@ process_haproxy_lighttpd_services(){
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
### handle apache2 service
|
||||||
|
if [ "$DISABLE_APACHE2" = "true" ] || [ "$REMOVE_APACHE2" = "true" ]; then
|
||||||
|
if systemctl is-active apache2 -q; then
|
||||||
|
status_msg "Stopping apache2 service ..."
|
||||||
|
sudo systemctl stop apache2 && ok_msg "Service stopped!"
|
||||||
|
fi
|
||||||
|
|
||||||
|
### disable lighttpd
|
||||||
|
if [ "$DISABLE_APACHE2" = "true" ]; then
|
||||||
|
status_msg "Disabling lighttpd ..."
|
||||||
|
sudo systemctl disable apache2 && ok_msg "Apache2 service disabled!"
|
||||||
|
|
||||||
|
### remove lighttpd
|
||||||
|
if [ "$REMOVE_APACHE2" = "true" ]; then
|
||||||
|
status_msg "Removing apache2 ..."
|
||||||
|
sudo apt-get remove apache2 -y && sudo update-rc.d -f apache2 remove && ok_msg "Apache2 removed!"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
process_haproxy_lighttpd_dialog(){
|
process_services_dialog(){
|
||||||
#notify user about haproxy or lighttpd services found and possible issues
|
#notify user about haproxy or lighttpd services found and possible issues
|
||||||
if [ "$HAPROXY_FOUND" = "true" ] || [ "$LIGHTTPD_FOUND" = "true" ]; then
|
if [ "$HAPROXY_FOUND" = "true" ] || [ "$LIGHTTPD_FOUND" = "true" ] || [ "$APACHE2_FOUND" = "true" ]; then
|
||||||
while true; do
|
while true; do
|
||||||
echo
|
echo
|
||||||
top_border
|
top_border
|
||||||
@@ -539,6 +564,9 @@ process_haproxy_lighttpd_dialog(){
|
|||||||
if [ "$LIGHTTPD_FOUND" = "true" ]; then
|
if [ "$LIGHTTPD_FOUND" = "true" ]; then
|
||||||
echo -e "| ● lighttpd |"
|
echo -e "| ● lighttpd |"
|
||||||
fi
|
fi
|
||||||
|
if [ "$APACHE2_FOUND" = "true" ]; then
|
||||||
|
echo -e "| ● apache2 |"
|
||||||
|
fi
|
||||||
hr
|
hr
|
||||||
echo -e "| Having those packages installed can lead to unwanted |"
|
echo -e "| Having those packages installed can lead to unwanted |"
|
||||||
echo -e "| behaviour. It is recommend to remove those packages. |"
|
echo -e "| behaviour. It is recommend to remove those packages. |"
|
||||||
@@ -551,25 +579,15 @@ process_haproxy_lighttpd_dialog(){
|
|||||||
case "$action" in
|
case "$action" in
|
||||||
1)
|
1)
|
||||||
echo -e "###### > Remove packages"
|
echo -e "###### > Remove packages"
|
||||||
if [ "$HAPROXY_FOUND" = "true" ]; then
|
REMOVE_HAPROXY="true"
|
||||||
DISABLE_HAPROXY="true"
|
REMOVE_LIGHTTPD="true"
|
||||||
REMOVE_HAPROXY="true"
|
REMOVE_APACHE2="true"
|
||||||
fi
|
|
||||||
if [ "$LIGHTTPD_FOUND" = "true" ]; then
|
|
||||||
DISABLE_LIGHTTPD="true"
|
|
||||||
REMOVE_LIGHTTPD="true"
|
|
||||||
fi
|
|
||||||
break;;
|
break;;
|
||||||
2)
|
2)
|
||||||
echo -e "###### > Disable only"
|
echo -e "###### > Disable only"
|
||||||
if [ "$HAPROXY_FOUND" = "true" ]; then
|
DISABLE_HAPROXY="true"
|
||||||
DISABLE_HAPROXY="true"
|
DISABLE_LIGHTTPD="true"
|
||||||
REMOVE_HAPROXY="false"
|
DISABLE_APACHE2="true"
|
||||||
fi
|
|
||||||
if [ "$LIGHTTPD_FOUND" = "true" ]; then
|
|
||||||
DISABLE_LIGHTTPD="true"
|
|
||||||
REMOVE_LIGHTTPD="false"
|
|
||||||
fi
|
|
||||||
break;;
|
break;;
|
||||||
3)
|
3)
|
||||||
echo -e "###### > Skip"
|
echo -e "###### > Skip"
|
||||||
|
|||||||
Reference in New Issue
Block a user