aboutsummaryrefslogtreecommitdiffstats
path: root/community/virt-what
diff options
context:
space:
mode:
Diffstat (limited to 'community/virt-what')
-rw-r--r--community/virt-what/0001-Missing-have_cpuinfo-check.patch25
-rw-r--r--community/virt-what/0002-Remove-bashisms.patch48
-rw-r--r--community/virt-what/0003-As-xen-pv-guest-can-access-cpuid-from-Intel-CPUs-sta.patch35
-rw-r--r--community/virt-what/APKBUILD52
4 files changed, 160 insertions, 0 deletions
diff --git a/community/virt-what/0001-Missing-have_cpuinfo-check.patch b/community/virt-what/0001-Missing-have_cpuinfo-check.patch
new file mode 100644
index 0000000000..9f56566eff
--- /dev/null
+++ b/community/virt-what/0001-Missing-have_cpuinfo-check.patch
@@ -0,0 +1,25 @@
+From eefc1e7e3dd8fb422baf0f13aec1df9880541b83 Mon Sep 17 00:00:00 2001
+From: Jasper Lievisse Adriaanse <bug@jasper.la>
+Date: Thu, 10 Aug 2017 08:44:01 +0100
+Subject: [PATCH] Missing have_cpuinfo check.
+
+---
+ virt-what.in | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/virt-what.in b/virt-what.in
+index 8c27b11..9050035 100644
+--- a/virt-what.in
++++ b/virt-what.in
+@@ -308,7 +308,7 @@ if ! "$skip_qemu_kvm"; then
+ # option, since /proc/cpuinfo will not contain the QEMU
+ # string. QEMU 2.10 added a new CPUID leaf, so this
+ # problem only triggered for older QEMU
+- if grep -q 'QEMU' "${root}/proc/cpuinfo"; then
++ if have_cpuinfo && grep -q 'QEMU' "${root}/proc/cpuinfo"; then
+ echo qemu
+ fi
+ fi
+--
+2.15.0
+
diff --git a/community/virt-what/0002-Remove-bashisms.patch b/community/virt-what/0002-Remove-bashisms.patch
new file mode 100644
index 0000000000..02fe382e2a
--- /dev/null
+++ b/community/virt-what/0002-Remove-bashisms.patch
@@ -0,0 +1,48 @@
+From 9d90704a05dee7704470eff818a1c44aeef6c880 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Guido=20G=C3=BCnther?= <agx@sigxcpu.org>
+Date: Fri, 4 Aug 2017 12:02:08 -0300
+Subject: [PATCH] Remove bashisms
+
+Use [ instead of [[ so we fall back to test if necessary:
+
+ http://pubs.opengroup.org/onlinepubs/9699919799/utilities/test.html
+
+Gbp-Pq: Name Remove-bashisms.patch
+---
+ virt-what.in | 12 ++++++------
+ 1 file changed, 6 insertions(+), 6 deletions(-)
+
+diff --git a/virt-what.in b/virt-what.in
+index 9050035..a05e0db 100644
+--- a/virt-what.in
++++ b/virt-what.in
+@@ -360,20 +360,20 @@ if [ "$cpuid" = "OpenBSDVMM58" ]; then
+ fi
+
+ # Check for LDoms
+-if [[ "$arch" == sparc* && -e ${root}/dev/mdesc ]]; then
++if [ "${arch#sparc}" != "$arch" ] && [ -e "${root}/dev/mdesc" ]; then
+ echo ldoms
+- if [[ -d ${root}/sys/class/vlds/ctrl && \
+- -d ${root}/sys/class/vlds/sp ]]; then
++ if [ -d "${root}/sys/class/vlds/ctrl" ] && \
++ [ -d "${root}/sys/class/vlds/sp" ]; then
+ echo ldoms-control
+ else
+ echo ldoms-guest
+ fi
+ MDPROP="${root}/usr/lib/ldoms/mdprop.py"
+- if [[ -x ${MDPROP} ]]; then
+- if [[ -n $($MDPROP -v iodevice device-type=pciex) ]]; then
++ if [ -x "${MDPROP}" ]; then
++ if [ -n "$($MDPROP -v iodevice device-type=pciex)" ]; then
+ echo ldoms-root
+ echo ldoms-io
+- elif [[ -n $($MDPROP -v iov-device vf-id=0) ]]; then
++ elif [ -n "$($MDPROP -v iov-device vf-id=0)" ]; then
+ echo ldoms-io
+ fi
+ fi
+--
+2.15.0
+
diff --git a/community/virt-what/0003-As-xen-pv-guest-can-access-cpuid-from-Intel-CPUs-sta.patch b/community/virt-what/0003-As-xen-pv-guest-can-access-cpuid-from-Intel-CPUs-sta.patch
new file mode 100644
index 0000000000..f2f634c076
--- /dev/null
+++ b/community/virt-what/0003-As-xen-pv-guest-can-access-cpuid-from-Intel-CPUs-sta.patch
@@ -0,0 +1,35 @@
+From a821dc9961d457c086fffcc16a911cb6f9f8659a Mon Sep 17 00:00:00 2001
+From: xiliang <xiliang@redhat.com>
+Date: Sun, 18 Jun 2017 00:33:28 +0800
+Subject: [PATCH] As xen pv guest can access cpuid from Intel CPUs started
+ IvyBridge onwards have CPUID Faulting, added one more check in virt-what.
+
+---
+ virt-what.in | 5 +++--
+ 1 file changed, 3 insertions(+), 2 deletions(-)
+
+diff --git a/virt-what.in b/virt-what.in
+index a05e0db..247348e 100644
+--- a/virt-what.in
++++ b/virt-what.in
+@@ -1,6 +1,6 @@
+ #!/bin/sh -
+ # @configure_input@
+-# Copyright (C) 2008-2015 Red Hat Inc.
++# Copyright (C) 2008-2017 Red Hat Inc.
+ #
+ # This program is free software; you can redistribute it and/or modify
+ # it under the terms of the GNU General Public License as published by
+@@ -223,7 +223,8 @@ fi
+
+ # Check for Xen.
+
+-if [ "$cpuid" = "XenVMMXenVMM" ]; then
++if [ "$cpuid" = "XenVMMXenVMM" ] &&
++ ! echo "$dmi" | grep -q 'No SMBIOS nor DMI entry point found, sorry'; then
+ echo xen; echo xen-hvm
+ # Check for AWS
+ if echo "$dmi" | grep -q 'Version: [0-9]\.[0-9]\.amazon'; then
+--
+2.15.0
+
diff --git a/community/virt-what/APKBUILD b/community/virt-what/APKBUILD
new file mode 100644
index 0000000000..77e53f30f4
--- /dev/null
+++ b/community/virt-what/APKBUILD
@@ -0,0 +1,52 @@
+# Contributor: Henrik Riomar <henrik.riomar@gmail.com>
+# Maintainer: Henrik Riomar <henrik.riomar@gmail.com>
+pkgname=virt-what
+pkgver=1.18
+pkgrel=2
+pkgdesc="Detect if we are running in a virtual machine"
+url="https://people.redhat.com/~rjones/virt-what/"
+arch="x86 x86_64 ppc64le"
+license="GPL-2.0-or-later"
+checkdepends="checkbashisms"
+makedepends="automake autoconf perl-dev"
+subpackages="$pkgname-doc"
+source="http://people.redhat.com/~rjones/$pkgname/files/$pkgname-$pkgver.tar.gz
+ 0001-Missing-have_cpuinfo-check.patch
+ 0002-Remove-bashisms.patch
+ 0003-As-xen-pv-guest-can-access-cpuid-from-Intel-CPUs-sta.patch
+ "
+builddir="$srcdir/$pkgname-$pkgver"
+
+prepare() {
+ default_prepare
+
+ cd "$builddir"
+ autoreconf -ivf
+}
+
+build() {
+ cd "$builddir"
+ ./configure \
+ --build=$CBUILD \
+ --host=$CHOST \
+ --prefix=/usr \
+ --mandir=/usr/share/man
+ make
+}
+
+check() {
+ cd "$builddir"
+ make check
+
+ checkbashisms ./virt-what
+}
+
+package() {
+ cd "$builddir"
+ make install DESTDIR="$pkgdir"
+}
+
+sha512sums="8085a38111d5664f411f5bb9d2ee221bc22e5b0f2d993e8d518718b3f63b16ba73e052b1623c090493cf8fef52fd237ba823377503a32b4b7d03cc5380d5c613 virt-what-1.18.tar.gz
+e910d197b172f7d9bf730238e0ea4cabd9db732051040233e2d25b44e07ed160c875ff9dd76048f0534ee269a77be14d01b2e8e66a51c8e9325109d25fb03d9b 0001-Missing-have_cpuinfo-check.patch
+b57686e6f7af4d1c388b26d0a3e3a4964b5f74133aba47f4ed1f6771c8f22337f92f4519f01dd240a82e00e6fdbf0adaa7dd6040c4b9ec4924ce973b1fca9b33 0002-Remove-bashisms.patch
+979c91b4f65ec95d85f2ad873e4148cd46e399534109ebeee03f8815c05327b590cf72a68a46f5ad655513591fb0c4a75cd08908446583d44213b87a75741c50 0003-As-xen-pv-guest-can-access-cpuid-from-Intel-CPUs-sta.patch"