-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbootstrap.sh
More file actions
32 lines (27 loc) · 914 Bytes
/
bootstrap.sh
File metadata and controls
32 lines (27 loc) · 914 Bytes
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
#!/bin/bash
set -e
while getopts v: opt
do
case "$opt" in
v) version="$OPTARG";;
esac
done
if [ -z "$version" ]; then
echo "This script requires that you pin the version of Chef you are installing! Exiting..."
exit 1
fi
if [ $(grep -c Ubuntu /etc/product) -ge 1 ]; then
apt-get update
apt-get install -y wget ca-certificates
curl -s -L https://chef.io/chef/install.sh | bash -s -- -v $version
fi
if [ $(grep -c SmartOS /etc/release) -ge 1 ]; then
chef_package=$(pkgin search chef | grep "chef-[0-9]" | head -n1 | cut -d" " -f1 | cut -d";" -f1)
pkgin -y install $chef_package build-essential
gem install chef --version "$version" --no-ri --no-rdoc
mkdir -p /opt/chef/bin
mkdir -p /opt/chef/embedded/bin
ln -fs /opt/local/bin/chef-client /opt/chef/bin/chef-client
ln -fs /opt/local/bin/ruby /opt/chef/embedded/bin/ruby
ln -fs /opt/local/bin/gem /opt/chef/embedded/bin/gem
fi