paul@1104 | 1 | #!/bin/sh |
paul@1104 | 2 | |
paul@1157 | 3 | DIRNAME=`dirname "$0"` |
paul@1157 | 4 | PROGNAME=`basename "$0"` |
paul@1104 | 5 | |
paul@1225 | 6 | ARCHIVE=imip-agent |
paul@1225 | 7 | |
paul@1157 | 8 | if [ ! "$1" ] || [ "$1" = '--help' ] ; then |
paul@1104 | 9 | cat 1>&2 <<EOF |
paul@1104 | 10 | Usage: $PROGNAME <output directory> [ -f ] |
paul@1157 | 11 | |
paul@1157 | 12 | Make release archives from tags starting with "rel-" in the repository, |
paul@1157 | 13 | storing the archives in the output directory. If an archive already exists for |
paul@1157 | 14 | a release, it is not regenerated unless the -f (force) option is given. |
paul@1157 | 15 | |
paul@1157 | 16 | All newly-created archive filenames are emitted on standard output. |
paul@1104 | 17 | EOF |
paul@1104 | 18 | exit 1 |
paul@1104 | 19 | fi |
paul@1104 | 20 | |
paul@1157 | 21 | OUTDIR=$1 |
paul@1157 | 22 | FORCE=$2 |
paul@1157 | 23 | |
paul@1104 | 24 | if [ "$FORCE" != '-f' ]; then |
paul@1104 | 25 | FORCE= |
paul@1104 | 26 | fi |
paul@1104 | 27 | |
paul@1104 | 28 | if [ ! -e "$OUTDIR" ]; then |
paul@1104 | 29 | mkdir -p "$OUTDIR" |
paul@1104 | 30 | fi |
paul@1104 | 31 | |
paul@1104 | 32 | for TAG in `hg tags | grep ^rel- | cut -f 1 -d ' '` ; do |
paul@1104 | 33 | NUM=`echo "$TAG" | sed 's/rel-//;s/-/./g'` |
paul@1225 | 34 | OUTFILE="$OUTDIR/$ARCHIVE-$NUM.tar.bz2" |
paul@1104 | 35 | if [ ! -e "$OUTFILE" ] || [ "$FORCE" ]; then |
paul@1104 | 36 | hg archive -t tbz2 -r "$TAG" "$OUTFILE" |
paul@1157 | 37 | echo "$OUTFILE" |
paul@1104 | 38 | fi |
paul@1104 | 39 | done |