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