Files
OpenVPNAdapter/scripts/snapshot
Sergey Abramchuk e2ad2ab5d5 Squashed 'Sources/OpenVPNAdapter/Libraries/Vendors/openvpn/' content from commit 554d8b888
git-subtree-dir: Sources/OpenVPNAdapter/Libraries/Vendors/openvpn
git-subtree-split: 554d8b88817d3a7b836e78940ed61bb11ed2bd9b
2018-07-27 18:08:58 +03:00

37 lines
1019 B
Bash
Executable File

#!/usr/bin/env bash
# Create a tarball from a git checkout.
#
# DEP_DIR : dependency directory
# NAME : basename of git root directory in dependency directory
# DL : download directory, where to build tarball, defaults to ~/Downloads
# Note: this script gives priority to $NAME-yyyymmdd as source location,
# so for Asio, make sure to delete such directories if you want to
# favor straight "asio" directory.
set -e
if [ -z "$NAME" ]; then
echo "NAME var must exist"
exit 1
fi
[ -z "$DL" ] && DL=~/Downloads
if ! [ -d "$DL" ]; then
echo $DL directory must exist
exit 1
fi
[ "$DEP_DIR" ] && cd $DEP_DIR
NAMETS=$(ls -dt ${NAME}-* 2>/dev/null | head -n1)
if [ -z "$NAMETS" ]; then
cd $NAME
NAMETS=${NAME}-$(git log -1 --date=short --pretty=format:%cd | tr -d '-')
cd ..
mv $NAME $NAMETS
fi
NAMEVER=$(echo $NAME | awk '{print toupper($0)}')_VERSION
TGZ=$DL/$NAMETS.tar.gz
echo "creating $TGZ"
tar cfz $TGZ $NAMETS
echo 'Add to $O3/core/deps/lib-versions :'
echo "export $NAMEVER=$NAMETS"