summaryrefslogtreecommitdiffstats
path: root/php-PhpCollection-strip.sh
blob: e0a65f5d86f72c7a3cac957009ad17304211d753 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#!/bin/bash

if [ $# != 2 ]; then
	echo "Usage: $0 VERSION GITHUB_COMMIT" 1>&2
	exit 1
fi

VERSION=$1
GITHUB_COMMIT=$2

ORIGINAL_SOURCE_FILE="${GITHUB_COMMIT}.tar.gz"
NEW_SOURCE_FILE="php-PhpCollection-${VERSION}-${GITHUB_COMMIT}.tar.gz"

if [ ! -f "$ORIGINAL_SOURCE_FILE" ]; then
	echo "ERROR: Original source file '${ORIGINAL_SOURCE_FILE}' not found" 1>&2
	exit 1
fi

TAR=`which tar`

$TAR -xzf "$ORIGINAL_SOURCE_FILE"
rm -rf "php-collection-${GITHUB_COMMIT}/doc" "$NEW_SOURCE_FILE"
$TAR -czf "$NEW_SOURCE_FILE" "php-collection-${GITHUB_COMMIT}"

echo "${NEW_SOURCE_FILE} created"
exit 0