From 7271f85e6d4a9a760f2a393fc8b09fbe8aede631 Mon Sep 17 00:00:00 2001 From: Bryan Roe Date: Mon, 21 Oct 2019 16:59:07 -0700 Subject: [PATCH 1/2] Updated Linux install script, to retry without SUDO if SUDO fails --- views/default.handlebars | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/views/default.handlebars b/views/default.handlebars index 628e31bb..069e062c 100644 --- a/views/default.handlebars +++ b/views/default.handlebars @@ -3202,13 +3202,13 @@ var portStr = (serverinfo.port == 443)?'':(':' + serverinfo.port); if ((features & 0x2000) == 0) { - Q('agins_linux_area').value = '(wget https://' + servername + portStr + domainUrl + 'meshagents?script=1 --no-check-certificate -O ./meshinstall.sh || wget https://' + servername + portStr + domainUrl + 'meshagents?script=1 --no-proxy --no-check-certificate -O ./meshinstall.sh) && chmod 755 ./meshinstall.sh && sudo -E ./meshinstall.sh https://' + servername + portStr + domainUrlNoSlash + ' \'' + meshid.split('/')[2] + '\'\r\n'; + Q('agins_linux_area').value = '(wget https://' + servername + portStr + domainUrl + 'meshagents?script=1 --no-check-certificate -O ./meshinstall.sh || wget https://' + servername + portStr + domainUrl + 'meshagents?script=1 --no-proxy --no-check-certificate -O ./meshinstall.sh) && chmod 755 ./meshinstall.sh && sudo -E ./meshinstall.sh https://' + servername + portStr + domainUrlNoSlash + ' \'' + meshid.split('/')[2] + '\' || ./meshinstall.sh https://' + servername + portStr + domainUrlNoSlash + ' \'' + meshid.split('/')[2] + '\'\r\n'; Q('agins_linux_area_un').value = '(wget https://' + servername + portStr + domainUrl + 'meshagents?script=1 --no-check-certificate -O ./meshinstall.sh || wget https://' + servername + portStr + domainUrl + '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 + domainUrl + 'meshagents?script=1 --no-proxy --no-check-certificate -O ./meshinstall.sh && chmod 755 ./meshinstall.sh && sudo ./meshinstall.sh https://' + servername + portStr + domainUrlNoSlash + ' \'' + meshid.split('/')[2] + '\'\r\n'; + Q('agins_linux_area').value = 'wget https://' + servername + portStr + domainUrl + 'meshagents?script=1 --no-proxy --no-check-certificate -O ./meshinstall.sh && chmod 755 ./meshinstall.sh && sudo ./meshinstall.sh https://' + servername + portStr + domainUrlNoSlash + ' \'' + meshid.split('/')[2] + '\' || ./meshinstall.sh https://' + servername + portStr + domainUrlNoSlash + ' \'' + meshid.split('/')[2] + '\'\r\n'; Q('agins_linux_area_un').value = 'wget https://' + servername + portStr + domainUrl + 'meshagents?script=1 --no-proxy --no-check-certificate -O ./meshinstall.sh && chmod 755 ./meshinstall.sh && sudo ./meshinstall.sh uninstall\r\n'; } } From 856fb7400bf4d32839f8d19bd96a34c2d6e17757 Mon Sep 17 00:00:00 2001 From: Bryan Roe Date: Mon, 21 Oct 2019 16:59:35 -0700 Subject: [PATCH 2/2] Added Pseudo Service Support --- agents/meshinstall-linux.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/agents/meshinstall-linux.sh b/agents/meshinstall-linux.sh index 8d9b79f4..033ab750 100644 --- a/agents/meshinstall-linux.sh +++ b/agents/meshinstall-linux.sh @@ -202,7 +202,11 @@ DownloadAgent() { else # unknown echo "Unknown Service Platform Type. (ie: init, systemd, etc)" - echo "Unable to install meshagent as service." + echo "Installing as Pseudo Service (Mesh Daemon)" + /usr/local/mesh/meshagent -exec "require('service-manager').manager.installService({name: 'meshagent', servicePath: process.execPath, files: ['/usr/local/mesh/meshagent.msh']});process.exit();" + /usr/local/mesh_daemons/daemon start meshagent + echo 'To start service: /usr/local/mesh_daemons/daemon start meshagent' + echo 'To stop service: /usr/local/mesh_daemons/daemon stop meshagent' fi echo "Mesh agent started." else