-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathget_upstream.sh
More file actions
39 lines (37 loc) · 960 Bytes
/
get_upstream.sh
File metadata and controls
39 lines (37 loc) · 960 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/bin/bash
#
# Version: 1.0
# Date: 2019-09-26
# This bash fetches a tagged version from the upstream repository:
#
# Requirements:
# bash shell
# curl
#
# Upstream repository, tag and local target directory
UPSTREAM_URL=https://github.com/oasis-tcs/pkcs11
UPSTREAM_TAG=master
TARGET_DIR=local
if [ $# -gt 1 ]; then
echo "Too many parameters specified"
echo "Usage: $0 [repo-tag]"
exit
elif [ $# -eq 1 ]; then
UPSTREAM_TAG=$1
echo "Downloading from $UPSTREAM_URL tag: $UPSTREAM_TAG"
echo "removing local ..."
/bin/rm -rf $TARGET_DIR
elif [ $# -eq 0 ]; then
echo "Downloading from $UPSTREAM_URL tag: $UPSTREAM_TAG"
fi
# if $TARGET_DIR folder does not exist create it and fetch content
if [ ! -d $TARGET_DIR ]; then
mkdir $TARGET_DIR
pushd $TARGET_DIR
curl -L $UPSTREAM_URL/tarball/$UPSTREAM_TAG | tar xz --strip=1
mkdir include
cp -v published/2-40-errata-1/* include/
rm -rf published
rm -rf working
popd
fi