refactor: fluidd status

Signed-off-by: Dominik Willner th33xitus@gmail.com
This commit is contained in:
th33xitus
2022-04-17 19:57:03 +02:00
parent 4487b9593c
commit bc2ce383ee
2 changed files with 17 additions and 19 deletions

View File

@@ -149,26 +149,25 @@ function get_fluidd_ver(){
} }
function fluidd_status(){ function fluidd_status(){
fcount=0 local status
fluidd_data=(
$FLUIDD_DIR ### remove the "SERVICE" entry from the data array if a moonraker service is installed
$NGINX_SA/fluidd local data_arr=("${FLUIDD_DIR}" "${NGINX_SA}/fluidd" "${NGINX_SE}/fluidd")
$NGINX_SE/fluidd
) ### count+1 for each found data-item from array
#count+1 for each found data-item from array local filecount=0
for fd in "${fluidd_data[@]}" for data in "${data_arr[@]}"; do
do [ -e "${data}" ] && filecount=$(("${filecount}" + 1))
if [ -e $fd ]; then
fcount=$(expr $fcount + 1)
fi
done done
if [ "$fcount" == "${#fluidd_data[*]}" ]; then
FLUIDD_STATUS="${green}Installed!${white} " if [ "${filecount}" == "${#data_arr[*]}" ]; then
elif [ "$fcount" == 0 ]; then status="${green}Installed!${white} "
FLUIDD_STATUS="${red}Not installed!${white} " elif [ "${filecount}" == 0 ]; then
status="${red}Not installed!${white} "
else else
FLUIDD_STATUS="${yellow}Incomplete!${white} " status="${yellow}Incomplete!${white} "
fi fi
echo "${status}"
} }
function get_local_fluidd_version(){ function get_local_fluidd_version(){

View File

@@ -21,7 +21,7 @@ main_ui(){
echo -e "| 2) [Update] | Moonraker: $(get_moonraker_status)|" echo -e "| 2) [Update] | Moonraker: $(get_moonraker_status)|"
echo -e "| 3) [Remove] | |" echo -e "| 3) [Remove] | |"
echo -e "| 4) [Advanced] | Mainsail: $(mainsail_status)|" echo -e "| 4) [Advanced] | Mainsail: $(mainsail_status)|"
echo -e "| 5) [Backup] | Fluidd: $FLUIDD_STATUS|" echo -e "| 5) [Backup] | Fluidd: $(fluidd_status)|"
echo -e "| | KlipperScreen: $(klipperscreen_status)|" echo -e "| | KlipperScreen: $(klipperscreen_status)|"
echo -e "| 6) [Settings] | Telegram Bot: $(get_telegram_bot_status)|" echo -e "| 6) [Settings] | Telegram Bot: $(get_telegram_bot_status)|"
echo -e "| | |" echo -e "| | |"
@@ -65,7 +65,6 @@ main_menu(){
#prompt for KIAUH update if update available #prompt for KIAUH update if update available
kiauh_update_dialog kiauh_update_dialog
#check install status #check install status
fluidd_status
octoprint_status octoprint_status
main_ui main_ui
while true; do while true; do