feat: display klipper repo in main menu
Signed-off-by: Dominik Willner th33xitus@gmail.com
This commit is contained in:
@@ -244,7 +244,7 @@ function update_fluidd(){
|
|||||||
#================== FLUIDD STATUS ==================#
|
#================== FLUIDD STATUS ==================#
|
||||||
#===================================================#
|
#===================================================#
|
||||||
|
|
||||||
function fluidd_status(){
|
function get_fluidd_status(){
|
||||||
local status
|
local status
|
||||||
local data_arr=("${FLUIDD_DIR}" "${NGINX_SA}/fluidd" "${NGINX_SE}/fluidd")
|
local data_arr=("${FLUIDD_DIR}" "${NGINX_SA}/fluidd" "${NGINX_SE}/fluidd")
|
||||||
|
|
||||||
@@ -254,12 +254,12 @@ function fluidd_status(){
|
|||||||
[ -e "${data}" ] && filecount=$(("${filecount}" + 1))
|
[ -e "${data}" ] && filecount=$(("${filecount}" + 1))
|
||||||
done
|
done
|
||||||
|
|
||||||
if [ "${filecount}" == "${#data_arr[*]}" ]; then
|
if (( filecount == ${#data_arr[*]})); then
|
||||||
status="${green}Installed!${white} "
|
status="Installed!"
|
||||||
elif [ "${filecount}" == 0 ]; then
|
elif ((filecount == 0)); then
|
||||||
status="${red}Not installed!${white} "
|
status="Not installed!"
|
||||||
else
|
else
|
||||||
status="${yellow}Incomplete!${white} "
|
status="Incomplete!"
|
||||||
fi
|
fi
|
||||||
echo "${status}"
|
echo "${status}"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -376,12 +376,12 @@ function get_klipper_status(){
|
|||||||
[ -e "${data}" ] && filecount=$(("${filecount}" + 1))
|
[ -e "${data}" ] && filecount=$(("${filecount}" + 1))
|
||||||
done
|
done
|
||||||
|
|
||||||
if [ "${filecount}" == "${#data_arr[*]}" ]; then
|
if (( filecount == ${#data_arr[*]})); then
|
||||||
status="$(printf "${green}Installed: %-5s${white}" "${sf_count}")"
|
status="Installed: ${sf_count}"
|
||||||
elif [ "${filecount}" == 0 ]; then
|
elif ((filecount == 0)); then
|
||||||
status="${red}Not installed!${white} "
|
status="Not installed!"
|
||||||
else
|
else
|
||||||
status="${yellow}Incomplete!${white} "
|
status="Incomplete!"
|
||||||
fi
|
fi
|
||||||
echo "${status}"
|
echo "${status}"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -123,7 +123,7 @@ function update_klipperscreen(){
|
|||||||
#=============== KLIPPERSCREEN STATUS ==============#
|
#=============== KLIPPERSCREEN STATUS ==============#
|
||||||
#===================================================#
|
#===================================================#
|
||||||
|
|
||||||
function klipperscreen_status(){
|
function get_klipperscreen_status(){
|
||||||
local sf_count status
|
local sf_count status
|
||||||
sf_count="$(klipperscreen_systemd | wc -w)"
|
sf_count="$(klipperscreen_systemd | wc -w)"
|
||||||
|
|
||||||
@@ -137,12 +137,12 @@ function klipperscreen_status(){
|
|||||||
[ -e "${data}" ] && filecount=$(("${filecount}" + 1))
|
[ -e "${data}" ] && filecount=$(("${filecount}" + 1))
|
||||||
done
|
done
|
||||||
|
|
||||||
if [ "${filecount}" == "${#data_arr[*]}" ]; then
|
if (( filecount == ${#data_arr[*]})); then
|
||||||
status="$(printf "${green}Installed: %-5s${white}" "${sf_count}")"
|
status="Installed!"
|
||||||
elif [ "${filecount}" == 0 ]; then
|
elif ((filecount == 0)); then
|
||||||
status="${red}Not installed!${white} "
|
status="Not installed!"
|
||||||
else
|
else
|
||||||
status="${yellow}Incomplete!${white} "
|
status="Incomplete!"
|
||||||
fi
|
fi
|
||||||
echo "${status}"
|
echo "${status}"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -249,7 +249,7 @@ function update_mainsail(){
|
|||||||
#================= MAINSAIL STATUS =================#
|
#================= MAINSAIL STATUS =================#
|
||||||
#===================================================#
|
#===================================================#
|
||||||
|
|
||||||
function mainsail_status(){
|
function get_mainsail_status(){
|
||||||
local status
|
local status
|
||||||
local data_arr=("${MAINSAIL_DIR}" "${NGINX_SA}/mainsail" "${NGINX_SE}/mainsail")
|
local data_arr=("${MAINSAIL_DIR}" "${NGINX_SA}/mainsail" "${NGINX_SE}/mainsail")
|
||||||
|
|
||||||
@@ -259,12 +259,12 @@ function mainsail_status(){
|
|||||||
[ -e "${data}" ] && filecount=$(("${filecount}" + 1))
|
[ -e "${data}" ] && filecount=$(("${filecount}" + 1))
|
||||||
done
|
done
|
||||||
|
|
||||||
if [ "${filecount}" == "${#data_arr[*]}" ]; then
|
if (( filecount == ${#data_arr[*]})); then
|
||||||
status="${green}Installed!${white} "
|
status="Installed!"
|
||||||
elif [ "${filecount}" == 0 ]; then
|
elif ((filecount == 0)); then
|
||||||
status="${red}Not installed!${white} "
|
status="Not installed!"
|
||||||
else
|
else
|
||||||
status="${yellow}Incomplete!${white} "
|
status="Incomplete!"
|
||||||
fi
|
fi
|
||||||
echo "${status}"
|
echo "${status}"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -120,12 +120,12 @@ function get_telegram_bot_status(){
|
|||||||
[ -e "${data}" ] && filecount=$(("${filecount}" + 1))
|
[ -e "${data}" ] && filecount=$(("${filecount}" + 1))
|
||||||
done
|
done
|
||||||
|
|
||||||
if [ "${filecount}" == "${#data_arr[*]}" ]; then
|
if (( filecount == ${#data_arr[*]})); then
|
||||||
status="$(printf "${green}Installed: %-5s${white}" "${sf_count}")"
|
status="Installed!"
|
||||||
elif [ "${filecount}" == 0 ]; then
|
elif ((filecount == 0)); then
|
||||||
status="${red}Not installed!${white} "
|
status="Not installed!"
|
||||||
else
|
else
|
||||||
status="${yellow}Incomplete!${white} "
|
status="Incomplete!"
|
||||||
fi
|
fi
|
||||||
echo "${status}"
|
echo "${status}"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -428,12 +428,12 @@ function get_moonraker_status(){
|
|||||||
[ -e "${data}" ] && filecount=$(("${filecount}" + 1))
|
[ -e "${data}" ] && filecount=$(("${filecount}" + 1))
|
||||||
done
|
done
|
||||||
|
|
||||||
if [ "${filecount}" == "${#data_arr[*]}" ]; then
|
if (( filecount == ${#data_arr[*]})); then
|
||||||
status="$(printf "${green}Installed: %-5s${white}" "${sf_count}")"
|
status="Installed: ${sf_count}"
|
||||||
elif [ "${filecount}" == 0 ]; then
|
elif ((filecount == 0)); then
|
||||||
status="${red}Not installed!${white} "
|
status="Not installed!"
|
||||||
else
|
else
|
||||||
status="${yellow}Incomplete!${white} "
|
status="Incomplete!"
|
||||||
fi
|
fi
|
||||||
echo "${status}"
|
echo "${status}"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -278,18 +278,18 @@ function remove_octoprint(){
|
|||||||
#=============== OCTOPRINT STATUS ================#
|
#=============== OCTOPRINT STATUS ================#
|
||||||
#=================================================#
|
#=================================================#
|
||||||
|
|
||||||
function octoprint_status(){
|
function get_octoprint_status(){
|
||||||
local sf_count env_count dir_count status
|
local sf_count env_count dir_count status
|
||||||
sf_count="$(octoprint_systemd | wc -w)"
|
sf_count="$(octoprint_systemd | wc -w)"
|
||||||
env_count=$(find "${HOME}" -maxdepth 1 -regextype posix-extended -regex "${HOME}/OctoPrint(_[^0])?[0-9]*" | wc -w)
|
env_count=$(find "${HOME}" -maxdepth 1 -regextype posix-extended -regex "${HOME}/OctoPrint(_[^0])?[0-9]*" | wc -w)
|
||||||
dir_count=$(find "${HOME}" -maxdepth 1 -regextype posix-extended -regex "${HOME}/.octoprint(_[^0])?[0-9]*" | wc -w)
|
dir_count=$(find "${HOME}" -maxdepth 1 -regextype posix-extended -regex "${HOME}/.octoprint(_[^0])?[0-9]*" | wc -w)
|
||||||
|
|
||||||
if (( sf_count == 0 )) && (( env_count == 0 )) && (( dir_count == 0 )); then
|
if (( sf_count == 0 )) && (( env_count == 0 )) && (( dir_count == 0 )); then
|
||||||
status="${red}Not installed!${white} "
|
status="Not installed!"
|
||||||
elif (( sf_count == env_count)) && (( sf_count == dir_count)); then
|
elif (( sf_count == env_count)) && (( sf_count == dir_count)); then
|
||||||
status="$(printf "${green}Installed: %-5s${white}" "${sf_count}")"
|
status="Installed: ${sf_count}"
|
||||||
else
|
else
|
||||||
status="${yellow}Incomplete!${white} "
|
status="Incomplete!"
|
||||||
fi
|
fi
|
||||||
echo "${status}"
|
echo "${status}"
|
||||||
}
|
}
|
||||||
@@ -15,17 +15,17 @@ function main_ui(){
|
|||||||
top_border
|
top_border
|
||||||
echo -e "| $(title_msg "~~~~~~~~~~~~~~~ [ Main Menu ] ~~~~~~~~~~~~~~~") |"
|
echo -e "| $(title_msg "~~~~~~~~~~~~~~~ [ Main Menu ] ~~~~~~~~~~~~~~~") |"
|
||||||
hr
|
hr
|
||||||
echo -e "| 0) [Log-Upload] | Klipper: $(get_klipper_status)|"
|
echo -e "| 0) [Log-Upload] | Klipper: $(print_status "klipper")|"
|
||||||
echo -e "| | |"
|
echo -e "| | Repo: $(print_klipper_repo)|"
|
||||||
echo -e "| 1) [Install] | |"
|
echo -e "| 1) [Install] | |"
|
||||||
echo -e "| 2) [Update] | Moonraker: $(get_moonraker_status)|"
|
echo -e "| 2) [Update] | Moonraker: $(print_status "moonraker")|"
|
||||||
echo -e "| 3) [Remove] | |"
|
echo -e "| 3) [Remove] | |"
|
||||||
echo -e "| 4) [Advanced] | Mainsail: $(mainsail_status)|"
|
echo -e "| 4) [Advanced] | Mainsail: $(print_status "mainsail")|"
|
||||||
echo -e "| 5) [Backup] | Fluidd: $(fluidd_status)|"
|
echo -e "| 5) [Backup] | Fluidd: $(print_status "fluidd")|"
|
||||||
echo -e "| | KlipperScreen: $(klipperscreen_status)|"
|
echo -e "| | KlipperScreen: $(print_status "klipperscreen")|"
|
||||||
echo -e "| 6) [Settings] | Telegram Bot: $(get_telegram_bot_status)|"
|
echo -e "| 6) [Settings] | Telegram Bot: $(print_status "telegram_bot")|"
|
||||||
echo -e "| | |"
|
echo -e "| | |"
|
||||||
echo -e "| $(print_kiauh_version)| Octoprint: $(octoprint_status)|"
|
echo -e "| $(print_kiauh_version)| Octoprint: $(print_status "octoprint")|"
|
||||||
quit_footer
|
quit_footer
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -38,10 +38,39 @@ function get_kiauh_version(){
|
|||||||
|
|
||||||
function print_kiauh_version(){
|
function print_kiauh_version(){
|
||||||
local version
|
local version
|
||||||
version="$(printf "%-20s" "$(get_kiauh_version)")"
|
version="$(printf "%-18s" "$(get_kiauh_version)")"
|
||||||
echo "${cyan}${version}${white}"
|
echo "${cyan}${version}${white}"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function print_status(){
|
||||||
|
local status component="${1}"
|
||||||
|
status=$(get_"${component}"_status)
|
||||||
|
if [ "${status}" == "Not installed!" ]; then
|
||||||
|
status="${red}${status}${white}"
|
||||||
|
elif [ "${status}" == "Incomplete!" ]; then
|
||||||
|
status="${yellow}${status}${white}"
|
||||||
|
else
|
||||||
|
status="${green}${status}${white}"
|
||||||
|
fi
|
||||||
|
printf "%-28s" "${status}"
|
||||||
|
}
|
||||||
|
|
||||||
|
function print_klipper_repo(){
|
||||||
|
read_kiauh_ini
|
||||||
|
local repo klipper_status
|
||||||
|
klipper_status=$(get_klipper_status)
|
||||||
|
repo=$(echo ${custom_klipper_repo} | sed "s/https:\/\/github\.com\///" | sed "s/\.git$//")
|
||||||
|
repo="${repo^^}"
|
||||||
|
if [[ "${klipper_status}" == "Not installed!" ]]; then
|
||||||
|
repo="${red}-${white}"
|
||||||
|
elif [[ -n "${repo}" && "${repo}" != "KLIPPER3D/KLIPPER" ]]; then
|
||||||
|
repo="${cyan}custom${white}"
|
||||||
|
else
|
||||||
|
repo="${cyan}Klipper3d/klipper${white}"
|
||||||
|
fi
|
||||||
|
printf "%-28s" "${repo}"
|
||||||
|
}
|
||||||
|
|
||||||
function kiauh_update_dialog(){
|
function kiauh_update_dialog(){
|
||||||
[ ! "$(kiauh_update_avail)" == "true" ] && return
|
[ ! "$(kiauh_update_avail)" == "true" ] && return
|
||||||
top_border
|
top_border
|
||||||
|
|||||||
Reference in New Issue
Block a user