Skip to content

Instantly share code, notes, and snippets.

@gildas
Last active June 6, 2017 01:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gildas/4b1c5e19fa8057d90d745c1754cb46b2 to your computer and use it in GitHub Desktop.
Save gildas/4b1c5e19fa8057d90d745c1754cb46b2 to your computer and use it in GitHub Desktop.
Install Hyper-V Integration stuff on CentOS/RHEL platform
#!/usr/bin/env bash
function main() {
if ! yum --cacheonly list installed checkpolicy &> /dev/null ; then
sudo yum install -y checkpolicy
fi
if ! yum --cacheonly list installed policycoreutils-python &> /dev/null ; then
sudo yum install -y policycoreutils-python
fi
if ! yum --cacheonly list installed selinux-policy-devel-3.13.1-102.el7.noarch &> /dev/null ; then
sudo yum install -y selinux-policy-devel-3.13.1-102.el7.noarch
fi
curl -L https://download.microsoft.com/download/7/6/B/76BE7A6E-E39F-436C-9353-F4B44EF966E9/lis-rpms-4.1.3.tar.gz | tar xzf - -C /tmp
(cd /tmp/LISISO ; sudo ./install.sh)
cat > /tmp/hyperv-daemons.te << EOT
module hyperv-daemons 1.0;
require {
type hypervkvp_t;
type device_t;
type hypervvssd_t;
type ifconfig_t;
class chr_file { read write open };
}
allow hypervkvp_t device_t:chr_file { read write open };
allow hypervvssd_t device_t:chr_file { read write open };
allow ifconfig_t device_t:chr_file { read write open };
EOT
checkmodule -M -m -o /tmp/hyperv-daemons.mod /tmp/hyperv-daemons.te
semodule_package -o /tmp/hyperv-daemons.pp -m /tmp/hyperv-daemons.mod
sudo semodule -s targeted -i /tmp/hyperv-daemons.pp
rm -rf /tmp/LISISO /tmp/hyperv-daemons*
}
main "$@"
@gildas
Copy link
Author

gildas commented Jun 6, 2017

With URL Shortener:

curl -sSL https://goo.gl/OEPDHI | bash -s

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment