boxes: Prevent puppet and chef from being reinstalled

This commit is contained in:
Fabio Rehm 2014-03-09 17:19:57 -03:00
parent dbb6d1f131
commit cd23804046

View file

@ -21,24 +21,31 @@ SALT=${SALT:-0}
BABUSHKA=${BABUSHKA:-0} BABUSHKA=${BABUSHKA:-0}
if [ $CHEF = 1 ]; then if [ $CHEF = 1 ]; then
# TODO: Check if Chef has been installed if $(lxc-attach -n ${CONTAINER} -- which chef-solo &>/dev/null); then
log "Installing Chef" log "Chef has been installed on container, skipping"
cat > ${ROOTFS}/tmp/install-chef.sh << EOF else
log "Installing Chef"
cat > ${ROOTFS}/tmp/install-chef.sh << EOF
#!/bin/sh #!/bin/sh
curl -L https://www.opscode.com/chef/install.sh -k | sudo bash curl -L https://www.opscode.com/chef/install.sh -k | sudo bash
EOF EOF
chmod +x ${ROOTFS}/tmp/install-chef.sh chmod +x ${ROOTFS}/tmp/install-chef.sh
lxc-attach -n ${CONTAINER} -- /tmp/install-chef.sh lxc-attach -n ${CONTAINER} -- /tmp/install-chef.sh
fi
else else
log "Skipping Chef installation" log "Skipping Chef installation"
fi fi
if [ $PUPPET = 1 ]; then if [ $PUPPET = 1 ]; then
log "Installing Puppet" if $(lxc-attach -n ${CONTAINER} -- which puppet &>/dev/null); then
wget http://apt.puppetlabs.com/puppetlabs-release-stable.deb -O "${ROOTFS}/tmp/puppetlabs-release-stable.deb" log "Puppet has been installed on container, skipping"
lxc-attach -n ${CONTAINER} -- dpkg -i "/tmp/puppetlabs-release-stable.deb" else
lxc-attach -n ${CONTAINER} -- apt-get update log "Installing Puppet"
lxc-attach -n ${CONTAINER} -- apt-get install puppet -y --force-yes wget http://apt.puppetlabs.com/puppetlabs-release-stable.deb -O "${ROOTFS}/tmp/puppetlabs-release-stable.deb"
lxc-attach -n ${CONTAINER} -- dpkg -i "/tmp/puppetlabs-release-stable.deb"
lxc-attach -n ${CONTAINER} -- apt-get update
lxc-attach -n ${CONTAINER} -- apt-get install puppet -y --force-yes
fi
else else
log "Skipping Puppet installation" log "Skipping Puppet installation"
fi fi