ttyload/exportit

58 lines
1.9 KiB
Plaintext
Raw Permalink Normal View History

2008-09-17 04:35:28 +02:00
#!/bin/ksh
2001-08-07 04:05:50 +02:00
# exportit -- a simple little script to export something from a
2011-02-06 10:15:40 +01:00
# git repository and create a "release" tarbal of it, in mostly
# automated fasion. Re-written from an earlier CVS version.
2001-08-07 04:05:50 +02:00
2011-02-06 10:15:40 +01:00
# Note that people getting this with ttyload will presumably have no
# reason to use it in conjunction with ttyload, unless they're forking
# their own version. I'd much prefer to get patches or pull requests
# (e.g. on GitHub, though from your own git repo is fine, too).
# Copyright 2001-2011 by David Lindes, All Rights Reserved.
# Distributed under the license described in the file LICENSE that
# comes with ttyload.
# if you're wanting to use this script for some other project,
# and you want to call your release something other than the
# name of the directory above this one (.., but by name), change
# the "false" below to "true", and the "xyzprod" to whatever you
# want to call things. Note that your tagging will have to also
# be changed appropriately.
if false
then
# override the name of what to call stuff:
name="xyzprod"
else
# make sure name is unset, so that the ${name:-blah}
# expansion below doesn't get stuff from your environment
# accidentally
unset name
fi
2001-08-07 04:05:50 +02:00
2001-08-07 04:08:58 +02:00
# automagical settings for things:
2011-02-06 10:15:40 +01:00
name="${name:-ttyload}" # this used to be automatic, from CVS info. Skipping that now.
version="`cat Version`"
2011-02-06 10:15:40 +01:00
tagname="${name}_`echo \"$version\" | sed -e 's/[ \.]/_/g'`"
2001-08-07 04:05:50 +02:00
dirname="$name-$version"
2011-02-06 10:15:40 +01:00
for item in "$dirname.tar" "$dirname.tar.gz" "$dirname.tar.bz2"
do
if [ -e "$item" ]
then
echo "Sorry, $item exists, and I need it not to." >&2
echo "Please remove it or update your Version file to proceed." >&2
exit 1
fi
done
2001-08-07 04:08:58 +02:00
# let the user know what the settings came up with:
2011-02-06 10:15:40 +01:00
echo "Creating export of $name version $version (tag: $tagname)"
2001-08-07 04:05:50 +02:00
2001-08-07 04:08:58 +02:00
# export, and if that fails, bail.
2011-02-06 10:15:40 +01:00
git archive --prefix=$dirname/ -o $dirname.tar $tagname || exit 1
2001-08-07 04:08:58 +02:00
2011-02-06 10:15:40 +01:00
# then bzip:
bzip2 -9fv "$dirname.tar"