1
0
Fork 0
mirror of https://github.com/Ylianst/MeshCentral.git synced 2025-03-09 15:40:18 +00:00

1. Updated uninstall script to uninstall diagnostic agent if present

2. Updated handlebars, so that the download command will retry without proxy if proxy fails
This commit is contained in:
Bryan Roe 2019-04-23 15:12:04 -07:00
parent 2591e6db48
commit f421b8fd22
2 changed files with 37 additions and 9 deletions

View file

@ -2673,15 +2673,35 @@
var servername = serverinfo.name;
if ((servername.indexOf('.') == -1) || ((features & 2) != 0)) { servername = window.location.hostname; } // If the server name is not set or it's in LAN-only mode, use the URL hostname as server name.
var noProxy = ((features & 0x2000) != 0)?'--no-proxy ':''; // Server asked that agent be installed to preferably not use a HTTP proxy.
if (serverinfo.https == true) {
if (serverinfo.https == true)
{
var portStr = (serverinfo.port == 443)?'':(":" + serverinfo.port);
Q('agins_linux_area').value = "wget https://" + servername + portStr + "/meshagents?script=1 " + noProxy + "--no-check-certificate -O ./meshinstall.sh && chmod 755 ./meshinstall.sh && sudo ./meshinstall.sh https://" + servername + portStr + " '" + meshid.split('/')[2] + "'\r\n";
Q('agins_linux_area_un').value = "wget https://" + servername + portStr + "/meshagents?script=1 " + noProxy + "--no-check-certificate -O ./meshinstall.sh && chmod 755 ./meshinstall.sh && sudo ./meshinstall.sh uninstall\r\n";
} else {
var portStr = (serverinfo.port == 80)?'':(":" + serverinfo.port);
Q('agins_linux_area').value = "wget http://" + servername + portStr + "/meshagents?script=1 " + noProxy + "-O ./meshinstall.sh && chmod 755 ./meshinstall.sh && sudo ./meshinstall.sh http://" + servername + portStr + " '" + meshid.split('/')[2] + "'\r\n";
Q('agins_linux_area_un').value = "wget http://" + servername + portStr + "/meshagents?script=1 " + noProxy + "-O ./meshinstall.sh && chmod 755 ./meshinstall.sh && sudo ./meshinstall.sh uninstall\r\n";
if ((features & 0x2000) == 0)
{
Q('agins_linux_area').value = "(wget https://" + servername + portStr + "/meshagents?script=1 --no-check-certificate -O ./meshinstall.sh || wget https://" + servername + portStr + "/meshagents?script=1 --no-proxy --no-check-certificate -O ./meshinstall.sh) && chmod 755 ./meshinstall.sh && sudo ./meshinstall.sh https://" + servername + portStr + " '" + meshid.split('/')[2] + "'\r\n";
Q('agins_linux_area_un').value = "(wget https://" + servername + portStr + "/meshagents?script=1 --no-check-certificate -O ./meshinstall.sh || wget https://" + servername + portStr + "/meshagents?script=1 --no-proxy --no-check-certificate -O ./meshinstall.sh) && chmod 755 ./meshinstall.sh && sudo ./meshinstall.sh uninstall\r\n";
}
else
{
// Server asked that agent be installed to preferably not use a HTTP proxy.
Q('agins_linux_area').value = "wget https://" + servername + portStr + "/meshagents?script=1 --no-proxy --no-check-certificate -O ./meshinstall.sh && chmod 755 ./meshinstall.sh && sudo ./meshinstall.sh https://" + servername + portStr + " '" + meshid.split('/')[2] + "'\r\n";
Q('agins_linux_area_un').value = "wget https://" + servername + portStr + "/meshagents?script=1 --no-proxy --no-check-certificate -O ./meshinstall.sh && chmod 755 ./meshinstall.sh && sudo ./meshinstall.sh uninstall\r\n";
}
}
else
{
var portStr = (serverinfo.port == 80) ? '' : (":" + serverinfo.port);
if ((features & 0x2000) == 0)
{
Q('agins_linux_area').value = "(wget http://" + servername + portStr + "/meshagents?script=1 -O ./meshinstall.sh || wget http://" + servername + portStr + "/meshagents?script=1 --no-proxy -O ./meshinstall.sh) && chmod 755 ./meshinstall.sh && sudo ./meshinstall.sh http://" + servername + portStr + " '" + meshid.split('/')[2] + "'\r\n";
Q('agins_linux_area_un').value = "(wget http://" + servername + portStr + "/meshagents?script=1 -O ./meshinstall.sh || wget http://" + servername + portStr + "/meshagents?script=1 --no-proxy -O ./meshinstall.sh) && chmod 755 ./meshinstall.sh && sudo ./meshinstall.sh uninstall\r\n";
}
else
{
// Server asked that agent be installed to preferably not use a HTTP proxy.
Q('agins_linux_area').value = "wget http://" + servername + portStr + "/meshagents?script=1 --no-proxy -O ./meshinstall.sh && chmod 755 ./meshinstall.sh && sudo ./meshinstall.sh http://" + servername + portStr + " '" + meshid.split('/')[2] + "'\r\n";
Q('agins_linux_area_un').value = "wget http://" + servername + portStr + "/meshagents?script=1 --no-proxy -O ./meshinstall.sh && chmod 755 ./meshinstall.sh && sudo ./meshinstall.sh uninstall\r\n";
}
}
Q('aginsSelect').focus();
addAgentToMeshClick();