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

View File

@@ -21,7 +21,7 @@ main_ui(){
echo -e "| 2) [Update] | Moonraker: $(get_moonraker_status)|"
echo -e "| 3) [Remove] | |"
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 "| 6) [Settings] | Telegram Bot: $(get_telegram_bot_status)|"
echo -e "| | |"
@@ -65,7 +65,6 @@ main_menu(){
#prompt for KIAUH update if update available
kiauh_update_dialog
#check install status
fluidd_status
octoprint_status
main_ui
while true; do