2014-03-25 03:26:19 +00:00
|
|
|
#!/bin/bash
|
|
|
|
set -e
|
|
|
|
|
2018-04-15 03:30:48 +00:00
|
|
|
source /etc/profile
|
|
|
|
source /envdump
|
2014-03-25 03:26:19 +00:00
|
|
|
|
2018-04-15 03:30:48 +00:00
|
|
|
echo 'Installing extra packages and upgrading'
|
2014-03-25 03:26:19 +00:00
|
|
|
|
2016-06-27 12:07:22 +00:00
|
|
|
PACKAGES=(vim curl wget man-db openssh-server bash-completion ca-certificates sudo)
|
2015-12-27 15:34:32 +00:00
|
|
|
|
2018-04-15 03:30:48 +00:00
|
|
|
echo "Installing additional packages: ${ADDPACKAGES}"
|
2015-12-27 15:34:32 +00:00
|
|
|
PACKAGES+=" ${ADDPACKAGES}"
|
|
|
|
|
2014-03-25 03:26:19 +00:00
|
|
|
if [ $DISTRIBUTION = 'ubuntu' ]; then
|
|
|
|
PACKAGES+=' software-properties-common'
|
|
|
|
fi
|
2018-04-15 03:30:48 +00:00
|
|
|
apt-get update
|
|
|
|
apt-get install ${PACKAGES[*]} -y --force-yes
|
|
|
|
apt-get upgrade -y --force-yes
|
2014-03-25 03:26:19 +00:00
|
|
|
|
2016-04-29 16:18:53 +00:00
|
|
|
ANSIBLE=${ANSIBLE:-0}
|
2014-03-25 03:26:19 +00:00
|
|
|
CHEF=${CHEF:-0}
|
|
|
|
PUPPET=${PUPPET:-0}
|
|
|
|
SALT=${SALT:-0}
|
|
|
|
BABUSHKA=${BABUSHKA:-0}
|
|
|
|
|
|
|
|
if [ $DISTRIBUTION = 'debian' ]; then
|
|
|
|
# Enable bash-completion
|
|
|
|
sed -e '/^#if ! shopt -oq posix; then/,/^#fi/ s/^#\(.*\)/\1/g' \
|
2018-04-15 03:30:48 +00:00
|
|
|
-i /etc/bash.bashrc
|
2014-03-25 03:26:19 +00:00
|
|
|
fi
|
|
|
|
|
2018-04-15 03:30:48 +00:00
|
|
|
#if [ $ANSIBLE = 1 ]; then
|
|
|
|
# if $(lxc-attach -n ${CONTAINER} -- which ansible &>/dev/null); then
|
|
|
|
# log "Ansible has been installed on container, skipping"
|
|
|
|
# else
|
|
|
|
# info "Installing Ansible"
|
|
|
|
# cp debian/install-ansible.sh ${ROOTFS}/tmp/ && chmod +x ${ROOTFS}/tmp/install-ansible.sh
|
|
|
|
# utils.lxc.attach /tmp/install-ansible.sh &>>${LOG}
|
|
|
|
# fi
|
|
|
|
#else
|
|
|
|
# log "Skipping Ansible installation"
|
|
|
|
#fi
|
|
|
|
|
|
|
|
#if [ $CHEF = 1 ]; then
|
|
|
|
# if $(lxc-attach -n ${CONTAINER} -- which chef-solo &>/dev/null); then
|
|
|
|
# log "Chef has been installed on container, skipping"
|
|
|
|
# else
|
|
|
|
# log "Installing Chef"
|
|
|
|
# cat > ${ROOTFS}/tmp/install-chef.sh << EOF
|
|
|
|
##!/bin/sh
|
|
|
|
#curl -L https://www.opscode.com/chef/install.sh -k | sudo bash
|
|
|
|
#EOF
|
|
|
|
# chmod +x ${ROOTFS}/tmp/install-chef.sh
|
|
|
|
# utils.lxc.attach /tmp/install-chef.sh
|
|
|
|
# fi
|
|
|
|
#else
|
|
|
|
# log "Skipping Chef installation"
|
|
|
|
#fi
|
|
|
|
|
|
|
|
#if [ $PUPPET = 1 ]; then
|
|
|
|
# if $(lxc-attach -n ${CONTAINER} -- which puppet &>/dev/null); then
|
|
|
|
# log "Puppet has been installed on container, skipping"
|
|
|
|
# elif [ ${RELEASE} = 'sid' ]; then
|
|
|
|
# warn "Puppet can't be installed on Debian sid, skipping"
|
|
|
|
# else
|
|
|
|
# log "Installing Puppet"
|
|
|
|
# wget http://apt.puppetlabs.com/puppetlabs-release-${RELEASE}.deb -O "${ROOTFS}/tmp/puppetlabs-release-stable.deb" &>>${LOG}
|
|
|
|
# utils.lxc.attach dpkg -i "/tmp/puppetlabs-release-stable.deb"
|
|
|
|
# utils.lxc.attach apt-get update
|
|
|
|
# utils.lxc.attach apt-get install puppet -y --force-yes
|
|
|
|
# fi
|
|
|
|
#else
|
|
|
|
# log "Skipping Puppet installation"
|
|
|
|
#fi
|
|
|
|
|
|
|
|
#if [ $SALT = 1 ]; then
|
|
|
|
# if $(lxc-attach -n ${CONTAINER} -- which salt-minion &>/dev/null); then
|
|
|
|
# log "Salt has been installed on container, skipping"
|
|
|
|
# elif [ ${RELEASE} = 'raring' ]; then
|
|
|
|
# warn "Salt can't be installed on Ubuntu Raring 13.04, skipping"
|
|
|
|
# else
|
|
|
|
# if [ $DISTRIBUTION = 'ubuntu' ]; then
|
|
|
|
# if [ $RELEASE = 'precise' ] || [ $RELEASE = 'trusty' ] || [ $RELEASE = 'xenial' ] ; then
|
|
|
|
# # For LTS releases we use packages from repo.saltstack.com
|
|
|
|
# if [ $RELEASE = 'precise' ]; then
|
|
|
|
# SALT_SOURCE_1="deb http://repo.saltstack.com/apt/ubuntu/12.04/amd64/latest precise main"
|
|
|
|
# SALT_GPG_KEY="https://repo.saltstack.com/apt/ubuntu/12.04/amd64/latest/SALTSTACK-GPG-KEY.pub"
|
|
|
|
# elif [ $RELEASE = 'trusty' ]; then
|
|
|
|
# SALT_SOURCE_1="deb http://repo.saltstack.com/apt/ubuntu/14.04/amd64/latest trusty main"
|
|
|
|
# SALT_GPG_KEY="https://repo.saltstack.com/apt/ubuntu/14.04/amd64/latest/SALTSTACK-GPG-KEY.pub"
|
|
|
|
# elif [ $RELEASE = 'xenial' ]; then
|
|
|
|
# SALT_SOURCE_1="deb http://repo.saltstack.com/apt/ubuntu/16.04/amd64/latest xenial main"
|
|
|
|
# SALT_GPG_KEY="https://repo.saltstack.com/apt/ubuntu/16.04/amd64/latest/SALTSTACK-GPG-KEY.pub"
|
|
|
|
# fi
|
|
|
|
# echo $SALT_SOURCE_1 > ${ROOTFS}/etc/apt/sources.list.d/saltstack.list
|
|
|
|
|
|
|
|
# utils.lxc.attach wget -q -O /tmp/salt.key $SALT_GPG_KEY
|
|
|
|
# utils.lxc.attach apt-key add /tmp/salt.key
|
|
|
|
# elif [ $RELEASE = 'quantal' ] || [ $RELEASE = 'saucy' ] ; then
|
|
|
|
# utils.lxc.attach add-apt-repository -y ppa:saltstack/salt
|
|
|
|
# fi
|
|
|
|
# # For Utopic, Vivid and Wily releases use system packages
|
|
|
|
# else # DEBIAN
|
|
|
|
# if [ $RELEASE == "squeeze" ]; then
|
|
|
|
# SALT_SOURCE_1="deb http://debian.saltstack.com/debian squeeze-saltstack main"
|
|
|
|
# SALT_SOURCE_2="deb http://backports.debian.org/debian-backports squeeze-backports main contrib non-free"
|
|
|
|
# elif [ $RELEASE == "wheezy" ]; then
|
|
|
|
# SALT_SOURCE_1="deb http://repo.saltstack.com/apt/debian/7/amd64/latest wheezy main"
|
|
|
|
# elif [ $RELEASE == "jessie" ]; then
|
|
|
|
# SALT_SOURCE_1="deb http://repo.saltstack.com/apt/debian/8/amd64/latest jessie main"
|
|
|
|
# else
|
|
|
|
# SALT_SOURCE_1="deb http://debian.saltstack.com/debian unstable main"
|
|
|
|
# fi
|
|
|
|
# echo $SALT_SOURCE_1 > ${ROOTFS}/etc/apt/sources.list.d/saltstack.list
|
|
|
|
# echo $SALT_SOURCE_2 >> ${ROOTFS}/etc/apt/sources.list.d/saltstack.list
|
|
|
|
|
|
|
|
# utils.lxc.attach wget -q -O /tmp/salt.key "https://repo.saltstack.com/apt/debian/8/amd64/latest/SALTSTACK-GPG-KEY.pub"
|
|
|
|
# utils.lxc.attach apt-key add /tmp/salt.key
|
|
|
|
# fi
|
|
|
|
# utils.lxc.attach apt-get update
|
|
|
|
# utils.lxc.attach apt-get install salt-minion -y --force-yes
|
|
|
|
# fi
|
|
|
|
#else
|
|
|
|
# log "Skipping Salt installation"
|
|
|
|
#fi
|
|
|
|
|
|
|
|
#if [ $BABUSHKA = 1 ]; then
|
|
|
|
# if $(lxc-attach -n ${CONTAINER} -- which babushka &>/dev/null); then
|
|
|
|
# log "Babushka has been installed on container, skipping"
|
|
|
|
# elif [ ${RELEASE} = 'trusty' ]; then
|
|
|
|
# warn "Babushka can't be installed on Ubuntu Trusty 14.04, skipping"
|
|
|
|
# else
|
|
|
|
# log "Installing Babushka"
|
|
|
|
# cat > $ROOTFS/tmp/install-babushka.sh << EOF
|
|
|
|
##!/bin/sh
|
|
|
|
#curl https://babushka.me/up | sudo bash
|
|
|
|
#EOF
|
|
|
|
# chmod +x $ROOTFS/tmp/install-babushka.sh
|
|
|
|
# utils.lxc.attach /tmp/install-babushka.sh
|
|
|
|
# fi
|
|
|
|
#else
|
|
|
|
# log "Skipping Babushka installation"
|
|
|
|
#fi
|