Browse Source

server

master
zeus 4 years ago
parent
commit
17593536aa
  1. 50
      install.sh
  2. 4
      test/testnode.js

50
install.sh

@ -12,21 +12,47 @@ if [ ! -d $wdir_connect ];then
mkdir -p $wdir_connect mkdir -p $wdir_connect
fi fi
# check for node #check for jq
nodeversion=$(node $wdir/test/testnode.js) if ! command -v jq &> /dev/null
if [ $nodeversion != 'Node_is_working' ];then then
echo "Cannot find node" toolsok='no'
echo "jq could not be found"
exit
fi
# check version >15
if ! command -v node &> /dev/null
then
toolsok='no'
echo "Install: https://github.com/nodesource/distributions"
echo "Install it and try again!" echo "Install it and try again!"
else
nodeversion=$(node -v | cut -d'.' -f1)
nodeversion="${nodeversion#v}"
if [ $nodeversion -lt 15 ];then
echo "node version < 15"
echo "Update: https://github.com/nodesource/distributions"
echo "Update it and try again!"
toolsok='no' toolsok='no'
fi fi
fi
#check for docker #check for docker
dockerversion=$(/bin/bash $wdir/test/testdocker.sh) if ! command -v docker &> /dev/null
if [ $dockerversion != 'linux' ];then then
echo "Cannot find docker" echo "Cannot find docker"
echo "Install it and try again!" echo "Install it and try again!"
echo "http://docs.swarmlab.io/SwarmLab-HowTos/labs/Howtos/docker/install.adoc.html" echo "http://docs.swarmlab.io/SwarmLab-HowTos/labs/Howtos/docker/install.adoc.html"
toolsok='no' toolsok='no'
else
dockerversion=$(docker info --format "{{json .}}" | jq .ServerVersion | cut -d'.' -f1)
dockerversion="${dockerversion#\"}"
if [ $dockerversion -lt 19 ];then
echo "docker version < 19"
echo "Update docker and try again!"
echo "http://docs.swarmlab.io/SwarmLab-HowTos/labs/Howtos/docker/install.adoc.html"
toolsok='no'
fi
fi fi
#check for docker-compose #check for docker-compose
@ -39,8 +65,8 @@ if [ $dockercomposeversion != 'swarmlabclient' ];then
fi fi
#check for wireguard #check for wireguard
wgversion=$(wg --version | cut -d' ' -f1) if ! command -v wg &> /dev/null
if [ $wgversion != 'wireguard-tools' ];then then
echo "Cannot find wg" echo "Cannot find wg"
echo "Install it and try again!" echo "Install it and try again!"
echo "https://www.wireguard.com/install/" echo "https://www.wireguard.com/install/"
@ -56,14 +82,8 @@ then
exit exit
fi fi
#check for jq
if ! command -v jq &> /dev/null
then
toolsok='no'
echo "jq could not be found"
exit
fi
# npm install
if [ $toolsok == 'ok' ];then if [ $toolsok == 'ok' ];then
npm install npm install

4
test/testnode.js

@ -1,4 +0,0 @@
function testNode() {
return "Node_is_working"
};
console.log(testNode());
Loading…
Cancel
Save