-
Notifications
You must be signed in to change notification settings - Fork 11
/
install.sh
executable file
·78 lines (63 loc) · 2.16 KB
/
install.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
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
#!/bin/bash
# Copyright (C) 2014 Oscar Campos <[email protected]>
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
# See LICENSE file for more details.
# tools
GO=`which go`
GIT=`which git`
# colors
OK="\033[32m"
FAIL="\033[31m"
RESET="\033[0m"
# variables
CURRDIR=`pwd`
WORKDIR='.vengo_installation'
DESTDIR=$HOME/.VenGO
REPOSITORY='github.com/DamnWidget/VenGO'
[ "$GIT" = "" ] && {
echo "Git can't be found in your system"
echo -ne " ${OK}suggestion${RESET}: run '"
[ x$(uname) = "xLinux" ] && {
[ x$(which apt-get) != "x" ] && {
echo "apt-get install git' to install it"
} || {
echo "yum install git' to install it"
}
} || {
echo "'brew install git'"
}
echo ""
exit 1
}
echo -n "Getting sources... "
$GIT clone https://$REPOSITORY $WORKDIR 2> /dev/null
echo -e "${OK}✔${RESET}"
echo -n "Getting VenGO binary... "
$GO get $REPOSITORY
mv $GOPATH/bin/VenGO $WORKDIR/bin/vengo
echo -e "${OK}✔${RESET}"
echo -n "Installing binaries and data into $DESTDIR..."
if [ ! -d "$DESTDIR" ]; then
mkdir $DESTDIR
fi
rm -Rf "${DESTDIR}/bin"
rm -Rf "${DESTDIR}/scripts/tpl"
mv $WORKDIR/bin $DESTDIR/
mv $WORKDIR/env/tpl $DESTDIR/scripts/
mv $WORKDIR/VERSION $DESTDIR/
rm -Rf $WORKDIR
echo -e "${OK}✔${RESET}"
echo ""
echo -e "${OK}VenGO is now installed in your system${RESET}"
echo "add 'source ${HOME}/.VenGO/bin/vengo.sh' to your .bashrc or .profile to activate it"
echo "you can also do '. ${HOME}/.VenGO/bin/vengo.sh' to start using it right now"