forked from map7/chef-solo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall.sh
52 lines (38 loc) · 1.94 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
#!/bin/bash
json="${1}"
logfile="/root/chef-solo.log"
# This runs as root on the server
chef_binary="/usr/local/rvm/gems/ruby-1.9.2-p290/bin/chef-solo"
# Are we on a vanilla system?
if ! test -f "$chef_binary"; then
export DEBIAN_FRONTEND=noninteractive
# Upgrade headlessly (this is only safe-ish on vanilla systems)
apt-get update -o Acquire::http::No-Cache=True
apt-get -o Dpkg::Options::="--force-confnew" \
--force-yes -fuy dist-upgrade
# Install RVM as root (System-wide install)
apt-get install -y curl git-core bzip2 build-essential zlib1g-dev libssl-dev libxslt-dev libxml2-dev libxslt1-dev imagemagick libmagickwand-dev libmysql-ruby libmysqlclient-dev libsqlite3-dev libncurses5-dev libreadline5-dev openssl
# Note system-wide installs are not in the RVM main version
# bash < <(curl -s https://rvm.beginrescueend.com/install/rvm)
bash <( curl -L https://github.com/wayneeseguin/rvm/raw/1.3.0/contrib/install-system-wide ) --version '1.3.0'
(cat <<'EOP'
[[ -s "/usr/local/rvm/scripts/rvm" ]] && source "/usr/local/rvm/scripts/rvm" # This loads RVM into a shell session.
EOP
) > /etc/profile.d/rvm.sh
# Install Ruby using RVM
[[ -s "/usr/local/rvm/scripts/rvm" ]] && source "/usr/local/rvm/scripts/rvm"i
ruby $(find / -name extconf.rb | grep readline)
rvm package install readline
rvm install 1.9.2-p290@rails3
rvm use 1.9.2-p290 --default
# Upgrade rubygems (Latest version 1.8.10 has a lot of problems)
# Use 'bundle exec' in front of everything
# 1.7.2 - is suggested but I've found issues with this as well.
# 1.6.2 - is what I use on my dev box and comes with rvm install
# gem update --system
# Install chef
gem install --no-rdoc --no-ri chef --version 0.10.0
fi
# Run chef-solo on server
[[ -s "/usr/local/rvm/scripts/rvm" ]] && source "/usr/local/rvm/scripts/rvm"
"$chef_binary" --config solo.rb --json-attributes "$json"