/ Scripts / Menu / menu-system-updates.sh
menu-system-updates.sh
 1  #!/bin/bash
 2  
 3  # shellcheck source=./Scripts/defaults.sh
 4  . "$HOME"/RoninDojo/Scripts/defaults.sh
 5  
 6  # shellcheck source=./Scripts/functions.sh
 7  . "$HOME"/RoninDojo/Scripts/functions.sh
 8  
 9  _load_user_conf
10  
11  OPTIONS=(1 "Check for RoninDojo Update"
12           2 "Update RoninDojo"
13           3 "Go Back")
14  
15  CHOICE=$(dialog --clear \
16                  --title "$TITLE" \
17                  --menu "$MENU" \
18                  "$HEIGHT" "$WIDTH" "$CHOICE_HEIGHT" \
19                  "${OPTIONS[@]}" \
20                  2>&1 >/dev/tty)
21  
22  clear
23  case $CHOICE in
24      1)
25          
26          cd "${ronin_dir}" || exit
27          git fetch --prune > /dev/null
28          newCommitCount="$(git rev-list --first-parent --count "HEAD..${ronin_dojo_branch}")"
29          cd - || exit
30  
31          if [[ "${newCommitCount}" != "0" ]] ; then
32              _print_message "RoninDojo update is available!"
33              _sleep
34          else
35              _print_message "No update is available!"
36              _sleep
37          fi
38          ;;
39  
40      2)
41          bash -c "${ronin_dojo_api_ronindojo_upgrade}"
42          ;;
43      3)
44          bash -c "${ronin_system_menu}"
45          exit
46          ;;
47  esac
48  
49  _pause return
50  bash -c "${ronin_system_update}"