-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathcheckUpdate.sh
More file actions
26 lines (23 loc) · 965 Bytes
/
checkUpdate.sh
File metadata and controls
26 lines (23 loc) · 965 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
function _ddeCheckUpdate() {
local oldPwd=$(pwd)
cd ${ROOT_DIR}
if [ ! -f "${DDE_DATA_HOME}/.dde_update_check" ] || [ $(find "${DDE_DATA_HOME}/.dde_update_check" -mtime +1 -print) ]; then
_logYellow "Check if dde update is available"
git fetch || true # allow offline usage
touch ${DDE_DATA_HOME}/.dde_update_check
fi
local upstream=${1:-'@{u}'}
local local=$(git rev-parse @)
local remote=$(git rev-parse "$upstream")
local base=$(git merge-base @ "$upstream")
if [ "$local" != "$remote" ] && [ "$local" = "$base" ]; then
_logRed ""
_logRed "--------------------------------------------"
_logRed "| dde update available |"
_logRed "--------------------------------------------"
_logRed "| please run dde system:update |"
_logRed "--------------------------------------------"
_logRed ""
fi
cd ${oldPwd}
}