blob: 9ab9e1ee7b260e53b84f946e009253c4795f29e2 [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
Filip Pytlounaee95a82018-01-05 13:20:57 +01006echo "Acquire::CompressionTypes::Order gz;" >/etc/apt/apt.conf.d/99compression-workaround-salt
7
azvyagintsevd8f85232017-10-02 15:30:28 +03008# Overwrite default mirrors
9echo "deb mirror://mirrors.ubuntu.com/mirrors.txt xenial main restricted multiverse universe" > /etc/apt/sources.list
10echo "deb mirror://mirrors.ubuntu.com/mirrors.txt xenial-updates main restricted multiverse universe" >> /etc/apt/sources.list
11echo "deb mirror://mirrors.ubuntu.com/mirrors.txt xenial-security main restricted multiverse universe" >> /etc/apt/sources.list
12echo "deb mirror://mirrors.ubuntu.com/mirrors.txt xenial-backports main restricted multiverse universe" >> /etc/apt/sources.list
Filip Pytloun4c969992017-02-20 14:42:09 +010013
Filip Pytloun2d3628a2017-10-03 12:22:51 +020014# Add apt repository
15echo "deb [arch=amd64] http://apt.mirantis.com/xenial/ nightly salt" > /etc/apt/sources.list.d/mcp_salt.list
16echo "deb [arch=amd64] http://apt.mirantis.com/xenial/ nightly extra" > /etc/apt/sources.list.d/mcp_extra.list
17curl -sf http://apt.mirantis.com/public.gpg | apt-key add -
Filip Pytloun4c969992017-02-20 14:42:09 +010018
azvyagintsevd8f85232017-10-02 15:30:28 +030019apt-get clean
20apt-get update
21
22# Useful tools
23apt-get -y install byobu curl ethtool htop iputils-ping lsof strace tcpdump tmux traceroute tree vim-nox wget
24# Install common prerequisites
25apt-get -y install apt-transport-https libmnl0 python-apt python-m2crypto python-psutil
26
Filip Pytloun7ae5c752016-01-15 13:48:38 +010027# Cleanup old kernels, ensure latest is installed via virtual package
Filip Pytloun81fa31c2017-02-23 09:37:06 +010028apt-get purge -y linux-image-* linux-headers-*
Filip Pytloun7ae5c752016-01-15 13:48:38 +010029if [ ! -f /tmp/no_install_kernel ]; then
Filip Pytloun81fa31c2017-02-23 09:37:06 +010030 # Use HWE kernel
Marek Celoudb5ba6b72017-05-22 10:30:48 +020031 ## Temporary disable latest hwe due to: https://bugs.launchpad.net/ubuntu/+source/linux-hwe-edge/+bug/1679823
Richard Felklf8ed1792018-03-19 14:21:06 +010032 #apt-get install -y linux-image-4.8.0-41-generic linux-image-extra-4.8.0-41-generic
33 apt-get install -y linux-image-generic-hwe-16.04
Filip Pytloun7ae5c752016-01-15 13:48:38 +010034
35 # Update grub cmdline
36 sed -i 's|GRUB_CMDLINE_LINUX_DEFAULT=.*|GRUB_CMDLINE_LINUX_DEFAULT="console=tty0 console=ttyS0,115200n8"|g' /etc/default/grub
37 sed -i 's|GRUB_CMDLINE_LINUX=.*|GRUB_CMDLINE_LINUX="console=tty0 console=ttyS0,115200n8"|g' /etc/default/grub
38 update-grub
39fi
40
41apt-get -y upgrade
42apt-get -y dist-upgrade
43
44apt-get autoremove --purge
45
Filip Pytloun7ae5c752016-01-15 13:48:38 +010046# Tmux fixes
47cat << 'EOF' >> /etc/tmux.conf
48set -g default-terminal "screen-256color"
49set -g set-titles on
50set -g xterm-keys on
51EOF
52
53# Setup cloud-init
54apt-get -y install cloud-init
Filip Pytloun4c969992017-02-20 14:42:09 +010055
Jakub Josef4e8e3322017-06-13 16:56:58 +020056# Disable apt-daily
azvyagintsevd8f85232017-10-02 15:30:28 +030057systemctl disable apt-daily.timer
58
59# Motd
60apt-get -y install update-motd
61rm -vf /etc/update-motd.d/*
62echo "BUILD_TIMESTAMP=$(date '+%Y-%m-%d-%H-%M-%S' -u)" > /etc/image_version
63echo "BUILD_TIMESTAMP_RFC=\"$(date -u -R)\"" >> /etc/image_version
64cat << 'EOF' >> /etc/update-motd.d/00-header-mirantis
65#!/bin/sh
66#
67# 00-header - create the header of the MOTD
68#
69[ -r /etc/image_version ] && . /etc/image_version
70echo "Ubuntu 16.04 \"Xenial\" Mirantis cloud image"
71echo "Build date: ${BUILD_TIMESTAMP_RFC}"
72EOF
73chmod +x /etc/update-motd.d/00-header-mirantis
74