mktar.sh 1.2 KB

123456789101112131415161718192021222324252627282930313233343536
  1. #! /bin/sh
  2. # Copyright 2018 The OpenSSL Project Authors. All Rights Reserved.
  3. #
  4. # Licensed under the OpenSSL license (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. version=`grep 'OPENSSL_VERSION_TEXT *"OpenSSL' $HERE/../include/openssl/opensslv.h | sed -e 's|.*"OpenSSL ||' -e 's| .*||'`
  10. basename=openssl
  11. NAME="$basename-$version"
  12. while [ $# -gt 0 ]; do
  13. case "$1" in
  14. --name=* ) NAME=`echo "$1" | sed -e 's|[^=]*=||'` ;;
  15. --name ) shift; NAME="$1" ;;
  16. --tarfile=* ) TARFILE=`echo "$1" | sed -e 's|[^=]*=||'` ;;
  17. --tarfile ) shift; TARFILE="$1" ;;
  18. * ) echo >&2 "Could not parse '$1'"; exit 1 ;;
  19. esac
  20. shift
  21. done
  22. if [ -z "$TARFILE" ]; then TARFILE="$NAME.tar"; fi
  23. # This counts on .gitattributes to specify what files should be ignored
  24. git archive --worktree-attributes --format=tar --prefix="$NAME/" -v HEAD \
  25. | gzip -9 > "$TARFILE.gz"
  26. # Good old way to ensure we display an absolute path
  27. td=`dirname $TARFILE`
  28. tf=`basename $TARFILE`
  29. ls -l "`cd $td; pwd`/$tf.gz"