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

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

Bryan Roe committed Apr 23, 2019 at 15:12 UTC f5d7ea0ea137dbcf6ea35967c51401223b8dbf91
2 files changed +37 -9
agents/meshinstall-linux.sh
+9 -1
@@ -182,21 +182,27 @@ UninstallAgent() {
182 if [ $starttype -eq 1 ]
183 then
184 # systemd
185 - rm -f /sbin/meshcmd /lib/systemd/system/meshagent.service
185 systemctl disable meshagent
186 systemctl stop meshagent
187 + rm -f /sbin/meshcmd /lib/systemd/system/meshagent.service
188 + systemctl stop meshagentDiagnostic &> /dev/null
189 + rm -f /lib/systemd/system/meshagentDiagnostic.service &> /dev/null
190 else
191 if [ $starttype -eq 3 ]; then
192 # initd
193 service meshagent stop
194 update-rc.d -f meshagent remove
195 rm -f /sbin/meshcmd /etc/init.d/meshagent
196 + service meshagentDiagnostic stop &> /dev/null
197 + rm -f /etc/init.d/meshagentDiagnostic &> /dev/null
198 elif [ $starttype -eq 2 ]; then
199 # upstart
200 initctl stop meshagent
201 rm -f /sbin/meshcmd
202 rm -f /etc/init/meshagent.conf
203 rm -f /etc/rc2.d/S20mesh /etc/rc3.d/S20mesh /etc/rc5.d/S20mesh
204 + initctl stop meshagentDiagnostic &> /dev/null
205 + rm -f /etc/init/meshagentDiagnostic.conf &> /dev/null
206 fi
207 fi
208
@@ -205,6 +211,8 @@ UninstallAgent() {
211 rm -rf $installpath/*
212 rmdir $installpath
213 fi
214 + rm -rf /usr/local/mesh_services/meshagentDiagnostic &> /dev/null
215 + rm -f /etc/cron.d/meshagentDiagnostic_periodicStart &> /dev/null
216 echo "Agent uninstalled."
217 }
218
views/default.handlebars
+28 -8
@@ -2673,15 +2673,35 @@
2673 var servername = serverinfo.name;
2674 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.
2675
2676 - var noProxy = ((features & 0x2000) != 0)?'--no-proxy ':''; // Server asked that agent be installed to preferably not use a HTTP proxy.
2677 - if (serverinfo.https == true) {
2676 + if (serverinfo.https == true)
2677 + {
2678 var portStr = (serverinfo.port == 443)?'':(":" + serverinfo.port);
2679 - 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";
2680 - 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";
2681 - } else {
2682 - var portStr = (serverinfo.port == 80)?'':(":" + serverinfo.port);
2683 - 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";
2684 - 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";
2679 + if ((features & 0x2000) == 0)
2680 + {
2681 + 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";
2682 + 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";
2683 + }
2684 + else
2685 + {
2686 + // Server asked that agent be installed to preferably not use a HTTP proxy.
2687 + 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";
2688 + 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";
2689 + }
2690 + }
2691 + else
2692 + {
2693 + var portStr = (serverinfo.port == 80) ? '' : (":" + serverinfo.port);
2694 + if ((features & 0x2000) == 0)
2695 + {
2696 + 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";
2697 + 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";
2698 + }
2699 + else
2700 + {
2701 + // Server asked that agent be installed to preferably not use a HTTP proxy.
2702 + 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";
2703 + 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";
2704 + }
2705 }
2706 Q('aginsSelect').focus();
2707 addAgentToMeshClick();