-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathggcom.bash
executable file
·79 lines (63 loc) · 2.21 KB
/
ggcom.bash
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#!/usr/bin/env bash
: <<'!COMMENT'
GGCOM - Bash - Utils - GotGet Common Interface v201504162001
Louis T. Getterman IV (@LTGIV)
www.GotGetLLC.com | www.opensour.cc/ggcom/interface
Example usage:
ggcom.bash
!COMMENT
################################################################################
SOURCE="${BASH_SOURCE[0]}" # Dave Dopson, Thank You! - http://stackoverflow.com/questions/59895/can-a-bash-script-tell-what-directory-its-stored-in
while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
SCRIPTPATH="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
SOURCE="$(readlink "$SOURCE")"
[[ $SOURCE != /* ]] && SOURCE="$SCRIPTPATH/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
done
################################################################################
SCRIPTPATH="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
SCRIPTNAME=`basename "$SOURCE"`
LIBPATH="$( cd "$(dirname "${SCRIPTPATH}/../../")" ; pwd -P )/ggcom-bash-library"
################################################################################
source "${LIBPATH}/varsBash.bash"
source "${LIBPATH}/string.bash"
source "${LIBPATH}/version.bash"
################################################################################
source "${LIBPATH}/prompt.bash"
################################################################################
#----- NOTICE: INFO
echo "`getVersion $0 header`"
echo;
#-----/NOTICE: INFO
#----- FYI
echo;
echo "FYI: Right now, the only thing that this utility does is update.";
echo "`pauseret`";
#-----/FYI
#----- CREATE GGCOM UPDATER
TMPUPD=`mktemp /tmp/ggcom.XXXXXXXXX`
chmod 700 $TMPUPD
#-----/CREATE GGCOM UPDATER
#----- CREATE GGCOM MANIFEST
read -r -d '' UPDCMDS <<EOF
echo "Updater generated by: `getVersion $0 program`"
sleep 5
cd "${SCRIPTPATH}/"
echo -n "Updating : "
pwd
git pull
cd "${LIBPATH}/"
echo -n "Updating : "
pwd
git pull
echo
echo "[Removing GGCOM updater]"
rm -rfv "${TMPUPD}"
EOF
#-----/CREATE GGCOM MANIFEST
#----- WRITE GGCOM MANIFEST TO GGCOM UPDATER
echo "$UPDCMDS" > $TMPUPD
#-----/WRITE GGCOM MANIFEST TO GGCOM UPDATER
#----- RUN GGCOM UPDATER
echo "[Running GGCOM updater]"
eval $TMPUPD &
#-----/RUN GGCOM UPDATER