diff --git a/kiauh.sh b/kiauh.sh index abdc090..cb4b581 100755 --- a/kiauh.sh +++ b/kiauh.sh @@ -93,7 +93,7 @@ clear_msg(){ main_menu(){ print_header #print KIAUH update msg if update available - if [ $KIAUH_UPDATE_AVAIL = 1 ]; then + if [ $KIAUH_UPDATE_AVAIL -gt 0 ]; then kiauh_update_msg fi #check install status diff --git a/scripts/status.sh b/scripts/status.sh index 6a5e75a..c4739f1 100644 --- a/scripts/status.sh +++ b/scripts/status.sh @@ -1,15 +1,15 @@ kiauh_status(){ cd ${HOME}/kiauh - #get remote state - git fetch origin master -q - REMOTE_KIAUH_COMMIT=$(git rev-parse --short=8 origin/master) - #REMOTE_KIAUH_COMMIT=$(git rev-parse --short=8 dev-2.0) - #get local state - LOCAL_KIAUH_COMMIT=$(git rev-parse --short=8 HEAD) - if [ "$LOCAL_KIAUH_COMMIT" != "$REMOTE_KIAUH_COMMIT" ]; then - KIAUH_UPDATE_AVAIL=1 - else - KIAUH_UPDATE_AVAIL=0 + git fetch --all -q + CURR_KIAUH_BRANCH=$(git branch -a | head -1 | cut -d" " -f2) + if [ $CURR_KIAUH_BRANCH = "master" ]; then + REMOTE_KIAUH_COMMIT=$(git rev-parse --short=8 origin/master) + #if count of new commits >0, then update available + KIAUH_UPDATE_AVAIL=$(git log ..origin/master --oneline | wc -l) + elif [ $CURR_KIAUH_BRANCH = "dev-2.0" ]; then + REMOTE_KIAUH_COMMIT=$(git rev-parse --short=8 dev-2.0) + #if count of new commits >0, then update available + KIAUH_UPDATE_AVAIL=$(git log ..dev-2.0 --oneline | wc -l) fi } diff --git a/scripts/ui.sh b/scripts/ui.sh index 91d224b..ef81f57 100644 --- a/scripts/ui.sh +++ b/scripts/ui.sh @@ -17,6 +17,7 @@ quit_footer(){ hr echo -e "| ${red}Q) Quit${default} | " bottom_border + echo -e " KIAUH: $CURR_KIAUH_BRANCH" } print_header(){ diff --git a/scripts/update.sh b/scripts/update.sh index b054e2d..c387307 100644 --- a/scripts/update.sh +++ b/scripts/update.sh @@ -1,8 +1,9 @@ update_kiauh(){ - if [ $KIAUH_UPDATE_AVAIL = 1 ]; then + if [ $KIAUH_UPDATE_AVAIL -gt 0 ]; then status_msg "Updating 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 }