blob: 439c5a42d26819e68b5fec034f37cd5a513bc191 [file] [log] [blame]
Filip Pytloun60411d12015-06-25 21:14:41 +02001## 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 Pytloune3181af2015-06-25 22:11:22 +02005
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 trusty main restricted multiverse universe" > /etc/apt/sources.list
10echo "deb mirror://mirrors.ubuntu.com/mirrors.txt trusty-updates main restricted multiverse universe" >> /etc/apt/sources.list
11echo "deb mirror://mirrors.ubuntu.com/mirrors.txt trusty-security main restricted multiverse universe" >> /etc/apt/sources.list
12echo "deb mirror://mirrors.ubuntu.com/mirrors.txt trusty-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/trusty/ nightly salt" > /etc/apt/sources.list.d/mcp_salt.list
16echo "deb [arch=amd64] http://apt.mirantis.com/trusty/ 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 Pytloune3181af2015-06-25 22:11:22 +020027# Cleanup old kernels, ensure latest is installed via virtual package
Filip Pytloun896f37b2015-06-25 18:35:42 +020028apt-get purge -y linux-image-* linux-headers-*
Filip Pytloun7b48fd22015-06-30 23:34:01 +020029if [ ! -f /tmp/no_install_kernel ]; then
Jakub Josefcbf20152017-03-10 16:05:08 +010030 apt-get install -y linux-generic-lts-xenial
Filip Pytloun7b48fd22015-06-30 23:34:01 +020031
32 # Update grub cmdline
33 sed -i 's|GRUB_CMDLINE_LINUX_DEFAULT=.*|GRUB_CMDLINE_LINUX_DEFAULT="console=tty0 console=ttyS0,115200n8"|g' /etc/default/grub
34 sed -i 's|GRUB_CMDLINE_LINUX=.*|GRUB_CMDLINE_LINUX="console=tty0 console=ttyS0,115200n8"|g' /etc/default/grub
35 update-grub
36fi
Filip Pytloune3181af2015-06-25 22:11:22 +020037
jan kaufmana519d7b2015-03-04 00:51:47 +010038apt-get -y upgrade
39apt-get -y dist-upgrade
jan kaufmandfc08f02015-04-29 20:17:55 +020040
Filip Pytloune3181af2015-06-25 22:11:22 +020041apt-get autoremove --purge
42
Filip Pytloun39832362015-06-25 18:05:47 +020043# Tmux fixes
44cat << 'EOF' >> /etc/tmux.conf
45set -g default-terminal "screen-256color"
46set -g set-titles on
47set -g xterm-keys on
48EOF
Filip Pytloundd27ad82015-06-18 11:12:08 +020049
Petr Micahlec50f87e02017-04-13 11:38:22 +020050# Install common prerequisites
Alexander Noskov926853e2017-06-02 15:47:24 +040051apt-get -y install apt-transport-https libmnl0 python-apt python-m2crypto python-psutil
Petr Micahlec50f87e02017-04-13 11:38:22 +020052
Filip Pytloundd27ad82015-06-18 11:12:08 +020053# Setup cloud-init
jan kaufman0fcf1a72015-05-06 10:16:12 +020054apt-get -y install cloud-init
Filip Pytloun4c969992017-02-20 14:42:09 +010055
56# Motd
azvyagintsevd8f85232017-10-02 15:30:28 +030057apt-get -y install update-motd
58rm -vf /etc/update-motd.d/*
59echo "BUILD_TIMESTAMP=$(date '+%Y-%m-%d-%H-%M-%S' -u)" > /etc/image_version
60echo "BUILD_TIMESTAMP_RFC=\"$(date -u -R)\"" >> /etc/image_version
61cat << 'EOF' >> /etc/update-motd.d/00-header-mirantis
62#!/bin/sh
63#
64# 00-header - create the header of the MOTD
65#
66[ -r /etc/image_version ] && . /etc/image_version
67echo "Ubuntu 14.04 \"Trusty\" Mirantis cloud image"
68echo "Build date: ${BUILD_TIMESTAMP_RFC}"
Filip Pytloun4c969992017-02-20 14:42:09 +010069EOF
azvyagintsevd8f85232017-10-02 15:30:28 +030070chmod +x /etc/update-motd.d/00-header-mirantis