forked from struCoder/pmgo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
install.sh
62 lines (46 loc) · 1.17 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
#!/bin/sh
version="0.5.1"
UNAME=$(uname)
PROJECT_PATH="$GOPATH/src/github.com/struCoder"
OLD_PROJECT_PATH="$GOPATH/src/github.com/struCoder/pmgo"
BACKUP=false
# Check to see if it starts with MINGW.
if [ "$UNAME" ">" "MINGW" -a "$UNAME" "<" "MINGX" ] ; then
echo "current release do not support windows"
exit 1
fi
if [ "$UNAME" != "Linux" -a "$UNAME" != "Darwin" ] ; then
echo "Sorry, this OS is not supported yet via this installer."
exit 1
fi
# Check GOPATH exist
if [ ! -n "$GOPATH" ] ; then
echo "please make sure that GOPATH exist"
exit 1
fi
# create source dir
if [ ! -d "$PROJECT_PATH" ] ; then
mkdir -p $PROJECT_PATH
fi
# backup if pmgo dir exited
if [ -d "$OLD_PROJECT_PATH" ] ; then
mv $OLD_PROJECT_PATH "$PROJECT_PATH/pmgo_backup"
BACKUP=true
fi
cd $PROJECT_PATH
wget https://github.com/struCoder/pmgo/archive/v${version}.tar.gz
tar -zxvf v${version}.tar.gz
mv pmgo-${version} pmgo
cd pmgo
echo "build pmgo..."
go build -o /usr/local/bin/pmgo pmgo.go
echo "build done"
cd ..
echo "rm build files"
rm -rf pmgo-${version}
rm -rf pmgo
rm v${version}.tar.gz
if [ "$BACKUP" = true ] ; then
mv "$PROJECT_PATH/pmgo_backup" pmgo
fi
echo "all down."