Skip to content

Instantly share code, notes, and snippets.

@streadway
Created September 27, 2010 13:54
Show Gist options
  • Save streadway/599059 to your computer and use it in GitHub Desktop.
Save streadway/599059 to your computer and use it in GitHub Desktop.
#!/bin/bash
cat << EOF > /etc/apt/sources.list.d/testing.list
deb http://ftp.de.debian.org/debian/ squeeze main contrib non-free
deb-src http://ftp.de.debian.org/debian/ squeeze main contrib non-free
EOF
cat << EOF > /etc/apt/preferences
Package: *
Pin: release a=stable
Pin-Priority: 700
Package: *
Pin: release a=lenny-backports
Pin-Priority: 650
Package: *
Pin: release a=testing
Pin-Priority: 600
Package: *
Pin: release a=unstable
Pin-Priority: 500
EOF
cat << EOF > /etc/gemrc
install: --no-rdoc --no-ri
update: --no-rdoc --no-ri
EOF
apt-get update
apt-get --yes install git-core build-essential rake ruby ruby-dev libopenssl-ruby openssl openssh-server curl vim-nox
apt-get --yes -t testing install rubygems
(grep -qx PATH:/var/lib/gems/1.8/bin /etc/profile) || cat << EOF >> /etc/profile
export PATH=$PATH:/var/lib/gems/1.8/bin
EOF
(grep -qx GEM_HOME=/var/lib/gems/1.8 /etc/profile) || cat << EOF >> /etc/profile
export GEM_HOME=/var/lib/gems/1.8
EOF
(grep -qx EDITOR /etc/profile) || cat << EOF >> /etc/profile
export EDITOR=vim
EOF
(gem list | grep -q chef) || gem install chef
[[ -d /etc/chef ]] || mkdir -p /etc/chef
[[ -d /var/tmp/chef ]] || mkdir -p /var/tmp/chef
[[ -f /etc/chef/solo.rb ]] || cat << EOF > /etc/chef/solo.rb
file_cache_path "/var/tmp/chef"
cookbook_path ["/var/chef/cookbooks", "/var/chef/site"]
node_name "$(hostname)"
EOF
[[ -f /etc/chef/first-boot.json ]] || cat << EOF > /etc/first-boot.json
{ "run_list": [ "recipe[base]" ] }
EOF
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment