-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall_cmds.sh
More file actions
executable file
·68 lines (61 loc) · 2.52 KB
/
install_cmds.sh
File metadata and controls
executable file
·68 lines (61 loc) · 2.52 KB
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
#!/bin/bash
# Copyright 2014, Tom Eklöf, Mogul AB
#
# 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/>.
function COOK-1406()
# Work around the omnibus pg gem issue as suggested by Joshua Timberman in COOK-1406
{
apt-get install -y build-essential
apt-get build-dep -y postgresql
cd /opt/chef/embedded/
curl -o postgresql-9.2.1.tar.gz http://ftp.postgresql.org/pub/source/v9.2.1/postgresql-9.2.1.tar.gz
tar xzf /opt/chef/embedded/postgresql-9.2.1.tar.gz -C /opt/chef/embedded/
cd postgresql-9.2.1
export MAJOR_VER=9.2
./configure --prefix=/opt/chef/embedded \
--mandir=/opt/chef/embedded/share/postgresql/${MAJOR_VER}/man \
--docdir=/opt/chef/embedded/share/doc/postgresql-doc-${MAJOR_VER} \
--sysconfdir=/etc/postgresql-common \
--datarootdir=/opt/chef/embedded/share/ \
--datadir=/opt/chef/embedded/share/postgresql/${MAJOR_VER} \
--bindir=/opt/chef/embedded/lib/postgresql/${MAJOR_VER}/bin \
--libdir=/opt/chef/embedded/lib/ \
--libexecdir=/opt/chef/embedded/lib/postgresql/ \
--includedir=/opt/chef/embedded/include/postgresql/ \
--enable-integer-datetimes \
--enable-thread-safety \
--enable-debug \
--with-gnu-ld \
--with-pgport=5432 \
--with-openssl \
--with-libedit-preferred \
--with-includes=/opt/chef/embedded/include \
--with-libs=/opt/chef/embedded/lib
make
make install
/opt/chef/embedded/bin/gem install pg -- --with-pg-config=/opt/chef/embedded/lib/postgresql/9.2/bin/pg_config
rm -f /opt/chef/embedded/postgresql-9.2.1.tar.gz
cd -
}
apt-get -y update
COOK-1406 # This is currently needed to use the database cookbook
# Change the dbpassword string below to something good.
sed -i "s%md5sumhash%$(echo -n 'dbpassword' | openssl md5 | sed -e 's/.* /md5/')%g" /etc/chef/node.json
# Install cookbooks defined in Berkshelf file
cd /
/opt/chef/embedded/bin/berks vendor /etc/chef/cookbooks/
# Add our custom cookbook to create the database
mv /create-db.rb /etc/chef/cookbooks/database/recipes/create-db.rb
# Run cookbooks
chef-solo