mktar.sh 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. #! /bin/sh
  2. # Copyright 2018-2020 The OpenSSL Project Authors. All Rights Reserved.
  3. #
  4. # Licensed under the Apache License 2.0 (the "License"). You may not use
  5. # this file except in compliance with the License. You can obtain a copy
  6. # in the file LICENSE in the source distribution or at
  7. # https://www.openssl.org/source/license.html
  8. HERE=`dirname $0`
  9. # Get all version data as shell variables
  10. . $HERE/../VERSION.dat
  11. if [ -n "$PRE_RELEASE_TAG" ]; then PRE_RELEASE_TAG=-$PRE_RELEASE_TAG; fi
  12. version=$MAJOR.$MINOR.$PATCH$PRE_RELEASE_TAG$BUILD_METADATA
  13. basename=openssl
  14. NAME="$basename-$version"
  15. while [ $# -gt 0 ]; do
  16. case "$1" in
  17. --name=* ) NAME=`echo "$1" | sed -e 's|[^=]*=||'` ;;
  18. --name ) shift; NAME="$1" ;;
  19. --tarfile=* ) TARFILE=`echo "$1" | sed -e 's|[^=]*=||'` ;;
  20. --tarfile ) shift; TARFILE="$1" ;;
  21. * ) echo >&2 "Could not parse '$1'"; exit 1 ;;
  22. esac
  23. shift
  24. done
  25. if [ -z "$TARFILE" ]; then TARFILE="$NAME.tar"; fi
  26. # This counts on .gitattributes to specify what files should be ignored
  27. git archive --worktree-attributes --format=tar --prefix="$NAME/" -v HEAD \
  28. | gzip -9 > "$TARFILE.gz"
  29. # Good old way to ensure we display an absolute path
  30. td=`dirname $TARFILE`
  31. tf=`basename $TARFILE`
  32. ls -l "`cd $td; pwd`/$tf.gz"