forked from Azure/azure-linux-extensions
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpackaging.sh
executable file
·51 lines (43 loc) · 1.31 KB
/
packaging.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
#! /bin/bash
set -e
source omsagent.version
usage()
{
local basename=`basename $0`
echo "usage: ./$basename <path to omsagent-<version>.universal.x64{.sh, .sha256sums, .asc}> [path for zip output]"
}
input_path=$1
output_path=$2
PACKAGE_NAME="oms$OMS_EXTENSION_VERSION.zip"
if [[ "$1" == "--help" ]]; then
usage
exit 0
elif [[ ! -d $input_path ]]; then
echo "OMS files path '$input_path' not found"
usage
exit 1
fi
if [[ "$output_path" == "" ]]; then
output_path="../"
fi
# Packaging starts here
cp -r ../Utils .
cp ../Common/WALinuxAgent-2.0.16/waagent .
# cleanup packages, ext
rm -rf packages ext/future
mkdir -p packages ext/future
# copy shell bundle to packages/
cp $input_path/omsagent-$OMS_SHELL_BUNDLE_VERSION.universal.x64.* packages/
# copy just the source of python-future
cp -r ext/python-future/src/* ext/future
# sync the file copy
sync
if [[ -f $output_path/$PACKAGE_NAME ]]; then
echo "Removing existing $PACKAGE_NAME ..."
rm -f $output_path/$PACKAGE_NAME
fi
echo "Packaging extension $PACKAGE_NAME to $output_path"
excluded_files="omsagent.version packaging.sh apply_version.sh update_version.sh"
zip -r $output_path/$PACKAGE_NAME * -x $excluded_files "./test/*" "./extension-test/*" "./references" "./ext/python-future/*"
# cleanup newly added dir or files
rm -rf Utils/ waagent