Swarmlab docs

Application development in a distributed system

Development of Distributed Systems from Design to Application


You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

179 lines
4.8 KiB

3 years ago
#!/bin/bash
3 years ago
txturl='\033[1;36m'
txturl1='\033[0;36m'
txtg='\033[0;32m'
NOCOLOR='\033[0m'
3 years ago
repoupdate ()
{
echo ""
echo "--------------"
echo "Repo update"
echo "--------------"
echo ""
git fetch -q
git pull -a
}
usage ()
{
echo ""
echo "--------------"
echo " Documantation "
echo "--------------"
echo ""
echo " USAGE: ./build.sh [OPTIONS]"
echo ""
echo " Examples of [OPTIONS] can be:"
3 years ago
echo ""
3 years ago
echo -e " ${txtg}iptables:${NOCOLOR} This tutorial demonstrates, howto setup iptables & howto use it "
echo ""
3 years ago
echo -e " ${txtg}network-scanning:${NOCOLOR} This tutorial demonstrates some common nmap port scanning scenarios and explains the output. "
3 years ago
echo ""
3 years ago
echo -e " ${txtg}network-adhoc:${NOCOLOR} This tutorial demonstrates, howto setup ad-hoc network & howto use it "
echo ""
3 years ago
echo -e " ${txtg}poc-datacollector:${NOCOLOR} This tutorial demonstrates, howto setup data collector & howto use it "
echo ""
3 years ago
echo -e " ${txtg}raspi-docker:${NOCOLOR} This tutorial demonstrates, howto setup docker on Raspberry PI & howto use it "
echo ""
3 years ago
echo -e " ${txtg}sensor-node:${NOCOLOR} This tutorial demonstrates, howto create a mote with Raspberry Pi and Arduino & howto use it "
3 years ago
echo ""
echo -e " ${txtg}ssh-tunneling:${NOCOLOR} This tutorial demonstrates, howto create a ssh-tunneling & howto use it "
echo ""
3 years ago
echo -e " ${txtg}tech-list:${NOCOLOR} This tutorial provides a list of commonly used tools "
echo ""
3 years ago
echo -e " ${txtg}help:${NOCOLOR} show this message"
3 years ago
echo " ./build.sh help"
echo ""
3 years ago
echo " ********************************************"
3 years ago
echo -e " ${txturl1}On Error:${NOCOLOR}"
3 years ago
echo " Get https://hub.swarmlab.io:5480/v2/: x509: certificate"
echo " ERROR: Get https://hub.swarmlab.io:5480/v2/: x509: certificate signed by unknown authority"
3 years ago
echo -e " ${txturl1}run:${NOCOLOR}"
echo -e " ${txtg}./0-get-certs.sh${NOCOLOR} "
3 years ago
echo " ********************************************"
echo ""
3 years ago
echo -e " ---------------------------- ${txturl1}WSL2${NOCOLOR} --------------------------"
3 years ago
echo ""
3 years ago
echo -e " With Docker Desktop running on WSL 2, users can use: ${txtg}http://127.0.0.1:8080${NOCOLOR}"
3 years ago
echo ""
echo " ------------------------------------------------------------"
echo ""
echo ""
3 years ago
echo " "
}
create_docs ()
{
printf "\\n\\n===> Build docs"
printf "\\n"
docker stop swarmlab-documentation
docker container rm swarmlab-documentation
docker pull hub.swarmlab.io:5480/antora
./0-cert.error
3 years ago
docker run -ti --name swarmlab-documentation -p 8080:8080 -v $PWD/$docdir:/antora -v $PWD/supplemental-ui:/antora/supplemental-ui hub.swarmlab.io:5480/antora /bin/sh -c "DOCSEARCH_ENABLED=true DOCSEARCH_ENGINE=lunr DOCSEARCH_INDEX_VERSION=latest NODE_PATH=/usr/local/lib/node_modules:\$NODE_PATH exec sh -c '/antora/run/$build'"
3 years ago
}
COMMAND_CREATE=0
build=""
docdir=""
while [ "$1" != "" ];
do
PARAM=$(echo "$1" | awk -F= '{print $1}')
VALUE=$(echo "$1" | awk -F= '{print $2}')
case $PARAM in
help)
usage
exit
;;
network-scanning)
DESC="network-scanning" ;
build="build-intro.sh" ;
docdir="intro" ;
3 years ago
COMMAND_CREATE=1
;;
network-adhoc)
DESC="network-adhoc" ;
3 years ago
build="build.sh" ;
docdir="network-adhoc" ;
3 years ago
COMMAND_CREATE=1
;;
3 years ago
sensor-node)
DESC="Sensor node" ;
3 years ago
build="build.sh" ;
# source adoc directory
3 years ago
docdir="sensor-node" ;
COMMAND_CREATE=1
;;
ssh-tunneling)
DESC="SSH Tunneling" ;
build="build.sh" ;
# source adoc directory
docdir="ssh-tunneling" ;
COMMAND_CREATE=1
;;
3 years ago
poc-datacollector)
DESC="Data Collector" ;
build="build.sh" ;
# source adoc directory
docdir="poc-datacollector" ;
COMMAND_CREATE=1
;;
3 years ago
raspi-docker)
DESC="raspi-docker" ;
build="build.sh" ;
# source adoc directory
docdir="raspi-docker" ;
COMMAND_CREATE=1
;;
3 years ago
tech-list)
DESC="tech-list" ;
build="build.sh" ;
# source adoc directory
docdir="tech-list" ;
COMMAND_CREATE=1
;;
3 years ago
iptables)
DESC="iptables" ;
build="build.sh" ;
# source adoc directory
docdir="iptables" ;
COMMAND_CREATE=1
;;
3 years ago
*)
echo "ERROR: unknown parameter \"$PARAM\""
usage
exit 1
;;
esac
shift
done
if [ $COMMAND_CREATE -eq 1 ]; then
create_docs
else
repoupdate
usage
fi