mirror of
https://github.com/dw-0/kiauh.git
synced 2025-12-14 02:54:28 +05:00
new kiauh update check
This commit is contained in:
2
kiauh.sh
2
kiauh.sh
@@ -93,7 +93,7 @@ clear_msg(){
|
|||||||
main_menu(){
|
main_menu(){
|
||||||
print_header
|
print_header
|
||||||
#print KIAUH update msg if update available
|
#print KIAUH update msg if update available
|
||||||
if [ $KIAUH_UPDATE_AVAIL = 1 ]; then
|
if [ $KIAUH_UPDATE_AVAIL -gt 0 ]; then
|
||||||
kiauh_update_msg
|
kiauh_update_msg
|
||||||
fi
|
fi
|
||||||
#check install status
|
#check install status
|
||||||
|
|||||||
@@ -1,15 +1,15 @@
|
|||||||
kiauh_status(){
|
kiauh_status(){
|
||||||
cd ${HOME}/kiauh
|
cd ${HOME}/kiauh
|
||||||
#get remote state
|
git fetch --all -q
|
||||||
git fetch origin master -q
|
CURR_KIAUH_BRANCH=$(git branch -a | head -1 | cut -d" " -f2)
|
||||||
REMOTE_KIAUH_COMMIT=$(git rev-parse --short=8 origin/master)
|
if [ $CURR_KIAUH_BRANCH = "master" ]; then
|
||||||
#REMOTE_KIAUH_COMMIT=$(git rev-parse --short=8 dev-2.0)
|
REMOTE_KIAUH_COMMIT=$(git rev-parse --short=8 origin/master)
|
||||||
#get local state
|
#if count of new commits >0, then update available
|
||||||
LOCAL_KIAUH_COMMIT=$(git rev-parse --short=8 HEAD)
|
KIAUH_UPDATE_AVAIL=$(git log ..origin/master --oneline | wc -l)
|
||||||
if [ "$LOCAL_KIAUH_COMMIT" != "$REMOTE_KIAUH_COMMIT" ]; then
|
elif [ $CURR_KIAUH_BRANCH = "dev-2.0" ]; then
|
||||||
KIAUH_UPDATE_AVAIL=1
|
REMOTE_KIAUH_COMMIT=$(git rev-parse --short=8 dev-2.0)
|
||||||
else
|
#if count of new commits >0, then update available
|
||||||
KIAUH_UPDATE_AVAIL=0
|
KIAUH_UPDATE_AVAIL=$(git log ..dev-2.0 --oneline | wc -l)
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ quit_footer(){
|
|||||||
hr
|
hr
|
||||||
echo -e "| ${red}Q) Quit${default} | "
|
echo -e "| ${red}Q) Quit${default} | "
|
||||||
bottom_border
|
bottom_border
|
||||||
|
echo -e " KIAUH: $CURR_KIAUH_BRANCH"
|
||||||
}
|
}
|
||||||
|
|
||||||
print_header(){
|
print_header(){
|
||||||
|
|||||||
@@ -1,8 +1,9 @@
|
|||||||
update_kiauh(){
|
update_kiauh(){
|
||||||
if [ $KIAUH_UPDATE_AVAIL = 1 ]; then
|
if [ $KIAUH_UPDATE_AVAIL -gt 0 ]; then
|
||||||
status_msg "Updating KIAUH ..."
|
status_msg "Updating KIAUH ..."
|
||||||
cd ${HOME}/kiauh
|
cd ${HOME}/kiauh
|
||||||
git pull && ok_msg "Update complete! Please restart KIAUH."; echo
|
git pull && ok_msg "Update complete! Please restart KIAUH."
|
||||||
|
exit -1
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user