-
Notifications
You must be signed in to change notification settings - Fork 2
/
build.sh
executable file
·71 lines (54 loc) · 1.64 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
#!/usr/bin/env bash
set -euox pipefail
# For bootstrapping build process in linux (Ubuntu, CentOS)
cd "$(dirname "${BASH_SOURCE[0]}")"
export DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1
export DOTNET_CLI_TELEMETRY_OPTOUT=1
export DOTNET_NOLOGO=1
# https://askubuntu.com/a/1214268/101335
readonly os_name=$(cat /etc/os-release | awk -F '=' '/^NAME/{print $2}' | awk '{print $1}' | tr -d '"')
# Check dotnet exist or not?
# https://stackoverflow.com/a/677212/1539100
if ! command -v dotnet &> /dev/null ; then
# https://askubuntu.com/a/1214268/101335
if [ "$os_name" == "Ubuntu" ]
then
echo "system is Ubuntu"
# Update the apt package index and install packages needed to use the .NET SDK apt repository:
sudo apt-get update
sudo apt-get install -y apt-transport-https ca-certificates curl
sudo apt-get update
sudo apt-get install -y dotnet-sdk-6.0
elif [ "$os_name" == "CentOS" ]
then
echo "system is CentOS"
sudo dnf install dotnet-sdk-6.0
else
echo "system is $os_name"
fi
fi
# Check docker-compose exist or not?
# https://stackoverflow.com/a/677212/1539100
if ! command -v docker-compose &> /dev/null ; then
if [ "$os_name" == "Ubuntu" ]
then
echo "system is Ubuntu"
sudo apt-get update
sudo apt-get install -y docker-compose
elif [ "$os_name" == "CentOS" ]
then
echo "system is CentOS"
sudo dnf install docker-compose
else
echo "system is $os_name"
fi
fi
dotnet new tool-manifest --force
dotnet tool install Cake.Tool
dotnet tool restore
dotnet --info
cd Build/ && dotnet cake linux-build.cake "$@" && cd ..
if [ -f 'build/build-call-control-system.cake' ]
then
cd build/ && dotnet cake build-call-control-system.cake "$@"
fi