Browse Source

server

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

62
install.sh

@ -12,21 +12,47 @@ if [ ! -d $wdir_connect ];then
mkdir -p $wdir_connect
fi
# check for node
nodeversion=$(node $wdir/test/testnode.js)
if [ $nodeversion != 'Node_is_working' ];then
echo "Cannot find node"
echo "Install it and try again!"
toolsok='no'
#check for jq
if ! command -v jq &> /dev/null
then
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!"
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'
fi
fi
#check for docker
dockerversion=$(/bin/bash $wdir/test/testdocker.sh)
if [ $dockerversion != 'linux' ];then
echo "Cannot find docker"
echo "Install it and try again!"
echo "http://docs.swarmlab.io/SwarmLab-HowTos/labs/Howtos/docker/install.adoc.html"
toolsok='no'
if ! command -v docker &> /dev/null
then
echo "Cannot find docker"
echo "Install it and try again!"
echo "http://docs.swarmlab.io/SwarmLab-HowTos/labs/Howtos/docker/install.adoc.html"
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
#check for docker-compose
@ -39,8 +65,8 @@ if [ $dockercomposeversion != 'swarmlabclient' ];then
fi
#check for wireguard
wgversion=$(wg --version | cut -d' ' -f1)
if [ $wgversion != 'wireguard-tools' ];then
if ! command -v wg &> /dev/null
then
echo "Cannot find wg"
echo "Install it and try again!"
echo "https://www.wireguard.com/install/"
@ -56,14 +82,8 @@ then
exit
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
npm install

4
test/testnode.js

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