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

@ -182,21 +182,27 @@ UninstallAgent() {
if [ $starttype -eq 1 ] if [ $starttype -eq 1 ]
then then
# systemd # systemd
rm -f /sbin/meshcmd /lib/systemd/system/meshagent.service
systemctl disable meshagent systemctl disable meshagent
systemctl stop meshagent systemctl stop meshagent
rm -f /sbin/meshcmd /lib/systemd/system/meshagent.service
systemctl stop meshagentDiagnostic &> /dev/null
rm -f /lib/systemd/system/meshagentDiagnostic.service &> /dev/null
else else
if [ $starttype -eq 3 ]; then if [ $starttype -eq 3 ]; then
# initd # initd
service meshagent stop service meshagent stop
update-rc.d -f meshagent remove update-rc.d -f meshagent remove
rm -f /sbin/meshcmd /etc/init.d/meshagent rm -f /sbin/meshcmd /etc/init.d/meshagent
service meshagentDiagnostic stop &> /dev/null
rm -f /etc/init.d/meshagentDiagnostic &> /dev/null
elif [ $starttype -eq 2 ]; then elif [ $starttype -eq 2 ]; then
# upstart # upstart
initctl stop meshagent initctl stop meshagent
rm -f /sbin/meshcmd rm -f /sbin/meshcmd
rm -f /etc/init/meshagent.conf rm -f /etc/init/meshagent.conf
rm -f /etc/rc2.d/S20mesh /etc/rc3.d/S20mesh /etc/rc5.d/S20mesh rm -f /etc/rc2.d/S20mesh /etc/rc3.d/S20mesh /etc/rc5.d/S20mesh
initctl stop meshagentDiagnostic &> /dev/null
rm -f /etc/init/meshagentDiagnostic.conf &> /dev/null
fi fi
fi fi
@ -205,6 +211,8 @@ UninstallAgent() {
rm -rf $installpath/* rm -rf $installpath/*
rmdir $installpath rmdir $installpath
fi fi
rm -rf /usr/local/mesh_services/meshagentDiagnostic &> /dev/null
rm -f /etc/cron.d/meshagentDiagnostic_periodicStart &> /dev/null
echo "Agent uninstalled." echo "Agent uninstalled."
} }

View File

@ -2673,15 +2673,35 @@
var servername = serverinfo.name; 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. 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); 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"; if ((features & 0x2000) == 0)
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 { 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); 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"; if ((features & 0x2000) == 0)
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"; {
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(); Q('aginsSelect').focus();
addAgentToMeshClick(); addAgentToMeshClick();