-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathconfigure
executable file
·181 lines (166 loc) · 5.41 KB
/
configure
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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
#!/bin/sh
# Usage:
# ./configure [install]
# TODO:
# - Add puppet instructions for OSX, see: http://projects.puppetlabs.com/projects/1/wiki/puppet_mac_osx
PUPPET_CMD=`which puppet`
ERROR=0
DONE=0
RED=$(tput setaf 1)
GREEN=$(tput setaf 2)
BLUE=$(tput setaf 6)
YELLOW=$(tput setaf 3)
NC=$(tput sgr 0)
# Show distribution details.
case "$OSTYPE" in
linux-gnu*) # Debian
lsb_release -a
;;
linux*)
lsb_release -a
;;
darwin*) # Mac (OSX)
uname -a
;;
*)
which lsb_release && lsb_release -a || uname -a
;;
esac
# Check if user has sudo access
if sudo -n true 2>/dev/null; then
SUDO="sudo"
else
SUDO=""
fi
if [ ! -n "$PUPPET_CMD" ]; then
if [ "x$1" = "xinstall" ]; then
echo "Installing puppet..."
# Add the repo for your distribution if dpkg is present.
which dpkg && (curl -O https://apt.puppetlabs.com/puppetlabs-release-precise.deb && ls && $SUDO dpkg -i puppetlabs-release-precise.deb)
# >= dpkg >= 1.17.7 # curl -o- https://apt.puppetlabs.com/puppetlabs-release-precise.deb | sudo dpkg --install -
case "$OSTYPE" in
linux*)
$SUDO apt-get update && $SUDO apt-get -y install puppet
;;
darwin*) # Mac (OSX)
$SUDO brew install puppet
;;
*)
which apt-get && $SUDO apt-get update && $SUDO apt-get -y install puppet || echo "System $OSTYPE not supported."
;;
esac
which puppet && echo "Installed puppet in version `puppet --version`" || echo "Installation of puppet failed."
else
echo "${RED}Detected missing puppet command${NC}, you may install it via:"
echo " ${BLUE}sudo apt-get install puppet${NC}"
echo "OR just re-run script with:"
echo " ${BLUE}$0 install${NC}"
echo ""
ERROR=1
fi
fi
if [ ! "`$SUDO puppet module list`" ]; then
if [ "x$1" = "xinstall" ]; then
echo "Installing puppet-module gem..."
$SUDO gem install puppet-module
else
echo "${RED}Detected missing puppet module subcommand, so you should upgrade your puppet, you install it via:"
echo " ${BLUE}${SUDO} gem install puppet-module${NC}"
echo "OR just re-run script with:"
echo " ${BLUE}$0 install${NC}"
echo ""
ERROR=1
fi
fi
if [ ! -n "`$SUDO puppet module list | grep rafaelfc-pear`" ]; then
if [ "x$1" = "xinstall" ]; then
echo "Installing rafaelfc-pear puppet module..."
$SUDO puppet module install rafaelfc-pear
else
echo "${RED}Detected missing puppet module \"rafaelfc-pear\"${NC}, you may install it via:"
echo " ${BLUE}${SUDO} puppet module install rafaelfc-pear${NC}"
echo "OR just re-run script with:"
echo " ${BLUE}$0 install${NC}"
echo ""
ERROR=1
fi
fi
if [ ! -n "`$SUDO puppet module list | grep puppetlabs-apache`" ]; then
if [ "x$1" = "xinstall" ]; then
echo "Installing puppetlabs-apache puppet module..."
$SUDO puppet module install puppetlabs-apache
else
echo "${RED}Detected missing puppet module \"puppetlabs-apache\"${NC}, you may install it via:"
echo " ${BLUE}${SUDO} puppet module install puppetlabs-apache${NC}"
echo "OR just re-run script with:"
echo " ${BLUE}$0 install${NC}"
echo ""
ERROR=1
fi
fi
if [ ! -n "`sudo puppet module list | grep puppetlabs-mysql`" ]; then
if [ "x$1" = "xinstall" ]; then
echo "Installing puppetlabs-mysql puppet module..."
$SUDO puppet module install puppetlabs-mysql
else
echo "${RED}Detected missing puppet module \"puppetlabs-mysql\"${NC}, you may install it via:"
echo " ${BLUE}${SUDO} puppet module install puppetlabs-mysql${NC}"
echo "OR just re-run script with:"
echo " ${BLUE}$0 install${NC}"
echo ""
ERROR=1
fi
fi
if [ ! -n "`sudo puppet module list | grep puppetlabs-java`" ]; then
if [ "x$1" = "xinstall" ]; then
echo "Installing puppetlabs-java puppet module..."
$SUDO puppet module install puppetlabs-java
else
echo "${RED}Detected missing puppet module \"puppetlabs-java\"${NC}, you may install it via:"
echo " ${BLUE}${SUDO} puppet module install puppetlabs-java${NC}"
echo "OR just re-run script with:"
echo " ${BLUE}$0 install${NC}"
echo ""
ERROR=1
fi
fi
if [ ! -n "`sudo puppet module list | grep puppetlabs-tomcat`" ]; then
if [ "x$1" = "xinstall" ]; then
echo "Installing puppetlabs-tomcat puppet module..."
$SUDO puppet module install puppetlabs-tomcat
else
echo "${RED}Detected missing puppet module \"puppetlabs-tomcat\"${NC}, you may install it via:"
echo " ${BLUE}${SUDO} puppet module install puppetlabs-tomcat${NC}"
echo "OR just re-run script with:"
echo " ${BLUE}$0 install${NC}"
echo ""
ERROR=1
fi
fi
if [ "${ERROR}" = "1" ]; then
echo "${RED}Errors encountered. Quitting.${NC}"
exit 1
fi
echo "${GREEN}Configuration successful.${NC}"
if [ "x$1" = "xinstall" ]; then
echo "Configuring puppet modules..."
cat puppet/ads.dev.pp puppet/apache-mod_geoip2.pp | puppet apply
echo ""
DONE=1
else
echo "${YELLOW}You need to run puppet to apply configuration requirements, you may do it via:${NC}"
echo " ${BLUE}${SUDO} puppet -v puppet/ads.dev.pp${NC}"
echo "OR just re-run script with:"
echo " ${BLUE}$0 install${NC}"
echo ""
DONE=0
fi
if [ "${DONE}" = "1" ]; then
echo "Now you can build ADS distribution by the following command:"
echo " ${BLUE}make (or phing)${NC}"
echo ""
else
echo "${YELLOW}After you finish, you will be able to build ADS distribution by the following command:${NC}"
echo " ${BLUE}make (or phing)${NC}"
echo ""
fi