Created
June 16, 2017 06:23
-
-
Save seeker815/9a1639ad63deeb0b19c789058c216e0d to your computer and use it in GitHub Desktop.
bootstrap chefdk
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Ensure we're not running as root | |
if [ $EUID -eq 0 ] ; then | |
echo "Do not run as root!" 1>&2 | |
exit 1 | |
fi | |
# Install base packages | |
which lsb_release | |
rc=$? | |
set -x | |
if [ $rc -eq 0 ] ; then | |
# Ubuntu | |
sudo apt-get update | |
sudo apt-get install -y python-software-properties software-properties-common | |
sudo apt-add-repository -y ppa:brightbox/ruby-ng | |
sudo apt-get update | |
sudo apt-get install -y virtualbox curl ruby2.3 ruby2.3-dev build-essential libqtcore4 libqtgui4 libqt4-dev libboost-dev zlib1g-dev jq | |
sudo update-alternatives --set ruby /usr/bin/ruby2.3 | |
sudo update-alternatives --set gem /usr/bin/gem2.3 | |
pushd /tmp | |
curl -O -sLf https://releases.hashicorp.com/vagrant/1.9.5/vagrant_1.9.5_x86_64.deb | |
sudo dpkg -i vagrant_1.9.5_x86_64.deb | |
rm vagrant_1.9.5_x86_64.deb | |
curl -O -sLf https://packages.chef.io/files/stable/chefdk/1.4.3/ubuntu/14.04/chefdk_1.4.3-1_amd64.deb | |
sudo dpkg -i chefdk_1.4.3-1_amd64.deb | |
rm chefdk_1.4.3-1_amd64.deb | |
curl -O -sLf "http://us.archive.ubuntu.com/ubuntu/pool/universe/g/gecode/libgecode30_3.7.1-3_amd64.deb" | |
curl -O -sLf "http://us.archive.ubuntu.com/ubuntu/pool/universe/g/gecode/libgecode-dev_3.7.1-3_amd64.deb" | |
curl -O -sLf "http://us.archive.ubuntu.com/ubuntu/pool/universe/g/gecode/libgecodegist30_3.7.1-3_amd64.deb" | |
curl -O -sLf "http://us.archive.ubuntu.com/ubuntu/pool/universe/g/gecode/libgecodeflatzinc30_3.7.1-3_amd64.deb" | |
sudo dpkg -i libgecode30_3.7.1-3_amd64.deb libgecodegist30_3.7.1-3_amd64.deb libgecodeflatzinc30_3.7.1-3_amd64.deb libgecode-dev_3.7.1-3_amd64.deb | |
export USE_SYSTEM_GECODE=1 | |
popd | |
else | |
# Mac OS X | |
sudo chown -R "$(whoami):staff" /usr/local | |
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" | |
brew tap homebrew/versions | |
brew install libxml2 libxslt jq | |
brew tap caskroom/cask | |
brew install brew-cask | |
brew cask install virtualbox | |
pushd /tmp | |
curl -O -sLf https://releases.hashicorp.com/vagrant/1.9.5/vagrant_1.9.5_x86_64.dmg | |
hdiutil attach vagrant_1.9.5_x86_64.dmg | |
sudo installer -pkg /Volumes/Vagrant/Vagrant.pkg -target / | |
hdiutil detach vagrant_1.9.5_x86_64.dmg | |
rm vagrant_1.9.5_x86_64.dmg | |
curl -O -sLf https://packages.chef.io/files/stable/chefdk/1.4.3/mac_os_x/10.11/chefdk-1.4.3-1.dmg | |
hdiutil attach chefdk-0.10.0-1.dmg | |
sudo installer -pkg '/Volumes/Chef Development Kit/chefdk-0.10.0-1.pkg' -target / | |
hdiutil detach chefdk-0.10.0-1.dmg | |
rm chefdk-0.10.0-1.dmg | |
popd | |
fi | |
# Install gems, plugins, configs, &c. | |
cd /vagrant | |
sudo gem install bundler | |
bundle | |
vagrant plugin install vagrant-berkshelf | |
vagrant plugin install vagrant-hostmanager | |
vagrant plugin install vagrant-omnibus | |
vagrant plugin install vagrant-cachier | |
mkdir -p ~/.berkshelf | |
cat << END > ~/.berkshelf/config.json | |
{ | |
"chef": { | |
"client_key": "/dev/null" | |
} | |
} | |
END | |
echo "Enter your gitlab token. It can be found here: http://git.bjn.io/profile/account" | |
read token | |
cat << END > ~/.bourdain.json | |
{ | |
"gitlab": { | |
"token": "$token" | |
} | |
} | |
END | |
echo "If you need to change the token, you can edit ~/.bourdain.json" | |
bundle exec tony check | |
# GTFO | |
cat << END | |
=============== | |
Done! You may want to add the following alias to your profile, so you can run "bundle exec" more simply | |
alias bx="bundle exec" | |
END |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment