mirror of
https://github.com/dw-0/kiauh.git
synced 2025-12-14 11:04:29 +05:00
simple startup update check for KIAUH
This commit is contained in:
13
kiauh.sh
13
kiauh.sh
@@ -93,19 +93,29 @@ print_msg(){
|
|||||||
|
|
||||||
main_menu(){
|
main_menu(){
|
||||||
print_header
|
print_header
|
||||||
print_msg && CONFIRM_MSG="" && ERROR_MSG=""
|
#print KIAUH update msg if update available
|
||||||
|
if [ $KIAUH_UPDATE_AVAIL = 1 ]; then
|
||||||
|
kiauh_update_msg
|
||||||
|
fi
|
||||||
#check install status
|
#check install status
|
||||||
klipper_status
|
klipper_status
|
||||||
dwc2_status
|
dwc2_status
|
||||||
mainsail_status
|
mainsail_status
|
||||||
octoprint_status
|
octoprint_status
|
||||||
print_branch
|
print_branch
|
||||||
|
print_msg && CONFIRM_MSG="" && ERROR_MSG=""
|
||||||
main_ui
|
main_ui
|
||||||
while true; do
|
while true; do
|
||||||
echo -e "${cyan}"
|
echo -e "${cyan}"
|
||||||
read -p "Perform action: " action; echo
|
read -p "Perform action: " action; echo
|
||||||
echo -e "${default}"
|
echo -e "${default}"
|
||||||
case "$action" in
|
case "$action" in
|
||||||
|
update)
|
||||||
|
clear
|
||||||
|
print_header
|
||||||
|
update_kiauh
|
||||||
|
print_msg && CONFIRM_MSG="" && ERROR_MSG=""
|
||||||
|
main_ui;;
|
||||||
0)
|
0)
|
||||||
clear
|
clear
|
||||||
print_header
|
print_header
|
||||||
@@ -487,4 +497,5 @@ SRCDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )"/.. && pwd )"
|
|||||||
for script in ${SRCDIR}/kiauh/scripts/*; do . $script; done
|
for script in ${SRCDIR}/kiauh/scripts/*; do . $script; done
|
||||||
|
|
||||||
check_euid
|
check_euid
|
||||||
|
kiauh_status
|
||||||
main_menu
|
main_menu
|
||||||
@@ -1,3 +1,16 @@
|
|||||||
|
kiauh_status(){
|
||||||
|
cd ${HOME}/kiauh
|
||||||
|
#get local state
|
||||||
|
LOCAL_KIAUH_COMMIT=$(git rev-parse --short=8 HEAD)
|
||||||
|
#REMOTE_KIAUH_COMMIT=$(git rev-parse --short=8 origin/master)
|
||||||
|
REMOTE_KIAUH_COMMIT=$(git rev-parse --short=8 dev-2.0)
|
||||||
|
if [ "$LOCAL_KIAUH_COMMIT" != "$REMOTE_KIAUH_COMMIT" ]; then
|
||||||
|
KIAUH_UPDATE_AVAIL=1
|
||||||
|
else
|
||||||
|
KIAUH_UPDATE_AVAIL=0
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
klipper_status(){
|
klipper_status(){
|
||||||
kcount=0
|
kcount=0
|
||||||
klipper_data=(
|
klipper_data=(
|
||||||
|
|||||||
@@ -155,3 +155,10 @@ switch_ui(){
|
|||||||
echo -e "| 5) [--> dev-moonraker] | "
|
echo -e "| 5) [--> dev-moonraker] | "
|
||||||
quit_footer
|
quit_footer
|
||||||
}
|
}
|
||||||
|
|
||||||
|
kiauh_update_msg(){
|
||||||
|
top_border
|
||||||
|
echo -e "| ${yellow}There is a newer version of this script available!${default} | "
|
||||||
|
echo -e "| ${yellow}Type 'update' if you want to update KIAUH now.${default} | "
|
||||||
|
bottom_border
|
||||||
|
}
|
||||||
@@ -6,6 +6,14 @@ update_check(){
|
|||||||
read_remote_commit
|
read_remote_commit
|
||||||
}
|
}
|
||||||
|
|
||||||
|
update_kiauh(){
|
||||||
|
if [ $KIAUH_UPDATE_AVAIL = 1 ]; then
|
||||||
|
status_msg "Updating KIAUH ..."
|
||||||
|
cd ${HOME}/kiauh
|
||||||
|
git pull && ok_msg "Update complete! Please restart KIAUH."; echo
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
update_klipper(){
|
update_klipper(){
|
||||||
stop_klipper
|
stop_klipper
|
||||||
bb4u "klipper"
|
bb4u "klipper"
|
||||||
|
|||||||
Reference in New Issue
Block a user