qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH 5/5] guest tools: installer for qemu-ga


From: Michael Roth
Subject: [Qemu-devel] [PATCH 5/5] guest tools: installer for qemu-ga
Date: Mon, 22 Aug 2011 12:09:20 -0500

Detects host distro/architecture, then chooses the appropriate binary
and init scripts to install. Support for more distros will be added as
they're tested. Currently RHEL6, RHEL5, Fedora 15, Ubuntu 10.04, and
Ubuntu 10.10 are known to be supported with qemu-ga binaries generated
on a RHEL5 build host. RHEL6 builds will not work on RHEL5 due to glibc
issues. These idiosyncrasies will need to be documented once everything
is fleshed out.

Signed-off-by: Michael Roth <address@hidden>
---
 guest-tools-iso/projects/qemu-ga/install.linux |   61 ++++++++++++++++++++++++
 1 files changed, 61 insertions(+), 0 deletions(-)
 create mode 100755 guest-tools-iso/projects/qemu-ga/install.linux

diff --git a/guest-tools-iso/projects/qemu-ga/install.linux 
b/guest-tools-iso/projects/qemu-ga/install.linux
new file mode 100755
index 0000000..1f200b6
--- /dev/null
+++ b/guest-tools-iso/projects/qemu-ga/install.linux
@@ -0,0 +1,61 @@
+#!/bin/sh
+
+#arch=""
+#distro=""
+
+get_arch() {
+    machine=`uname --machine`
+    if [ "$machine" = "x86_64" ]; then
+        arch="x86_64"
+    elif [ "`echo $machine | sed 's/i[3456]86/x86/'`" = "x86" ]; then
+        arch="x86"
+    else
+        echo "unsupported architecture"
+        exit 1
+    fi
+}
+
+get_distro() {
+    if [ -f /etc/redhat-release ]; then
+        distro="redhat"
+    elif [ -f /etc/fedora-release ]; then
+        distro="fedora"
+    elif [ -f /etc/debian_version ]; then
+        distro_id=`lsb_release -i | awk '{print $3}'`
+        if [ "$distro_id" = "Ubuntu" ]; then
+            distro="ubuntu"
+        else
+            distro="debian"
+        fi
+    else
+        echo "unsupported distribution"
+        exit 1
+    fi
+}
+
+get_arch
+get_distro
+
+echo detected arch: $arch
+echo detected distro: $distro
+echo installing...
+
+install -D -p -m 0755 qemu-ga.linux.$arch /usr/sbin/qemu-ga
+
+if [ "$distro" = "redhat" ] || [ "$distro" = "fedora" ]; then
+    install -D -p -m 0755 redhat/qemu-ga.init /etc/init.d/qemu-ga
+    install -D -p -m 0644 redhat/qemu-ga.sysconfig /etc/sysconfig/qemu-ga
+    /sbin/chkconfig --add qemu-ga
+    /sbin/chkconfig --level 2345 qemu-ga on
+    /sbin/service qemu-ga restart
+elif [ "$distro" = "ubuntu" ] || [ "$distro" = "debian" ]; then
+    install -D -p -m 0755 debian/qemu-ga.init /etc/init.d/qemu-ga
+    install -D -p -m 0644 debian/qemu-ga.sysconfig /etc/sysconfig/qemu-ga
+    /usr/sbin/update-rc.d qemu-ga defaults
+    /etc/init.d/qemu-ga restart
+else
+    "no associated init script for distro: $distro"
+    exit 1
+fi
+
+echo installation complete.
-- 
1.7.0.4




reply via email to

[Prev in Thread] Current Thread [Next in Thread]