Skip to content

Instantly share code, notes, and snippets.

@lennysh
Last active April 27, 2018 18:15
Show Gist options
  • Save lennysh/18fdfde7c7c50ff4edcff5d01a2c3100 to your computer and use it in GitHub Desktop.
Save lennysh/18fdfde7c7c50ff4edcff5d01a2c3100 to your computer and use it in GitHub Desktop.
#!/bin/bash
# Script to install the virtual packages for Hyper-V in Ubuntu
. /etc/lsb-release
#DISTRIB_ID=Ubuntu
#DISTRIB_RELEASE=12.04
#DISTRIB_CODENAME=precise
#DISTRIB_DESCRIPTION="Ubuntu 12.04.2 LTS"
OS=$DISTRIB_ID
VER=$DISTRIB_RELEASE
DESC=$DISTRIB_DESCRIPTION
#echo $OS
#echo $VER
#echo $DESC
if [ "$OS" != "Ubuntu" ]; then
echo "This version of $DESC is not supported."
exit 1
fi
case $VER in
18.04)
apt-get update
apt-get install -y linux-image-virtual
apt-get install -y linux-tools-virtual linux-cloud-tools-virtual
;;
17.04)
apt-get update
apt-get install -y linux-image-virtual
apt-get install -y linux-tools-virtual linux-cloud-tools-virtual
;;
16.10)
apt-get update
apt-get install -y linux-image-virtual
apt-get install -y linux-tools-virtual linux-cloud-tools-virtual
;;
16.04)
apt-get update
apt-get install -y linux-virtual-lts-xenial
apt-get install -y linux-tools-virtual-lts-xenial linux-cloud-tools-virtual-lts-xenial
;;
14.04)
apt-get update
apt-get install -y linux-virtual-lts-xenial
apt-get install -y hv-kvp-daemon-init linux-tools-virtual-lts-xenial linux-cloud-tools-virtual-lts-xenial
;;
12.04)
apt-get update
apt-get install -y linux-generic-lts-trusty
apt-get install -y hv-kvp-daemon-init linux-tools-lts-trusty linux-cloud-tools-generic-lts-trusty
;;
*)
echo "This version of $DESC is not supported."
;;
esac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment