mirror of
https://github.com/Relintai/pandemonium_engine_minimal.git
synced 2024-11-10 20:12:10 +01:00
67 lines
1.4 KiB
Bash
67 lines
1.4 KiB
Bash
|
#!/bin/sh
|
||
|
|
||
|
if [ ! -e "version.py" ]; then
|
||
|
echo "This script should be ran from the root folder of the Pandemonium repository."
|
||
|
exit 1
|
||
|
fi
|
||
|
|
||
|
while getopts "h?sv:g:" opt; do
|
||
|
case "$opt" in
|
||
|
h|\?)
|
||
|
echo "Usage: $0 [OPTIONS...]"
|
||
|
echo
|
||
|
echo " -s script friendly file name (pandemonium.tar.gz)"
|
||
|
echo " -v pandemonium version for file name (e.g. 4.0-stable)"
|
||
|
echo " -g git treeish to archive (e.g. master)"
|
||
|
echo
|
||
|
exit 1
|
||
|
;;
|
||
|
s)
|
||
|
script_friendly_name=1
|
||
|
;;
|
||
|
v)
|
||
|
pandemonium_version=$OPTARG
|
||
|
;;
|
||
|
g)
|
||
|
git_treeish=$OPTARG
|
||
|
;;
|
||
|
esac
|
||
|
done
|
||
|
|
||
|
if [ ! -z "$git_treeish" ]; then
|
||
|
HEAD=$(git rev-parse $git_treeish)
|
||
|
else
|
||
|
HEAD=$(git rev-parse HEAD)
|
||
|
fi
|
||
|
|
||
|
if [ ! -z "$script_friendly_name" ]; then
|
||
|
NAME=pandemonium
|
||
|
else
|
||
|
if [ ! -z "$pandemonium_version" ]; then
|
||
|
NAME=pandemonium-$pandemonium_version
|
||
|
else
|
||
|
NAME=pandemonium-$HEAD
|
||
|
fi
|
||
|
fi
|
||
|
|
||
|
CURDIR=$(pwd)
|
||
|
TMPDIR=$(mktemp -d -t pandemonium-XXXXXX)
|
||
|
|
||
|
echo "Generating tarball for revision $HEAD with folder name '$NAME'."
|
||
|
echo
|
||
|
echo "The tarball will be written to the parent folder:"
|
||
|
echo " $(dirname $CURDIR)/$NAME.tar.gz"
|
||
|
|
||
|
git archive $HEAD --prefix=$NAME/ -o $TMPDIR/$NAME.tar
|
||
|
|
||
|
# Adding custom .git/HEAD to tarball so that we can generate VERSION_HASH.
|
||
|
cd $TMPDIR
|
||
|
mkdir -p $NAME/.git
|
||
|
echo $HEAD > $NAME/.git/HEAD
|
||
|
tar -uf $NAME.tar $NAME
|
||
|
|
||
|
cd $CURDIR
|
||
|
gzip -c $TMPDIR/$NAME.tar > ../$NAME.tar.gz
|
||
|
|
||
|
rm -rf $TMPDIR
|