-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall
executable file
·62 lines (55 loc) · 2.38 KB
/
install
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
#!/usr/bin/env sh
#
# Clone gilbertsoft/infrastructure-opsone-dba from github to user home
# Copyright (C) 2019 Gilbertsoft
#
# 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 3 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, see <http://www.gnu.org/licenses/>.
n=$(readlink -f ${0})
if [ "$(basename ${0})" = "install" ]; then
# Create tmp copy to prevent update errors
cp -p ${n} ${n}.exec
chmod +x ${n}.exec
exec ${n}.exec
else
# Change directory to user home
cd ~
# Check for an existing git repository
if [ -d ".git" ]; then
echo "*****************************************************************************"
echo "* A git repository does already exist, the installer will use the current *"
echo "* branch to continue the setup process. *"
echo "* *"
echo "* If you like to do a fresh installation, run the following command: *"
echo "* *"
echo "* 'rm -fr .git && ./installer' *"
echo "* *"
echo "*****************************************************************************"
# Reset hard and update
git reset -q --hard
git pull -q
else
# Clone gilbertsoft/infrastructure-opsone-dba stable branch from github
git clone -q --depth=1 --branch=stable https://github.com/gilbertsoft/infrastructure-opsone-dba.git tmp/dba
# Move .git to current directory
mv tmp/dba/.git .git
# Delete tmp/dba
rm -fr tmp/dba
fi
# Run setup script
. ./setup
# Clean up tmp .exec file
if [ -f ${n} ]; then
rm -f ${n}
fi
fi