more Linux install script fixes.

This commit is contained in:
Ylian Saint-Hilaire 2019-03-01 18:07:38 -08:00
parent 67eb89143d
commit 9319e6ed43
4 changed files with 90 additions and 91 deletions

View File

@ -80,8 +80,3 @@ case "$1" in
;;
esac
exit 0

View File

@ -3,13 +3,13 @@
CheckStartupType() {
# echo "Checking process autostart system..."
starttype=`ps -p 1 | awk '/1/ {print $4}'`
# 1 is Systemd;
# Systemd
if [[ $starttype == 'systemd' ]]; then return 1;
elif [[ $starttype == 'init' ]];
then
# 2 is Upstart
# Upstart
if [[ `/sbin/init --version` =~ upstart ]]; then return 2;
# 3 is Sysv-init
# Sysv-init
return 3;
fi
fi
@ -92,13 +92,13 @@ DownloadAgent() {
mkdir -p /usr/local/mesh
cd /usr/local/mesh
echo "Downloading Mesh agent #$machineid..."
wget $url/meshagents?id=$machineid --no-check-certificate -O /usr/local/mesh/meshagent
wget $url/meshagents?id=$machineid --no-check-certificate {{{noproxy}}}-O /usr/local/mesh/meshagent
# If it did not work, try again using http
if [ $? != 0 ]
then
url=${url/"https://"/"http://"}
wget $url/meshagents?id=$machineid -O /usr/local/mesh/meshagent
wget $url/meshagents?id=$machineid {{{noproxy}}}-O /usr/local/mesh/meshagent
fi
if [ $? -eq 0 ]
@ -106,12 +106,12 @@ DownloadAgent() {
echo "Mesh agent downloaded."
# TODO: We could check the meshagent sha256 hash, but best to authenticate the server.
chmod 755 /usr/local/mesh/meshagent
wget $url/meshsettings?id=$meshid --no-check-certificate -O /usr/local/mesh/meshagent.msh
wget $url/meshsettings?id=$meshid --no-check-certificate {{{noproxy}}}-O /usr/local/mesh/meshagent.msh
# If it did not work, try again using http
if [ $? -ne 0 ]
then
wget $url/meshsettings?id=$meshid -O /usr/local/mesh/meshagent.msh
wget $url/meshsettings?id=$meshid {{{noproxy}}}-O /usr/local/mesh/meshagent.msh
fi
if [ $? -eq 0 ]
@ -140,7 +140,7 @@ DownloadAgent() {
elif [ $starttype -eq 3 ]
then
# initd
wget $url/meshagents?script=2 --no-check-certificate -O /etc/init.d/meshagent
wget $url/meshagents?script=2 --no-check-certificate {{{noproxy}}}-O /etc/init.d/meshagent
chmod +x /etc/init.d/meshagent
# creates symlinks for rc.d
update-rc.d meshagent defaults
@ -196,6 +196,7 @@ UninstallAgent() {
service meshagent stop
rm -f /sbin/meshcmd
rm -f /etc/init/meshagent.conf
rm -f /etc/rc2.d/S20mesh /etc/rc3.d/S20mesh /etc/rc5.d/S20mesh
fi
fi

View File

@ -1275,8 +1275,8 @@ function CreateMeshCentralServer(config, args) {
// List of possible mesh agent install scripts
var meshAgentsInstallScriptList = {
1: { id: 1, localname: 'meshinstall-linux.sh', rname: 'meshinstall.sh' },
2: { id: 2, localname: 'meshinstall-initd.sh', rname: 'meshagent' }
1: { id: 1, localname: 'meshinstall-linux.sh', rname: 'meshinstall.sh', linux: true },
2: { id: 2, localname: 'meshinstall-initd.sh', rname: 'meshagent', linux: true }
};
// Update the list of available mesh agents
@ -1302,6 +1302,9 @@ function CreateMeshCentralServer(config, args) {
var stats = null;
try { stats = obj.fs.statSync(this.agentpath); } catch (e) { }
if (stats != null) { obj.meshAgentInstallScripts[this.info.id].size = stats.size; }
// Place Unit line breaks on Linux scripts if not already present.
if (obj.meshAgentInstallScripts[this.info.id].linux === true) { obj.meshAgentInstallScripts[this.info.id].data = obj.meshAgentInstallScripts[this.info.id].data.split('\r\n').join('\n') }
});
stream.info = meshAgentsInstallScriptList[scriptid];
stream.agentpath = scriptpath;

View File

@ -1,6 +1,6 @@
{
"name": "meshcentral",
"version": "0.2.9-m",
"version": "0.2.9-n",
"keywords": [
"Remote Management",
"Intel AMT",