Added Linux ARM Linaro support, improved Linux install script.

This commit is contained in:
Ylian Saint-Hilaire 2018-11-08 15:42:02 -08:00
parent 046bc1e963
commit 00ebb38ca4
11 changed files with 54 additions and 29 deletions

Binary file not shown.

BIN
agents/meshagent_arm-linaro Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -1,7 +1,7 @@
#!/bin/bash #!/bin/bash
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}'`
if [[ $starttype == 'systemd' ]]; then return 1; # systemd; if [[ $starttype == 'systemd' ]]; then return 1; # systemd;
elif [[ $starttype == 'init' ]]; then return 3; # sysv-init; elif [[ $starttype == 'init' ]]; then return 3; # sysv-init;
@ -11,7 +11,7 @@ CheckStartupType() {
} }
CheckStartupTypeOld() { CheckStartupTypeOld() {
# echo "Checking process autostart system..." # echo "Checking process autostart system..."
if [[ `systemctl` =~ -\.mount ]]; then return 1; # systemd; if [[ `systemctl` =~ -\.mount ]]; then return 1; # systemd;
elif [[ `/sbin/init --version` =~ upstart ]]; then return 2; # upstart; elif [[ `/sbin/init --version` =~ upstart ]]; then return 2; # upstart;
elif [[ -f /etc/init.d/cron && ! -h /etc/init.d/cron ]]; then return 3; # sysv-init; elif [[ -f /etc/init.d/cron && ! -h /etc/init.d/cron ]]; then return 3; # sysv-init;
@ -29,45 +29,55 @@ UpdateMshFile() {
} }
CheckInstallAgent() { CheckInstallAgent() {
# echo "Checking mesh identifier..." # echo "Checking mesh identifier..."
if [ -e "/usr/local" ] if [ -e "/usr/local" ]
then then
installpath="/usr/local/mesh" installpath="/usr/local/mesh"
else else
installpath="/usr/mesh" installpath="/usr/mesh"
fi fi
if [ $# -eq 2 ] if [ $# -ge 2 ]
then then
url=$1 url=$1
meshid=$2 meshid=$2
meshidlen=${#meshid} meshidlen=${#meshid}
if [ $meshidlen -eq 64 ] if [ $meshidlen -eq 64 ]
then then
# echo "Detecting computer type..."
machinetype=$( uname -m )
machineid=0 machineid=0
machinetype=$( uname -m )
# If we have 3 arguments...
if [ $# -ge 3 ]
then
# echo "Computer type is specified..."
machineid=$3
else
# echo "Detecting computer type..."
if [ $machinetype == 'x86_64' ] || [ $machinetype == 'amd64' ] if [ $machinetype == 'x86_64' ] || [ $machinetype == 'amd64' ]
then then
# Linux x86, 64 bit # Linux x86, 64 bit
machineid=6 machineid=6
fi fi
if [ $machinetype == 'x86' ] || [ $machinetype == 'i686' ] if [ $machinetype == 'x86' ] || [ $machinetype == 'i686' ]
then then
# Linux x86, 32 bit # Linux x86, 32 bit
machineid=5 machineid=5
fi fi
if [ $machinetype == 'armv6l' ] || [ $machinetype == 'armv7l' ] if [ $machinetype == 'armv6l' ] || [ $machinetype == 'armv7l' ]
then then
# RaspberryPi 1 (armv6l) or RaspberryPi 2/3 (armv7l) # RaspberryPi 1 (armv6l) or RaspberryPi 2/3 (armv7l)
machineid=25 machineid=25
fi fi
# TODO: Add more machine types, detect KVM support, etc. # Add more machine types, detect KVM support... here.
fi
if [ $machineid -eq 0 ] if [ $machineid -eq 0 ]
then then
echo "Unsupported machine type: $machinetype, check with server administrator." echo "Unsupported machine type: $machinetype."
else else
DownloadAgent $url $meshid $machineid DownloadAgent $url $meshid $machineid
fi fi
else else
echo "MeshID is not correct, must be 64 characters long." echo "MeshID is not correct, must be 64 characters long."
fi fi
@ -81,17 +91,32 @@ DownloadAgent() {
url=$1 url=$1
meshid=$2 meshid=$2
machineid=$3 machineid=$3
# Create folder # Create folder
mkdir -p /usr/local/mesh mkdir -p /usr/local/mesh
cd /usr/local/mesh cd /usr/local/mesh
# echo "Downloading mesh agent..." echo "Downloading Mesh agent #$machineid..."
wget $url/meshagents?id=$machineid -q --no-check-certificate -O /usr/local/mesh/meshagent wget $url/meshagents?id=$machineid -q --no-check-certificate -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 -q -O /usr/local/mesh/meshagent
fi
if [ $? -eq 0 ] if [ $? -eq 0 ]
then then
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 -q --no-check-certificate -O /usr/local/mesh/meshagent.msh wget $url/meshsettings?id=$meshid -q --no-check-certificate -O /usr/local/mesh/meshagent.msh
# If it did not work, try again using http
if [ $? -eq 0 ]
then
wget $url/meshsettings?id=$meshid -q -O /usr/local/mesh/meshagent.msh
fi
if [ $? -eq 0 ] if [ $? -eq 0 ]
then then
UpdateMshFile UpdateMshFile
@ -177,7 +202,7 @@ if [ $currentuser == 'root' ]
then then
if [ $# -eq 0 ] if [ $# -eq 0 ]
then then
echo -e "This script will install or uninstall a mesh agent, usage:\n $0 [serverurl] [meshid]\n $0 uninstall" echo -e "This script will install or uninstall a mesh agent, usage:\n $0 [serverurl] [meshid] (machineid)\n $0 uninstall"
else else
if [ $# -eq 1 ] if [ $# -eq 1 ]
then then
@ -186,7 +211,7 @@ then
UninstallAgent UninstallAgent
fi fi
else else
CheckInstallAgent $1 $2 CheckInstallAgent $1 $2 $3
fi fi
fi fi
else else

View File

@ -1,6 +1,6 @@
{ {
"name": "meshcentral", "name": "meshcentral",
"version": "0.2.2-t", "version": "0.2.2-u",
"keywords": [ "keywords": [
"Remote Management", "Remote Management",
"Intel AMT", "Intel AMT",