File generate_acpi-tools_tarball.sh of Package acpica

#!/bin/bash

# Author: Thomas Renninger <trenn@suse.de>

# Execute in kernel git repositories root dir
# (or pass directory as shown below)
# for example fetch it via:
# git clone git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6
#
# Examples:
# Create acpi tools based on git v3.13 tag
# generate_acpi-tools_tarball.sh 3.13

# Create acpi tools based on git HEAD (latest code), name it acpi-tools-3.15
# Kernel git repo is in /tmp/linux-2.6
# generate_acpi-tools_tarball.sh 3.15 HEAD /tmp/linux-2.6

export GIT_DIR=".git"

if [ $# -gt 3 ] || [ $# -lt 1 ];then
    echo "generate_acpi-tools_tarball.sh VERSION [ GIT_VERSION ] [ PATH_TO_GIT_REPO ]"
    echo "If you want to pass PATH_TO_GIT_REPO, GIT_VERSION also must be passed"
    exit 1
elif [ $# -eq 1 ];then
    VERSION=$1
    GIT_VERSION=v$1
elif [ $# -eq 2 ];then
    VERSION=$1
    GIT_VERSION=$2
elif [ $# -eq 3 ];then
    VERSION=$1
    GIT_VERSION=$2
    GIT_DIR="$3"/.git
else
    # unreachable
    echo "generate_acpi-tools_tarball.sh VERSION [ GIT_VERSION ]"
    exit 1
fi

set -x
TMP=`mktemp -d`
ROOT="$TMP"/acpi-tools-$VERSION
git archive --format=tar --prefix=acpi-tools-${VERSION}/ ${GIT_VERSION}:tools/power/acpi |tar -x -C "$TMP"
mkdir -p "$ROOT"/include
git archive --format=tar --prefix=acpi/ ${GIT_VERSION}:include/acpi |tar -x -C "$ROOT"/include
tar -C "$TMP" -cvjf acpi-tools-$VERSION.tar.bz2 acpi-tools-$VERSION
rm -rf "$TMP"
openSUSE Build Service is sponsored by