-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathupdater.sh
executable file
·50 lines (33 loc) · 1.2 KB
/
updater.sh
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#!/usr/bin/env bash
#
# Author: GauchoCode - A Software Development Agency - https://gauchocode.com
# Version: 3.3.10
#############################################################################
SCRIPT="$(readlink -f "$0")"
SCRIPTFILE="$(basename "${SCRIPT}")"
#SCRIPTPATH="$(dirname "${SCRIPT}")"
BRANCH="master"
# Foreground/Text Colours
GREEN='\E[32;40m'
YELLOW='\E[33;40m'
CYAN='\E[36;40m'
ENDCOLOR='\033[0m'
function _self_update() {
# Store credentials on first git pull
git config --global credential.helper store
git fetch
if git diff --name-only "origin/${BRANCH}" | grep -q "${SCRIPTFILE}"; then
echo -e "${GREEN}Found a new version of BROLIT Shell, updating ...${ENDCOLOR}"
git checkout --quiet "${BRANCH}"
git reset --hard --quiet origin/master
git pull --ff-only --force --quiet
echo -e "${GREEN}Running chmod ...${ENDCOLOR}"
find ./ -name "*.sh" -exec chmod +x {} \;
echo -e "${CYAN}Now you can run the runner.sh, enjoy!${ENDCOLOR}"
exit 1
else
echo -e "${YELLOW}Already the latest version.${ENDCOLOR}"
fi
}
#############################################################################
_self_update