| ## Base packages and setup |
| export DEBIAN_FRONTEND=noninteractive |
| echo "exit 101" > /usr/sbin/policy-rc.d |
| chmod +x /usr/sbin/policy-rc.d |
| |
| echo "Acquire::CompressionTypes::Order gz;" >/etc/apt/apt.conf.d/99compression-workaround-salt |
| |
| # Overwrite default mirrors |
| echo "deb mirror://mirrors.ubuntu.com/mirrors.txt trusty main restricted multiverse universe" > /etc/apt/sources.list |
| echo "deb mirror://mirrors.ubuntu.com/mirrors.txt trusty-updates main restricted multiverse universe" >> /etc/apt/sources.list |
| echo "deb mirror://mirrors.ubuntu.com/mirrors.txt trusty-security main restricted multiverse universe" >> /etc/apt/sources.list |
| echo "deb mirror://mirrors.ubuntu.com/mirrors.txt trusty-backports main restricted multiverse universe" >> /etc/apt/sources.list |
| |
| # Add apt repository |
| echo "deb [arch=amd64] http://apt.mirantis.com/trusty/ nightly salt" > /etc/apt/sources.list.d/mcp_salt.list |
| echo "deb [arch=amd64] http://apt.mirantis.com/trusty/ nightly extra" > /etc/apt/sources.list.d/mcp_extra.list |
| curl -sf http://apt.mirantis.com/public.gpg | apt-key add - |
| |
| apt-get clean |
| apt-get update |
| |
| # Useful tools |
| apt-get -y install byobu curl ethtool htop iputils-ping lsof strace tcpdump tmux traceroute tree vim-nox wget |
| # Install common prerequisites |
| apt-get -y install apt-transport-https libmnl0 python-apt python-m2crypto python-psutil |
| |
| # Cleanup old kernels, ensure latest is installed via virtual package |
| apt-get purge -y linux-image-* linux-headers-* |
| if [ ! -f /tmp/no_install_kernel ]; then |
| apt-get install -y linux-generic-lts-xenial |
| |
| # Update grub cmdline |
| sed -i 's|GRUB_CMDLINE_LINUX_DEFAULT=.*|GRUB_CMDLINE_LINUX_DEFAULT="console=tty0 console=ttyS0,115200n8"|g' /etc/default/grub |
| sed -i 's|GRUB_CMDLINE_LINUX=.*|GRUB_CMDLINE_LINUX="console=tty0 console=ttyS0,115200n8"|g' /etc/default/grub |
| update-grub |
| fi |
| |
| apt-get -y upgrade |
| apt-get -y dist-upgrade |
| |
| apt-get autoremove --purge |
| |
| # Tmux fixes |
| cat << 'EOF' >> /etc/tmux.conf |
| set -g default-terminal "screen-256color" |
| set -g set-titles on |
| set -g xterm-keys on |
| EOF |
| |
| # Install common prerequisites |
| apt-get -y install apt-transport-https libmnl0 python-apt python-m2crypto python-psutil |
| |
| # Setup cloud-init |
| apt-get -y install cloud-init |
| |
| # Motd |
| apt-get -y install update-motd |
| rm -vf /etc/update-motd.d/* |
| echo "BUILD_TIMESTAMP=$(date '+%Y-%m-%d-%H-%M-%S' -u)" > /etc/image_version |
| echo "BUILD_TIMESTAMP_RFC=\"$(date -u -R)\"" >> /etc/image_version |
| cat << 'EOF' >> /etc/update-motd.d/00-header-mirantis |
| #!/bin/sh |
| # |
| # 00-header - create the header of the MOTD |
| # |
| [ -r /etc/image_version ] && . /etc/image_version |
| echo "Ubuntu 14.04 \"Trusty\" Mirantis cloud image" |
| echo "Build date: ${BUILD_TIMESTAMP_RFC}" |
| EOF |
| chmod +x /etc/update-motd.d/00-header-mirantis |