From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44310) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V4ffA-0008QD-Q5 for qemu-devel@nongnu.org; Wed, 31 Jul 2013 19:18:42 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1V4epZ-0004Dc-3U for qemu-devel@nongnu.org; Wed, 31 Jul 2013 18:25:25 -0400 Received: from usindpps03.hds.com ([207.126.252.16]:48902) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V4epY-0004DI-Tg for qemu-devel@nongnu.org; Wed, 31 Jul 2013 18:25:17 -0400 From: Tomoki Sekiyama Date: Wed, 31 Jul 2013 18:24:51 -0400 Message-ID: <20130731222451.13673.29348.stgit@hds.com> In-Reply-To: <20130731222435.13673.16685.stgit@hds.com> References: <20130731222435.13673.16685.stgit@hds.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Subject: [Qemu-devel] [PATCH v9 04/10] Add a script to extract VSS SDK headers on POSIX system List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: libaiqing@huawei.com, ghammer@redhat.com, stefanha@gmail.com, Michael Roth , lcapitulino@redhat.com, vrozenfe@redhat.com, Paolo Bonzini , seiji.aguchi@hds.com, Laszlo Ersek , areis@redhat.com VSS SDK(*) setup.exe is only runnable on Windows. This adds a script to extract VSS SDK headers on POSIX-systems using msitools. * http://www.microsoft.com/en-us/download/details.aspx?id=23490 From: Paolo Bonzini Signed-off-by: Paolo Bonzini Signed-off-by: Tomoki Sekiyama Reviewed-by: Laszlo Ersek Reviewed-by: Michael Roth --- scripts/extract-vsssdk-headers | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100755 scripts/extract-vsssdk-headers diff --git a/scripts/extract-vsssdk-headers b/scripts/extract-vsssdk-headers new file mode 100755 index 0000000..9e38510 --- /dev/null +++ b/scripts/extract-vsssdk-headers @@ -0,0 +1,35 @@ +#! /bin/bash + +# extract-vsssdk-headers +# Author: Paolo Bonzini + +set -e +if test $# != 1 || ! test -f "$1"; then + echo 'Usage: extract-vsssdk-headers /path/to/setup.exe' >&2 + exit 1 +fi + +if ! command -v msiextract > /dev/null; then + echo 'msiextract not found. Please install msitools.' >&2 + exit 1 +fi + +if test -e inc; then + echo '"inc" already exists.' >&2 + exit 1 +fi + +# Extract .MSI file in the .exe, looking for the OLE compound +# document signature. Extra data at the end does not matter. +export LC_ALL=C +MAGIC=$'\xd0\xcf\x11\xe0\xa1\xb1\x1a\xe1' +offset=$(grep -abom1 "$MAGIC" "$1" | sed -n 's/:/\n/; P') +tmpdir=$(mktemp -d) +trap 'rm -fr -- "$tmpdir" vsssdk.msi' EXIT HUP INT QUIT ALRM TERM +tail -c +$(($offset+1)) -- "$1" > vsssdk.msi + +# Now extract the files. +msiextract -C $tmpdir vsssdk.msi +mv "$tmpdir/Program Files/Microsoft/VSSSDK72/inc" inc +echo 'Extracted SDK headers into "inc" directory.' +exit 0