From ec24e72e9f860950375900ce375034ab6eb16c69 Mon Sep 17 00:00:00 2001 From: Alnotz Date: Sun, 24 Jul 2022 02:10:21 +0200 Subject: [PATCH] WeBash Logotype updated --- README.md | 2 +- WeBashCLI/start.sh | 138 ++++++++++++++ WeBashCLI/stop.sh | 81 ++++++++ WeBashCLI/webash.sh | 317 +++++++++++++++++++++++++++++++ WeBashCLILogo_v2.cpp | 10 +- WeBashLogoWeb/WeBashLogoWeb.html | 4 +- 6 files changed, 544 insertions(+), 8 deletions(-) create mode 100644 WeBashCLI/start.sh create mode 100644 WeBashCLI/stop.sh create mode 100644 WeBashCLI/webash.sh diff --git a/README.md b/README.md index 817c22b..74a5482 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# WeBash-Logo +# WeBash Logo Une collection de logotypes pour le projet [*WeBash*](https://github.com/taokann/WeBash "Source du projet WeBash"). diff --git a/WeBashCLI/start.sh b/WeBashCLI/start.sh new file mode 100644 index 0000000..f973c1e --- /dev/null +++ b/WeBashCLI/start.sh @@ -0,0 +1,138 @@ +# +# File name: start.sh +# Description: Bash script to easily start the docker container +# Authors: colivier74 +# If you're a new WeBash contributor and worked on this file, please add your name here. +# +# This file is part of the WeBash project with is released under the terms of GNU Affero General Public License V3.0. +# You should have received a copy of the GNU Affero General Public License along with WeBash. If not, see . +# + +#!/bin/bash +DIRECTORY=$(cd `dirname $0` && pwd) +GIT=$(type -p git) + +if [ -z $GIT ]; then + echo "WeBash needs git to work, please install it." + exit 1 +fi + +#REMOVE OLDS FILES + #docker +rm $DIRECTORY/docker-compose.yml > /dev/null 2>&1 +rm $DIRECTORY/Dockerfile > /dev/null 2>&1 +rm $DIRECTORY/.env > /dev/null 2>&1 + #node +rm $DIRECTORY/npmout.txt > /dev/null 2>&1 +rm $DIRECTORY/npmerr.txt > /dev/null 2>&1 + +#UPDATE +$GIT -C $DIRECTORY pull + # MAN-DB-TXT +$GIT clone https://github.com/colivier74/man-db-txt.git res/git-libs/man-db-txt +$GIT -C res/git-libs/man-db-txt pull + +if [ -z $1 ]; then + echo "Please specify a way to start Webash" + echo "Usage : bash start.sh [args ...]" + echo "" + echo "way : docker" + echo "args : -p " + echo " -n " + echo "" + echo "way : node" + echo "args : -p " +#DOCKER +elif [ $1 = docker ]; then + #check for dependencies + DOCKER_COMPOSE=$(type -p docker-compose) + DOCKER=$(type -p docker) + if [ -z $DOCKER ]; then + echo "WeBash needs docker to work, please install it." + exit 1 + fi + + if [ -z $DOCKER_COMPOSE ]; then + echo "WeBash needs docker-compose to work, please install it." + exit 1 + fi + + #copy files + cp $DIRECTORY/deployment/docker/docker-compose_pattern.yml $DIRECTORY/docker-compose.yml > /dev/null 2>&1 + cp $DIRECTORY/deployment/docker/Dockerfile_pattern $DIRECTORY/Dockerfile > /dev/null 2>&1 + + while [ -n "$1" ]; do + case $1 in + -p|--port) PORT=$2; shift;; + -n|--name) NAME=$2; shift;; + esac + shift + done + + if [ -z $PORT ]; then + PORT="8085" + fi + + if [ -z $NAME ]; then + NAME="webash" + fi + + touch $DIRECTORY/.env + echo "PORT=$PORT" >> $DIRECTORY/.env + echo "NAME=$NAME" >> $DIRECTORY/.env + + #run container + $DOCKER_COMPOSE -f $DIRECTORY/docker-compose.yml up --build -d > /dev/null 2>&1 + + echo "------------" + echo "WeBash was successfully started with docker and the following parameters:" + echo "port :" $PORT + echo "container name:" $NAME + echo "------------" +elif [ $1 = node ]; then + #check for dependencies + NODE=$(type -p node) + NPM=$(type -p npm) + if [ -z $NODE ]; then + echo "WeBash needs node.js to work, please install it." + exit 1 + fi + + if [ -z $NPM ]; then + echo "WeBash needs npm to work, please install it." + exit 1 + fi + + #Install dependencies npm + $NPM install + + while [ -n "$1" ]; do + case $1 in + -p|--port) PORT=$2; shift;; + esac + shift + done + + if [ -z $PORT ]; then + PORT="8085" + fi + + touch $DIRECTORY/.env + echo "PORT=$PORT" >> $DIRECTORY/.env + + #run container + $NPM start > $DIRECTORY/npmout.txt 2> $DIRECTORY/npmerr.txt & + + echo "------------" + echo "WeBash was successfully started with node.js and the following parameters:" + echo "port :" $PORT + echo "------------" +else + echo "Unknown way" + echo "Here are the means available :" + echo "docker" + echo "node" +fi + +#You can add a crontab for this script for update your server automatically (change the path with your's) +#* * * * * /bin/sh /home/chevro/WeBash/start.sh diff --git a/WeBashCLI/stop.sh b/WeBashCLI/stop.sh new file mode 100644 index 0000000..663f748 --- /dev/null +++ b/WeBashCLI/stop.sh @@ -0,0 +1,81 @@ +# +# File name: stop.sh +# Description: Bash script to easily stop the docker container +# Authors: colivier74 +# If you're a new WeBash contributor and worked on this file, please add your name here. +# +# This file is part of the WeBash project with is released under the terms of GNU Affero General Public License V3.0. +# You should have received a copy of the GNU Affero General Public License along with WeBash. If not, see . +# + +#!/bin/bash +DIRECTORY=$(cd `dirname $0` && pwd) + +if [ -z $1 ]; then + echo "Please specify how you started Webash" + echo "Usage : bash stop.sh " + echo "ways : docker" + echo " node" +#DOCKER +elif [ $1 = docker ]; then + #check for dependencies + DOCKER_COMPOSE=$(type -p docker-compose) + DOCKER=$(type -p docker) + if [ -z $DOCKER ]; then + echo "WeBash needs docker to work, please install it." + exit 1 + fi + + if [ -z $DOCKER_COMPOSE ]; then + echo "WeBash needs docker-compose to work, please install it." + exit 1 + fi + + #stop container + if [ ! -f $DIRECTORY/docker-compose.yml ]; then + echo "Container already stopped !" + exit 1 + else + $DOCKER_COMPOSE -f $DIRECTORY/docker-compose.yml down --remove-orphans + fi + + #removes files + rm $DIRECTORY/docker-compose.yml > /dev/null 2>&1 + rm $DIRECTORY/Dockerfile > /dev/null 2>&1 +#node +elif [ $1 = node ]; then + #check for dependencies + NODE=$(type -p node) + NPM=$(type -p npm) + if [ -z $NODE ]; then + echo "WeBash needs node.js to work, please install it." + exit 1 + fi + + if [ -z $NPM ]; then + echo "WeBash needs npm to work, please install it." + exit 1 + fi + + #stop npm + if [ ! -f $DIRECTORY/npmout.txt ]; then + echo "Node already stopped !" + exit 1 + else + killall -SIGINT WeBash + fi + + #removes files + rm $DIRECTORY/npmout.txt > /dev/null 2>&1 + rm $DIRECTORY/npmerr.txt > /dev/null 2>&1 + +######################FILES FOR EVERY WAYS + #removes files +rm $DIRECTORY/.env > /dev/null 2>&1 + +else + echo "Unknown way" + echo "Here are the means available :" + echo "docker" + echo "node" +fi diff --git a/WeBashCLI/webash.sh b/WeBashCLI/webash.sh new file mode 100644 index 0000000..57d6194 --- /dev/null +++ b/WeBashCLI/webash.sh @@ -0,0 +1,317 @@ +# +# File name: webash.sh +# Description: Bash script to easily start and stop the docker container +# Authors: colivier74, Alnotz +# If you're a new WeBash contributor and worked on this file, please add your name here. +# +# This file is part of the WeBash project with is released under the terms of GNU Affero General Public License V3.0. +# You should have received a copy of the GNU Affero General Public License along with WeBash. If not, see . +# + +#!/bin/bash +DIRECTORY=$(cd `dirname $0` && pwd) +GIT=$(type -p git) +VERBOSE=0 + +if [ -z $GIT ]; then + echo "WeBash needs git to work, please install it." + exit 1 +fi + +#REMOVE OLDS FILES + #docker +rm $DIRECTORY/docker-compose.yml > /dev/null 2>&1 +rm $DIRECTORY/Dockerfile > /dev/null 2>&1 +rm $DIRECTORY/.env > /dev/null 2>&1 + #node +rm $DIRECTORY/npmout.txt > /dev/null 2>&1 +rm $DIRECTORY/npmerr.txt > /dev/null 2>&1 + +#UPDATE +$GIT -C $DIRECTORY pull +# MAN-DB-TXT +$GIT clone https://github.com/colivier74/man-db-txt.git res/git-libs/man-db-txt +$GIT -C res/git-libs/man-db-txt pull + +case $1 in + #Command for help text. + help ) + case $LANG in + #Translated in French. + fr* ) + echo "Usage : webash [-v] { help | start WAY [-p IP] [-n NAME] | stop WAY }" + echo "" + echo "Argument général" + echo "" + echo "-v | --verbose" + echo " Rend plus bavard." + echo "" + echo "" + echo "Commandes" + echo "" + echo "help" + echo " Affiche cette sortie d'aide." + echo "" + echo "start WAY" + echo " Démarre l'émulation WeBash via la méthode WAY." + echo " On peut préciser le port TCP/UDP PORT via l'argument -p" + echo " et préciser le nom du conteneur NAME via l'argument -n." + echo "" + echo "stop WAY" + echo " Démarre l'émulation WeBash via la méthode WAY." + echo "" + echo "" + echo "Arguments spécifiques" + echo "" + echo "-p | --port=PORT" + echo " Insère un port TCP/UDP personnalisé PORT. La valeur par" + echo " défaut de PORT est 8085." + echo "" + echo "-n | --name=NAME" + echo " Insère un nom de conteneur NAME. La valeur par défaut" + echo " de NAME est \"webash\"." + echo "" + echo "" + echo "Variables" + echo "" + echo "WAY" + echo " Nom de méthode pour l'implémentation de WeBash. Les" + echo " valeurs légales sont \"docker\" et \"node\"." + echo "" + echo "Version : 1.0" + echo "" + echo "Source : https://github.com/taokann/WeBash" + echo "" + echo "Auteurs : Tao-Kann MARTIN et Olivier CARTIER" + echo "" + echo "Licence : GNU Affero General Public License V3.0" + echo "" + ;; + #English as default language. + * ) + echo "Usage : webash [-v] { help | start WAY [-i IP] [-n NAME] | stop WAY }" + echo "" + echo "General argument" + echo "" + echo "-v | --verbose" + echo " Gives more verbosity." + echo "" + echo "" + echo "Commands" + echo "" + echo "help" + echo " Show this help output." + echo "" + echo "start" + echo " Starts the WeBash emulation via WAY method." + echo " One can precise the TCP/UDP port PORT via -p argument" + echo " and precise the container name NAME via -n argument." + echo "" + echo "stop WAY" + echo " Stops the WeBash emulation via WAY method." + echo "" + echo "" + echo "Specific arguments" + echo "" + echo "-p | --port=PORT" + echo " Set customized TCP/UDP port PORT. PORT's default value" + echo " is 8085." + echo "" + echo "-n | --name=NAME" + echo " Set customized container name NAME. NAME's default" + echo " value is \"webash\"." + echo "" + echo "" + echo "Variables" + echo "" + echo "WAY" + echo " Method name for WeBash implementation. Legal" + echo " values are \"docker\" and \"node\"." + echo "" + echo "Version : 1.0" + echo "" + echo "Source : https://github.com/taokann/WeBash" + echo "" + echo "Authors : Tao-Kann MARTIN and Olivier CARTIER" + echo "" + echo "Licence : GNU Affero General Public License V3.0" + echo "" + ;; + esac + exit 0;; + #Global argument for verbosity in console. + -v | --verbose ) + VERBOSE=1 + shift;; + #Commande to start WeBash. + start ) + if [ -z $1 ]; then + echo "Please specify a way to start Webash" + echo "Usage : bash start.sh [args ...]" + echo "" + echo "way : docker" + echo "args : -p " + echo " -n " + echo "" + echo "way : node" + echo "args : -p " + #DOCKER + elif [ $1 = docker ]; then + #check for dependencies + DOCKER_COMPOSE=$(type -p docker-compose) + DOCKER=$(type -p docker) + if [ -z $DOCKER ]; then + echo "WeBash needs docker to work, please install it." + exit 1 + fi + + if [ -z $DOCKER_COMPOSE ]; then + echo "WeBash needs docker-compose to work, please install it." + exit 1 + fi + + #copy files + cp $DIRECTORY/deployment/docker/docker-compose_pattern.yml $DIRECTORY/docker-compose.yml > /dev/null 2>&1 + cp $DIRECTORY/deployment/docker/Dockerfile_pattern $DIRECTORY/Dockerfile > /dev/null 2>&1 + + while [ -n "$1" ]; do + case $2 in + -p|--port) PORT=$2; shift;; + -n|--name) NAME=$2; shift;; + esac + shift + done + + if [ -z $PORT ]; then + PORT="8085" + fi + + if [ -z $NAME ]; then + NAME="webash" + fi + + touch $DIRECTORY/.env + echo "PORT=$PORT" >> $DIRECTORY/.env + echo "NAME=$NAME" >> $DIRECTORY/.env + + #run container + $DOCKER_COMPOSE -f $DIRECTORY/docker-compose.yml up --build -d > /dev/null 2>&1 + + echo "------------" + echo "WeBash was successfully started with docker and the following parameters:" + echo "port :" $PORT + echo "container name:" $NAME + echo "------------" + elif [ $1 = node ]; then + #check for dependencies + NODE=$(type -p node) + NPM=$(type -p npm) + if [ -z $NODE ]; then + echo "WeBash needs node.js to work, please install it." + exit 1 + fi + + if [ -z $NPM ]; then + echo "WeBash needs npm to work, please install it." + exit 1 + fi + + #Install dependencies npm + $NPM install + + while [ -n "$1" ]; do + case $1 in + -p|--port) PORT=$1; shift;; + esac + shift + done + + if [ -z $PORT ]; then + PORT="8085" + fi + + touch $DIRECTORY/.env + echo "PORT=$PORT" >> $DIRECTORY/.env + + #run container + $NPM start > $DIRECTORY/npmout.txt 2> $DIRECTORY/npmerr.txt & + + echo "------------" + echo "WeBash was successfully started with node.js and the following parameters:" + echo "port :" $PORT + echo "------------" + else + echo "Unknown way" + echo "Here are the means available :" + echo "docker" + echo "node" + fi;; + + stop ) + #DOCKER + elif [ $1 = docker ]; then + #check for dependencies + DOCKER_COMPOSE=$(type -p docker-compose) + DOCKER=$(type -p docker) + if [ -z $DOCKER ]; then + echo "WeBash needs docker to work, please install it." + exit 1 + fi + + if [ -z $DOCKER_COMPOSE ]; then + echo "WeBash needs docker-compose to work, please install it." + exit 1 + fi + + #stop container + if [ ! -f $DIRECTORY/docker-compose.yml ]; then + echo "Container already stopped !" + exit 1 + else + $DOCKER_COMPOSE -f $DIRECTORY/docker-compose.yml down --remove-orphans + fi + + #removes files + rm $DIRECTORY/docker-compose.yml > /dev/null 2>&1 + rm $DIRECTORY/Dockerfile > /dev/null 2>&1 + #node + elif [ $1 = node ]; then + #check for dependencies + NODE=$(type -p node) + NPM=$(type -p npm) + if [ -z $NODE ]; then + echo "WeBash needs node.js to work, please install it." + exit 1 + fi + + if [ -z $NPM ]; then + echo "WeBash needs npm to work, please install it." + exit 1 + fi + + #stop npm + if [ ! -f $DIRECTORY/npmout.txt ]; then + echo "Node already stopped !" + exit 1 + else + killall -SIGINT WeBash + fi + + #removes files + rm $DIRECTORY/npmout.txt > /dev/null 2>&1 + rm $DIRECTORY/npmerr.txt > /dev/null 2>&1 + + ######################FILES FOR EVERY WAYS + #removes files + rm $DIRECTORY/.env > /dev/null 2>&1 + + else + echo "Unknown way" + echo "Here are the means available :" + echo "docker" + echo "node" + fi + exit 0;; + * ) + exit 0;; +esac diff --git a/WeBashCLILogo_v2.cpp b/WeBashCLILogo_v2.cpp index 0ee9943..4f87ae1 100644 --- a/WeBashCLILogo_v2.cpp +++ b/WeBashCLILogo_v2.cpp @@ -1,6 +1,6 @@ /* Logo dynamique WeBash * Par Alnotz ! - * Version 2.0 (03/10/2021) + * Version 2.1 (24/07/2022) */ /* _______________________________ @@ -23,7 +23,7 @@ \ / \_________________________________/ */ -/* g++ -std=c++17 -Wall -Wextra -c WeBashLogo.cpp && g++ -Wall -Wextra WeBashLogo.o -o WeBashLogo */ +/* g++ -std=c++17 -Wall -Wextra -c WeBashCLILogo_v2.cpp && g++ -Wall -Wextra WeBashCLILogo_v2.o -o WeBashCLILogo_v2 */ #include //I/O en C++. #include //Caractères C++. #include //Non standard en C de GNU pour 'usleep()'. @@ -35,7 +35,7 @@ const auto LETTRES_LIGNES = 19; const auto SORTIE_LIGNES = 19; const auto SORTIE_COLONNES = 100; /* Numéro de version. */ -const auto LOGO_VERSION = std::string("2.0"); +const auto LOGO_VERSION = std::string("2.1"); /* Temps de pause (microsecondes). */ const auto TEMPS_L = 800000;//Long. const auto TEMPS_C = 200000;//Court. @@ -235,10 +235,10 @@ void help_info(char *commName) "Aide pour " << commName << " :\n\n\ Commandes : " << commName << " [-h | --help | -v [SYMBOLE] | --verbose [SYMBOLE] | -V | --version] \n\n\ -h --help\t\tInformation sur les commandes.\n\n\ --v --verbose\t\tMode bavard pour les essais. Ajouter une valeur\ +-v --verbose\t\tMode bavard pour les essais. Ajouter une valeur \ SYMBOLE affiche le symbole correspondant.\n\n\ -V --version\t\tValeur de version.\n\n\ -SYMBOLE\t\tUne des valeurs de 1 à 6 pour les 6 lettres de WeBash\ +SYMBOLE\t\tUne des valeurs de 1 à 6 pour les 6 lettres de WeBash \ ou 0 pour le logo initial ou encore N pour une fenêtre sans croisillon.\n"; } void essai(int argc, char **argv) diff --git a/WeBashLogoWeb/WeBashLogoWeb.html b/WeBashLogoWeb/WeBashLogoWeb.html index a9cab7f..0ca569e 100644 --- a/WeBashLogoWeb/WeBashLogoWeb.html +++ b/WeBashLogoWeb/WeBashLogoWeb.html @@ -7,7 +7,7 @@ WeBash Animated Logo - +

Un logo animé de WeBash

@@ -32,5 +32,5 @@ Logo rouge avec marqué « GPLv3 or later » - +