forked from Azure/azure-iot-sdks
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy patharduinoyun_c.sh
executable file
·56 lines (49 loc) · 2.17 KB
/
arduinoyun_c.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
#!/bin/bash
# Copyright (c) Microsoft. All rights reserved.
# Licensed under the MIT license. See LICENSE file in the project root for full license information.
build_root=$(cd "$(dirname "$0")/.." && pwd)
cd $build_root
# -----------------------------------------------------------------------------
# -- helper subroutines
# -----------------------------------------------------------------------------
checkExists() {
if hash $1 2>/dev/null;
then
return 1
else
echo "$1" not found. Please make sure that "$1" is installed and available in the path.
exit 1
fi
}
# -----------------------------------------------------------------------------
# -- Check for environment pre-requisites. This script requires
# -- that the following programs work:
# -- curl uuid g++ make cmake git unzip gawk
# -----------------------------------------------------------------------------
checkExists curl
checkExists uuid
checkExists g++
checkExists make
checkExists cmake
checkExists git
checkExists unzip
checkExists gawk
# -----------------------------------------------------------------------------
# -- Run the ./setup.sh script to install the OpenWRT SDK
# -----------------------------------------------------------------------------
echo ---------- Installing OpenWRT SDK by executing ./setup.sh script ----------
cd $build_root/c/build_all/arduino
printf 'y\ny\n' | ./setup.sh
# -----------------------------------------------------------------------------
# -- Modify c/serializer/samples/simplesample_http/simplesample_http.c
# -----------------------------------------------------------------------------
echo ---------- Modifying c/serializer/samples/simplesample_http/simplesample_http.c file ----------
cd $build_root
sed -i 's/\[device connection string\]/'$IOTHUB_DEVICE_CONN_STR'/g' c/serializer/samples/simplesample_http/simplesample_http.c
# -----------------------------------------------------------------------------
# -- Build the SDK
# -----------------------------------------------------------------------------
echo ---------- Building the SDK by executing build.sh script ----------
cd $build_root/c/build_all/arduino
./build.sh
[ $? -eq 0 ] || exit $?