blob: 67e82f318240811f60a9abb5326a0c7a6afd0fbe [file] [log] [blame]
Filip Pytloun7ae5c752016-01-15 13:48:38 +01001## Base packages and setup
Filip Pytloun2516a612016-02-12 10:50:29 +01002export DEBIAN_FRONTEND=noninteractive
Filip Pytlouncb52dd52016-02-01 10:42:54 +01003echo "exit 101" > /usr/sbin/policy-rc.d
4chmod +x /usr/sbin/policy-rc.d
Filip Pytloun7ae5c752016-01-15 13:48:38 +01005
azvyagintsevd8f85232017-10-02 15:30:28 +03006# Overwrite default mirrors
7echo "deb mirror://mirrors.ubuntu.com/mirrors.txt xenial main restricted multiverse universe" > /etc/apt/sources.list
8echo "deb mirror://mirrors.ubuntu.com/mirrors.txt xenial-updates main restricted multiverse universe" >> /etc/apt/sources.list
9echo "deb mirror://mirrors.ubuntu.com/mirrors.txt xenial-security main restricted multiverse universe" >> /etc/apt/sources.list
10echo "deb mirror://mirrors.ubuntu.com/mirrors.txt xenial-backports main restricted multiverse universe" >> /etc/apt/sources.list
Filip Pytloun4c969992017-02-20 14:42:09 +010011
Filip Pytloun2d3628a2017-10-03 12:22:51 +020012# Add apt repository
13echo "deb [arch=amd64] http://apt.mirantis.com/xenial/ nightly salt" > /etc/apt/sources.list.d/mcp_salt.list
14echo "deb [arch=amd64] http://apt.mirantis.com/xenial/ nightly extra" > /etc/apt/sources.list.d/mcp_extra.list
15curl -sf http://apt.mirantis.com/public.gpg | apt-key add -
Filip Pytloun4c969992017-02-20 14:42:09 +010016
azvyagintsevd8f85232017-10-02 15:30:28 +030017apt-get clean
18apt-get update
19
20# Useful tools
21apt-get -y install byobu curl ethtool htop iputils-ping lsof strace tcpdump tmux traceroute tree vim-nox wget
22# Install common prerequisites
23apt-get -y install apt-transport-https libmnl0 python-apt python-m2crypto python-psutil
24
Filip Pytloun7ae5c752016-01-15 13:48:38 +010025# Cleanup old kernels, ensure latest is installed via virtual package
Filip Pytloun81fa31c2017-02-23 09:37:06 +010026apt-get purge -y linux-image-* linux-headers-*
Filip Pytloun7ae5c752016-01-15 13:48:38 +010027if [ ! -f /tmp/no_install_kernel ]; then
Filip Pytloun81fa31c2017-02-23 09:37:06 +010028 # Use HWE kernel
Marek Celoudb5ba6b72017-05-22 10:30:48 +020029 ## Temporary disable latest hwe due to: https://bugs.launchpad.net/ubuntu/+source/linux-hwe-edge/+bug/1679823
30 #apt-get install -y linux-image-generic-hwe-16.04
31 apt-get install -y linux-image-4.8.0-41-generic linux-image-extra-4.8.0-41-generic
Filip Pytloun7ae5c752016-01-15 13:48:38 +010032
33 # Update grub cmdline
34 sed -i 's|GRUB_CMDLINE_LINUX_DEFAULT=.*|GRUB_CMDLINE_LINUX_DEFAULT="console=tty0 console=ttyS0,115200n8"|g' /etc/default/grub
35 sed -i 's|GRUB_CMDLINE_LINUX=.*|GRUB_CMDLINE_LINUX="console=tty0 console=ttyS0,115200n8"|g' /etc/default/grub
36 update-grub
37fi
38
39apt-get -y upgrade
40apt-get -y dist-upgrade
41
42apt-get autoremove --purge
43
Filip Pytloun7ae5c752016-01-15 13:48:38 +010044# Tmux fixes
45cat << 'EOF' >> /etc/tmux.conf
46set -g default-terminal "screen-256color"
47set -g set-titles on
48set -g xterm-keys on
49EOF
50
51# Setup cloud-init
52apt-get -y install cloud-init
Filip Pytloun4c969992017-02-20 14:42:09 +010053
Jakub Josef4e8e3322017-06-13 16:56:58 +020054# Disable apt-daily
azvyagintsevd8f85232017-10-02 15:30:28 +030055systemctl disable apt-daily.timer
56
57# Motd
58apt-get -y install update-motd
59rm -vf /etc/update-motd.d/*
60echo "BUILD_TIMESTAMP=$(date '+%Y-%m-%d-%H-%M-%S' -u)" > /etc/image_version
61echo "BUILD_TIMESTAMP_RFC=\"$(date -u -R)\"" >> /etc/image_version
62cat << 'EOF' >> /etc/update-motd.d/00-header-mirantis
63#!/bin/sh
64#
65# 00-header - create the header of the MOTD
66#
67[ -r /etc/image_version ] && . /etc/image_version
68echo "Ubuntu 16.04 \"Xenial\" Mirantis cloud image"
69echo "Build date: ${BUILD_TIMESTAMP_RFC}"
70EOF
71chmod +x /etc/update-motd.d/00-header-mirantis
72