Browse Source

- support/scripts: add get-hg-archive.sh

master
vanhofen 3 years ago
parent
commit
bd817c8e79
  1. 34
      support/scripts/get-hg-archive.sh
  2. 2
      support/scripts/get-hg-source.sh

34
support/scripts/get-hg-archive.sh

@ -0,0 +1,34 @@
#!/bin/bash
#
# get a specified hg version as tarball
#
# (C) 2022 vanhofen
# License: WTFPLv2
#
# parameters:
# * hg URL
# * hg tag/tree-ish to archive
# * archive name (.tar.bz2 will be stripped off)
# * archive/download directory
#
# *** no matter the archive name, it will always be compressed with bzip2 ***
#
HG_URL="$1"
HG_TAG="$2"
TAR_NAME="$3"
ARCHIVE="$4"
test -z "$ARCHIVE" && ARCHIVE="$PWD"
TAR_PATH=${TAR_NAME%.tar*}
DIR=$(mktemp -d $PWD/hg_archive.XXXXXX)
# clean up at exit
trap "rm -rf $DIR" EXIT
# exit on error
set -e
hg clone $HG_URL $DIR
cd $DIR
hg archive -o $TAR_PATH.tar --prefix=$TAR_PATH/ $HG_TAG
bzip2 $TAR_PATH.tar
mv $TAR_PATH.tar.bz2 $ARCHIVE/
# exit trap cleans up...

2
support/scripts/get-hg-source.sh

@ -2,7 +2,7 @@
#
# clone or pull an existing hg repository
#
# (C) 2019 vanhofen
# (C) 2022 vanhofen
# License: WTFPLv2
#
# parameters:

Loading…
Cancel
Save