7 info 'Installing extra packages and upgrading'
9 debug 'Bringing container up'
12 # Sleep for a bit so that the container can get an IP
13 log 'Sleeping for 5 seconds...'
16 # TODO: Support for appending to this list from outside
17 PACKAGES=(vim curl wget man-db bash-completion python-software-properties ca-certificates sudo)
18 if [ $DISTRIBUTION = 'ubuntu' ]; then
19 PACKAGES+=' software-properties-common'
21 if [ $RELEASE != 'raring' ] && [ $RELEASE != 'saucy' ] && [ $RELEASE != 'trusty' ] ; then
22 PACKAGES+=' nfs-common'
24 utils.lxc.attach apt-get update
25 utils.lxc.attach apt-get install ${PACKAGES[*]} -y --force-yes
26 utils.lxc.attach apt-get upgrade -y --force-yes
31 BABUSHKA=${BABUSHKA:-0}
33 if [ $DISTRIBUTION = 'debian' ]; then
34 # Enable bash-completion
35 sed -e '/^#if ! shopt -oq posix; then/,/^#fi/ s/^#\(.*\)/\1/g' \
36 -i ${ROOTFS}/etc/bash.bashrc
39 if [ $CHEF = 1 ]; then
40 if $(lxc-attach -n ${CONTAINER} -- which chef-solo &>/dev/null); then
41 log "Chef has been installed on container, skipping"
44 cat > ${ROOTFS}/tmp/install-chef.sh << EOF
46 curl -L https://www.opscode.com/chef/install.sh -k | sudo bash
48 chmod +x ${ROOTFS}/tmp/install-chef.sh
49 utils.lxc.attach /tmp/install-chef.sh
52 log "Skipping Chef installation"
55 if [ $PUPPET = 1 ]; then
56 if $(lxc-attach -n ${CONTAINER} -- which puppet &>/dev/null); then
57 log "Puppet has been installed on container, skipping"
58 elif [ ${RELEASE} = 'trusty' ]; then
59 warn "Puppet can't be installed on Ubuntu Trusty 14.04, skipping"
60 elif [ ${RELEASE} = 'sid' ]; then
61 warn "Puppet can't be installed on Debian sid, skipping"
63 log "Installing Puppet"
64 wget http://apt.puppetlabs.com/puppetlabs-release-stable.deb -O "${ROOTFS}/tmp/puppetlabs-release-stable.deb" &>>${LOG}
65 utils.lxc.attach dpkg -i "/tmp/puppetlabs-release-stable.deb"
66 utils.lxc.attach apt-get update
67 utils.lxc.attach apt-get install puppet -y --force-yes
70 log "Skipping Puppet installation"
73 if [ $SALT = 1 ]; then
74 if $(lxc-attach -n ${CONTAINER} -- which salt-minion &>/dev/null); then
75 log "Salt has been installed on container, skipping"
76 elif [ ${RELEASE} = 'raring' ]; then
77 warn "Salt can't be installed on Ubuntu Raring 13.04, skipping"
79 if [ $DISTRIBUTION = 'ubuntu' ]; then
80 utils.lxc.attach add-apt-repository -y ppa:saltstack/salt
82 if [ $RELEASE == "squeeze" ]; then
83 SALT_SOURCE_1="deb http://debian.saltstack.com/debian squeeze-saltstack main"
84 SALT_SOURCE_2="deb http://backports.debian.org/debian-backports squeeze-backports main contrib non-free"
85 elif [ $RELEASE == "wheezy" ]; then
86 SALT_SOURCE_1="deb http://debian.saltstack.com/debian wheezy-saltstack main"
88 SALT_SOURCE_1="deb http://debian.saltstack.com/debian unstable main"
90 echo $SALT_SOURCE_1 > ${ROOTFS}/etc/apt/sources.list.d/saltstack.list
91 echo $SALT_SOURCE_2 >> ${ROOTFS}/etc/apt/sources.list.d/saltstack.list
93 utils.lxc.attach wget -q -O /tmp/salt.key "http://debian.saltstack.com/debian-salt-team-joehealy.gpg.key"
94 utils.lxc.attach apt-key add /tmp/salt.key
96 utils.lxc.attach apt-get update
97 utils.lxc.attach apt-get install salt-minion -y --force-yes
100 log "Skipping Salt installation"
103 if [ $BABUSHKA = 1 ]; then
104 if $(lxc-attach -n ${CONTAINER} -- which babushka &>/dev/null); then
105 log "Babushka has been installed on container, skipping"
106 elif [ ${RELEASE} = 'trusty' ]; then
107 warn "Babushka can't be installed on Ubuntu Trusty 14.04, skipping"
109 log "Installing Babushka"
110 cat > $ROOTFS/tmp/install-babushka.sh << EOF
112 curl https://babushka.me/up | sudo bash
114 chmod +x $ROOTFS/tmp/install-babushka.sh
115 utils.lxc.attach /tmp/install-babushka.sh
118 log "Skipping Babushka installation"