-
Notifications
You must be signed in to change notification settings - Fork 76
/
Copy pathAWSIoTArduinoYunSetupEnvironment.sh
executable file
·40 lines (36 loc) · 1.38 KB
/
AWSIoTArduinoYunSetupEnvironment.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
#!/usr/bin/expect
# This script helps to upload the targeted file/directory to remote Arduino Yun Board
# Args check
if {$argc!= 3} {
send_user "usage: ./AWSIoTArduinoYunScp.sh <Board IP> <UserName> <Board Password>\n"
exit
}
set timeout -1
set ArduinoYunIPAddress [lindex $argv 0]
set ArduinoYunUserName [lindex $argv 1]
set ArduinoYunPassword [lindex $argv 2]
set RemoteEndpoint "$ArduinoYunUserName@$ArduinoYunIPAddress"
send_user "Arduino Yun IP is: $ArduinoYunIPAddress\n"
send_user "Arduino Yun User Name is: $ArduinoYunUserName\n"
send_user "\nThe following dependencies will be remotely installed on Arduino Yun:\n"
send_user "distribute\npython-openssl\n\n"
send_user "Please wait until the installation completes and the program exits.\n\n"
# ssh into Arduino Yun and automatically perform the installation
spawn ssh $RemoteEndpoint
expect {
# In case this is the first time
-re ".*yes/no.*" {
send "yes\r"; exp_continue
-re ".*assword.*" { send "$ArduinoYunPassword\r" }
}
-re ".*assword.*" { send "$ArduinoYunPassword\r" }
}
# Install all dependencies
expect "*~#" { send "opkg update\r" }
expect "*~#" { send "opkg install distribute\r" }
expect "*~#" { send "opkg install python-openssl\r" }
expect "*~#" { send "easy_install pip\r" }
expect "*~#" { send "pip install AWSIoTPythonSDK==1.0.0\r" }
expect "*~#" { send "exit\r" }
# End of installation
interact