more Linux install script fixes.
This commit is contained in:
parent
67eb89143d
commit
9319e6ed43
|
@ -80,8 +80,3 @@ case "$1" in
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
exit 0
|
exit 0
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -3,13 +3,13 @@
|
||||||
CheckStartupType() {
|
CheckStartupType() {
|
||||||
# echo "Checking process autostart system..."
|
# echo "Checking process autostart system..."
|
||||||
starttype=`ps -p 1 | awk '/1/ {print $4}'`
|
starttype=`ps -p 1 | awk '/1/ {print $4}'`
|
||||||
# 1 is Systemd;
|
# Systemd
|
||||||
if [[ $starttype == 'systemd' ]]; then return 1;
|
if [[ $starttype == 'systemd' ]]; then return 1;
|
||||||
elif [[ $starttype == 'init' ]];
|
elif [[ $starttype == 'init' ]];
|
||||||
then
|
then
|
||||||
# 2 is Upstart
|
# Upstart
|
||||||
if [[ `/sbin/init --version` =~ upstart ]]; then return 2;
|
if [[ `/sbin/init --version` =~ upstart ]]; then return 2;
|
||||||
# 3 is Sysv-init
|
# Sysv-init
|
||||||
return 3;
|
return 3;
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
@ -92,13 +92,13 @@ DownloadAgent() {
|
||||||
mkdir -p /usr/local/mesh
|
mkdir -p /usr/local/mesh
|
||||||
cd /usr/local/mesh
|
cd /usr/local/mesh
|
||||||
echo "Downloading Mesh agent #$machineid..."
|
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 it did not work, try again using http
|
||||||
if [ $? != 0 ]
|
if [ $? != 0 ]
|
||||||
then
|
then
|
||||||
url=${url/"https://"/"http://"}
|
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
|
fi
|
||||||
|
|
||||||
if [ $? -eq 0 ]
|
if [ $? -eq 0 ]
|
||||||
|
@ -106,12 +106,12 @@ DownloadAgent() {
|
||||||
echo "Mesh agent downloaded."
|
echo "Mesh agent downloaded."
|
||||||
# TODO: We could check the meshagent sha256 hash, but best to authenticate the server.
|
# TODO: We could check the meshagent sha256 hash, but best to authenticate the server.
|
||||||
chmod 755 /usr/local/mesh/meshagent
|
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 it did not work, try again using http
|
||||||
if [ $? -ne 0 ]
|
if [ $? -ne 0 ]
|
||||||
then
|
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
|
fi
|
||||||
|
|
||||||
if [ $? -eq 0 ]
|
if [ $? -eq 0 ]
|
||||||
|
@ -140,7 +140,7 @@ DownloadAgent() {
|
||||||
elif [ $starttype -eq 3 ]
|
elif [ $starttype -eq 3 ]
|
||||||
then
|
then
|
||||||
# initd
|
# 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
|
chmod +x /etc/init.d/meshagent
|
||||||
# creates symlinks for rc.d
|
# creates symlinks for rc.d
|
||||||
update-rc.d meshagent defaults
|
update-rc.d meshagent defaults
|
||||||
|
@ -196,6 +196,7 @@ UninstallAgent() {
|
||||||
service meshagent stop
|
service meshagent stop
|
||||||
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
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
|
@ -1275,8 +1275,8 @@ function CreateMeshCentralServer(config, args) {
|
||||||
|
|
||||||
// List of possible mesh agent install scripts
|
// List of possible mesh agent install scripts
|
||||||
var meshAgentsInstallScriptList = {
|
var meshAgentsInstallScriptList = {
|
||||||
1: { id: 1, localname: 'meshinstall-linux.sh', rname: 'meshinstall.sh' },
|
1: { id: 1, localname: 'meshinstall-linux.sh', rname: 'meshinstall.sh', linux: true },
|
||||||
2: { id: 2, localname: 'meshinstall-initd.sh', rname: 'meshagent' }
|
2: { id: 2, localname: 'meshinstall-initd.sh', rname: 'meshagent', linux: true }
|
||||||
};
|
};
|
||||||
|
|
||||||
// Update the list of available mesh agents
|
// Update the list of available mesh agents
|
||||||
|
@ -1302,6 +1302,9 @@ function CreateMeshCentralServer(config, args) {
|
||||||
var stats = null;
|
var stats = null;
|
||||||
try { stats = obj.fs.statSync(this.agentpath); } catch (e) { }
|
try { stats = obj.fs.statSync(this.agentpath); } catch (e) { }
|
||||||
if (stats != null) { obj.meshAgentInstallScripts[this.info.id].size = stats.size; }
|
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.info = meshAgentsInstallScriptList[scriptid];
|
||||||
stream.agentpath = scriptpath;
|
stream.agentpath = scriptpath;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "meshcentral",
|
"name": "meshcentral",
|
||||||
"version": "0.2.9-m",
|
"version": "0.2.9-n",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"Remote Management",
|
"Remote Management",
|
||||||
"Intel AMT",
|
"Intel AMT",
|
||||||
|
|
Loading…
Reference in New Issue