-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild.sh
executable file
·104 lines (94 loc) · 1.98 KB
/
build.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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
#!/bin/bash
set -e
MARINER_RELEASE_TAG=2.0-stable
SRC_ROOT=`pwd`
OUT_DIR=$SRC_ROOT/out
BOWLINE_LOG_LEVEL=info
trap cleanup EXIT
function cleanup() {
if [ -d CBL-Mariner ]; then
sudo rm -rf CBL-Mariner
fi
}
function getToolkit() {
echo "Building the Mariner toolkit..."
if [ ! -d toolkit ]; then
if [ ! -d CBL-Mariner ]; then
git clone \
--branch ${MARINER_RELEASE_TAG} \
--depth 1 \
https://github.com/microsoft/CBL-Mariner.git
fi
sudo make \
-C CBL-Mariner/toolkit \
package-toolkit \
REBUILD_TOOLS=y \
OUT_DIR=$OUT_DIR && \
rm -rf toolkit && \
tar -xzvf ${OUT_DIR}/toolkit-*.tar.gz -C "${SRC_ROOT}"
fi
}
function buildPackages() {
echo "Building the Bowline packages..."
getToolkit
pushd $SRC_ROOT/toolkit
rm -f $SRC_ROOT/build/make_status/build_srpms.flag
sudo make -j$(nproc) build-packages \
CONFIG_FILE= \
SPECS_DIR=../SPECS \
OUT_DIR=$OUT_DIR \
PACKAGE_REBUILD_LIST="$@" \
PACKAGE_BUILD_LIST="$@" \
SOURCE_URL=https://cblmarinerstorage.blob.core.windows.net/sources/core \
USE_PREVIEW_REPO=n \
SRPM_FILE_SIGNATURE_HANDLING=update \
LOG_LEVEL=$BOWLINE_LOG_LEVEL
popd
}
function buildImage() {
echo "Building the Bowline images..."
getToolkit
pushd $SRC_ROOT/toolkit
sudo make iso \
REBUILD_PACKAGES=n \
CONFIG_FILE=../images/bowline-iso.json \
USE_PREVIEW_REPO=n \
LOG_LEVEL=$BOWLINE_LOG_LEVEL
popd
}
function showUsage() {
echo "build.sh [-p][-i][-t][-h]"
echo " [-h]: Show this help message"
echo " [-t]: Build the toolkit"
echo " [-i]: Build the image"
echo " [-p]: Build the packages"
}
if [ -z "${OPTIONS}" ]; then
showUsage
exit 1
fi
while getopts "hipt" OPTIONS; do
case "${OPTIONS}" in
h )
showUsage
exit 0
;;
i )
buildImage
;;
p )
buildPackages
;;
t )
getToolkit
;;
\? )
echo "-- Error - Invalid Option: -$OPTARG" 1>&2
exit 1
;;
: )
echo "-- Error - Invalid Option: -$OPTARG requires an argument" 1>&2
exit 1
;;
esac
done