mirror of
				https://github.com/Ylianst/MeshCentral.git
				synced 2025-03-09 15:40:18 +00:00 
			
		
		
		
	More Linux interactive installer improvements.
This commit is contained in:
		
							parent
							
								
									2cd930b2dc
								
							
						
					
					
						commit
						abe862153e
					
				
					 3 changed files with 57 additions and 44 deletions
				
			
		| 
						 | 
				
			
			@ -573,6 +573,7 @@
 | 
			
		|||
    <Content Include="views\login-mobile.handlebars" />
 | 
			
		||||
    <Content Include="views\login.handlebars" />
 | 
			
		||||
    <Content Include="views\message.handlebars" />
 | 
			
		||||
    <Content Include="views\message2.handlebars" />
 | 
			
		||||
    <Content Include="views\messenger.handlebars" />
 | 
			
		||||
    <Content Include="views\mstsc.handlebars" />
 | 
			
		||||
    <Content Include="views\player.handlebars" />
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -55,42 +55,14 @@ if (msh.InstallFlags == null) {
 | 
			
		|||
    msh.InstallFlags = parseInt(msh.InstallFlags.toString());
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
if ((msh.InstallFlags & 1) == 1) { buttons.unshift('Connect'); }
 | 
			
		||||
if ((msh.InstallFlags & 2) == 2) {
 | 
			
		||||
    if (!require('user-sessions').isRoot()) {
 | 
			
		||||
        console.log('\n' + "Elevated permissions is required to install/uninstall the agent.");
 | 
			
		||||
        console.log("Please try again with sudo.");
 | 
			
		||||
if (process.argv.includes('-mesh')) {
 | 
			
		||||
    console.log(JSON.stringify(msh, null, 2));
 | 
			
		||||
    process.exit();
 | 
			
		||||
    }
 | 
			
		||||
    if (s) {
 | 
			
		||||
        if (process.platform == 'darwin' || require('message-box').kdialog) {
 | 
			
		||||
            buttons.unshift("Setup");
 | 
			
		||||
        } else {
 | 
			
		||||
            buttons.unshift("Uninstall");
 | 
			
		||||
            buttons.unshift("Update");
 | 
			
		||||
        }
 | 
			
		||||
    } else {
 | 
			
		||||
        buttons.unshift("Install");
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
if (process.platform != 'darwin') {
 | 
			
		||||
    if (!require('message-box').kdialog && (require('message-box').zenity == null || (!require('message-box').zenity.extra))) {
 | 
			
		||||
        if (process.argv.includes('-install') || process.argv.includes('-update')) {
 | 
			
		||||
            var p = [];
 | 
			
		||||
            for (var i = 0; i < process.argv.length; ++i) {
 | 
			
		||||
                if (process.argv[i].startsWith('--installPath=')) {
 | 
			
		||||
                    p.push('--installPath="' + process.argv[i].split('=').pop() + '"');
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
            _install(p);
 | 
			
		||||
            process.exit();
 | 
			
		||||
        }
 | 
			
		||||
        else if (process.argv.includes('-uninstall')) {
 | 
			
		||||
            _uninstall();
 | 
			
		||||
            process.exit();
 | 
			
		||||
        }
 | 
			
		||||
        else if (process.argv.includes('-connect')) {
 | 
			
		||||
if ((msh.InstallFlags & 1) == 1) {
 | 
			
		||||
    buttons.unshift('Connect');
 | 
			
		||||
    if (process.argv.includes('-connect')) {
 | 
			
		||||
        global._child = require('child_process').execFile(process.execPath,
 | 
			
		||||
            [process.execPath.split('/').pop(), '--no-embedded=1', '--disableUpdate=1',
 | 
			
		||||
                '--MeshName="' + msh.MeshName + '"', '--MeshType="' + msh.MeshType + '"',
 | 
			
		||||
| 
						 | 
				
			
			@ -105,9 +77,47 @@ if (process.platform != 'darwin') {
 | 
			
		|||
 | 
			
		||||
        console.log("\nConnecting to: " + msh.MeshServer);
 | 
			
		||||
        console.log("Device Group: " + msh.MeshName);
 | 
			
		||||
            console.log('\nPress Ctrl-c to exit\n');
 | 
			
		||||
        console.log('\nPress Ctrl-C to exit\n');
 | 
			
		||||
        skip = true;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
if ((!skip) && ((msh.InstallFlags & 2) == 2)) {
 | 
			
		||||
    if (!require('user-sessions').isRoot()) {
 | 
			
		||||
        console.log('\n' + "Elevated permissions is required to install/uninstall the agent.");
 | 
			
		||||
        console.log("Please try again with sudo.");
 | 
			
		||||
        process.exit();
 | 
			
		||||
    }
 | 
			
		||||
    if (s) {
 | 
			
		||||
        if ((process.platform == 'darwin') || require('message-box').kdialog) {
 | 
			
		||||
            buttons.unshift("Setup");
 | 
			
		||||
        } else {
 | 
			
		||||
            buttons.unshift("Uninstall");
 | 
			
		||||
            buttons.unshift("Update");
 | 
			
		||||
        }
 | 
			
		||||
    } else {
 | 
			
		||||
        buttons.unshift("Install");
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
if (!skip) {
 | 
			
		||||
    if (process.platform != 'darwin') {
 | 
			
		||||
        if (process.argv.includes('-install') || process.argv.includes('-update')) {
 | 
			
		||||
            var p = [];
 | 
			
		||||
            for (var i = 0; i < process.argv.length; ++i) {
 | 
			
		||||
                if (process.argv[i].startsWith('--installPath=')) {
 | 
			
		||||
                    p.push('--installPath="' + process.argv[i].split('=').pop() + '"');
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
            _install(p);
 | 
			
		||||
            process.exit();
 | 
			
		||||
        }
 | 
			
		||||
        else if (process.argv.includes('-uninstall')) {
 | 
			
		||||
            _uninstall();
 | 
			
		||||
            process.exit();
 | 
			
		||||
        }
 | 
			
		||||
        else {
 | 
			
		||||
            if (!require('message-box').kdialog && ((require('message-box').zenity == null) || (!require('message-box').zenity.extra))) {
 | 
			
		||||
                console.log('\n' + "The graphical version of this installer cannot run on this system.");
 | 
			
		||||
                console.log("Try installing/updating Zenity, and run again." + '\n');
 | 
			
		||||
                console.log("You can also run the text version from the command line with the following command(s): ");
 | 
			
		||||
| 
						 | 
				
			
			@ -128,9 +138,10 @@ if (process.platform != 'darwin') {
 | 
			
		|||
                process.exit();
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
}
 | 
			
		||||
else {
 | 
			
		||||
    }
 | 
			
		||||
    else {
 | 
			
		||||
        if (!require('user-sessions').isRoot()) { console.log('\n' + "This utility requires elevated permissions. Please try again with sudo."); process.exit(); }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -4170,8 +4170,9 @@
 | 
			
		|||
            if (serverinfo.https == true) { portStr = (serverinfo.port == 443)?'':(':' + serverinfo.port); } else { portStr = (serverinfo.port == 80) ? '' : (':' + serverinfo.port); }
 | 
			
		||||
 | 
			
		||||
            // Add Linux/macOS binary installer option
 | 
			
		||||
            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' };
 | 
			
		||||
            for (var i in binaryInstallAgents) { moreoptions += '<option value=' + i + '>' + binaryInstallAgents[i] + '</option>' }
 | 
			
		||||
            var binaryInstallAgentsOrder = [ 6, 5 ,16 ,25 ,26 ,28 ,30 ];
 | 
			
		||||
            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' };
 | 
			
		||||
            for (var i in binaryInstallAgentsOrder) { moreoptions += '<option value=' + binaryInstallAgentsOrder[i] + '>' + binaryInstallAgents[binaryInstallAgentsOrder[i]] + '</option>' }
 | 
			
		||||
            x += '<div id=aginsSysTypeDiv>';
 | 
			
		||||
            x += addHtmlValue("System Type", '<select id=aginsSysType onchange=addAgentToMeshClick() style=width:236px>' + moreoptions + '</select>');
 | 
			
		||||
            x += '</div>';
 | 
			
		||||
| 
						 | 
				
			
			@ -4216,7 +4217,7 @@
 | 
			
		|||
            // Linux binary installer
 | 
			
		||||
            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 />';
 | 
			
		||||
            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)>');
 | 
			
		||||
            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")>');
 | 
			
		||||
            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")>');
 | 
			
		||||
            x += '</div>';
 | 
			
		||||
 | 
			
		||||
            setDialogMode(2, "Add Mesh Agent", 2, null, x, 'fileDownload');
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue