Handle missing of package linux-image-extra-virtual

This package doesn't present at ec2 Ubuntu instance. Docker
installation may or may not work in this case. This commit
detect the presence of these packages and print a warning.

Change-Id: I2c5b4ed1446d63949be4d181da696933df4c64f8
This commit is contained in:
Hongbin Lu 2017-05-27 22:52:13 +00:00
parent d9cbc6c325
commit e39a806b9f
1 changed files with 5 additions and 1 deletions

View File

@ -46,7 +46,11 @@ function install_docker {
local dist_version=${os_CODENAME} local dist_version=${os_CODENAME}
local arch=$(dpkg --print-architecture) local arch=$(dpkg --print-architecture)
if is_ubuntu; then if is_ubuntu; then
apt_get install linux-image-extra-$(uname -r) linux-image-extra-virtual if uname -r | grep -q -- '-generic' && dpkg -l 'linux-image-*-generic' | grep -qE '^ii|^hi' 2>/dev/null; then
apt_get install linux-image-extra-$(uname -r) linux-image-extra-virtual
else
warn $LINENO "Current kernel is not supported by the linux-image-extra-virtual package. Docker may not work."
fi
apt_get install apt-transport-https ca-certificates software-properties-common apt_get install apt-transport-https ca-certificates software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository -y \ sudo add-apt-repository -y \