-
Notifications
You must be signed in to change notification settings - Fork 76
/
AWSIoTArduinoYunInstallAll.sh
executable file
·38 lines (38 loc) · 1.63 KB
/
AWSIoTArduinoYunInstallAll.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
#!/bin/bash
# If input args not correct, echo usage
if [ $# -ne 3 ]; then
echo "usage: ./AWSIoTArduinoYunInstallAll.sh <Board IP> <UserName> <Board Password>"
else
# Welcoming prompt
echo "This script will install all of the depencies and upload the codebase and credentials to the targeted Arduino Yun Board for the AWS IoT Arduino Yun SDK, which includes:"
echo "- Install dependencies"
echo "- Upload codebase"
echo "- Upload credentials"
echo "Please make sure you have included your credentials (private key, certificate and rootCA) in AWS-IoT-Python-Runtime/certs/"
# Load in params
yunBoardIP=$1
yunBoardUserName=$2
yunBoardPassword=$3
pyLibDir="./AWS-IoT-Python-Runtime"
certsDir="$pyLibDir/certs"
# Check to see if AWS-IoT-Python-Runtime/certs/ is empty
if [ "`ls -A $certsDir`" = "" ]; then
echo -e "\nIt seems there are no credentials in $certsDir. Please generate your credentials and put them in that directory.\n"
exit
fi
# Change permission of functional scripts
echo "Changing permissions for functional scripts..."
chmod 755 AWSIoTArduinoYunScp.sh
chmod 755 AWSIoTArduinoYunSetupEnvironment.sh
echo "Done."
# Now start uploading codebase and credentials
echo "Uploading codebase and credentials..."
./AWSIoTArduinoYunScp.sh $yunBoardIP $yunBoardUserName $yunBoardPassword $pyLibDir /root/
echo "Done."
# Now start installing codebase on Arduino Yun Board
echo "Installing dependencies on Arduino Yun..."
./AWSIoTArduinoYunSetupEnvironment.sh $yunBoardIP $yunBoardUserName $yunBoardPassword
echo "Done."
# End of this script
echo "Execution completed!"
fi