refactor: check kiauh update only on start
do not prompt for updates everytime the main menu gets displayed Signed-off-by: Dominik Willner th33xitus@gmail.com
This commit is contained in:
29
kiauh.sh
29
kiauh.sh
@@ -54,9 +54,36 @@ function kiauh_update_avail() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function kiauh_update_dialog() {
|
||||||
|
[[ ! $(kiauh_update_avail) == "true" ]] && return
|
||||||
|
top_border
|
||||||
|
echo -e "|${green} New KIAUH update available! ${white}|"
|
||||||
|
hr
|
||||||
|
echo -e "|${green} View Changelog: https://git.io/JnmlX ${white}|"
|
||||||
|
blank_line
|
||||||
|
echo -e "|${yellow} It is recommended to keep KIAUH up to date. Updates ${white}|"
|
||||||
|
echo -e "|${yellow} usually contain bugfixes, important changes or new ${white}|"
|
||||||
|
echo -e "|${yellow} features. Please consider updating! ${white}|"
|
||||||
|
bottom_border
|
||||||
|
|
||||||
|
local yn
|
||||||
|
read -p "${cyan}Do you want to update now? (Y/n):${white} " yn
|
||||||
|
while true; do
|
||||||
|
case "${yn}" in
|
||||||
|
Y|y|Yes|yes|"")
|
||||||
|
do_action "update_kiauh"
|
||||||
|
break;;
|
||||||
|
N|n|No|no)
|
||||||
|
break;;
|
||||||
|
*)
|
||||||
|
deny_action "kiauh_update_dialog";;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
check_euid
|
check_euid
|
||||||
init_logfile
|
init_logfile
|
||||||
set_globals
|
set_globals
|
||||||
init_ini
|
init_ini
|
||||||
kiauh_update_avail
|
kiauh_update_dialog
|
||||||
main_menu
|
main_menu
|
||||||
|
|||||||
@@ -76,38 +76,10 @@ function print_klipper_repo() {
|
|||||||
printf "%-28s" "${repo}"
|
printf "%-28s" "${repo}"
|
||||||
}
|
}
|
||||||
|
|
||||||
function kiauh_update_dialog() {
|
|
||||||
[[ ! $(kiauh_update_avail) == "true" ]] && return
|
|
||||||
top_border
|
|
||||||
echo -e "|${green} New KIAUH update available! ${white}|"
|
|
||||||
hr
|
|
||||||
echo -e "|${green} View Changelog: https://git.io/JnmlX ${white}|"
|
|
||||||
blank_line
|
|
||||||
echo -e "|${yellow} It is recommended to keep KIAUH up to date. Updates ${white}|"
|
|
||||||
echo -e "|${yellow} usually contain bugfixes, important changes or new ${white}|"
|
|
||||||
echo -e "|${yellow} features. Please consider updating! ${white}|"
|
|
||||||
bottom_border
|
|
||||||
|
|
||||||
local yn
|
|
||||||
read -p "${cyan}Do you want to update now? (Y/n):${white} " yn
|
|
||||||
while true; do
|
|
||||||
case "${yn}" in
|
|
||||||
Y|y|Yes|yes|"")
|
|
||||||
do_action "update_kiauh"
|
|
||||||
break;;
|
|
||||||
N|n|No|no)
|
|
||||||
break;;
|
|
||||||
*)
|
|
||||||
deny_action "kiauh_update_dialog";;
|
|
||||||
esac
|
|
||||||
done
|
|
||||||
}
|
|
||||||
|
|
||||||
function main_menu() {
|
function main_menu() {
|
||||||
print_header
|
print_header && main_ui
|
||||||
#prompt for KIAUH update if update available
|
|
||||||
kiauh_update_dialog
|
|
||||||
main_ui
|
|
||||||
|
|
||||||
local action
|
local action
|
||||||
while true; do
|
while true; do
|
||||||
|
|||||||
Reference in New Issue
Block a user