-
Notifications
You must be signed in to change notification settings - Fork 77
/
BOA.sh.txt
118 lines (109 loc) · 4.67 KB
/
BOA.sh.txt
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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
#!/bin/bash
###----------------------------------------###
###
### BOA Meta Installer
###
### Copyright (C) 2010-2014 Omega8.cc
### noc@omega8.cc www.omega8.cc
###
### This program is free software. You can
### redistribute it and/or modify it under
### the terms of the GNU GPL as published by
### the Free Software Foundation, version 2
### or later.
###
### 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 GPL
### for more details.
###
### You should have received a copy of the
### GNU GPL along with this program.
### If not, see http://www.gnu.org/licenses/
###
### Code: https://code.aegir.cc/aegir
###
###----------------------------------------###
###----------------------------------------###
### HOW-TO: run it with bash, not with sh ###
###----------------------------------------###
###
### bash BOA.sh.txt
###
###----------------------------------------###
### DON'T EDIT ANYTHING BELOW THIS LINE ###
###----------------------------------------###
export PATH=$PATH:/opt/local/bin
SHELL=/bin/bash
_TODAY=`date +%y%m%d`
setup ()
{
if [ ! -e "/etc/resolv.conf" ] ; then
echo "nameserver 8.8.8.8" >/etc/resolv.conf
echo "nameserver 8.8.4.4" >>/etc/resolv.conf
else
_RESOLV_TEST=$(grep "nameserver" /etc/resolv.conf)
if [[ "$_RESOLV_TEST" =~ "nameserver" ]] ; then
_DO_NOTHING=YES
else
rm -f /etc/resolv.conf
echo "nameserver 8.8.8.8" >/etc/resolv.conf
echo "nameserver 8.8.4.4" >>/etc/resolv.conf
fi
fi
_CURL_TEST=$(curl -L --max-redirs 10 -k -s -I "http://files.aegir.cc" 2> /dev/null)
if [[ "$_CURL_TEST" =~ "200 OK" ]] ; then
_DO_NOTHING=YES
else
apt-get clean -qq &> /dev/null
apt-get update -qq &> /dev/null
apt-get install curl -y --force-yes --reinstall &> /dev/null
fi
mkdir -p /usr/local/bin
mkdir -p /opt/local/bin
if [ ! -f "/opt/local/bin/.boa.bins.txt" ] || [ ! -f "/opt/local/bin/boa" ] || [ -L "/usr/local/bin/boa" ] ; then
rm -f /usr/local/bin/{barracuda*,boa*,drushextra*,octopus*,randpass*,sqlmagic*,syncpass*,thinkdifferent*}
touch /opt/local/bin/.boa.bins.txt
fi
if [ ! -f "/usr/local/bin/barracuda" ] || [ ! -f "/usr/local/bin/boa" ] || [ ! -f "/usr/local/bin/octopus" ] ; then
ln -sf /opt/local/bin/barracuda /usr/local/bin/barracuda
ln -sf /opt/local/bin/boa /usr/local/bin/boa
ln -sf /opt/local/bin/octopus /usr/local/bin/octopus
fi
rm -f /opt/local/bin/{barracuda*,boa*,drushextra*,octopus*,randpass*,sqlmagic*,syncpass*,thinkdifferent*}
curl -L --max-redirs 10 -k -s --retry 10 --retry-delay 5 -A iCab "http://files.aegir.cc/versions/master/aegir/tools/bin/barracuda" -o /opt/local/bin/barracuda
curl -L --max-redirs 10 -k -s --retry 10 --retry-delay 5 -A iCab "http://files.aegir.cc/versions/master/aegir/tools/bin/boa" -o /opt/local/bin/boa
curl -L --max-redirs 10 -k -s --retry 10 --retry-delay 5 -A iCab "http://files.aegir.cc/versions/master/aegir/tools/bin/drushextra" -o /opt/local/bin/drushextra
curl -L --max-redirs 10 -k -s --retry 10 --retry-delay 5 -A iCab "http://files.aegir.cc/versions/master/aegir/tools/bin/octopus" -o /opt/local/bin/octopus
curl -L --max-redirs 10 -k -s --retry 10 --retry-delay 5 -A iCab "http://files.aegir.cc/versions/master/aegir/tools/bin/randpass" -o /opt/local/bin/randpass
curl -L --max-redirs 10 -k -s --retry 10 --retry-delay 5 -A iCab "http://files.aegir.cc/versions/master/aegir/tools/bin/sqlmagic" -o /opt/local/bin/sqlmagic
curl -L --max-redirs 10 -k -s --retry 10 --retry-delay 5 -A iCab "http://files.aegir.cc/versions/master/aegir/tools/bin/syncpass" -o /opt/local/bin/syncpass
curl -L --max-redirs 10 -k -s --retry 10 --retry-delay 5 -A iCab "http://files.aegir.cc/versions/master/aegir/tools/bin/thinkdifferent" -o /opt/local/bin/thinkdifferent
echo "### $_TODAY ###" >> /opt/local/bin/boa
echo "### $_TODAY ###" >> /opt/local/bin/barracuda
echo "### $_TODAY ###" >> /opt/local/bin/octopus
chmod 700 /opt/local/bin/{boa,barracuda,octopus,syncpass}
chmod 755 /opt/local/bin/{randpass,sqlmagic,drushextra,thinkdifferent}
echo
echo "BOA Meta Installer setup completed"
echo "Please check INSTALL.txt and UPGRADE.txt at http://bit.ly/boa-docs for how-to"
echo "Bye"
echo
}
###--------------------###
if [ `whoami` = "root" ] ; then
chmod a+w /dev/null
if [ ! -e "/dev/fd" ] ; then
if [ -e "/proc/self/fd" ] ; then
rm -rf /dev/fd
ln -s /proc/self/fd /dev/fd
fi
fi
setup
exit 0
else
msg "ERROR: This script should be ran as a root user - please `sudo -i` first"
exit 1
fi