More Linux interactive installer improvements.
Ylian Saint-Hilaire committed
Sep 14, 2020 at 15:34 UTC
abe862153ec9b84aeea56a017e98498f4c375a90
3 files changed
+57
-44
MeshCentralServer.njsproj
+1
@@ -573,6 +573,7 @@
573
<Content Include="views\login-mobile.handlebars" />
574
<Content Include="views\login.handlebars" />
575
<Content Include="views\message.handlebars" />
576
+ <Content Include="views\message2.handlebars" />
577
<Content Include="views\messenger.handlebars" />
578
<Content Include="views\mstsc.handlebars" />
579
<Content Include="views\player.handlebars" />
agents/meshinstall-linux.js
+52
-41
@@ -55,15 +55,41 @@ if (msh.InstallFlags == null) {
55
msh.InstallFlags = parseInt(msh.InstallFlags.toString());
56
}
57
58
-if ((msh.InstallFlags & 1) == 1) { buttons.unshift('Connect'); }
59
-if ((msh.InstallFlags & 2) == 2) {
58
+if (process.argv.includes('-mesh')) {
59
+ console.log(JSON.stringify(msh, null, 2));
60
+ process.exit();
61
+}
62
+
63
+if ((msh.InstallFlags & 1) == 1) {
64
+ buttons.unshift('Connect');
65
+ if (process.argv.includes('-connect')) {
66
+ global._child = require('child_process').execFile(process.execPath,
67
+ [process.execPath.split('/').pop(), '--no-embedded=1', '--disableUpdate=1',
68
+ '--MeshName="' + msh.MeshName + '"', '--MeshType="' + msh.MeshType + '"',
69
+ '--MeshID="' + msh.MeshID + '"',
70
+ '--ServerID="' + msh.ServerID + '"',
71
+ '--MeshServer="' + msh.MeshServer + '"',
72
+ '--AgentCapabilities="0x00000020"']);
73
+
74
+ global._child.stdout.on('data', function (c) { });
75
+ global._child.stderr.on('data', function (c) { });
76
+ global._child.on('exit', function (code) { process.exit(code); });
77
+
78
+ console.log("\nConnecting to: " + msh.MeshServer);
79
+ console.log("Device Group: " + msh.MeshName);
80
+ console.log('\nPress Ctrl-C to exit\n');
81
+ skip = true;
82
+ }
83
+}
84
+
85
+if ((!skip) && ((msh.InstallFlags & 2) == 2)) {
86
if (!require('user-sessions').isRoot()) {
87
console.log('\n' + "Elevated permissions is required to install/uninstall the agent.");
88
console.log("Please try again with sudo.");
89
process.exit();
90
}
91
if (s) {
66
- if (process.platform == 'darwin' || require('message-box').kdialog) {
92
+ if ((process.platform == 'darwin') || require('message-box').kdialog) {
93
buttons.unshift("Setup");
94
} else {
95
buttons.unshift("Uninstall");
@@ -74,8 +100,8 @@ if ((msh.InstallFlags & 2) == 2) {
100
}
101
}
102
77
-if (process.platform != 'darwin') {
78
- if (!require('message-box').kdialog && (require('message-box').zenity == null || (!require('message-box').zenity.extra))) {
103
+if (!skip) {
104
+ if (process.platform != 'darwin') {
105
if (process.argv.includes('-install') || process.argv.includes('-update')) {
106
var p = [];
107
for (var i = 0; i < process.argv.length; ++i) {
@@ -90,47 +116,32 @@ if (process.platform != 'darwin') {
116
_uninstall();
117
process.exit();
118
}
93
- else if (process.argv.includes('-connect')) {
94
- global._child = require('child_process').execFile(process.execPath,
95
- [process.execPath.split('/').pop(), '--no-embedded=1', '--disableUpdate=1',
96
- '--MeshName="' + msh.MeshName + '"', '--MeshType="' + msh.MeshType + '"',
97
- '--MeshID="' + msh.MeshID + '"',
98
- '--ServerID="' + msh.ServerID + '"',
99
- '--MeshServer="' + msh.MeshServer + '"',
100
- '--AgentCapabilities="0x00000020"']);
101
-
102
- global._child.stdout.on('data', function (c) { });
103
- global._child.stderr.on('data', function (c) { });
104
- global._child.on('exit', function (code) { process.exit(code); });
105
-
106
- console.log("\nConnecting to: " + msh.MeshServer);
107
- console.log("Device Group: " + msh.MeshName);
108
- console.log('\nPress Ctrl-c to exit\n');
109
- skip = true;
110
- } else {
111
- console.log('\n' + "The graphical version of this installer cannot run on this system.");
112
- console.log("Try installing/updating Zenity, and run again." + '\n');
113
- console.log("You can also run the text version from the command line with the following command(s): ");
114
- if ((msh.InstallFlags & 1) == 1) {
115
- console.log('./' + process.execPath.split('/').pop() + ' -connect');
116
- }
117
- if ((msh.InstallFlags & 2) == 2) {
118
- if (s) {
119
- console.log('./' + process.execPath.split('/').pop() + ' -update');
120
- console.log('./' + process.execPath.split('/').pop() + ' -uninstall');
119
+ else {
120
+ if (!require('message-box').kdialog && ((require('message-box').zenity == null) || (!require('message-box').zenity.extra))) {
121
+ console.log('\n' + "The graphical version of this installer cannot run on this system.");
122
+ console.log("Try installing/updating Zenity, and run again." + '\n');
123
+ console.log("You can also run the text version from the command line with the following command(s): ");
124
+ if ((msh.InstallFlags & 1) == 1) {
125
+ console.log('./' + process.execPath.split('/').pop() + ' -connect');
126
}
122
- else {
123
- console.log('./' + process.execPath.split('/').pop() + ' -install');
124
- console.log('./' + process.execPath.split('/').pop() + ' -install --installPath="/alternate/path"');
127
+ if ((msh.InstallFlags & 2) == 2) {
128
+ if (s) {
129
+ console.log('./' + process.execPath.split('/').pop() + ' -update');
130
+ console.log('./' + process.execPath.split('/').pop() + ' -uninstall');
131
+ }
132
+ else {
133
+ console.log('./' + process.execPath.split('/').pop() + ' -install');
134
+ console.log('./' + process.execPath.split('/').pop() + ' -install --installPath="/alternate/path"');
135
+ }
136
}
137
+ console.log('');
138
+ process.exit();
139
}
127
- console.log('');
128
- process.exit();
140
}
141
}
131
-}
132
-else {
133
- if (!require('user-sessions').isRoot()) { console.log('\n' + "This utility requires elevated permissions. Please try again with sudo."); process.exit(); }
142
+ else {
143
+ if (!require('user-sessions').isRoot()) { console.log('\n' + "This utility requires elevated permissions. Please try again with sudo."); process.exit(); }
144
+ }
145
}
146
147
views/default.handlebars
+4
-3
@@ -4170,8 +4170,9 @@
4170
if (serverinfo.https == true) { portStr = (serverinfo.port == 443)?'':(':' + serverinfo.port); } else { portStr = (serverinfo.port == 80) ? '' : (':' + serverinfo.port); }
4171
4172
// Add Linux/macOS binary installer option
4173
- var binaryInstallAgents = { 6 : 'Linux x86-64', 5 : 'Linux x86-32', 16 : 'Apple OSX x86-64', 25 : 'Linux ARM-HF, Rasberry Pi', 26 : 'Linux ARM64-HF', 28: 'Linux MIPS24KC (OpenWRT)', 30 : 'FreeBSD x86-64' };
4174
- for (var i in binaryInstallAgents) { moreoptions += '<option value=' + i + '>' + binaryInstallAgents[i] + '</option>' }
4173
+ var binaryInstallAgentsOrder = [ 6, 5 ,16 ,25 ,26 ,28 ,30 ];
4174
+ var binaryInstallAgents = { 5 : 'Linux x86-32', 6 : 'Linux x86-64', 16 : 'Apple OSX x86-64', 25 : 'Linux ARM-HF, Rasberry Pi', 26 : 'Linux ARM64-HF', 28: 'Linux MIPS24KC (OpenWRT)', 30 : 'FreeBSD x86-64' };
4175
+ for (var i in binaryInstallAgentsOrder) { moreoptions += '<option value=' + binaryInstallAgentsOrder[i] + '>' + binaryInstallAgents[binaryInstallAgentsOrder[i]] + '</option>' }
4176
x += '<div id=aginsSysTypeDiv>';
4177
x += addHtmlValue("System Type", '<select id=aginsSysType onchange=addAgentToMeshClick() style=width:236px>' + moreoptions + '</select>');
4178
x += '</div>';
@@ -4216,7 +4217,7 @@
4217
// Linux binary installer
4218
x += '<div id=agins_linux_inst style=display:none>' + "This is a executable on OS's with graphical user interfaces. You need to 'chmod +x meshagent' and run this file." + '<br /><br />';
4219
x += addHtmlValue("Mesh Agent", '<a id=aginsbinlnk href="meshagents?id=' + meshid.split('/')[2] + '&installflags=0' + (urlargs.key?('&key=' + urlargs.key):'') + '" download onclick="setDialogMode(0)">' + "meshagent" + '</a> <img src=images/link4.png height=10 width=10 title="' + "Copy agent URL to clipboard" + '" style=cursor:pointer onclick=copyAgentUrl("meshagents?id=' + meshid.split('/')[2] + '&installflags=",1)>');
4219
- x += addHtmlValue("Command", '<input id=aginsbincmd type=text style="width:216px" readonly value=\'wget -O meshagent' + (((features & 0x80000000) != 0)?' --no-check-certificate':'') + ' \"https://' + servername + portStr + domainUrl + 'meshagents?id=' + meshid.split('/')[2] + '\' /> <img src=images/link4.png height=10 width=10 title="' + "Copy agent URL to clipboard" + '" style=cursor:pointer onclick=copyAgentIdValue("aginsbincmd")>');
4220
+ x += addHtmlValue("Command", '<input id=aginsbincmd type=text style="width:216px" readonly value=\'wget -O meshagent' + (((features & 0x80000000) != 0)?' --no-check-certificate':'') + ' \"https://' + servername + portStr + domainUrl + 'meshagents?id=' + meshid.split('/')[2].split('$').join('%24').split('@').join('%40') + '\' /> <img src=images/link4.png height=10 width=10 title="' + "Copy agent URL to clipboard" + '" style=cursor:pointer onclick=copyAgentIdValue("aginsbincmd")>');
4221
x += '</div>';
4222
4223
setDialogMode(2, "Add Mesh Agent", 2, null, x, 'fileDownload');