0
0
mirror of https://github.com/OpenVPN/openvpn3.git synced 2024-09-20 12:12:15 +02:00
openvpn3/scripts/snapshot
2016-08-03 13:09:43 -06: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"