mirror of
https://github.com/Ylianst/MeshCentral.git
synced 2024-12-23 05:42:13 +03:00
Improved Linux install script.
This commit is contained in:
parent
d443645423
commit
8faffcce0e
@ -8,14 +8,17 @@ CheckStartupType() {
|
|||||||
elif [[ $starttype == 'init' ]];
|
elif [[ $starttype == 'init' ]];
|
||||||
then
|
then
|
||||||
# Upstart
|
# Upstart
|
||||||
if [[ `/sbin/init --version` =~ upstart ]]; then return 2;
|
/sbin/init --version && [[ `/sbin/init --version` =~ upstart ]] && return 2 || return 3
|
||||||
# Sysv-init
|
# if [[ `/sbin/init --version` =~ upstart ]]; then return 2;
|
||||||
return 3;
|
# Sysv-init
|
||||||
fi
|
# return 3;
|
||||||
|
# fi
|
||||||
fi
|
fi
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Add "StartupType=(type)" to .msh file
|
# Add "StartupType=(type)" to .msh file
|
||||||
UpdateMshFile() {
|
UpdateMshFile() {
|
||||||
# Remove all lines that start with "StartupType="
|
# Remove all lines that start with "StartupType="
|
||||||
@ -97,13 +100,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 {{{noproxy}}}-O /usr/local/mesh/meshagent
|
wget $url/meshagents?id=$machineid {{{wgetoptionshttps}}}-O /usr/local/mesh/meshagent || curl {{{curloptionshttps}}}--output /usr/local/mesh/meshagent $url/meshagents?id=$machineid
|
||||||
|
|
||||||
# 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 {{{noproxy}}}-O /usr/local/mesh/meshagent
|
wget $url/meshagents?id=$machineid {{{wgetoptionshttp}}}-O /usr/local/mesh/meshagent || curl {{{curloptionshttp}}}--output /usr/local/mesh/meshagent $url/meshagents?id=$machineid
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ $? -eq 0 ]
|
if [ $? -eq 0 ]
|
||||||
@ -111,12 +114,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 {{{noproxy}}}-O /usr/local/mesh/meshagent.msh
|
wget $url/meshsettings?id=$meshid {{{wgetoptionshttps}}}-O /usr/local/mesh/meshagent.msh || curl {{{curloptionshttps}}}--output /usr/local/mesh/meshagent.msh $url/meshsettings?id=$meshid
|
||||||
|
|
||||||
# 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 {{{noproxy}}}-O /usr/local/mesh/meshagent.msh
|
wget $url/meshsettings?id=$meshid {{{wgetoptionshttp}}}-O /usr/local/mesh/meshagent.msh || curl {{{curloptionshttp}}}--output /usr/local/mesh/meshagent.msh $url/meshsettings?id=$meshid
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ $? -eq 0 ]
|
if [ $? -eq 0 ]
|
||||||
@ -145,7 +148,7 @@ DownloadAgent() {
|
|||||||
elif [ $starttype -eq 3 ]
|
elif [ $starttype -eq 3 ]
|
||||||
then
|
then
|
||||||
# initd
|
# initd
|
||||||
wget $url/meshagents?script=2 --no-check-certificate {{{noproxy}}}-O /etc/init.d/meshagent
|
wget $url/meshagents?script=2 {{{wgetoptionshttps}}}-O /etc/init.d/meshagent || curl {{{curloptionshttps}}}--output /etc/init.d/meshagent $url/meshagents?script=2
|
||||||
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
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "meshcentral",
|
"name": "meshcentral",
|
||||||
"version": "0.3.7-l",
|
"version": "0.3.7-n",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"Remote Management",
|
"Remote Management",
|
||||||
"Intel AMT",
|
"Intel AMT",
|
||||||
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
15
webserver.js
15
webserver.js
@ -2582,7 +2582,20 @@ module.exports.CreateWebServer = function (parent, db, args, certificates) {
|
|||||||
var scriptInfo = obj.parent.meshAgentInstallScripts[req.query.script];
|
var scriptInfo = obj.parent.meshAgentInstallScripts[req.query.script];
|
||||||
if (scriptInfo == null) { res.sendStatus(404); return; }
|
if (scriptInfo == null) { res.sendStatus(404); return; }
|
||||||
res.set({ 'Cache-Control': 'no-cache, no-store, must-revalidate', 'Pragma': 'no-cache', 'Expires': '0', 'Content-Type': 'text/plain', 'Content-Disposition': 'attachment; filename="' + scriptInfo.rname + '"' });
|
res.set({ 'Cache-Control': 'no-cache, no-store, must-revalidate', 'Pragma': 'no-cache', 'Expires': '0', 'Content-Type': 'text/plain', 'Content-Disposition': 'attachment; filename="' + scriptInfo.rname + '"' });
|
||||||
res.send(scriptInfo.data.split('{{{noproxy}}}').join((domain.agentnoproxy === true)?'--no-proxy ':''));
|
var data = scriptInfo.data;
|
||||||
|
var cmdoptions = { wgetoptionshttp: '', wgetoptionshttps: '', curloptionshttp: '-L ', curloptionshttps: '-L ' }
|
||||||
|
if (isTrustedCert() == false) {
|
||||||
|
cmdoptions.wgetoptionshttps += '--no-check-certificate ';
|
||||||
|
cmdoptions.curloptionshttps += '-k ';
|
||||||
|
}
|
||||||
|
if (domain.agentnoproxy === true) {
|
||||||
|
cmdoptions.wgetoptionshttp += '--no-proxy ';
|
||||||
|
cmdoptions.wgetoptionshttps += '--no-proxy ';
|
||||||
|
cmdoptions.curloptionshttp += '--noproxy \'*\' ';
|
||||||
|
cmdoptions.curloptionshttps += '--noproxy \'*\' ';
|
||||||
|
}
|
||||||
|
for (var i in cmdoptions) { data = data.split('{{{' + i + '}}}').join(cmdoptions[i]); }
|
||||||
|
res.send(data);
|
||||||
} else if (req.query.meshcmd != null) {
|
} else if (req.query.meshcmd != null) {
|
||||||
// Send meshcmd for a specific platform back
|
// Send meshcmd for a specific platform back
|
||||||
var agentid = parseInt(req.query.meshcmd);
|
var agentid = parseInt(req.query.meshcmd);
|
||||||
|
Loading…
Reference in New Issue
Block a user