Skip to content

Commit 1d7784b

Browse files
committed
fixed install script
1 parent 9b7eedf commit 1d7784b

File tree

1 file changed

+15
-34
lines changed

1 file changed

+15
-34
lines changed

src/YunMQTTInstall.cpp

Lines changed: 15 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -2,54 +2,35 @@
22

33
#include <Process.h>
44

5-
void sendCommand(const char *name, const char * cmd, const char * param1, const char * param2) {
5+
void sendCommand(const char *name, const char * cmd) {
66
Serial.print("=== ");
7-
Serial.print(name);
8-
Serial.println(" ===");
7+
Serial.println(name);
98

10-
Process p;
11-
p.begin(cmd);
12-
p.addParameter(param1);
13-
14-
if(param2 != NULL) {
15-
p.addParameter(param2);
16-
}
17-
18-
Serial.print("> running '");
9+
Serial.print("--> running '");
1910
Serial.print(cmd);
20-
Serial.print(' ');
21-
Serial.print(param1);
22-
23-
if(param2 != NULL) {
24-
Serial.print(' ');
25-
Serial.print(param2);
26-
}
27-
2811
Serial.println("'");
2912

30-
p.run();
13+
Process p;
14+
p.begin(cmd);
15+
p.runShellCommand(cmd);
3116

3217
while (p.available() > 0) {
3318
char c = p.read();
3419
Serial.print(c);
3520
}
3621

37-
Serial.flush();
38-
39-
Serial.println("> finished!");
40-
Serial.println("");
22+
Serial.println("--> finished!\n");
4123
}
4224

4325
void YunMQTTInstall() {
44-
Serial.println("Starting Installation!");
45-
Serial.println("");
46-
47-
sendCommand("Update", "opkg", "update", NULL);
48-
sendCommand("Install 'easy_install'", "opkg", "install", "distribute");
49-
sendCommand("Install python SSL support", "opkg", "install", "python-openssl");
50-
sendCommand("Install 'pip'", "easy_install", "pip", NULL);
51-
sendCommand("Install 'paho-mqtt'", "pip", "install", "paho-mqtt");
52-
sendCommand("Download script", "wget", "https://raw.githubusercontent.com/256dpi/arduino-mqtt/yun-client/yun/client.py", NULL);
26+
Serial.println("Starting Installation!\n");
27+
28+
sendCommand("Update", "opkg update");
29+
sendCommand("Install 'easy_install'", "opkg install distribute");
30+
sendCommand("Install python SSL support", "opkg install python-openssl");
31+
sendCommand("Install 'pip'", "easy_install pip");
32+
sendCommand("Install 'paho-mqtt'", "pip install paho-mqtt");
33+
sendCommand("Download script", "wget https://raw.githubusercontent.com/256dpi/arduino-mqtt/yun-client/yun/client.py --no-check-certificate -o /usr/client.py");
5334

5435
Serial.println("Installation finished!");
5536
}

0 commit comments

Comments
 (0)