From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:45516) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qvaog-0002YW-9w for qemu-devel@nongnu.org; Mon, 22 Aug 2011 16:10:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QvaoJ-0007Tw-4i for qemu-devel@nongnu.org; Mon, 22 Aug 2011 16:09:28 -0400 Received: from mout.perfora.net ([74.208.4.195]:50338) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QvaoI-0007Rd-A0 for qemu-devel@nongnu.org; Mon, 22 Aug 2011 16:09:27 -0400 From: Michael Roth Date: Mon, 22 Aug 2011 12:09:20 -0500 Message-Id: <1314032960-23474-6-git-send-email-mdroth@linux.vnet.ibm.com> In-Reply-To: <1314032960-23474-1-git-send-email-mdroth@linux.vnet.ibm.com> References: <1314032960-23474-1-git-send-email-mdroth@linux.vnet.ibm.com> Subject: [Qemu-devel] [PATCH 5/5] guest tools: installer for qemu-ga List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: aliguori@linux.vnet.ibm.com, mdroth@linux.vnet.ibm.com 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 --- 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