Added Linux ARM Linaro support, improved Linux install script.
Ylian Saint-Hilaire committed
Nov 8, 2018 at 15:42 UTC
00ebb38ca46442eb20e20d3affb4c45abdcb778d
11 files changed
+54
-29
agents/meshagent_arm
Binary files a/agents/meshagent_arm and b/agents/meshagent_arm differ
agents/meshagent_arm-linaro
Binary files /dev/null and b/agents/meshagent_arm-linaro differ
agents/meshagent_pogo
Binary files a/agents/meshagent_pogo and b/agents/meshagent_pogo differ
agents/meshagent_poky
Binary files a/agents/meshagent_poky and b/agents/meshagent_poky differ
agents/meshagent_poky64
Binary files a/agents/meshagent_poky64 and b/agents/meshagent_poky64 differ
agents/meshagent_x86
Binary files a/agents/meshagent_x86 and b/agents/meshagent_x86 differ
agents/meshagent_x86-64
Binary files a/agents/meshagent_x86-64 and b/agents/meshagent_x86-64 differ
agents/meshagent_x86-64_nokvm
Binary files a/agents/meshagent_x86-64_nokvm and b/agents/meshagent_x86-64_nokvm differ
agents/meshagent_x86_nokvm
Binary files a/agents/meshagent_x86_nokvm and b/agents/meshagent_x86_nokvm differ
agents/meshinstall-linux.sh
+53
-28
@@ -1,7 +1,7 @@
1
#!/bin/bash
2
3
CheckStartupType() {
4
-# echo "Checking process autostart system..."
4
+ # echo "Checking process autostart system..."
5
starttype=`ps -p 1 | awk '/1/ {print $4}'`
6
if [[ $starttype == 'systemd' ]]; then return 1; # systemd;
7
elif [[ $starttype == 'init' ]]; then return 3; # sysv-init;
@@ -11,7 +11,7 @@ CheckStartupType() {
11
}
12
13
CheckStartupTypeOld() {
14
-# echo "Checking process autostart system..."
14
+ # echo "Checking process autostart system..."
15
if [[ `systemctl` =~ -\.mount ]]; then return 1; # systemd;
16
elif [[ `/sbin/init --version` =~ upstart ]]; then return 2; # upstart;
17
elif [[ -f /etc/init.d/cron && ! -h /etc/init.d/cron ]]; then return 3; # sysv-init;
@@ -29,45 +29,55 @@ UpdateMshFile() {
29
}
30
31
CheckInstallAgent() {
32
-# echo "Checking mesh identifier..."
32
+ # echo "Checking mesh identifier..."
33
if [ -e "/usr/local" ]
34
then
35
installpath="/usr/local/mesh"
36
else
37
installpath="/usr/mesh"
38
fi
39
- if [ $# -eq 2 ]
39
+ if [ $# -ge 2 ]
40
then
41
url=$1
42
meshid=$2
43
meshidlen=${#meshid}
44
if [ $meshidlen -eq 64 ]
45
then
46
-# echo "Detecting computer type..."
47
- machinetype=$( uname -m )
46
machineid=0
49
- if [ $machinetype == 'x86_64' ] || [ $machinetype == 'amd64' ]
50
- then
51
-# Linux x86, 64 bit
52
- machineid=6
53
- fi
54
- if [ $machinetype == 'x86' ] || [ $machinetype == 'i686' ]
55
- then
56
-# Linux x86, 32 bit
57
- machineid=5
58
- fi
59
- if [ $machinetype == 'armv6l' ] || [ $machinetype == 'armv7l' ]
47
+ machinetype=$( uname -m )
48
+
49
+ # If we have 3 arguments...
50
+ if [ $# -ge 3 ]
51
then
61
-# RaspberryPi 1 (armv6l) or RaspberryPi 2/3 (armv7l)
62
- machineid=25
63
- fi
64
-# TODO: Add more machine types, detect KVM support, etc.
65
- if [ $machineid -eq 0 ]
52
+ # echo "Computer type is specified..."
53
+ machineid=$3
54
+ else
55
+ # echo "Detecting computer type..."
56
+ if [ $machinetype == 'x86_64' ] || [ $machinetype == 'amd64' ]
57
+ then
58
+ # Linux x86, 64 bit
59
+ machineid=6
60
+ fi
61
+ if [ $machinetype == 'x86' ] || [ $machinetype == 'i686' ]
62
+ then
63
+ # Linux x86, 32 bit
64
+ machineid=5
65
+ fi
66
+ if [ $machinetype == 'armv6l' ] || [ $machinetype == 'armv7l' ]
67
+ then
68
+ # RaspberryPi 1 (armv6l) or RaspberryPi 2/3 (armv7l)
69
+ machineid=25
70
+ fi
71
+ # Add more machine types, detect KVM support... here.
72
+ fi
73
+
74
+ if [ $machineid -eq 0 ]
75
then
67
- echo "Unsupported machine type: $machinetype, check with server administrator."
76
+ echo "Unsupported machine type: $machinetype."
77
else
78
DownloadAgent $url $meshid $machineid
79
fi
80
+
81
else
82
echo "MeshID is not correct, must be 64 characters long."
83
fi
@@ -81,17 +91,32 @@ DownloadAgent() {
91
url=$1
92
meshid=$2
93
machineid=$3
84
-# Create folder
94
+ # Create folder
95
mkdir -p /usr/local/mesh
96
cd /usr/local/mesh
87
-# echo "Downloading mesh agent..."
97
+ echo "Downloading Mesh agent #$machineid..."
98
wget $url/meshagents?id=$machineid -q --no-check-certificate -O /usr/local/mesh/meshagent
99
+
100
+ # If it did not work, try again using http
101
+ if [ $? != 0 ]
102
+ then
103
+ url=${url/"https://"/"http://"}
104
+ wget $url/meshagents?id=$machineid -q -O /usr/local/mesh/meshagent
105
+ fi
106
+
107
if [ $? -eq 0 ]
108
then
109
echo "Mesh agent downloaded."
92
-# TODO: We could check the meshagent sha256 hash, but best to authenticate the server.
110
+ # TODO: We could check the meshagent sha256 hash, but best to authenticate the server.
111
chmod 755 /usr/local/mesh/meshagent
112
wget $url/meshsettings?id=$meshid -q --no-check-certificate -O /usr/local/mesh/meshagent.msh
113
+
114
+ # If it did not work, try again using http
115
+ if [ $? -eq 0 ]
116
+ then
117
+ wget $url/meshsettings?id=$meshid -q -O /usr/local/mesh/meshagent.msh
118
+ fi
119
+
120
if [ $? -eq 0 ]
121
then
122
UpdateMshFile
@@ -177,7 +202,7 @@ if [ $currentuser == 'root' ]
202
then
203
if [ $# -eq 0 ]
204
then
180
- echo -e "This script will install or uninstall a mesh agent, usage:\n $0 [serverurl] [meshid]\n $0 uninstall"
205
+ echo -e "This script will install or uninstall a mesh agent, usage:\n $0 [serverurl] [meshid] (machineid)\n $0 uninstall"
206
else
207
if [ $# -eq 1 ]
208
then
@@ -186,7 +211,7 @@ then
211
UninstallAgent
212
fi
213
else
189
- CheckInstallAgent $1 $2
214
+ CheckInstallAgent $1 $2 $3
215
fi
216
fi
217
else
package.json
+1
-1
@@ -1,6 +1,6 @@
1
{
2
"name": "meshcentral",
3
- "version": "0.2.2-t",
3
+ "version": "0.2.2-u",
4
"keywords": [
5
"Remote Management",
6
"Intel AMT",