mirror of
https://github.com/dw-0/kiauh.git
synced 2025-12-15 03:24:29 +05:00
fix: refactor webui installer
This commit is contained in:
@@ -1,12 +1,9 @@
|
|||||||
check_moonraker(){
|
check_moonraker(){
|
||||||
status_msg "Checking for Moonraker service ..."
|
status_msg "Checking for Moonraker service ..."
|
||||||
if [ "$(systemctl list-units --full -all -t service --no-legend | grep -F "moonraker.service")" ] || [ "$(systemctl list-units --full -all -t service --no-legend | grep -E "moonraker-[[:digit:]].service")" ]; then
|
if [ "$(systemctl list-units --full -all -t service --no-legend | grep -F "moonraker.service")" ] || [ "$(systemctl list-units --full -all -t service --no-legend | grep -E "moonraker-[[:digit:]].service")" ]; then
|
||||||
ok_msg "Moonraker service found!"; echo
|
moonraker_chk_ok="true"
|
||||||
MOONRAKER_SERVICE_FOUND="true"
|
|
||||||
else
|
else
|
||||||
warn_msg "Moonraker service not found!"
|
moonraker_chk_ok="false"
|
||||||
warn_msg "Please install Moonraker first!"; echo
|
|
||||||
MOONRAKER_SERVICE_FOUND="false"
|
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -47,56 +44,40 @@ get_user_selection_kiauh_macros(){
|
|||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
install_mainsail(){
|
install_webui(){
|
||||||
### check if moonraker is already installed
|
### check if moonraker is already installed
|
||||||
check_moonraker
|
check_moonraker
|
||||||
|
|
||||||
if [ "$MOONRAKER_SERVICE_FOUND" = "true" ]; then
|
[ $1 == "mainsail" ] && INTERFACE="Mainsail"
|
||||||
### check for other enabled web interfaces
|
[ $1 == "fluidd" ] && INTERFACE="Mainsail"
|
||||||
unset SET_LISTEN_PORT
|
|
||||||
detect_enabled_sites
|
|
||||||
|
|
||||||
### check if another site already listens to port 80
|
### exit mainsail/fluidd setup if moonraker not found
|
||||||
mainsail_port_check
|
if [ $moonraker_chk_ok = "false" ]; then
|
||||||
|
ERROR_MSG="Moonraker service not found!\n Please install Moonraker first!"
|
||||||
### ask user to install the recommended webinterface macros
|
print_msg && clear_msg && return 0
|
||||||
get_user_selection_kiauh_macros "Mainsail "
|
else
|
||||||
|
ok_msg "Moonraker service found!"
|
||||||
### creating the mainsail nginx cfg
|
status_msg "Initializing $INTERFACE installation ..."
|
||||||
set_nginx_cfg "mainsail"
|
|
||||||
|
|
||||||
### copy the kiauh_macros.cfg to the config location
|
|
||||||
install_kiauh_macros
|
|
||||||
|
|
||||||
### install mainsail
|
|
||||||
mainsail_setup
|
|
||||||
fi
|
fi
|
||||||
}
|
|
||||||
|
|
||||||
install_fluidd(){
|
### check for other enabled web interfaces
|
||||||
### check if moonraker is already installed
|
unset SET_LISTEN_PORT
|
||||||
check_moonraker
|
detect_enabled_sites
|
||||||
|
|
||||||
if [ "$MOONRAKER_SERVICE_FOUND" = "true" ]; then
|
### check if another site already listens to port 80
|
||||||
### check for other enabled web interfaces
|
$1_port_check
|
||||||
unset SET_LISTEN_PORT
|
|
||||||
detect_enabled_sites
|
|
||||||
|
|
||||||
### check if another site already listens to port 80
|
### ask user to install the recommended webinterface macros
|
||||||
fluidd_port_check
|
get_user_selection_kiauh_macros "$INTERFACE "
|
||||||
|
|
||||||
### ask user to install the recommended webinterface macros
|
### creating the mainsail/fluidd nginx cfg
|
||||||
get_user_selection_kiauh_macros "Fluidd "
|
set_nginx_cfg "$1"
|
||||||
|
|
||||||
### creating the fluidd nginx cfg
|
### copy the kiauh_macros.cfg to the config location
|
||||||
set_nginx_cfg "fluidd"
|
install_kiauh_macros
|
||||||
|
|
||||||
### copy the kiauh_macros.cfg to the config location
|
### install mainsail/fluidd
|
||||||
install_kiauh_macros
|
$1_setup
|
||||||
|
|
||||||
### install fluidd
|
|
||||||
fluidd_setup
|
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
install_kiauh_macros(){
|
install_kiauh_macros(){
|
||||||
|
|||||||
@@ -29,9 +29,9 @@ install_menu(){
|
|||||||
2)
|
2)
|
||||||
do_action "moonraker_setup_dialog" "install_ui";;
|
do_action "moonraker_setup_dialog" "install_ui";;
|
||||||
3)
|
3)
|
||||||
do_action "install_mainsail" "install_ui";;
|
do_action "install_webui mainsail" "install_ui";;
|
||||||
4)
|
4)
|
||||||
do_action "install_fluidd" "install_ui";;
|
do_action "install_webui fluidd" "install_ui";;
|
||||||
5)
|
5)
|
||||||
do_action "install_klipperscreen" "install_ui";;
|
do_action "install_klipperscreen" "install_ui";;
|
||||||
6)
|
6)
|
||||||
|
|||||||
Reference in New Issue
Block a user