-
Notifications
You must be signed in to change notification settings - Fork 145
/
Copy pathprepare-oci-package.sh
executable file
·61 lines (44 loc) · 1.37 KB
/
prepare-oci-package.sh
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#!/bin/bash
set -eo pipefail
PACKAGE_VERSION=$(< ../artifacts/version.txt)
if [ -n "$CI_COMMIT_TAG" ] || [ -n "$DOTNET_PACKAGE_VERSION" ]; then
VERSION=$PACKAGE_VERSION
else
VERSION=$PACKAGE_VERSION$CI_VERSION_SUFFIX
fi
echo "VERSION=$VERSION"
if [ -z "$ARCH" ]; then
ARCH=amd64
fi
if [ "$OS" == "linux" ]; then
if [ "$ARCH" == "amd64" ]; then
SUFFIX=""
elif [ "$ARCH" == "arm64" ]; then
SUFFIX=".arm64"
else
echo "Unsupported architecture: $ARCH"
exit 1
fi
SRC_TAR="../artifacts/datadog-dotnet-apm-$PACKAGE_VERSION${SUFFIX}.tar.gz"
if [ ! -f $SRC_TAR ]; then
echo "$SRC_TAR was not found!"
exit 1
fi
mkdir -p sources
# extract the tarball, making sure to preserve the owner and permissions
tar --same-owner -pxvzf $SRC_TAR -C sources
cp ../artifacts/requirements.json sources/requirements.json
elif [ "$OS" == "windows" ]; then
if [ "$ARCH" != "amd64" ]; then
echo "Unsupported architecture: win-$ARCH"
exit 0
fi
# unzip the tracer home directory, and remove the xml files
mkdir -p sources/library
unzip ../artifacts/windows/windows-tracer-home.zip -d sources/library
find sources/library -type f -name "*.xml" -delete
# Unzip the fleet installer to the sub-directory
mkdir -p sources/installer
unzip ../artifacts/windows/fleet-installer.zip -d sources/installer/
fi
echo -n $VERSION > sources/version