From bba47844b94356ec537a45914713447d384acb01 Mon Sep 17 00:00:00 2001 From: poka Date: Wed, 4 Dec 2019 19:12:39 +0000 Subject: [PATCH 01/41] Move init.sh to good place, make good nodes --- {shell => .install}/init.sh.template | 0 .install/install.sh | 5 ++--- prepare.sh => .install/prepare.sh | 0 shell/good.nodes.txt | 4 ++-- 4 files changed, 4 insertions(+), 5 deletions(-) rename {shell => .install}/init.sh.template (100%) rename prepare.sh => .install/prepare.sh (100%) diff --git a/shell/init.sh.template b/.install/init.sh.template similarity index 100% rename from shell/init.sh.template rename to .install/init.sh.template diff --git a/.install/install.sh b/.install/install.sh index 63b9c5c..16868cb 100755 --- a/.install/install.sh +++ b/.install/install.sh @@ -10,7 +10,6 @@ ### TODO ## -## ## intall jq @@ -57,8 +56,8 @@ if [ ! -d ./G1sms+ ]; then # TODO ASK for GeoPoint echo "L'adresse où se trouve votre G1Node pour indiquer où venir chercher les G1Tag imprimés (ex: au G1FabLab de Toulouse)" read ADRESSE -z - cp /home/$YOU/G1sms+/shell/init.sh.template /home/$YOU/G1sms+/shell/init.sh + + cp init.sh.template /home/$YOU/G1sms+/shell/init.sh sed -i s/pi/$YOU/g /home/$YOU/G1sms+/shell/init.sh sed -i s/+33600000000/$MASTERPHONE/g /home/$YOU/G1sms+/shell/init.sh sed -i s/au\ G1FabLab\ de\ Toulouse/$ADRESSE/g /home/$YOU/G1sms+/shell/init.sh diff --git a/prepare.sh b/.install/prepare.sh similarity index 100% rename from prepare.sh rename to .install/prepare.sh diff --git a/shell/good.nodes.txt b/shell/good.nodes.txt index 0bbbf61..b38fa55 100644 --- a/shell/good.nodes.txt +++ b/shell/good.nodes.txt @@ -1,5 +1,5 @@ -duniter.moul.re:443 g1.duniter.fr:443 g1.duniter.org:443 +g1.le-sou.org:443 g1.monnaielibreoccitanie.org:443 -g1.presles.fr:443 +duniter-g1.p2p.legal:443 From 2e79716945304140dafea1ff7099a40b1c09bddf Mon Sep 17 00:00:00 2001 From: poka Date: Fri, 6 Dec 2019 14:13:01 +0000 Subject: [PATCH 02/41] Fix template for config.sh --- config.sh | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/config.sh b/config.sh index 3d3e7d1..9f54b97 100755 --- a/config.sh +++ b/config.sh @@ -6,10 +6,12 @@ ################################################################################ now=$(date +%Y-%m-%d) -echo "Ce script configure votre noeud G1sms+ (effacez ./shell/init.sh avant de le lancer)" +echo "Ce script configure votre noeud G1sms+" IPFS=$(ps auxf --sort=+utime | grep ipfs | tail -n 1 | cut -d " " -f 1); -if [[ -f ./shell/init.sh.template && ! -f ./shell/init.sh ]]; then +cp .install/init.sh.template ./shell/init.sh + +if [[ -f .install/init.sh.template ]]; then echo "Quel est l'utilisateur du système IPFS (détecté: $IPFS)?" read YOU if [[ "$YOU" == "" ]]; then YOU=$IPFS; fi @@ -29,16 +31,17 @@ if [[ -f ./shell/init.sh.template && ! -f ./shell/init.sh ]]; then echo "L'adresse où se trouve votre G1Node pour indiquer où venir chercher ses G1Tag (ex: au G1FabLab de Toulouse)" read ADRESSE + echo "LES PARAMETRES SONT BONS? Appliquer? ENTER ou CTRL-C ?" + read + + [[ -f ./shell/init.sh ]] && mv ./shell/init.sh ./shell/init.sh.old + sed -i s/pi/$YOU/g ./shell/init.sh.template sed -i s/+33600000000/$MASTERPHONE/g ./shell/init.sh.template sed -i s/au\ G1FabLab\ de\ Toulouse/$ADRESSE/g ./shell/init.sh.template sed -i s/+33647683646/$ADMINPHONE/g ./shell/init.sh.template sed -i s/Fred/$ADMINPSEUDO/g ./shell/init.sh.template - cat ./shell/init.sh.template + cat ./shell/init.sh - echo "LES PARAMETRES SONT BONS? Appliquer? ENTER ou CTRL-C ?" - read - cp ./shell/init.sh.template ./shell/init.sh fi - From 50610c24dfd3dc7841e115be85da14c9e06f9061 Mon Sep 17 00:00:00 2001 From: poka Date: Fri, 6 Dec 2019 14:14:36 +0000 Subject: [PATCH 03/41] Fix template for config.sh --- config.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/config.sh b/config.sh index 9f54b97..c4f6813 100755 --- a/config.sh +++ b/config.sh @@ -36,11 +36,11 @@ if [[ -f .install/init.sh.template ]]; then [[ -f ./shell/init.sh ]] && mv ./shell/init.sh ./shell/init.sh.old - sed -i s/pi/$YOU/g ./shell/init.sh.template - sed -i s/+33600000000/$MASTERPHONE/g ./shell/init.sh.template - sed -i s/au\ G1FabLab\ de\ Toulouse/$ADRESSE/g ./shell/init.sh.template - sed -i s/+33647683646/$ADMINPHONE/g ./shell/init.sh.template - sed -i s/Fred/$ADMINPSEUDO/g ./shell/init.sh.template + sed -i s/pi/$YOU/g .install/init.sh.template + sed -i s/+33600000000/$MASTERPHONE/g .install/init.sh.template + sed -i s/au\ G1FabLab\ de\ Toulouse/$ADRESSE/g .install/init.sh.template + sed -i s/+33647683646/$ADMINPHONE/g .install/init.sh.template + sed -i s/Fred/$ADMINPSEUDO/g .install/init.sh.template cat ./shell/init.sh From fd860ae85f856c7c7b7df1c9a9ff05996daeed76 Mon Sep 17 00:00:00 2001 From: poka Date: Fri, 6 Dec 2019 14:16:27 +0000 Subject: [PATCH 04/41] Fix template for config.sh --- config.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/config.sh b/config.sh index c4f6813..dab4fee 100755 --- a/config.sh +++ b/config.sh @@ -36,11 +36,11 @@ if [[ -f .install/init.sh.template ]]; then [[ -f ./shell/init.sh ]] && mv ./shell/init.sh ./shell/init.sh.old - sed -i s/pi/$YOU/g .install/init.sh.template - sed -i s/+33600000000/$MASTERPHONE/g .install/init.sh.template - sed -i s/au\ G1FabLab\ de\ Toulouse/$ADRESSE/g .install/init.sh.template - sed -i s/+33647683646/$ADMINPHONE/g .install/init.sh.template - sed -i s/Fred/$ADMINPSEUDO/g .install/init.sh.template + sed -i s/pi/$YOU/g ./shell/init.sh + sed -i s/+33600000000/$MASTERPHONE/g ./shell/init.sh + sed -i s/au\ G1FabLab\ de\ Toulouse/$ADRESSE/g ./shell/init.sh + sed -i s/+33647683646/$ADMINPHONE/g ./shell/init.sh + sed -i s/Fred/$ADMINPSEUDO/g ./shell/init.sh cat ./shell/init.sh From 81d224330f5265038b642b927865934178a822a3 Mon Sep 17 00:00:00 2001 From: poka Date: Fri, 6 Dec 2019 14:18:11 +0000 Subject: [PATCH 05/41] Fix template for config.sh --- config.sh | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/config.sh b/config.sh index dab4fee..6b636b8 100755 --- a/config.sh +++ b/config.sh @@ -9,8 +9,6 @@ now=$(date +%Y-%m-%d) echo "Ce script configure votre noeud G1sms+" IPFS=$(ps auxf --sort=+utime | grep ipfs | tail -n 1 | cut -d " " -f 1); -cp .install/init.sh.template ./shell/init.sh - if [[ -f .install/init.sh.template ]]; then echo "Quel est l'utilisateur du système IPFS (détecté: $IPFS)?" read YOU @@ -34,7 +32,8 @@ if [[ -f .install/init.sh.template ]]; then echo "LES PARAMETRES SONT BONS? Appliquer? ENTER ou CTRL-C ?" read - [[ -f ./shell/init.sh ]] && mv ./shell/init.sh ./shell/init.sh.old + [[ -f shell/init.sh ]] && mv shell/init.sh shell/init.sh.old + cp .install/init.sh.template shell/init.sh sed -i s/pi/$YOU/g ./shell/init.sh sed -i s/+33600000000/$MASTERPHONE/g ./shell/init.sh From 46dddbb083572def379457a6cf0edca9ed91dfac Mon Sep 17 00:00:00 2001 From: poka Date: Fri, 6 Dec 2019 14:27:16 +0000 Subject: [PATCH 06/41] Rename prepare.sh to install_requirements.sh --- .gitignore | 2 ++ config.sh => .install/config.sh | 0 .install/{prepare.sh => install_requirements.sh} | 0 3 files changed, 2 insertions(+) rename config.sh => .install/config.sh (100%) rename .install/{prepare.sh => install_requirements.sh} (100%) diff --git a/.gitignore b/.gitignore index b0f54db..d3c34be 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,5 @@ shell/trash/ wallets_swarm/ history.* TAG/ +.install/errors +.install/log diff --git a/config.sh b/.install/config.sh similarity index 100% rename from config.sh rename to .install/config.sh diff --git a/.install/prepare.sh b/.install/install_requirements.sh similarity index 100% rename from .install/prepare.sh rename to .install/install_requirements.sh From d0b057d5e3c8ef49e28c39279298a6b85912eccb Mon Sep 17 00:00:00 2001 From: poka Date: Fri, 6 Dec 2019 14:51:51 +0000 Subject: [PATCH 07/41] Reorganise .install --- .install/config.sh | 46 --- ..._ipfs_layer.sh => configure_ipfs_layer.sh} | 32 +-- .install/errors | 7 - .install/install.sh | 89 ++---- .install/install_requirements.sh | 36 ++- .install/log | 261 ------------------ 6 files changed, 53 insertions(+), 418 deletions(-) delete mode 100755 .install/config.sh rename .install/{install_ipfs_layer.sh => configure_ipfs_layer.sh} (82%) delete mode 100644 .install/errors delete mode 100644 .install/log diff --git a/.install/config.sh b/.install/config.sh deleted file mode 100755 index 6b636b8..0000000 --- a/.install/config.sh +++ /dev/null @@ -1,46 +0,0 @@ -#!/bin/bash -################################################################################ -# Author: Fred (support@qo-op.com) -# Version: 0.1 -# License: AGPL-3.0 (https://choosealicense.com/licenses/agpl-3.0/) -################################################################################ -now=$(date +%Y-%m-%d) - -echo "Ce script configure votre noeud G1sms+" -IPFS=$(ps auxf --sort=+utime | grep ipfs | tail -n 1 | cut -d " " -f 1); - -if [[ -f .install/init.sh.template ]]; then - echo "Quel est l'utilisateur du système IPFS (détecté: $IPFS)?" - read YOU - if [[ "$YOU" == "" ]]; then YOU=$IPFS; fi - - echo "Votre PSEUDO? (celui de votre Compte membre Duniter)" - read ADMINPSEUDO - if [[ "$ADMINPSEUDO" == "" ]]; then echo "IMPOSSIBLE DE CONTINUER"; exit; fi - - echo "Le Numéro de téléphone SMS Admin? (Support de ce noeud) (ex +33611223344)" - read ADMINPHONE - if [[ "$ADMINPHONE" == "" ]]; then echo "IMPOSSIBLE DE CONTINUER"; exit; fi - - echo "Le numéro de la carte SIM, du module SMS. AUCUNE liaison SMS? Laissez vide (défaut: +33600000000)" - read MASTERPHONE - if [[ "$MASTERPHONE" == "" ]]; then MASTERPHONE="+33600000000"; fi - - echo "L'adresse où se trouve votre G1Node pour indiquer où venir chercher ses G1Tag (ex: au G1FabLab de Toulouse)" - read ADRESSE - - echo "LES PARAMETRES SONT BONS? Appliquer? ENTER ou CTRL-C ?" - read - - [[ -f shell/init.sh ]] && mv shell/init.sh shell/init.sh.old - cp .install/init.sh.template shell/init.sh - - sed -i s/pi/$YOU/g ./shell/init.sh - sed -i s/+33600000000/$MASTERPHONE/g ./shell/init.sh - sed -i s/au\ G1FabLab\ de\ Toulouse/$ADRESSE/g ./shell/init.sh - sed -i s/+33647683646/$ADMINPHONE/g ./shell/init.sh - sed -i s/Fred/$ADMINPSEUDO/g ./shell/init.sh - - cat ./shell/init.sh - -fi diff --git a/.install/install_ipfs_layer.sh b/.install/configure_ipfs_layer.sh similarity index 82% rename from .install/install_ipfs_layer.sh rename to .install/configure_ipfs_layer.sh index 9010330..8a37557 100755 --- a/.install/install_ipfs_layer.sh +++ b/.install/configure_ipfs_layer.sh @@ -8,16 +8,13 @@ MY_PATH="`dirname \"$0\"`" # relative MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized stamp=$(date +%s) -[ -z "$MY_PATH" ] && exit 1 -echo $MY_PATH templates="$MY_PATH/templates" ####################################### -# INSTALL IPFS on G1sms+ Pi NODES +# CONFIGURE IPFS for G1sms+ Pi NODES ####################################### echo "DEFAULT INSTALL SCRIPT. VALIDATED ON RASPBERRYPI, SHOULD BE ADAPTED IF NOT ARM ARCH SYSTEM. -You are going to download and install ipfs daemon environement for running G1sms+ NODE. -TODO: TEST TEST TEST TEST + MANAGE DIFFERENT ARCH +You are going to configure ipfs daemon environement for running G1sms+ NODE. Ready?" read @@ -25,30 +22,7 @@ if [[ "$USER" == "root" ]]; then echo "Better run by 'pi', please create non-roo else echo "$USER, let's go!"; fi -echo "GET ipfs-update" -[[ ! -z $(which /usr/local/bin/ipfs) ]] && sudo service ipfs stop -##rm ~/.ipfs/ -r -if [[ -d ~/.ipfs/ ]]; then - -fi -wget -P $MY_PATH https://dist.ipfs.io/ipfs-update/v1.5.2/ipfs-update_v1.5.2_linux-arm.tar.gz - -echo "INSTALL ipfs-update" -sudo tar -xvzf $MY_PATH/ipfs-update_v1.5.2_linux-arm.tar.gz -C /usr/src/ -rm $MY_PATH/ipfs-update_v1.5.2_linux-arm.tar.gz -cd /usr/src/ipfs-update -sudo ./install.sh - -echo "INSTALL latest ipfs" -sudo ipfs-update install latest - -echo "CREATE SYSTEMD ipfs SERVICE" -[[ ! -z $(which /etc/systemd/system/ipfs.service) ]] && sudo rm /etc/systemd/system/ipfs.service -sudo cp -f $templates/ipfs.service /etc/systemd/system/ -sudo sed -i "s/_USER/$USER/g" /etc/systemd/system/ipfs.service - -sudo systemctl daemon-reload -sudo systemctl enable ipfs +## TODO: Check if IPFS is installed ################ # BECOME $USER diff --git a/.install/errors b/.install/errors deleted file mode 100644 index 8e350a7..0000000 --- a/.install/errors +++ /dev/null @@ -1,7 +0,0 @@ -Error: ipfs configuration file already exists! -Reinitializing would overwrite your keys. - --- - -Job for mpd.service failed because the control process exited with error code. -See "systemctl status mpd.service" and "journalctl -xe" for details. diff --git a/.install/install.sh b/.install/install.sh index 16868cb..a1b1ea0 100755 --- a/.install/install.sh +++ b/.install/install.sh @@ -4,87 +4,44 @@ # Version: 0.1 # License: AGPL-3.0 (https://choosealicense.com/licenses/agpl-3.0/) ################################################################################ -# LE Freaking LOL Hackathon de Noël https://framadate.org/sviOUlP6JLyWq5D2XLEdcKY9/admin -# +now=$(date +%Y-%m-%d) - -### TODO -## -## intall jq - - -now=$(date -u +%Y-%m-%d) - -echo "Bonjour $USER, je vous souhaite bon jour ($now)" -echo "Ce script va installer / mettre à jour votre noeud G1sms dans /home/$USER/G1sms+" -echo "ATTENTION! Vous devez avoir installé la couche ipfs & mpd au préalable!!! ./install_ipfs_layer.sh" +echo "Ce script configure votre noeud G1sms+" IPFS=$(ps auxf --sort=+utime | grep ipfs | tail -n 1 | cut -d " " -f 1); -echo "Quel est l'utilisateur du système IPFS (détecté: $IPFS)?" -read YOU -if [[ "$YOU" == "" ]]; then YOU=$IPFS; fi -cd /home/$USER -echo "Déplacement dans /home/$USER/" -echo "... Téléchargement de la dernière version du CODE G1sms+ (ipfs = $YOU)" +if [[ -f .install/init.sh.template ]]; then + echo "Quel est l'utilisateur du système IPFS (détecté: $IPFS)?" + read YOU + if [[ "$YOU" == "" ]]; then YOU=$IPFS; fi -# CODE is there?? Get it from ipns -ipfs get --output=./ /ipns/QmZHTne3bjtMgaXWRqSbdKchJbgq2NaAeVSzFUN7ceYpif - -if [ ! -d ./G1sms+ ]; then - - echo "RECHERCHE ET INSTALLATION DU CODE : G1sms+.latest.tgz " - if [[ -f "./CODE/G1sms+.latest.tgz" ]]; then - tar xzf ./CODE/G1sms+.latest.tgz - fi - - echo "VOULEZ VOUS CONFIGURER VOTRE NODE G1sms+ ? ^C" - echo "Les paramètres se trouvent dans /home/$YOU/G1sms+/shell/init.sh" - read - - echo "Votre PSEUDO? Celui de votre compte membre Duniter. (defaut: Fred)" + echo "Votre PSEUDO? (celui de votre Compte membre Duniter)" read ADMINPSEUDO - if [[ "$ADMINPSEUDO" == "" ]]; then ADMINPSEUDO="Fred"; fi + if [[ "$ADMINPSEUDO" == "" ]]; then echo "IMPOSSIBLE DE CONTINUER"; exit; fi - echo "Le Numéro de téléphone SMS Admin? Votre numéro de portable (defaut: +33647683646)" + echo "Le Numéro de téléphone SMS Admin? (Support de ce noeud) (ex +33611223344)" read ADMINPHONE - if [[ "$ADMINPHONE" == "" ]]; then ADMINPHONE="+33647683646"; fi + if [[ "$ADMINPHONE" == "" ]]; then echo "IMPOSSIBLE DE CONTINUER"; exit; fi echo "Le numéro de la carte SIM, du module SMS. AUCUNE liaison SMS? Laissez vide (défaut: +33600000000)" read MASTERPHONE if [[ "$MASTERPHONE" == "" ]]; then MASTERPHONE="+33600000000"; fi - # TODO ASK for GeoPoint - echo "L'adresse où se trouve votre G1Node pour indiquer où venir chercher les G1Tag imprimés (ex: au G1FabLab de Toulouse)" + echo "L'adresse où se trouve votre G1Node pour indiquer où venir chercher ses G1Tag (ex: au G1FabLab de Toulouse)" read ADRESSE - cp init.sh.template /home/$YOU/G1sms+/shell/init.sh - sed -i s/pi/$YOU/g /home/$YOU/G1sms+/shell/init.sh - sed -i s/+33600000000/$MASTERPHONE/g /home/$YOU/G1sms+/shell/init.sh - sed -i s/au\ G1FabLab\ de\ Toulouse/$ADRESSE/g /home/$YOU/G1sms+/shell/init.sh - sed -i s/+33647683646/$ADMINPHONE/g /home/$YOU/G1sms+/shell/init.sh - sed -i s/Fred/$ADMINPSEUDO/g /home/$YOU/G1sms+/shell/init.sh + echo "LES PARAMETRES SONT BONS? Appliquer? ENTER ou CTRL-C ?" + read - echo "=========================================" - echo "VERIFIEZ QUE LES PARAMETRES SONT BONS... " - echo "=========================================" - cat /home/$YOU/G1sms+/shell/init.sh - echo "=========================================" - echo "CONFIG: vi /home/$YOU/G1sms+/shell/init.sh " - echo "=========================================" + [[ -f shell/init.sh ]] && mv shell/init.sh shell/init.sh.old + cp .install/init.sh.template shell/init.sh + sed -i s/pi/$YOU/g ./shell/init.sh + sed -i s/+33600000000/$MASTERPHONE/g ./shell/init.sh + sed -i s/au\ G1FabLab\ de\ Toulouse/$ADRESSE/g ./shell/init.sh + sed -i s/+33647683646/$ADMINPHONE/g ./shell/init.sh + sed -i s/Fred/$ADMINPSEUDO/g ./shell/init.sh + + cat ./shell/init.sh else - echo "VOUS AVEZ UNE VERSION de G1sms+ DEJA INSTALLEE. MISE A JOUR..." - tar xzf CODE/G1sms+.latest.tgz - - cd G1sms+ - # TODO - # sudo chown -R $YOU ./TAG - # sudo chown -R $YOU ./wallets - echo "PREPARE rompr access from nginx" - mkdir -p ./www/rompr/prefs - mkdir -p ./www/rompr/albumarts - chmod 777 ./www/rompr/prefs - chmod 777 ./www/rompr/albumarts - - echo "Version installée ($now):: IPFS chain :: $(cat ./_chain)" + echo "init.sh.template introuvable..." fi diff --git a/.install/install_requirements.sh b/.install/install_requirements.sh index 62cf25f..88ae1cb 100755 --- a/.install/install_requirements.sh +++ b/.install/install_requirements.sh @@ -1,23 +1,41 @@ #!/bin/bash +MY_PATH="`dirname \"$0\"`" # relative +MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized + +# Basics +sudo apt install curl jq # Silkaj + Duniterpy -apt install python3-pip -apt install libsodium23 +sudo apt install python3-pip +sudo apt install libsodium23 pip3 install silkaj # Install IPFS -cd /usr/src/ -wget https://dist.ipfs.io/ipfs-update/v1.5.2/ipfs-update_v1.5.2_linux-arm.tar.gz -tar xvzf ipfs-update_v1.5.2_linux-arm.tar.gz -cd ipfs-update -./install.sh -ipfs-update install latest +[[ ! -z $(which /usr/local/bin/ipfs) ]] && sudo service ipfs stop +[[ -d ~/.ipfs/ ]] && mv ~/.ipfs/ ~/.ipfs-old +wget -P $MY_PATH https://dist.ipfs.io/ipfs-update/v1.5.2/ipfs-update_v1.5.2_linux-arm.tar.gz + +echo "INSTALL ipfs-update" +sudo tar -xvzf $MY_PATH/ipfs-update_v1.5.2_linux-arm.tar.gz -C /usr/src/ +rm $MY_PATH/ipfs-update_v1.5.2_linux-arm.tar.gz +sudo bash /usr/src/ipfs-update/install.sh + +echo "INSTALL latest ipfs" +sudo ipfs-update install latest + +echo "CREATE SYSTEMD ipfs SERVICE" +[[ ! -z $(which /etc/systemd/system/ipfs.service) ]] && sudo rm /etc/systemd/system/ipfs.service +sudo cp -f $templates/ipfs.service /etc/systemd/system/ +sudo sed -i "s/_USER/$USER/g" /etc/systemd/system/ipfs.service + +sudo systemctl daemon-reload +sudo systemctl enable ipfs + # Install gammu apt install ppp screen git minicom gammu gammu-smsd usermod -aG gammu pi - exit 0 diff --git a/.install/log b/.install/log deleted file mode 100644 index 828b87a..0000000 --- a/.install/log +++ /dev/null @@ -1,261 +0,0 @@ ---2019-12-02 22:22:59-- https://dist.ipfs.io/ipfs-update/v1.5.2/ipfs-update_v1.5.2_linux-arm.tar.gz -Resolving dist.ipfs.io (dist.ipfs.io)... 2602:fea2:2::1, 209.94.90.1 -Connecting to dist.ipfs.io (dist.ipfs.io)|2602:fea2:2::1|:443... connected. -HTTP request sent, awaiting response... 200 OK -Length: 2952193 (2.8M) [application/gzip] -Saving to: ‘/home/pi/apps/G1sms+/install/ipfs-update_v1.5.2_linux-arm.tar.gz’ - - 0K .......... .......... .......... .......... .......... 1% 856K 3s - 50K .......... .......... .......... .......... .......... 3% 852K 3s - 100K .......... .......... .......... .......... .......... 5% 347K 5s - 150K .......... .......... .......... .......... .......... 6% 555K 5s - 200K .......... .......... .......... .......... .......... 8% 574K 5s - 250K .......... .......... .......... .......... .......... 10% 783K 4s - 300K .......... .......... .......... .......... .......... 12% 864K 4s - 350K .......... .......... .......... .......... .......... 13% 864K 4s - 400K .......... .......... .......... .......... .......... 15% 947K 4s - 450K .......... .......... .......... .......... .......... 17% 1.24M 3s - 500K .......... .......... .......... .......... .......... 19% 936K 3s - 550K .......... .......... .......... .......... .......... 20% 1.52M 3s - 600K .......... .......... .......... .......... .......... 22% 1.06M 3s - 650K .......... .......... .......... .......... .......... 24% 1.40M 3s - 700K .......... .......... .......... .......... .......... 26% 1.48M 3s - 750K .......... .......... .......... .......... .......... 27% 1.33M 2s - 800K .......... .......... .......... .......... .......... 29% 1.78M 2s - 850K .......... .......... .......... .......... .......... 31% 1.13M 2s - 900K .......... .......... .......... .......... .......... 32% 1.61M 2s - 950K .......... .......... .......... .......... .......... 34% 1.59M 2s - 1000K .......... .......... .......... .......... .......... 36% 1.59M 2s - 1050K .......... .......... .......... .......... .......... 38% 1.81M 2s - 1100K .......... .......... .......... .......... .......... 39% 1.75M 2s - 1150K .......... .......... .......... .......... .......... 41% 1.69M 2s - 1200K .......... .......... .......... .......... .......... 43% 1.87M 2s - 1250K .......... .......... .......... .......... .......... 45% 1.60M 2s - 1300K .......... .......... .......... .......... .......... 46% 3.51M 1s - 1350K .......... .......... .......... .......... .......... 48% 1.76M 1s - 1400K .......... .......... .......... .......... .......... 50% 2.07M 1s - 1450K .......... .......... .......... .......... .......... 52% 1.84M 1s - 1500K .......... .......... .......... .......... .......... 53% 1.83M 1s - 1550K .......... .......... .......... .......... .......... 55% 1.92M 1s - 1600K .......... .......... .......... .......... .......... 57% 3.46M 1s - 1650K .......... .......... .......... .......... .......... 58% 1.97M 1s - 1700K .......... .......... .......... .......... .......... 60% 2.12M 1s - 1750K .......... .......... .......... .......... .......... 62% 1.82M 1s - 1800K .......... .......... .......... .......... .......... 64% 3.72M 1s - 1850K .......... .......... .......... .......... .......... 65% 2.02M 1s - 1900K .......... .......... .......... .......... .......... 67% 2.22M 1s - 1950K .......... .......... .......... .......... .......... 69% 3.18M 1s - 2000K .......... .......... .......... .......... .......... 71% 2.09M 1s - 2050K .......... .......... .......... .......... .......... 72% 2.29M 1s - 2100K .......... .......... .......... .......... .......... 74% 3.52M 1s - 2150K .......... .......... .......... .......... .......... 76% 1.97M 1s - 2200K .......... .......... .......... .......... .......... 78% 2.54M 0s - 2250K .......... .......... .......... .......... .......... 79% 3.30M 0s - 2300K .......... .......... .......... .......... .......... 81% 2.21M 0s - 2350K .......... .......... .......... .......... .......... 83% 2.33M 0s - 2400K .......... .......... .......... .......... .......... 84% 3.50M 0s - 2450K .......... .......... .......... .......... .......... 86% 2.38M 0s - 2500K .......... .......... .......... .......... .......... 88% 2.29M 0s - 2550K .......... .......... .......... .......... .......... 90% 3.02M 0s - 2600K .......... .......... .......... .......... .......... 91% 2.88M 0s - 2650K .......... .......... .......... .......... .......... 93% 3.04M 0s - 2700K .......... .......... .......... .......... .......... 95% 2.66M 0s - 2750K .......... .......... .......... .......... .......... 97% 2.64M 0s - 2800K .......... .......... .......... .......... .......... 98% 3.28M 0s - 2850K .......... .......... .......... ... 100% 2.33M=1.9s - -2019-12-02 22:23:01 (1.49 MB/s) - ‘/home/pi/apps/G1sms+/install/ipfs-update_v1.5.2_linux-arm.tar.gz’ saved [2952193/2952193] - -Error: ipfs configuration file already exists! -Reinitializing would overwrite your keys. - -/home/pi/apps/G1sms+/install/install_ipfs_layer.sh: line 76: /home/pi/.ssh/authorized_keys: No such file or directory -/home/pi/apps/G1sms+/install/install_ipfs_layer.sh: line 77: /home/pi/.ssh/authorized_keys: No such file or directory ---2019-12-02 22:23:05-- https://yt-dl.org/downloads/latest/youtube-dl -Resolving yt-dl.org (yt-dl.org)... 2001:1a50:11:0:5f:8f:acaa:177, 95.143.172.170 -Connecting to yt-dl.org (yt-dl.org)|2001:1a50:11:0:5f:8f:acaa:177|:443... connected. -HTTP request sent, awaiting response... 302 Found -Location: https://yt-dl.org/downloads/2019.11.28/youtube-dl [following] ---2019-12-02 22:23:05-- https://yt-dl.org/downloads/2019.11.28/youtube-dl -Connecting to yt-dl.org (yt-dl.org)|2001:1a50:11:0:5f:8f:acaa:177|:443... connected. -HTTP request sent, awaiting response... 302 Found -Location: https://github.com/ytdl-org/youtube-dl/releases/download/2019.11.28/youtube-dl [following] ---2019-12-02 22:23:06-- https://github.com/ytdl-org/youtube-dl/releases/download/2019.11.28/youtube-dl -Resolving github.com (github.com)... 140.82.118.3 -Connecting to github.com (github.com)|140.82.118.3|:443... connected. -HTTP request sent, awaiting response... 302 Found -Location: https://github-production-release-asset-2e65be.s3.amazonaws.com/1039520/9248cd00-1236-11ea-9c7d-f619365f8851?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20191202%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20191202T222306Z&X-Amz-Expires=300&X-Amz-Signature=3ab1d1d18fc465c4b7c7ed12e5083ee8e2a3c06c78e369ac2354b6a175403f80&X-Amz-SignedHeaders=host&actor_id=0&response-content-disposition=attachment%3B%20filename%3Dyoutube-dl&response-content-type=application%2Foctet-stream [following] ---2019-12-02 22:23:06-- https://github-production-release-asset-2e65be.s3.amazonaws.com/1039520/9248cd00-1236-11ea-9c7d-f619365f8851?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20191202%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20191202T222306Z&X-Amz-Expires=300&X-Amz-Signature=3ab1d1d18fc465c4b7c7ed12e5083ee8e2a3c06c78e369ac2354b6a175403f80&X-Amz-SignedHeaders=host&actor_id=0&response-content-disposition=attachment%3B%20filename%3Dyoutube-dl&response-content-type=application%2Foctet-stream -Resolving github-production-release-asset-2e65be.s3.amazonaws.com (github-production-release-asset-2e65be.s3.amazonaws.com)... 52.217.46.132 -Connecting to github-production-release-asset-2e65be.s3.amazonaws.com (github-production-release-asset-2e65be.s3.amazonaws.com)|52.217.46.132|:443... connected. -HTTP request sent, awaiting response... 200 OK -Length: 1743965 (1.7M) [application/octet-stream] -Saving to: ‘/usr/local/bin/youtube-dl’ - - 0K .......... .......... .......... .......... .......... 2% 249K 7s - 50K .......... .......... .......... .......... .......... 5% 4.26M 3s - 100K .......... .......... .......... .......... .......... 8% 258K 4s - 150K .......... .......... .......... .......... .......... 11% 561K 4s - 200K .......... .......... .......... .......... .......... 14% 3.64M 3s - 250K .......... .......... .......... .......... .......... 17% 4.08M 2s - 300K .......... .......... .......... .......... .......... 20% 575K 2s - 350K .......... .......... .......... .......... .......... 23% 553K 2s - 400K .......... .......... .......... .......... .......... 26% 4.14M 2s - 450K .......... .......... .......... .......... .......... 29% 266K 2s - 500K .......... .......... .......... .......... .......... 32% 522K 2s - 550K .......... .......... .......... .......... .......... 35% 504K 2s - 600K .......... .......... .......... .......... .......... 38% 505K 2s - 650K .......... .......... .......... .......... .......... 41% 506K 2s - 700K .......... .......... .......... .......... .......... 44% 505K 2s - 750K .......... .......... .......... .......... .......... 46% 505K 2s - 800K .......... .......... .......... .......... .......... 49% 508K 2s - 850K .......... .......... .......... .......... .......... 52% 360K 2s - 900K .......... .......... .......... .......... .......... 55% 826K 1s - 950K .......... .......... .......... .......... .......... 58% 261K 1s - 1000K .......... .......... .......... .......... .......... 61% 484K 1s - 1050K .......... .......... .......... .......... .......... 64% 369K 1s - 1100K .......... .......... .......... .......... .......... 67% 325K 1s - 1150K .......... .......... .......... .......... .......... 70% 485K 1s - 1200K .......... .......... .......... .......... .......... 73% 493K 1s - 1250K .......... .......... .......... .......... .......... 76% 489K 1s - 1300K .......... .......... .......... .......... .......... 79% 379K 1s - 1350K .......... .......... .......... .......... .......... 82% 327K 1s - 1400K .......... .......... .......... .......... .......... 85% 470K 1s - 1450K .......... .......... .......... .......... .......... 88% 506K 0s - 1500K .......... .......... .......... .......... .......... 91% 491K 0s - 1550K .......... .......... .......... .......... .......... 93% 407K 0s - 1600K .......... .......... .......... .......... .......... 96% 454K 0s - 1650K .......... .......... .......... .......... .......... 99% 599K 0s - 1700K ... 100% 5895G=3.6s - -2019-12-02 22:23:10 (475 KB/s) - ‘/usr/local/bin/youtube-dl’ saved [1743965/1743965] - -Job for mpd.service failed because the control process exited with error code. -See "systemctl status mpd.service" and "journalctl -xe" for details. ---2019-12-02 22:23:23-- http://launchpadlibrarian.net/339874908/libav-tools_3.3.4-2_all.deb -Resolving launchpadlibrarian.net (launchpadlibrarian.net)... 2001:67c:1560:8003::8008, 2001:67c:1560:8003::8007, 91.189.89.229, ... -Connecting to launchpadlibrarian.net (launchpadlibrarian.net)|2001:67c:1560:8003::8008|:80... connected. -HTTP request sent, awaiting response... 200 OK -Length: 16088 (16K) [application/x-debian-package] -Saving to: ‘/home/pi/apps/G1sms+/install/libav-tools_3.3.4-2_all.deb’ - - 0K .......... ..... 100% 723K=0.02s - -2019-12-02 22:23:23 (723 KB/s) - ‘/home/pi/apps/G1sms+/install/libav-tools_3.3.4-2_all.deb’ saved [16088/16088] - ---2019-12-02 22:23:23-- http://ftp.fr.debian.org/debian/pool/non-free/s/svox/libttspico-data_1.0+git20130326-3_all.deb -Resolving ftp.fr.debian.org (ftp.fr.debian.org)... 2a01:e0c:1:1598::2, 212.27.32.66 -Connecting to ftp.fr.debian.org (ftp.fr.debian.org)|2a01:e0c:1:1598::2|:80... connected. -HTTP request sent, awaiting response... 200 OK -Length: 4148618 (4.0M) [application/x-debian-package] -Saving to: ‘/home/pi/apps/G1sms+/install/libttspico-data_1.0+git20130326-3_all.deb’ - - 0K .......... .......... .......... .......... .......... 1% 1.65M 2s - 50K .......... .......... .......... .......... .......... 2% 1.57M 2s - 100K .......... .......... .......... .......... .......... 3% 3.14M 2s - 150K .......... .......... .......... .......... .......... 4% 1.67M 2s - 200K .......... .......... .......... .......... .......... 6% 1.64M 2s - 250K .......... .......... .......... .......... .......... 7% 1.68M 2s - 300K .......... .......... .......... .......... .......... 8% 2.89M 2s - 350K .......... .......... .......... .......... .......... 9% 1.68M 2s - 400K .......... .......... .......... .......... .......... 11% 1.69M 2s - 450K .......... .......... .......... .......... .......... 12% 2.86M 2s - 500K .......... .......... .......... .......... .......... 13% 1.73M 2s - 550K .......... .......... .......... .......... .......... 14% 2.93M 2s - 600K .......... .......... .......... .......... .......... 16% 1.73M 2s - 650K .......... .......... .......... .......... .......... 17% 2.91M 2s - 700K .......... .......... .......... .......... .......... 18% 1.73M 2s - 750K .......... .......... .......... .......... .......... 19% 3.06M 2s - 800K .......... .......... .......... .......... .......... 20% 1.69M 2s - 850K .......... .......... .......... .......... .......... 22% 3.05M 2s - 900K .......... .......... .......... .......... .......... 23% 1.68M 2s - 950K .......... .......... .......... .......... .......... 24% 3.18M 1s - 1000K .......... .......... .......... .......... .......... 25% 3.00M 1s - 1050K .......... .......... .......... .......... .......... 27% 1.71M 1s - 1100K .......... .......... .......... .......... .......... 28% 3.23M 1s - 1150K .......... .......... .......... .......... .......... 29% 2.98M 1s - 1200K .......... .......... .......... .......... .......... 30% 1.71M 1s - 1250K .......... .......... .......... .......... .......... 32% 3.11M 1s - 1300K .......... .......... .......... .......... .......... 33% 3.22M 1s - 1350K .......... .......... .......... .......... .......... 34% 1.69M 1s - 1400K .......... .......... .......... .......... .......... 35% 3.22M 1s - 1450K .......... .......... .......... .......... .......... 37% 3.11M 1s - 1500K .......... .......... .......... .......... .......... 38% 3.21M 1s - 1550K .......... .......... .......... .......... .......... 39% 1.69M 1s - 1600K .......... .......... .......... .......... .......... 40% 3.20M 1s - 1650K .......... .......... .......... .......... .......... 41% 3.24M 1s - 1700K .......... .......... .......... .......... .......... 43% 3.11M 1s - 1750K .......... .......... .......... .......... .......... 44% 3.22M 1s - 1800K .......... .......... .......... .......... .......... 45% 1.69M 1s - 1850K .......... .......... .......... .......... .......... 46% 3.17M 1s - 1900K .......... .......... .......... .......... .......... 48% 1.56M 1s - 1950K .......... .......... .......... .......... .......... 49% 24.1M 1s - 2000K .......... .......... .......... .......... .......... 50% 1.72M 1s - 2050K .......... .......... .......... .......... .......... 51% 3.07M 1s - 2100K .......... .......... .......... .......... .......... 53% 1.68M 1s - 2150K .......... .......... .......... .......... .......... 54% 2.99M 1s - 2200K .......... .......... .......... .......... .......... 55% 1.70M 1s - 2250K .......... .......... .......... .......... .......... 56% 2.98M 1s - 2300K .......... .......... .......... .......... .......... 58% 1.69M 1s - 2350K .......... .......... .......... .......... .......... 59% 3.00M 1s - 2400K .......... .......... .......... .......... .......... 60% 1.70M 1s - 2450K .......... .......... .......... .......... .......... 61% 2.99M 1s - 2500K .......... .......... .......... .......... .......... 62% 1.72M 1s - 2550K .......... .......... .......... .......... .......... 64% 3.03M 1s - 2600K .......... .......... .......... .......... .......... 65% 1.76M 1s - 2650K .......... .......... .......... .......... .......... 66% 2.83M 1s - 2700K .......... .......... .......... .......... .......... 67% 3.08M 1s - 2750K .......... .......... .......... .......... .......... 69% 1.73M 1s - 2800K .......... .......... .......... .......... .......... 70% 3.05M 1s - 2850K .......... .......... .......... .......... .......... 71% 1.82M 0s - 2900K .......... .......... .......... .......... .......... 72% 2.85M 0s - 2950K .......... .......... .......... .......... .......... 74% 3.04M 0s - 3000K .......... .......... .......... .......... .......... 75% 3.09M 0s - 3050K .......... .......... .......... .......... .......... 76% 1.73M 0s - 3100K .......... .......... .......... .......... .......... 77% 3.04M 0s - 3150K .......... .......... .......... .......... .......... 78% 3.08M 0s - 3200K .......... .......... .......... .......... .......... 80% 1.82M 0s - 3250K .......... .......... .......... .......... .......... 81% 3.01M 0s - 3300K .......... .......... .......... .......... .......... 82% 3.06M 0s - 3350K .......... .......... .......... .......... .......... 83% 3.24M 0s - 3400K .......... .......... .......... .......... .......... 85% 3.00M 0s - 3450K .......... .......... .......... .......... .......... 86% 1.92M 0s - 3500K .......... .......... .......... .......... .......... 87% 2.83M 0s - 3550K .......... .......... .......... .......... .......... 88% 3.07M 0s - 3600K .......... .......... .......... .......... .......... 90% 3.16M 0s - 3650K .......... .......... .......... .......... .......... 91% 3.12M 0s - 3700K .......... .......... .......... .......... .......... 92% 1.89M 0s - 3750K .......... .......... .......... .......... .......... 93% 3.06M 0s - 3800K .......... .......... .......... .......... .......... 95% 3.02M 0s - 3850K .......... .......... .......... .......... .......... 96% 3.05M 0s - 3900K .......... .......... .......... .......... .......... 97% 3.26M 0s - 3950K .......... .......... .......... .......... .......... 98% 3.06M 0s - 4000K .......... .......... .......... .......... .......... 99% 3.25M 0s - 4050K . 100% 3.44M=1.7s - -2019-12-02 22:23:25 (2.37 MB/s) - ‘/home/pi/apps/G1sms+/install/libttspico-data_1.0+git20130326-3_all.deb’ saved [4148618/4148618] - ---2019-12-02 22:23:25-- http://ftp.fr.debian.org/debian/pool/non-free/s/svox/libttspico0_1.0+git20130326-3_armhf.deb -Resolving ftp.fr.debian.org (ftp.fr.debian.org)... 2a01:e0c:1:1598::2, 212.27.32.66 -Connecting to ftp.fr.debian.org (ftp.fr.debian.org)|2a01:e0c:1:1598::2|:80... connected. -HTTP request sent, awaiting response... 200 OK -Length: 124694 (122K) [application/x-debian-package] -Saving to: ‘/home/pi/apps/G1sms+/install/libttspico0_1.0+git20130326-3_armhf.deb’ - - 0K .......... .......... .......... .......... .......... 41% 1.62M 0s - 50K .......... .......... .......... .......... .......... 82% 3.10M 0s - 100K .......... .......... . 100% 1.45M=0.06s - -2019-12-02 22:23:25 (1.97 MB/s) - ‘/home/pi/apps/G1sms+/install/libttspico0_1.0+git20130326-3_armhf.deb’ saved [124694/124694] - ---2019-12-02 22:23:25-- http://ftp.fr.debian.org/debian/pool/non-free/s/svox/libttspico-utils_1.0+git20130326-3_armhf.deb -Resolving ftp.fr.debian.org (ftp.fr.debian.org)... 2a01:e0c:1:1598::2, 212.27.32.66 -Connecting to ftp.fr.debian.org (ftp.fr.debian.org)|2a01:e0c:1:1598::2|:80... connected. -HTTP request sent, awaiting response... 200 OK -Length: 8590 (8.4K) [application/x-debian-package] -Saving to: ‘/home/pi/apps/G1sms+/install/libttspico-utils_1.0+git20130326-3_armhf.deb’ - - 0K ........ 100% 19.1M=0s - -2019-12-02 22:23:25 (19.1 MB/s) - ‘/home/pi/apps/G1sms+/install/libttspico-utils_1.0+git20130326-3_armhf.deb’ saved [8590/8590] - From 4705cc49d1ed3285d01240730ae87266c139f21c Mon Sep 17 00:00:00 2001 From: poka Date: Fri, 6 Dec 2019 15:14:08 +0000 Subject: [PATCH 08/41] improve /install.sh --- .../{init.sh.template => templates/init.sh} | 0 .install/install.sh => install.sh | 32 +++++++++++++------ 2 files changed, 22 insertions(+), 10 deletions(-) rename .install/{init.sh.template => templates/init.sh} (100%) rename .install/install.sh => install.sh (56%) diff --git a/.install/init.sh.template b/.install/templates/init.sh similarity index 100% rename from .install/init.sh.template rename to .install/templates/init.sh diff --git a/.install/install.sh b/install.sh similarity index 56% rename from .install/install.sh rename to install.sh index a1b1ea0..c94fc27 100755 --- a/.install/install.sh +++ b/install.sh @@ -4,12 +4,24 @@ # Version: 0.1 # License: AGPL-3.0 (https://choosealicense.com/licenses/agpl-3.0/) ################################################################################ +MY_PATH="`dirname \"$0\"`" # relative +MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized +init_loc="$MY_PATH/shell/init.sh" + now=$(date +%Y-%m-%d) +chmod u+x .install/configure_ipfs_layer.sh .install/install_requirements.sh + +if [ "$EUID" -eq 0 ] + then echo "Veuillez ne pas executez ce script en root. Choisissez un utilisateur pour votre serveur G1sms+ (nous recommandons l'utilisateur pi)" + exit 1 +fi echo "Ce script configure votre noeud G1sms+" -IPFS=$(ps auxf --sort=+utime | grep ipfs | tail -n 1 | cut -d " " -f 1); +IPFS=$(ps auxf --sort=+utime | grep -w ipfs | grep -v "color=auto" | tail -n 1 | cut -d " " -f 1); -if [[ -f .install/init.sh.template ]]; then +[[ -z $IPFS ]] && $MY_PATH/.install/install_requirements.sh && $MY_PATH/.install/configure_ipfs_layer.sh + +if [[ -f $MY_PATH/.install/templates/init.sh ]]; then echo "Quel est l'utilisateur du système IPFS (détecté: $IPFS)?" read YOU if [[ "$YOU" == "" ]]; then YOU=$IPFS; fi @@ -33,15 +45,15 @@ if [[ -f .install/init.sh.template ]]; then read [[ -f shell/init.sh ]] && mv shell/init.sh shell/init.sh.old - cp .install/init.sh.template shell/init.sh + cp $MY_PATH/.install/templates/init.sh shell/init.sh - sed -i s/pi/$YOU/g ./shell/init.sh - sed -i s/+33600000000/$MASTERPHONE/g ./shell/init.sh - sed -i s/au\ G1FabLab\ de\ Toulouse/$ADRESSE/g ./shell/init.sh - sed -i s/+33647683646/$ADMINPHONE/g ./shell/init.sh - sed -i s/Fred/$ADMINPSEUDO/g ./shell/init.sh + sed -i s/pi/$YOU/g $init_loc + sed -i s/+33600000000/$MASTERPHONE/g $init_loc + sed -i s/au\ G1FabLab\ de\ Toulouse/$ADRESSE/g $init_loc + sed -i s/+33647683646/$ADMINPHONE/g $init_loc + sed -i s/Fred/$ADMINPSEUDO/g $init_loc - cat ./shell/init.sh + cat $init_loc else - echo "init.sh.template introuvable..." + echo "init.sh introuvable..." fi From 8285ccc8589b1a6bb98334ad6353da8011027bab Mon Sep 17 00:00:00 2001 From: poka Date: Fri, 6 Dec 2019 15:17:02 +0000 Subject: [PATCH 09/41] improve init.sh --- .install/templates/init.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.install/templates/init.sh b/.install/templates/init.sh index 96b5137..95d0cb4 100755 --- a/.install/templates/init.sh +++ b/.install/templates/init.sh @@ -48,10 +48,10 @@ fi # Choose Default Unit: G1, DU, LOVE (DU cents), ZEN (G1 cents) export COIN="G1" ################################################################## - # Limit and commission values + # Limit and commission values export LIMIT=2 # Solde minimum = 2 G1 # FIXED COMMISSION SYSTEM - export COMMISSION=1 # transaction commission amount (G1) + export COMMISSION=1 # transaction commission amount (G1) export BILLCOM=20 ################################################################## # COMMISSION PARTS FROM TX FOR NODE & G1SMS NETWORK @@ -60,7 +60,7 @@ fi # TODO: NODE G1sms Wallet can receive rewards from SWARM or WALLETS/FILES export NODECOMM=10 ################################################################## - # SMS SIM Card Phone Number + # SMS SIM Card Phone Number export MASTERPHONE="+33600000000" export ADRESSE="au G1FabLab de Toulouse" export G1DAB="NO" From 8f7d89d56242e5f561f1abf03b742939dae31c97 Mon Sep 17 00:00:00 2001 From: poka Date: Fri, 6 Dec 2019 15:22:11 +0000 Subject: [PATCH 10/41] fix grep -v to detect ipfs isntall --- install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install.sh b/install.sh index c94fc27..d0293f0 100755 --- a/install.sh +++ b/install.sh @@ -17,7 +17,7 @@ if [ "$EUID" -eq 0 ] fi echo "Ce script configure votre noeud G1sms+" -IPFS=$(ps auxf --sort=+utime | grep -w ipfs | grep -v "color=auto" | tail -n 1 | cut -d " " -f 1); +IPFS=$(ps auxf --sort=+utime | grep -w ipfs | grep -v -E 'color=auto|grep' | tail -n 1 | cut -d " " -f 1); [[ -z $IPFS ]] && $MY_PATH/.install/install_requirements.sh && $MY_PATH/.install/configure_ipfs_layer.sh From ee00928a4fd443828dafb19d41b57ef94e270c2c Mon Sep 17 00:00:00 2001 From: poka Date: Fri, 6 Dec 2019 15:25:03 +0000 Subject: [PATCH 11/41] fix grep -v to detect ipfs isntall --- install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install.sh b/install.sh index d0293f0..c6b043e 100755 --- a/install.sh +++ b/install.sh @@ -19,7 +19,7 @@ fi echo "Ce script configure votre noeud G1sms+" IPFS=$(ps auxf --sort=+utime | grep -w ipfs | grep -v -E 'color=auto|grep' | tail -n 1 | cut -d " " -f 1); -[[ -z $IPFS ]] && $MY_PATH/.install/install_requirements.sh && $MY_PATH/.install/configure_ipfs_layer.sh +[[ -z $IPFS ]] && echo "IPFS n'a pas été détecté sur votre machine, nous allons installer tous les prérequis..." && $MY_PATH/.install/install_requirements.sh && $MY_PATH/.install/configure_ipfs_layer.sh if [[ -f $MY_PATH/.install/templates/init.sh ]]; then echo "Quel est l'utilisateur du système IPFS (détecté: $IPFS)?" From 63860d4d632f224350945a27620bc2dd7fbfcee6 Mon Sep 17 00:00:00 2001 From: poka Date: Fri, 6 Dec 2019 16:58:01 +0100 Subject: [PATCH 12/41] fix non ARM install and few stuff --- .install/install_requirements.sh | 31 ++++++++++++++++++++----------- 1 file changed, 20 insertions(+), 11 deletions(-) diff --git a/.install/install_requirements.sh b/.install/install_requirements.sh index 88ae1cb..6950539 100755 --- a/.install/install_requirements.sh +++ b/.install/install_requirements.sh @@ -2,32 +2,38 @@ MY_PATH="`dirname \"$0\"`" # relative MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized +isARM=$(uname -a | grep arm) # Basics -sudo apt install curl jq +sudo apt update +sudo apt install curl jq -y # Silkaj + Duniterpy -sudo apt install python3-pip -sudo apt install libsodium23 +sudo apt install python3-pip libsodium18 -y pip3 install silkaj - # Install IPFS [[ ! -z $(which /usr/local/bin/ipfs) ]] && sudo service ipfs stop [[ -d ~/.ipfs/ ]] && mv ~/.ipfs/ ~/.ipfs-old -wget -P $MY_PATH https://dist.ipfs.io/ipfs-update/v1.5.2/ipfs-update_v1.5.2_linux-arm.tar.gz +if [[ -z $isARM ]]; then + wget -P $MY_PATH https://dist.ipfs.io/ipfs-update/v1.5.2/ipfs-update_v1.5.2_linux-amd64.tar.gz -O ipfs-update.tar.gz +else + wget -P $MY_PATH https://dist.ipfs.io/ipfs-update/v1.5.2/ipfs-update_v1.5.2_linux-arm.tar.gz -O ipfs-update.tar.gz +fi echo "INSTALL ipfs-update" -sudo tar -xvzf $MY_PATH/ipfs-update_v1.5.2_linux-arm.tar.gz -C /usr/src/ -rm $MY_PATH/ipfs-update_v1.5.2_linux-arm.tar.gz -sudo bash /usr/src/ipfs-update/install.sh +sudo tar -xvzf $MY_PATH/ipfs-update.tar.gz -C /usr/src/ +rm $MY_PATH/ipfs-update.tar.gz +cd /usr/src/ipfs-update/ +sudo ./install.sh +cd $MY_PATH echo "INSTALL latest ipfs" sudo ipfs-update install latest echo "CREATE SYSTEMD ipfs SERVICE" [[ ! -z $(which /etc/systemd/system/ipfs.service) ]] && sudo rm /etc/systemd/system/ipfs.service -sudo cp -f $templates/ipfs.service /etc/systemd/system/ +sudo cp -f $MY_PATH/templates/ipfs.service /etc/systemd/system/ sudo sed -i "s/_USER/$USER/g" /etc/systemd/system/ipfs.service sudo systemctl daemon-reload @@ -35,7 +41,10 @@ sudo systemctl enable ipfs # Install gammu -apt install ppp screen git minicom gammu gammu-smsd -usermod -aG gammu pi +sudo apt install ppp screen git minicom gammu -y +sleep 1 +sudo apt install gammu-smsd -y + +sudo usermod -aG gammu $USER exit 0 From c031e76fb02ab5a692214c87d4e3a8faddd463f6 Mon Sep 17 00:00:00 2001 From: poka Date: Fri, 6 Dec 2019 18:06:18 +0100 Subject: [PATCH 13/41] Fix install_optionnal.sh --- .install/configure_ipfs_layer.sh | 67 ++++---------------------------- .install/install_optional.sh | 64 ++++++++++++++++++++++++++++++ .install/install_requirements.sh | 1 - install.sh | 8 +++- 4 files changed, 79 insertions(+), 61 deletions(-) create mode 100755 .install/install_optional.sh diff --git a/.install/configure_ipfs_layer.sh b/.install/configure_ipfs_layer.sh index 8a37557..719f9e1 100755 --- a/.install/configure_ipfs_layer.sh +++ b/.install/configure_ipfs_layer.sh @@ -13,16 +13,14 @@ templates="$MY_PATH/templates" ####################################### # CONFIGURE IPFS for G1sms+ Pi NODES ####################################### -echo "DEFAULT INSTALL SCRIPT. VALIDATED ON RASPBERRYPI, SHOULD BE ADAPTED IF NOT ARM ARCH SYSTEM. -You are going to configure ipfs daemon environement for running G1sms+ NODE. -Ready?" -read -if [[ "$USER" == "root" ]]; then echo "Better run by 'pi', please create non-root user and become that user before launching ipfs install..."; exit; +if [ "$EUID" -eq 0 ] + then echo "Veuillez ne pas executez ce script en root. Choisissez un utilisateur pour votre serveur G1sms+ (nous recommandons l'utilisateur pi)" + exit 1 else echo "$USER, let's go!"; fi -## TODO: Check if IPFS is installed +[[ -d ~/.ipfs/ ]] && rm -rf ~/.ipfs-old && mv ~/.ipfs/ ~/.ipfs-old ################ # BECOME $USER @@ -47,59 +45,10 @@ ipfs bootstrap add /ip4/51.15.2.211/tcp/4001/ipfs/QmSX7gFRPHui5A2DWFk2VmBvq6hynj # ALLOW REMOTE SSH CONNECTION FROM rec OR onelove (For swarm.key & keystore exchange ) # ADD SSH ADMIN/SUPPORT USERS $(cat .ssh/id_rsa.pub) -echo "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCs6oXRmPukaX7u2tDcFF1cecsDSEA30YyUqDaXSrw+yWQ8G79ktZ7BN0bPYBgfxO59FU8l5Jg1SPPG9kj81jfoCwGJpYdbczmMuP/iqw3aNoGv66swxwxzrqzbHrFFCXgn+6B2spDjn87tFB8JvQQTb2Kc4/sAZ9E6eY61pFiNpqbQehXdqSV5UemV9dkSQrnmJTl1PjUQ474AKQwFPzpdKHD/3VvqQS4i7ZLVeXS65euOP/YY8Bx9HvhsmhJ3h78OOK+D6GFfyv010xXBoG6kCSYR8LYMCEexpPGYV+Mduf/tUHjHP4GuWZAhd+wLRl0uPy6Tv7wHFfLyN01m/9vl fred@rec" >> ~/.ssh/authorized_keys -echo "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDFthQ3FggJlz/+ZglZJjVJzYs6ehx/iB7f89KY396K+7ai4ETqFhq6ANVp9xeQ4dLU26w0bFBELcnh9rn5QDSrXjsIptoWXErkSdZOeXqofnLtJEOhZO/I328y0C1vQRwtMMXKLLnqPe14h+zJenc7KJbL5cvB3Hd7nfQ+Q0uEnIsKb0f5wcKagySHIFdmY/FqaGz5g4MXGq7nlX/31hvfTFhF0g+k3mhvTTVQ368Op9qZZIozYhBoojWWvK5mwAovxdS9QT1hKrFXHfjov/aKQxLAy0a0oxFvHKoYN/l4ffGibFMAmedljTxf1VSDBv/k/RN53UU6RufW3qqBjY0b fred@onelove" >> ~/.ssh/authorized_keys +if [[ -z $(grep fred@rec ~/.ssh/authorized_keys) ]]; then + echo "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCs6oXRmPukaX7u2tDcFF1cecsDSEA30YyUqDaXSrw+yWQ8G79ktZ7BN0bPYBgfxO59FU8l5Jg1SPPG9kj81jfoCwGJpYdbczmMuP/iqw3aNoGv66swxwxzrqzbHrFFCXgn+6B2spDjn87tFB8JvQQTb2Kc4/sAZ9E6eY61pFiNpqbQehXdqSV5UemV9dkSQrnmJTl1PjUQ474AKQwFPzpdKHD/3VvqQS4i7ZLVeXS65euOP/YY8Bx9HvhsmhJ3h78OOK+D6GFfyv010xXBoG6kCSYR8LYMCEexpPGYV+Mduf/tUHjHP4GuWZAhd+wLRl0uPy6Tv7wHFfLyN01m/9vl fred@rec" >> ~/.ssh/authorized_keys + echo "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDFthQ3FggJlz/+ZglZJjVJzYs6ehx/iB7f89KY396K+7ai4ETqFhq6ANVp9xeQ4dLU26w0bFBELcnh9rn5QDSrXjsIptoWXErkSdZOeXqofnLtJEOhZO/I328y0C1vQRwtMMXKLLnqPe14h+zJenc7KJbL5cvB3Hd7nfQ+Q0uEnIsKb0f5wcKagySHIFdmY/FqaGz5g4MXGq7nlX/31hvfTFhF0g+k3mhvTTVQ368Op9qZZIozYhBoojWWvK5mwAovxdS9QT1hKrFXHfjov/aKQxLAy0a0oxFvHKoYN/l4ffGibFMAmedljTxf1VSDBv/k/RN53UU6RufW3qqBjY0b fred@onelove" >> ~/.ssh/authorized_keys +fi # START ipfs sudo systemctl start ipfs - -################################## -## INSTALL TOOLS -######## YOUTUBE-DL ########## -sudo wget -P $MY_PATH https://yt-dl.org/downloads/latest/youtube-dl -O /usr/local/bin/youtube-dl -sudo chmod a+rx /usr/local/bin/youtube-dl -sudo apt install libid3-tools mpd mpc lame -y - - -## CONFIG MPD -sudo cp -f $templates/mpd.conf /etc/mpd.conf -sudo sed -i "s/_USER/$USER/g" /etc/mpd.conf - -sudo chown -R $USER /var/lib/mpd/ /var/run/mpd /run/mpd /var/log/mpd -sudo service mpd restart - - -sudo apt-get install nginx php-curl php-sqlite3 php-gd php-json php-xml php-mbstring php-fpm sqlite -y -sudo apt-get install lame sox libsox-fmt-mp3 eyed3 python-chardet imagemagick curl -y #libav-tools -sudo apt-get install ca-certificates git-core binutils rsync alsa-utils bc libid3-tools espeak mpg321 fuse atomicparsley -y #libttspico-utils - -wget -P $MY_PATH http://launchpadlibrarian.net/339874908/libav-tools_3.3.4-2_all.deb -wget -P $MY_PATH http://ftp.fr.debian.org/debian/pool/non-free/s/svox/libttspico-data_1.0+git20130326-3_all.deb -wget -P $MY_PATH http://ftp.fr.debian.org/debian/pool/non-free/s/svox/libttspico0_1.0+git20130326-3_armhf.deb -wget -P $MY_PATH http://ftp.fr.debian.org/debian/pool/non-free/s/svox/libttspico-utils_1.0+git20130326-3_armhf.deb -sudo dpkg -i $MY_PATH/libttspico-data_1.0+git20130326-3_all.deb -sudo dpkg -i $MY_PATH/libttspico0_1.0+git20130326-3_armhf.deb -sudo dpkg -i $MY_PATH/libttspico-utils_1.0+git20130326-3_armhf.deb -sudo dpkg -i $MY_PATH/libav-tools_3.3.4-2_all.deb -rm $MY_PATH/libttspico-data_1.0+git20130326-3_all.deb $MY_PATH/libttspico0_1.0+git20130326-3_armhf.deb $MY_PATH/libttspico-utils_1.0+git20130326-3_armhf.deb $MY_PATH/libav-tools_3.3.4-2_all.deb - - -# CONFIG NGINX -sudo cp -f $templates/default /etc/nginx/sites-available/ -sudo sed -i "s/_USER/$USER/g" /etc/nginx/sites-available/default - -sudo systemctl restart nginx - -################################# -## Get _CopyLaRadio distrib -# ipfs get Qm.... > /tmp/copylaradio.zip - -# Add CopyLaRadio to system PATH -#export PATH=$PATH:/home/$USER/_CopyLaRadio -# etc.... - -# INSTALL ROMPR WebSite LINKs -#sudo ln -s /home/$USER/_CopyLaRadio/www/rompr /var/www/rompr -#sudo chmod 777 /home/$USER/_CopyLaRadio/www/rompr/albumart -#sudo chmod 777 /home/$USER/_CopyLaRadio/www/rompr/prefs - diff --git a/.install/install_optional.sh b/.install/install_optional.sh new file mode 100755 index 0000000..7c41851 --- /dev/null +++ b/.install/install_optional.sh @@ -0,0 +1,64 @@ +#!/bin/bash + +MY_PATH="`dirname \"$0\"`" # relative +MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized +templates="$MY_PATH/templates" + +isARM=$(uname -a | grep arm) + +################################## +## INSTALL TOOLS +######## YOUTUBE-DL ########## +sudo wget -P $MY_PATH https://yt-dl.org/downloads/latest/youtube-dl -O /usr/local/bin/youtube-dl +sudo chmod a+rx /usr/local/bin/youtube-dl +sudo apt install libid3-tools mpd mpc lame -y + + +## CONFIG MPD +sudo cp -f $templates/mpd.conf /etc/mpd.conf +sudo sed -i "s/_USER/$USER/g" /etc/mpd.conf + +sudo chown -R $USER /var/lib/mpd/ /var/run/mpd /run/mpd /var/log/mpd +sudo service mpd restart + + +sudo apt-get install nginx php-curl php-sqlite3 php-gd php-json php-xml php-mbstring php-fpm sqlite -y +sudo apt-get install lame sox libsox-fmt-mp3 eyed3 python-chardet imagemagick curl -y #libav-tools +sudo apt-get install ca-certificates git-core binutils rsync alsa-utils bc libid3-tools espeak mpg321 fuse atomicparsley -y #libttspico-utils + +wget -P $MY_PATH http://launchpadlibrarian.net/339874908/libav-tools_3.3.4-2_all.deb -O libav-tools.deb +wget -P $MY_PATH http://ftp.fr.debian.org/debian/pool/non-free/s/svox/libttspico-data_1.0+git20130326-3_all.deb -O libttspico-data.deb +if [[ -z $isARM ]]; then + wget -P $MY_PATH http://ftp.fr.debian.org/debian/pool/non-free/s/svox/libttspico0_1.0+git20130326-5_amd64.deb -O libttspico0.deb + wget -P $MY_PATH http://ftp.fr.debian.org/debian/pool/non-free/s/svox/libttspico-utils_1.0+git20130326-9_amd64.deb -O libttspico-utils.deb +else + wget -P $MY_PATH http://ftp.fr.debian.org/debian/pool/non-free/s/svox/libttspico0_1.0+git20130326-3_armhf.deb -O libttspico0.deb + wget -P $MY_PATH http://ftp.fr.debian.org/debian/pool/non-free/s/svox/libttspico-utils_1.0+git20130326-3_armhf.deb -O libttspico-utils.deb +fi +sudo dpkg -i $MY_PATH/libttspico-data.deb +sudo dpkg -i $MY_PATH/libttspico0.deb +sudo dpkg -i $MY_PATH/libttspico-utils.deb +sudo dpkg -i $MY_PATH/libav-tools.deb +rm $MY_PATH/libttspico-data.deb $MY_PATH/libttspico0.deb $MY_PATH/libttspico-utils.deb $MY_PATH/libav-tools.deb + + +# CONFIG NGINX +sudo cp -f $templates/default /etc/nginx/sites-available/ +sudo sed -i "s/_USER/$USER/g" /etc/nginx/sites-available/default + +sudo systemctl restart nginx + +################################# +## Get _CopyLaRadio distrib +# ipfs get Qm.... > /tmp/copylaradio.zip + +# Add CopyLaRadio to system PATH +#export PATH=$PATH:/home/$USER/_CopyLaRadio +# etc.... + +# INSTALL ROMPR WebSite LINKs +#sudo ln -s /home/$USER/_CopyLaRadio/www/rompr /var/www/rompr +#sudo chmod 777 /home/$USER/_CopyLaRadio/www/rompr/albumart +#sudo chmod 777 /home/$USER/_CopyLaRadio/www/rompr/prefs + +exit 0 diff --git a/.install/install_requirements.sh b/.install/install_requirements.sh index 6950539..f57f869 100755 --- a/.install/install_requirements.sh +++ b/.install/install_requirements.sh @@ -14,7 +14,6 @@ pip3 install silkaj # Install IPFS [[ ! -z $(which /usr/local/bin/ipfs) ]] && sudo service ipfs stop -[[ -d ~/.ipfs/ ]] && mv ~/.ipfs/ ~/.ipfs-old if [[ -z $isARM ]]; then wget -P $MY_PATH https://dist.ipfs.io/ipfs-update/v1.5.2/ipfs-update_v1.5.2_linux-amd64.tar.gz -O ipfs-update.tar.gz else diff --git a/install.sh b/install.sh index c6b043e..b9eb09c 100755 --- a/install.sh +++ b/install.sh @@ -9,7 +9,9 @@ MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized init_loc="$MY_PATH/shell/init.sh" now=$(date +%Y-%m-%d) -chmod u+x .install/configure_ipfs_layer.sh .install/install_requirements.sh +chmod u+x .install/configure_ipfs_layer.sh .install/install_requirements.sh .install/install_optional.sh + +repOption=$1 if [ "$EUID" -eq 0 ] then echo "Veuillez ne pas executez ce script en root. Choisissez un utilisateur pour votre serveur G1sms+ (nous recommandons l'utilisateur pi)" @@ -56,4 +58,8 @@ if [[ -f $MY_PATH/.install/templates/init.sh ]]; then cat $init_loc else echo "init.sh introuvable..." + exit 1 fi + +[[ -z $repOption || $repOption != "no" ]] && read -p "Voulez-vous installer les modules complémentaires de copylaradio ? (o/n)" repOption +[[ $repOption =~ ^(o|1|yes|options)$ ]] && .install/install_optional.sh From a23cb3a92c89aac8a28ec331226d42e00f5bd4c1 Mon Sep 17 00:00:00 2001 From: poka Date: Fri, 6 Dec 2019 18:34:06 +0100 Subject: [PATCH 14/41] Fix ipfs.service template and few stuff --- .install/install_optional.sh | 14 +++++++------- .install/install_requirements.sh | 8 ++++---- .install/templates/ipfs.service | 2 +- install.sh | 9 ++++++--- 4 files changed, 18 insertions(+), 15 deletions(-) diff --git a/.install/install_optional.sh b/.install/install_optional.sh index 7c41851..95e9d25 100755 --- a/.install/install_optional.sh +++ b/.install/install_optional.sh @@ -9,7 +9,7 @@ isARM=$(uname -a | grep arm) ################################## ## INSTALL TOOLS ######## YOUTUBE-DL ########## -sudo wget -P $MY_PATH https://yt-dl.org/downloads/latest/youtube-dl -O /usr/local/bin/youtube-dl +sudo wget https://yt-dl.org/downloads/latest/youtube-dl -O /usr/local/bin/youtube-dl sudo chmod a+rx /usr/local/bin/youtube-dl sudo apt install libid3-tools mpd mpc lame -y @@ -26,14 +26,14 @@ sudo apt-get install nginx php-curl php-sqlite3 php-gd php-json php-xml php-mbst sudo apt-get install lame sox libsox-fmt-mp3 eyed3 python-chardet imagemagick curl -y #libav-tools sudo apt-get install ca-certificates git-core binutils rsync alsa-utils bc libid3-tools espeak mpg321 fuse atomicparsley -y #libttspico-utils -wget -P $MY_PATH http://launchpadlibrarian.net/339874908/libav-tools_3.3.4-2_all.deb -O libav-tools.deb -wget -P $MY_PATH http://ftp.fr.debian.org/debian/pool/non-free/s/svox/libttspico-data_1.0+git20130326-3_all.deb -O libttspico-data.deb +wget http://launchpadlibrarian.net/339874908/libav-tools_3.3.4-2_all.deb -O $MY_PATH/libav-tools.deb +wget http://ftp.fr.debian.org/debian/pool/non-free/s/svox/libttspico-data_1.0+git20130326-3_all.deb -O $MY_PATH/libttspico-data.deb if [[ -z $isARM ]]; then - wget -P $MY_PATH http://ftp.fr.debian.org/debian/pool/non-free/s/svox/libttspico0_1.0+git20130326-5_amd64.deb -O libttspico0.deb - wget -P $MY_PATH http://ftp.fr.debian.org/debian/pool/non-free/s/svox/libttspico-utils_1.0+git20130326-9_amd64.deb -O libttspico-utils.deb + wget http://ftp.fr.debian.org/debian/pool/non-free/s/svox/libttspico0_1.0+git20130326-5_amd64.deb -O $MY_PATH/libttspico0.deb + wget http://ftp.fr.debian.org/debian/pool/non-free/s/svox/libttspico-utils_1.0+git20130326-9_amd64.deb -O $MY_PATH/libttspico-utils.deb else - wget -P $MY_PATH http://ftp.fr.debian.org/debian/pool/non-free/s/svox/libttspico0_1.0+git20130326-3_armhf.deb -O libttspico0.deb - wget -P $MY_PATH http://ftp.fr.debian.org/debian/pool/non-free/s/svox/libttspico-utils_1.0+git20130326-3_armhf.deb -O libttspico-utils.deb + wget http://ftp.fr.debian.org/debian/pool/non-free/s/svox/libttspico0_1.0+git20130326-3_armhf.deb -O $MY_PATH/libttspico0.deb + wget http://ftp.fr.debian.org/debian/pool/non-free/s/svox/libttspico-utils_1.0+git20130326-3_armhf.deb -O $MY_PATH/libttspico-utils.deb fi sudo dpkg -i $MY_PATH/libttspico-data.deb sudo dpkg -i $MY_PATH/libttspico0.deb diff --git a/.install/install_requirements.sh b/.install/install_requirements.sh index f57f869..ee6c3be 100755 --- a/.install/install_requirements.sh +++ b/.install/install_requirements.sh @@ -13,11 +13,11 @@ sudo apt install python3-pip libsodium18 -y pip3 install silkaj # Install IPFS -[[ ! -z $(which /usr/local/bin/ipfs) ]] && sudo service ipfs stop +[[ ! -z $(ls /usr/local/bin/ipfs) ]] && sudo service ipfs stop if [[ -z $isARM ]]; then - wget -P $MY_PATH https://dist.ipfs.io/ipfs-update/v1.5.2/ipfs-update_v1.5.2_linux-amd64.tar.gz -O ipfs-update.tar.gz + wget https://dist.ipfs.io/ipfs-update/v1.5.2/ipfs-update_v1.5.2_linux-amd64.tar.gz -O $MY_PATH/ipfs-update.tar.gz else - wget -P $MY_PATH https://dist.ipfs.io/ipfs-update/v1.5.2/ipfs-update_v1.5.2_linux-arm.tar.gz -O ipfs-update.tar.gz + wget https://dist.ipfs.io/ipfs-update/v1.5.2/ipfs-update_v1.5.2_linux-arm.tar.gz -O $MY_PATH/ipfs-update.tar.gz fi echo "INSTALL ipfs-update" @@ -31,7 +31,7 @@ echo "INSTALL latest ipfs" sudo ipfs-update install latest echo "CREATE SYSTEMD ipfs SERVICE" -[[ ! -z $(which /etc/systemd/system/ipfs.service) ]] && sudo rm /etc/systemd/system/ipfs.service +[[ ! -z $(ls /etc/systemd/system/ipfs.service) ]] && sudo rm /etc/systemd/system/ipfs.service sudo cp -f $MY_PATH/templates/ipfs.service /etc/systemd/system/ sudo sed -i "s/_USER/$USER/g" /etc/systemd/system/ipfs.service diff --git a/.install/templates/ipfs.service b/.install/templates/ipfs.service index 844d265..20602e5 100644 --- a/.install/templates/ipfs.service +++ b/.install/templates/ipfs.service @@ -3,7 +3,7 @@ Description=IPFS daemon After=network.target [Service] -User=pi +User=_USER ExecStart=/usr/local/bin/ipfs daemon --enable-pubsub-experiment --enable-namesys-pubsub --routing=dhtclient --enable-gc Restart=on-failure diff --git a/install.sh b/install.sh index b9eb09c..b9facda 100755 --- a/install.sh +++ b/install.sh @@ -8,6 +8,9 @@ MY_PATH="`dirname \"$0\"`" # relative MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized init_loc="$MY_PATH/shell/init.sh" +## Update G1sms+ code +git pull + now=$(date +%Y-%m-%d) chmod u+x .install/configure_ipfs_layer.sh .install/install_requirements.sh .install/install_optional.sh @@ -18,10 +21,10 @@ if [ "$EUID" -eq 0 ] exit 1 fi -echo "Ce script configure votre noeud G1sms+" -IPFS=$(ps auxf --sort=+utime | grep -w ipfs | grep -v -E 'color=auto|grep' | tail -n 1 | cut -d " " -f 1); +[[ -z $(which ipfs) ]] && echo "IPFS n'a pas été détecté sur votre machine, nous allons installer tous les prérequis..." && $MY_PATH/.install/install_requirements.sh && $MY_PATH/.install/configure_ipfs_layer.sh -[[ -z $IPFS ]] && echo "IPFS n'a pas été détecté sur votre machine, nous allons installer tous les prérequis..." && $MY_PATH/.install/install_requirements.sh && $MY_PATH/.install/configure_ipfs_layer.sh +echo "Ce script va désormais configurer votre noeud G1sms+" +IPFS=$(ps auxf --sort=+utime | grep -w ipfs | grep -v -E 'color=auto|grep' | tail -n 1 | cut -d " " -f 1); if [[ -f $MY_PATH/.install/templates/init.sh ]]; then echo "Quel est l'utilisateur du système IPFS (détecté: $IPFS)?" From 60e5f9a2c7fde2c992b4a393c324e8329e60ba99 Mon Sep 17 00:00:00 2001 From: poka Date: Fri, 6 Dec 2019 19:24:50 +0100 Subject: [PATCH 15/41] Add colors --- .gitignore | 1 + .install/export_colors.sh | 33 +++++++++++++++++++++++++++++ install.sh | 44 ++++++++++++++++++++++++--------------- 3 files changed, 61 insertions(+), 17 deletions(-) create mode 100755 .install/export_colors.sh diff --git a/.gitignore b/.gitignore index d3c34be..d587935 100644 --- a/.gitignore +++ b/.gitignore @@ -9,3 +9,4 @@ history.* TAG/ .install/errors .install/log +shell/init.sh.old diff --git a/.install/export_colors.sh b/.install/export_colors.sh new file mode 100755 index 0000000..c09180f --- /dev/null +++ b/.install/export_colors.sh @@ -0,0 +1,33 @@ +#!/bin/bash + +[[ ! -z $(cat ~/.bash_aliases | grep c_red) ]] && echo "Les couleurs sont déjà déclarés dans l'environnement" && exit 1 + +echo 'export c_blinkfast="\033[6m" +export c_light="\033[1m" +export c_white_bg="\033[47m" +export c_blue="\033[34m" +export c_red_bg="\033[41m" +export c_hide="\033[8m" +export c_purple_bg="\033[45m" +export c_yellow_bg="\033[43m" +export c_dark="\033[2m" +export c_reverse="003[7m" +export c_underline="\033[4m" +export c_blinkslow="\033[5m" +export c_red="\033[31m" +export c_white="\033[37m" +export c_cyan_bg="\033[46m" +export c_italic="\033[3m" +export c_black="\033[30m" +export c_cross="\033[9m" +export c_green="\033[32m" +export c_purple="\033[35m" +export c_="\033[0m" +export c_cyan="\033[36m" +export c_black_bg="\033[40m" +export c_yellow="\033[33m" +export c_blue_bg="\033[44m" +export c_green_bg="\033[42m"' >> ~/.bash_aliases + + +bash -i diff --git a/install.sh b/install.sh index b9facda..5c6e7e8 100755 --- a/install.sh +++ b/install.sh @@ -7,46 +7,54 @@ MY_PATH="`dirname \"$0\"`" # relative MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized init_loc="$MY_PATH/shell/init.sh" +now=$(date +%Y-%m-%d) +repOption=$1 ## Update G1sms+ code git pull -now=$(date +%Y-%m-%d) -chmod u+x .install/configure_ipfs_layer.sh .install/install_requirements.sh .install/install_optional.sh - -repOption=$1 +chmod u+x $MY_PATH/.install/*.sh if [ "$EUID" -eq 0 ] - then echo "Veuillez ne pas executez ce script en root. Choisissez un utilisateur pour votre serveur G1sms+ (nous recommandons l'utilisateur pi)" + then echo -e "${c_red}Veuillez ne pas executez ce script en root. Choisissez un utilisateur pour votre serveur G1sms+ (nous recommandons l'utilisateur pi)$c_" exit 1 fi -[[ -z $(which ipfs) ]] && echo "IPFS n'a pas été détecté sur votre machine, nous allons installer tous les prérequis..." && $MY_PATH/.install/install_requirements.sh && $MY_PATH/.install/configure_ipfs_layer.sh +$MY_PATH/.install/export_colors.sh -echo "Ce script va désormais configurer votre noeud G1sms+" +## Vérifie si IPFS est installé +if [[ -z $(which ipfs) ]];then + echo -e "${c_yellow}IPFS n'a pas été détecté sur votre machine, nous allons installer tous les prérequis...$c_" + $MY_PATH/.install/install_requirements.sh + $MY_PATH/.install/configure_ipfs_layer.sh +else + echo -e "${c_green}IPFS est déjà installé, configuration du noeud ...$c_" +fi + +echo -e "${c_yellow}Ce script va désormais configurer votre noeud G1sms+$c_" IPFS=$(ps auxf --sort=+utime | grep -w ipfs | grep -v -E 'color=auto|grep' | tail -n 1 | cut -d " " -f 1); if [[ -f $MY_PATH/.install/templates/init.sh ]]; then - echo "Quel est l'utilisateur du système IPFS (détecté: $IPFS)?" + echo -e "${c_light}Quel est l'utilisateur du système IPFS (détecté: $IPFS)?$c_" read YOU if [[ "$YOU" == "" ]]; then YOU=$IPFS; fi - echo "Votre PSEUDO? (celui de votre Compte membre Duniter)" + echo -e "${c_light}Votre PSEUDO? (celui de votre Compte membre Duniter)$c_" read ADMINPSEUDO - if [[ "$ADMINPSEUDO" == "" ]]; then echo "IMPOSSIBLE DE CONTINUER"; exit; fi + if [[ "$ADMINPSEUDO" == "" ]]; then echo -e "${c_red}IMPOSSIBLE DE CONTINUER$c_"; exit; fi - echo "Le Numéro de téléphone SMS Admin? (Support de ce noeud) (ex +33611223344)" + echo -e "${c_light}Le Numéro de téléphone SMS Admin? (Support de ce noeud) (ex +33611223344)$c_" read ADMINPHONE - if [[ "$ADMINPHONE" == "" ]]; then echo "IMPOSSIBLE DE CONTINUER"; exit; fi + if [[ "$ADMINPHONE" == "" ]]; then echo -e "${c_red}IMPOSSIBLE DE CONTINUER$c_"; exit; fi - echo "Le numéro de la carte SIM, du module SMS. AUCUNE liaison SMS? Laissez vide (défaut: +33600000000)" + echo -e "${c_light}Le numéro de la carte SIM, du module SMS. AUCUNE liaison SMS? Laissez vide (défaut: +33600000000)$c_" read MASTERPHONE if [[ "$MASTERPHONE" == "" ]]; then MASTERPHONE="+33600000000"; fi - echo "L'adresse où se trouve votre G1Node pour indiquer où venir chercher ses G1Tag (ex: au G1FabLab de Toulouse)" + echo -e "${c_light}L'adresse où se trouve votre G1Node pour indiquer où venir chercher ses G1Tag (ex: au G1FabLab de Toulouse)$c_" read ADRESSE - echo "LES PARAMETRES SONT BONS? Appliquer? ENTER ou CTRL-C ?" + echo -e "${c_light}${c_blue}LES PARAMETRES SONT BONS? Appliquer? ENTER ou CTRL-C ?$c_" read [[ -f shell/init.sh ]] && mv shell/init.sh shell/init.sh.old @@ -60,9 +68,11 @@ if [[ -f $MY_PATH/.install/templates/init.sh ]]; then cat $init_loc else - echo "init.sh introuvable..." + echo -e "${c_red}init.sh introuvable...$c_" exit 1 fi -[[ -z $repOption || $repOption != "no" ]] && read -p "Voulez-vous installer les modules complémentaires de copylaradio ? (o/n)" repOption +## Installation optionnel de copylaradio + +[[ -z $repOption ]] && echo -e "${c_yellow}Voulez-vous installer les modules complémentaires de copylaradio ? (o/n)$c_" && read repOption [[ $repOption =~ ^(o|1|yes|options)$ ]] && .install/install_optional.sh From e6db53a4df3ecf9ed150fb11554e9af8eef34760 Mon Sep 17 00:00:00 2001 From: poka Date: Fri, 6 Dec 2019 19:28:45 +0100 Subject: [PATCH 16/41] fix colors --- .install/export_colors.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.install/export_colors.sh b/.install/export_colors.sh index c09180f..92cc32a 100755 --- a/.install/export_colors.sh +++ b/.install/export_colors.sh @@ -1,6 +1,6 @@ #!/bin/bash -[[ ! -z $(cat ~/.bash_aliases | grep c_red) ]] && echo "Les couleurs sont déjà déclarés dans l'environnement" && exit 1 +[[ -f ~/.bash_aliases && ! -z $(cat ~/.bash_aliases | grep c_red) ]] && echo "Les couleurs sont déjà déclarés dans l'environnement" && exit 1 echo 'export c_blinkfast="\033[6m" export c_light="\033[1m" From 5cab225e79b1966168158337717f5529c0cddb40 Mon Sep 17 00:00:00 2001 From: poka Date: Fri, 6 Dec 2019 18:37:55 +0000 Subject: [PATCH 17/41] fix colors --- .install/export_colors.sh | 3 +-- install.sh | 1 + 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.install/export_colors.sh b/.install/export_colors.sh index 92cc32a..a036e55 100755 --- a/.install/export_colors.sh +++ b/.install/export_colors.sh @@ -29,5 +29,4 @@ export c_yellow="\033[33m" export c_blue_bg="\033[44m" export c_green_bg="\033[42m"' >> ~/.bash_aliases - -bash -i +source ~/.bash_aliases diff --git a/install.sh b/install.sh index 5c6e7e8..0922e7a 100755 --- a/install.sh +++ b/install.sh @@ -21,6 +21,7 @@ if [ "$EUID" -eq 0 ] fi $MY_PATH/.install/export_colors.sh +[[ -f ~/.bash_aliases ]] && source ~/.bash_aliases ## Vérifie si IPFS est installé if [[ -z $(which ipfs) ]];then From 875611062fb379f40e17f6c869b4a806366d6d5e Mon Sep 17 00:00:00 2001 From: poka Date: Fri, 6 Dec 2019 19:48:55 +0100 Subject: [PATCH 18/41] Improve questions ... --- .install/configure_ipfs_layer.sh | 7 ++++--- install.sh | 6 +++--- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/.install/configure_ipfs_layer.sh b/.install/configure_ipfs_layer.sh index 719f9e1..b17c3ef 100755 --- a/.install/configure_ipfs_layer.sh +++ b/.install/configure_ipfs_layer.sh @@ -15,9 +15,9 @@ templates="$MY_PATH/templates" ####################################### if [ "$EUID" -eq 0 ] - then echo "Veuillez ne pas executez ce script en root. Choisissez un utilisateur pour votre serveur G1sms+ (nous recommandons l'utilisateur pi)" + then echo -e "${c_red}Veuillez ne pas executez ce script en root. Choisissez un utilisateur pour votre serveur G1sms+ (nous recommandons l'utilisateur pi)$c_" exit 1 -else echo "$USER, let's go!"; +else echo -e "${c_yellow}OK $USER, let's go!$c_"; fi [[ -d ~/.ipfs/ ]] && rm -rf ~/.ipfs-old && mv ~/.ipfs/ ~/.ipfs-old @@ -51,4 +51,5 @@ if [[ -z $(grep fred@rec ~/.ssh/authorized_keys) ]]; then fi # START ipfs -sudo systemctl start ipfs +echo -e "${c_green}Démarrage de IPFS ...$c_" +sudo systemctl start ipfs || echo -e "${c_red}IPFS n'a pas pu démarrer ...$c_" diff --git a/install.sh b/install.sh index 0922e7a..6ce18be 100755 --- a/install.sh +++ b/install.sh @@ -24,12 +24,12 @@ $MY_PATH/.install/export_colors.sh [[ -f ~/.bash_aliases ]] && source ~/.bash_aliases ## Vérifie si IPFS est installé -if [[ -z $(which ipfs) ]];then - echo -e "${c_yellow}IPFS n'a pas été détecté sur votre machine, nous allons installer tous les prérequis...$c_" +if [[ -z $(which ipfs) || -z $(which gammu) ]];then + echo -e "${c_yellow}IPFS ou gammu n'ont pas été détectés sur votre machine, nous allons installer tous les prérequis...$c_" $MY_PATH/.install/install_requirements.sh $MY_PATH/.install/configure_ipfs_layer.sh else - echo -e "${c_green}IPFS est déjà installé, configuration du noeud ...$c_" + echo -e "${c_green}IPFS et gammu sont déjà installé !$c_" fi echo -e "${c_yellow}Ce script va désormais configurer votre noeud G1sms+$c_" From ddbda0d6a56b6323eea1c99100cbbac0f35f8232 Mon Sep 17 00:00:00 2001 From: poka Date: Fri, 6 Dec 2019 19:01:40 +0000 Subject: [PATCH 19/41] fix install requirements --- .install/install_requirements.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.install/install_requirements.sh b/.install/install_requirements.sh index ee6c3be..4b04932 100755 --- a/.install/install_requirements.sh +++ b/.install/install_requirements.sh @@ -13,7 +13,7 @@ sudo apt install python3-pip libsodium18 -y pip3 install silkaj # Install IPFS -[[ ! -z $(ls /usr/local/bin/ipfs) ]] && sudo service ipfs stop +[[ -f /usr/local/bin/ipfs ]] && sudo service ipfs stop if [[ -z $isARM ]]; then wget https://dist.ipfs.io/ipfs-update/v1.5.2/ipfs-update_v1.5.2_linux-amd64.tar.gz -O $MY_PATH/ipfs-update.tar.gz else @@ -31,7 +31,7 @@ echo "INSTALL latest ipfs" sudo ipfs-update install latest echo "CREATE SYSTEMD ipfs SERVICE" -[[ ! -z $(ls /etc/systemd/system/ipfs.service) ]] && sudo rm /etc/systemd/system/ipfs.service +[[ -f /etc/systemd/system/ipfs.service ]] && sudo rm /etc/systemd/system/ipfs.service sudo cp -f $MY_PATH/templates/ipfs.service /etc/systemd/system/ sudo sed -i "s/_USER/$USER/g" /etc/systemd/system/ipfs.service From 1b845057e30c44327ee8b7fc699fcbd2746acea7 Mon Sep 17 00:00:00 2001 From: poka Date: Fri, 6 Dec 2019 20:25:12 +0100 Subject: [PATCH 20/41] force install gammu-smsd --- .install/install_requirements.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.install/install_requirements.sh b/.install/install_requirements.sh index 4b04932..4320b7e 100755 --- a/.install/install_requirements.sh +++ b/.install/install_requirements.sh @@ -42,7 +42,7 @@ sudo systemctl enable ipfs # Install gammu sudo apt install ppp screen git minicom gammu -y sleep 1 -sudo apt install gammu-smsd -y +sudo apt install gammu-smsd -y || sudo apt install -f sudo usermod -aG gammu $USER From 7750613dd5d4e3b3382cd3da84062f994f6eafba Mon Sep 17 00:00:00 2001 From: poka Date: Fri, 6 Dec 2019 20:36:21 +0100 Subject: [PATCH 21/41] fix install_optionnal --- .install/install_optional.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.install/install_optional.sh b/.install/install_optional.sh index 95e9d25..804e854 100755 --- a/.install/install_optional.sh +++ b/.install/install_optional.sh @@ -38,7 +38,7 @@ fi sudo dpkg -i $MY_PATH/libttspico-data.deb sudo dpkg -i $MY_PATH/libttspico0.deb sudo dpkg -i $MY_PATH/libttspico-utils.deb -sudo dpkg -i $MY_PATH/libav-tools.deb +sudo dpkg -i $MY_PATH/libav-tools.deb || sudo apt --fix-broken install rm $MY_PATH/libttspico-data.deb $MY_PATH/libttspico0.deb $MY_PATH/libttspico-utils.deb $MY_PATH/libav-tools.deb From 03c37f00f1971c735962b21e496a2d02ac62c497 Mon Sep 17 00:00:00 2001 From: poka Date: Fri, 6 Dec 2019 19:54:13 +0000 Subject: [PATCH 22/41] Add force requirements options, autodetect libsodium version --- .install/install_requirements.sh | 3 ++- install.sh | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.install/install_requirements.sh b/.install/install_requirements.sh index 4320b7e..9ce3823 100755 --- a/.install/install_requirements.sh +++ b/.install/install_requirements.sh @@ -9,7 +9,8 @@ sudo apt update sudo apt install curl jq -y # Silkaj + Duniterpy -sudo apt install python3-pip libsodium18 -y +libsodium=$(sudo apt search libsodium | grep -v "header" | grep "Network communication" -B1 | head -n1 | awk -F '/' '{ print $1 }') +sudo apt install python3-pip $libsodium -y pip3 install silkaj # Install IPFS diff --git a/install.sh b/install.sh index 6ce18be..df81a6b 100755 --- a/install.sh +++ b/install.sh @@ -9,6 +9,7 @@ MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized init_loc="$MY_PATH/shell/init.sh" now=$(date +%Y-%m-%d) repOption=$1 +#force_req="o" ## Update G1sms+ code git pull @@ -24,7 +25,7 @@ $MY_PATH/.install/export_colors.sh [[ -f ~/.bash_aliases ]] && source ~/.bash_aliases ## Vérifie si IPFS est installé -if [[ -z $(which ipfs) || -z $(which gammu) ]];then +if [[ $force_req == "o" || -z $(which ipfs) || -z $(which gammu) ]];then echo -e "${c_yellow}IPFS ou gammu n'ont pas été détectés sur votre machine, nous allons installer tous les prérequis...$c_" $MY_PATH/.install/install_requirements.sh $MY_PATH/.install/configure_ipfs_layer.sh From fd20423bc411f775b7cce1e6350b93a4c227841a Mon Sep 17 00:00:00 2001 From: poka Date: Sun, 8 Dec 2019 03:24:18 +0100 Subject: [PATCH 23/41] Ajout du lien du pad readme --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index b2e33c6..2a9d600 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,8 @@ # G1sms+ +### Lien du pad : https://pad.p2p.legal/G1sms-install + + > LE DRAPEAU DE LA MONNAIE LIBRE EST PLANTE DANS LE SYSTEME DE FICHIER INTERPLANETAIRE!! :: [G1Forge / G1FabLab](https://www.g1sms.fr/fr/blog) :: Il s'agit de la seconde version de G1sms. Cette mouture utilise une carte fille GSM (à la place d'un dongle USB) et ajoute une couche de communication inter noeuds grâce à l'utilisation de IPFS. From 16f6c4c0bf3ce4ed41e060b36a7a37b9fab8bb10 Mon Sep 17 00:00:00 2001 From: poka Date: Tue, 10 Dec 2019 04:56:02 +0100 Subject: [PATCH 24/41] Add playSMS install, improve global install --- ...uirements.sh => 1-install_requirements.sh} | 0 ...pfs_layer.sh => 2-configure_ipfs_layer.sh} | 0 ...l_optional.sh => 3-install_copylaradio.sh} | 0 .install/4-install_playsms.sh | 123 ++++++++++++++++++ .install/templates/.profile | 7 + .install/templates/install-playsms.conf | 43 ++++++ .install/templates/playsms.conf | 40 ++++++ .install/templates/proxypass.conf | 9 ++ .install/templates/ssl.conf | 16 +++ .install/templates/ssl_renew.sh | 26 ++++ .profile | 7 + install.sh | 68 +++++----- 12 files changed, 310 insertions(+), 29 deletions(-) rename .install/{install_requirements.sh => 1-install_requirements.sh} (100%) rename .install/{configure_ipfs_layer.sh => 2-configure_ipfs_layer.sh} (100%) rename .install/{install_optional.sh => 3-install_copylaradio.sh} (100%) create mode 100755 .install/4-install_playsms.sh create mode 100644 .install/templates/.profile create mode 100644 .install/templates/install-playsms.conf create mode 100644 .install/templates/playsms.conf create mode 100644 .install/templates/proxypass.conf create mode 100644 .install/templates/ssl.conf create mode 100644 .install/templates/ssl_renew.sh create mode 100644 .profile diff --git a/.install/install_requirements.sh b/.install/1-install_requirements.sh similarity index 100% rename from .install/install_requirements.sh rename to .install/1-install_requirements.sh diff --git a/.install/configure_ipfs_layer.sh b/.install/2-configure_ipfs_layer.sh similarity index 100% rename from .install/configure_ipfs_layer.sh rename to .install/2-configure_ipfs_layer.sh diff --git a/.install/install_optional.sh b/.install/3-install_copylaradio.sh similarity index 100% rename from .install/install_optional.sh rename to .install/3-install_copylaradio.sh diff --git a/.install/4-install_playsms.sh b/.install/4-install_playsms.sh new file mode 100755 index 0000000..e8eb6b4 --- /dev/null +++ b/.install/4-install_playsms.sh @@ -0,0 +1,123 @@ +#!/bin/bash + +MY_PATH="`dirname \"$0\"`" # relative +MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized + +unset err + +echo -e "${c_yellow}Choisissez un nom de domain pour playsms: $c_" +read PSMS_DOMAIN + +sudo apt -y update +sudo apt -y install nginx php7.3-fpm php7.3-gd php7.3-mysql php7.3-curl php7.3-imap php7.3-mbstring php7.3-xml php7.3-cli mysql-server + +## Create database + +if [[ ! $(sudo mysql -e "show databases;" | grep playsms) ]]; then + sudo mysql -e "CREATE DATABASE playsms" + sudo mysql -e "CREATE USER 'playsms'@'localhost' IDENTIFIED BY 'playsms@mdp+';" + sudo mysql -e "GRANT ALL PRIVILEGES ON playsms.* TO 'playsms'@'localhost';" + sudo mysql -e "FLUSH PRIVILEGES;" +fi + +## Clone repo playSMS +git clone https://github.com/antonraharja/playSMS.git $MY_PATH/playsms + +cp $MY_PATH/templates/install-playsms.conf $MY_PATH/playsms/install.conf +pwdDB=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 42 | head -n 1) +sed -i "s/_pwdDB/$pwdDB/g" $MY_PATH/playsms/install.conf + +sudo chmod u+x $MY_PATH/playsms/install-playsms.sh +cd $MY_PATH/playsms +sudo ./install-playsms.sh +cd $MY_PATH +sudo rm -rf playsms + + +## Start playsmsd on boot +sudo /usr/local/bin/playsmsd start +[[ ! $(grep playsmsd /etc/rc.local) ]] && sudo sed -i '/^exit 0.*/i /usr/local/bin/playsmsd start' /etc/rc.local + +## Tests +if [[ $(sudo playsmsd status) =~ "is running" ]]; then + echo -e "${c_green}playSMS a été installé correctement et le daemon est démarré =)$c_" +else + echo -e "${c_red}Une erreur est survenu$c_" + err=1 +fi + +## Config NGINX + +[[ ! -d /etc/nginx/def_conf ]] && sudo mkdir /etc/nginx/def_conf/ +sudo cp $MY_PATH/templates/proxypass.conf /etc/nginx/def_conf/ +sudo cp $MY_PATH/templates/playsms.conf /etc/nginx/conf.d/ +sudo sed -i "s/_PSMS_DOMAIN/$PSMS_DOMAIN/" /etc/nginx/conf.d/playsms.conf + +## Active SSL + +manageSSL() { + + local action=$1 + [[ ! $action =~ ^(on|off|certif)$ ]] && echo "Veuillez choisir ssl, nonssl ou certif pour créer un certificat ssl" && exit 1 + + install_certbot(){ + if [[ $(grep buster /etc/os-release) ]]; then + [[ -z $(cat /etc/apt/sources.list | grep "buster-backports main") ]] && echo "deb http://deb.debian.org/debian buster-backports main" >> /etc/apt/sources.list + sudo apt update + sudo apt install certbot python-certbot-nginx -t buster-backports -y + elif [[ $(grep stretch /etc/os-release) ]]; then + sudo apt update + sudo apt install certbot python-certbot-nginx -y + fi + } + + create_certificate() { + sudo certbot --nginx certonly --non-interactive --agree-tos -m $USER@$PSMS_DOMAIN -d $PSMS_DOMAIN && echo "Le certificat de $PSMS_DOMAIN a bien été déployé" || echo "Une erreur s'est produite lors de la création du certificat SSL" + + ## Cronification + [[ ! -e /opt/scripts ]] && sudo mkdir /opt/scripts + sudo cp $MY_PATH/templates/ssl_renew.sh /opt/scripts/ + [[ -z $(sudo crontab -l | grep "/opt/scripts/ssl_renew.sh") ]] && (sudo crontab -l ; sudo echo "12 2 * * 1 /opt/scripts/ssl_renew.sh") | sudo crontab -u root - + } + + + case $action in + on) + sudo sed -i 's/ #if/ if/' /etc/nginx/conf.d/playsms.conf + + sudo sed -i "s/listen 443;/listen 443 ssl;/" /etc/nginx/conf.d/playsms.conf + [[ ! -d /etc/nginx/includes ]] && sudo mkdir /etc/nginx/includes + sudo cp $MY_PATH/templates/ssl.conf /etc/nginx/includes/ + sudo sed -i "/Content-Security-Policy/a \ include includes/ssl.conf;\n ssl_certificate /etc/letsencrypt/live/$PSMS_DOMAIN/fullchain.pem;\n ssl_certificate_key /etc/letsencrypt/live/$PSMS_DOMAIN/privkey.pem;" /etc/nginx/conf.d/playsms.conf + ;; + + off) + sudo sed -i 's/ if/ #if/' /etc/nginx/conf.d/playsms.conf + sudo sed -i '/ssl.conf;/d' /etc/nginx/conf.d/playsms.conf + sudo sed -i '/ssl_certificate/d' /etc/nginx/conf.d/playsms.conf + ;; + certif) + [[ -z $(which certbot) ]] && install_certbot + [[ -n /etc/letsencrypt/live/$PSMS_DOMAIN/fullchain.pem ]] && create_certificate + ;; + + esac +} + +echo -e "${c_yellow}playSMS ne fonctionne pas sans certifcat SSL.$c_" +printf "${c_yellow}Voulez activer installer un certificat SSL maintenant pour $PSMS_DOMAIN ? (o/n) $c_" +read askSSL +if [[ $askSSL =~ ^(o|y|yes|oui|Y|O|YES)$ ]]; then + manageSSL certif + if sudo test -f /etc/letsencrypt/live/$PSMS_DOMAIN/fullchain.pem; then manageSSL on; else manageSSL off && echo "Une erreur s'est produite, basculement vers le mode non SSL"; fi + http=https +else + manageSSL off + http=http +fi + +sudo service nginx restart + +[[ ! $err ]] && echo -e "${c_green}Félicitation ! playSMS est accessible via l'URL $http://$PSMS_DOMAIN" || echo -e "${c_red}Installation incomplète$c_" + +exit 0 diff --git a/.install/templates/.profile b/.install/templates/.profile new file mode 100644 index 0000000..c4a4d75 --- /dev/null +++ b/.install/templates/.profile @@ -0,0 +1,7 @@ +#!/bin/bash + +ADMINPSEUDO= +ADMINPHONE= +MASTERPHONE= +ADRESSE= + diff --git a/.install/templates/install-playsms.conf b/.install/templates/install-playsms.conf new file mode 100644 index 0000000..03cd481 --- /dev/null +++ b/.install/templates/install-playsms.conf @@ -0,0 +1,43 @@ +# MySQL database username +DBUSER="playsms" + +# MySQL database password +DBPASS="_pwdDB" + +# MySQL database name +DBNAME="playsms" + +# MySQL database host +DBHOST="localhost" + +# MySQL database port +DBPORT="3306" + +# Web server's user, for example apache2 user by default is www-data +# note: please make sure your web server user +WEBSERVERUSER="www-data" + +# Web server's group, for example apache2 group by default is www-data +# note: please make sure your web server group +WEBSERVERGROUP="www-data" + +# Path to playSMS extracted source files +PATHSRC="$(pwd)" + +# Path to playSMS web files +# note: please make sure your web root path, in this example its /var/www/html +PATHWEB="/var/www/playsms" + +# Path to playSMS additional files +PATHLIB="/var/www/playsms/lib/" + +# Path to playSMS daemon and other binary files +PATHBIN="/usr/local/bin" + +# Path to playSMS log files +PATHLOG="/var/log/playsms" + +# Path to playSMS daemon configuration file +# note: this example will create playsmsd.conf in /etc +PATHCONF="/etc" + diff --git a/.install/templates/playsms.conf b/.install/templates/playsms.conf new file mode 100644 index 0000000..41dce2f --- /dev/null +++ b/.install/templates/playsms.conf @@ -0,0 +1,40 @@ +server { + listen 80; + listen 443; + listen [::]:443 ssl; + server_name _PSMS_DOMAIN; + + add_header Content-Security-Policy upgrade-insecure-requests; + add_header 'Access-Control-Allow-Origin' '*'; + + #if ($http_x_forwarded_proto = "http") { return 301 https://$server_name$request_uri; } + + location / { + try_files $uri/ $uri /index.php?/$request_uri; # =404; + include /etc/nginx/def_conf/proxypass.conf; + } + + + index index.php index.html; + root /var/www/playsms/; + + # set expiration of assets to MAX for caching + location ~* \.(ico|css|js|gif|jpe?g|png)(\?[0-9]+)?$ { + expires max; + log_not_found off; + } + + # php parsing + location ~ \.php$ { + include fastcgi_params; + fastcgi_pass unix:/var/run/php/php7.3-fpm.sock; + fastcgi_index index.php; + fastcgi_param SCRIPT_FILENAME $request_filename; + } + + error_log /var/log/nginx/playsms_error.log; + access_log /var/log/nginx/playsms_access.log; + + +} + diff --git a/.install/templates/proxypass.conf b/.install/templates/proxypass.conf new file mode 100644 index 0000000..1e3fc6a --- /dev/null +++ b/.install/templates/proxypass.conf @@ -0,0 +1,9 @@ +proxy_http_version 1.1; +proxy_set_header Upgrade $http_upgrade; +proxy_set_header Connection "upgrade"; +proxy_set_header Host $http_host; +proxy_set_header X-Real-IP $remote_addr; +proxy_set_header X-Forward-For $proxy_add_x_forwarded_for; +proxy_set_header X-Forward-Proto http; +proxy_set_header X-Nginx-Proxy true; + diff --git a/.install/templates/ssl.conf b/.install/templates/ssl.conf new file mode 100644 index 0000000..64ff68f --- /dev/null +++ b/.install/templates/ssl.conf @@ -0,0 +1,16 @@ + ssl_session_timeout 4h; + ssl_session_cache shared:SSL:50m; + + ssl_protocols TLSv1 TLSv1.1 TLSv1.2; + ssl_ciphers 'ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES128-CBC-SHA:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-DES-CBC3-SHA:ECDHE-RSA-DES-CBC3-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:DES-CBC3-SHA:!DSS'; + ssl_prefer_server_ciphers on; + + add_header Strict-Transport-Security max-age=15768000; + + ssl_stapling on; + ssl_stapling_verify on; + + resolver 8.8.8.8 8.8.4.4 valid=86400; + resolver_timeout 10; + + ssl_session_tickets on; diff --git a/.install/templates/ssl_renew.sh b/.install/templates/ssl_renew.sh new file mode 100644 index 0000000..5915d47 --- /dev/null +++ b/.install/templates/ssl_renew.sh @@ -0,0 +1,26 @@ +#!/bin/bash + +log="/var/log/ssl_renew.log" +date=$(date +%d-%m-%Y) + +renew=$(certbot renew --pre-hook "service nginx stop" --post-hook "service nginx start") + +echo "####################################################################################" >> $log +echo "#################################### $date ####################################" >> $log +echo "####################################################################################" >> $log + +echo "$renew" >> $log + +if [[ $renew = *"No hooks were run"* ]]; then + echo "Rien n'a été fait" >> $log +else + sleep 5 + sudo service nginx stop + sleep 1 + killall nginx + sleep 3 + sudo service nginx restart &>> $log + echo "Des certificats ont été renouvellés" >> $log +fi + +exit 0 diff --git a/.profile b/.profile new file mode 100644 index 0000000..a6d3ca3 --- /dev/null +++ b/.profile @@ -0,0 +1,7 @@ +#!/bin/bash + +ADMINPSEUDO=poka +ADMINPHONE=0650573417 +MASTERPHONE=0699999999 +ADRESSE=Blois + diff --git a/install.sh b/install.sh index df81a6b..16e9716 100755 --- a/install.sh +++ b/install.sh @@ -8,59 +8,58 @@ MY_PATH="`dirname \"$0\"`" # relative MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized init_loc="$MY_PATH/shell/init.sh" now=$(date +%Y-%m-%d) -repOption=$1 -#force_req="o" -## Update G1sms+ code -git pull +args="$@" +[[ $args =~ all ]] && repOption=o +[[ $args =~ noptions ]] && repOption=n +[[ $args =~ force ]] && force_req=o +[[ $args =~ noask ]] && noask=o -chmod u+x $MY_PATH/.install/*.sh +unset err if [ "$EUID" -eq 0 ] then echo -e "${c_red}Veuillez ne pas executez ce script en root. Choisissez un utilisateur pour votre serveur G1sms+ (nous recommandons l'utilisateur pi)$c_" exit 1 fi +## Update G1sms+ code +git pull || err=1 + +chmod u+x $MY_PATH/.install/*.sh + $MY_PATH/.install/export_colors.sh [[ -f ~/.bash_aliases ]] && source ~/.bash_aliases ## Vérifie si IPFS est installé if [[ $force_req == "o" || -z $(which ipfs) || -z $(which gammu) ]];then echo -e "${c_yellow}IPFS ou gammu n'ont pas été détectés sur votre machine, nous allons installer tous les prérequis...$c_" - $MY_PATH/.install/install_requirements.sh - $MY_PATH/.install/configure_ipfs_layer.sh + $MY_PATH/.install/1-install_requirements.sh || err=1 + $MY_PATH/.install/2-configure_ipfs_layer.sh || err=1 else echo -e "${c_green}IPFS et gammu sont déjà installé !$c_" fi echo -e "${c_yellow}Ce script va désormais configurer votre noeud G1sms+$c_" -IPFS=$(ps auxf --sort=+utime | grep -w ipfs | grep -v -E 'color=auto|grep' | tail -n 1 | cut -d " " -f 1); +YOU=$(ps auxf --sort=+utime | grep -w ipfs | grep -v -E 'color=auto|grep' | tail -n 1 | cut -d " " -f 1); +[[ -f .profile ]] && source .profile if [[ -f $MY_PATH/.install/templates/init.sh ]]; then - echo -e "${c_light}Quel est l'utilisateur du système IPFS (détecté: $IPFS)?$c_" - read YOU - if [[ "$YOU" == "" ]]; then YOU=$IPFS; fi + [[ ! $ADMINPSEUDO ]] && echo -e "${c_light}Votre PSEUDO? (celui de votre Compte membre Duniter)$c_" && read ADMINPSEUDO + [[ "$ADMINPSEUDO" == "" ]] && echo -e "${c_red}IMPOSSIBLE DE CONTINUER$c_" && exit 1 - echo -e "${c_light}Votre PSEUDO? (celui de votre Compte membre Duniter)$c_" - read ADMINPSEUDO - if [[ "$ADMINPSEUDO" == "" ]]; then echo -e "${c_red}IMPOSSIBLE DE CONTINUER$c_"; exit; fi + [[ ! $ADMINPHONE ]] && echo -e "${c_light}Le Numéro de téléphone SMS Admin? (Support de ce noeud) (ex +33611223344)$c_" && read ADMINPHONE + [[ "$ADMINPHONE" == "" ]] && echo -e "${c_red}IMPOSSIBLE DE CONTINUER$c_" && exit 1 - echo -e "${c_light}Le Numéro de téléphone SMS Admin? (Support de ce noeud) (ex +33611223344)$c_" - read ADMINPHONE - if [[ "$ADMINPHONE" == "" ]]; then echo -e "${c_red}IMPOSSIBLE DE CONTINUER$c_"; exit; fi + [[ ! $MASTERPHONE ]] && echo -e "${c_light}Le numéro de la carte SIM, du module SMS. AUCUNE liaison SMS? Laissez vide (défaut: +33600000000)$c_" && read MASTERPHONE + [[ "$MASTERPHONE" == "" ]] && MASTERPHONE="+33600000000" - echo -e "${c_light}Le numéro de la carte SIM, du module SMS. AUCUNE liaison SMS? Laissez vide (défaut: +33600000000)$c_" - read MASTERPHONE - if [[ "$MASTERPHONE" == "" ]]; then MASTERPHONE="+33600000000"; fi + [[ ! $ADRESSE ]] && echo -e "${c_light}L'adresse où se trouve votre G1Node pour indiquer où venir chercher ses G1Tag (ex: au G1FabLab de Toulouse)$c_" && read ADRESSE - echo -e "${c_light}L'adresse où se trouve votre G1Node pour indiquer où venir chercher ses G1Tag (ex: au G1FabLab de Toulouse)$c_" - read ADRESSE - - echo -e "${c_light}${c_blue}LES PARAMETRES SONT BONS? Appliquer? ENTER ou CTRL-C ?$c_" - read + echo -e "ADMINPSEUDO: $ADMINPSEUDO\nADMINPHONE: $ADMINPHONE\nMASTERPHONE: $MASTERPHONE\nADRESSE: $ADRESSE" + [[ $noask != "o" ]] && echo -e "${c_light}${c_blue}LES PARAMETRES SONT BONS? Appliquer? ENTER ou CTRL-C ?$c_" && read [[ -f shell/init.sh ]] && mv shell/init.sh shell/init.sh.old - cp $MY_PATH/.install/templates/init.sh shell/init.sh + cp $MY_PATH/.install/templates/init.sh shell/init.sh || err=1 sed -i s/pi/$YOU/g $init_loc sed -i s/+33600000000/$MASTERPHONE/g $init_loc @@ -68,13 +67,24 @@ if [[ -f $MY_PATH/.install/templates/init.sh ]]; then sed -i s/+33647683646/$ADMINPHONE/g $init_loc sed -i s/Fred/$ADMINPSEUDO/g $init_loc - cat $init_loc + cat $init_loc || err=1 else echo -e "${c_red}init.sh introuvable...$c_" + err=1 exit 1 fi -## Installation optionnel de copylaradio +## Installations optionnels +repOld=$repOption [[ -z $repOption ]] && echo -e "${c_yellow}Voulez-vous installer les modules complémentaires de copylaradio ? (o/n)$c_" && read repOption -[[ $repOption =~ ^(o|1|yes|options)$ ]] && .install/install_optional.sh +[[ $repOption =~ ^(o|1|yes|options|a|all)$ ]] && .install/3-install_copylaradio.sh; repOption=$repOld +[[ -z $repOption ]] && echo -e "${c_yellow}Voulez-vous installer l'interface web playSMS ? (o/n)$c_" && read repOption +[[ $repOption =~ ^(o|1|yes|options|a|all)$ ]] && .install/4-install_playsms.sh; repOption=$repOld + +if [[ $err ]]; then + echo -e "---\n${c_red}L'installation n'est mal déroulé =($c_" +else + echo -e "---\n${c_green}L'installation de votre noeud G1SMS est terminé !\nBienvenue à bord =)$c_" +fi +exit 0 From a2c42d6d764866d12ce08236c1b035f27eaf9ae9 Mon Sep 17 00:00:00 2001 From: poka Date: Tue, 10 Dec 2019 05:00:57 +0100 Subject: [PATCH 25/41] Remove .profile --- .gitignore | 1 + .profile | 7 ------- 2 files changed, 1 insertion(+), 7 deletions(-) delete mode 100644 .profile diff --git a/.gitignore b/.gitignore index d587935..183b73d 100644 --- a/.gitignore +++ b/.gitignore @@ -10,3 +10,4 @@ TAG/ .install/errors .install/log shell/init.sh.old +.profile diff --git a/.profile b/.profile deleted file mode 100644 index a6d3ca3..0000000 --- a/.profile +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/bash - -ADMINPSEUDO=poka -ADMINPHONE=0650573417 -MASTERPHONE=0699999999 -ADRESSE=Blois - From 92399892a823492729bf548814aa5f3bf0ab289e Mon Sep 17 00:00:00 2001 From: poka Date: Tue, 10 Dec 2019 04:06:58 +0000 Subject: [PATCH 26/41] Change mysql to mariadb --- .install/4-install_playsms.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.install/4-install_playsms.sh b/.install/4-install_playsms.sh index e8eb6b4..b41b683 100755 --- a/.install/4-install_playsms.sh +++ b/.install/4-install_playsms.sh @@ -9,7 +9,7 @@ echo -e "${c_yellow}Choisissez un nom de domain pour playsms: $c_" read PSMS_DOMAIN sudo apt -y update -sudo apt -y install nginx php7.3-fpm php7.3-gd php7.3-mysql php7.3-curl php7.3-imap php7.3-mbstring php7.3-xml php7.3-cli mysql-server +sudo apt -y install nginx php7.3-fpm php7.3-gd php7.3-mysql php7.3-curl php7.3-imap php7.3-mbstring php7.3-xml php7.3-cli mariadb-server ## Create database From f89385a27a9e2a3f5f88b6b1cbd7c3f883a4f435 Mon Sep 17 00:00:00 2001 From: poka Date: Tue, 10 Dec 2019 19:12:41 +0000 Subject: [PATCH 27/41] Adapat isntall for stretch and buster only --- .install/3-install_copylaradio.sh | 2 +- .install/4-install_playsms.sh | 34 ++++++++++++++++++++++++++----- 2 files changed, 30 insertions(+), 6 deletions(-) diff --git a/.install/3-install_copylaradio.sh b/.install/3-install_copylaradio.sh index 804e854..d12e12e 100755 --- a/.install/3-install_copylaradio.sh +++ b/.install/3-install_copylaradio.sh @@ -38,7 +38,7 @@ fi sudo dpkg -i $MY_PATH/libttspico-data.deb sudo dpkg -i $MY_PATH/libttspico0.deb sudo dpkg -i $MY_PATH/libttspico-utils.deb -sudo dpkg -i $MY_PATH/libav-tools.deb || sudo apt --fix-broken install +sudo dpkg -i $MY_PATH/libav-tools.deb || sudo apt --fix-broken install -y rm $MY_PATH/libttspico-data.deb $MY_PATH/libttspico0.deb $MY_PATH/libttspico-utils.deb $MY_PATH/libav-tools.deb diff --git a/.install/4-install_playsms.sh b/.install/4-install_playsms.sh index b41b683..4717c20 100755 --- a/.install/4-install_playsms.sh +++ b/.install/4-install_playsms.sh @@ -9,7 +9,23 @@ echo -e "${c_yellow}Choisissez un nom de domain pour playsms: $c_" read PSMS_DOMAIN sudo apt -y update -sudo apt -y install nginx php7.3-fpm php7.3-gd php7.3-mysql php7.3-curl php7.3-imap php7.3-mbstring php7.3-xml php7.3-cli mariadb-server +if [[ $(grep buster /etc/os-release) ]]; then + sudo apt-key adv --recv-keys --keyserver keyserver.ubuntu.com 0xF1656F24C74CD1D8 + sudo add-apt-repository 'deb [arch=amd64] http://mariadb.mirror.liquidtelecom.com/repo/10.4/debian buster main' + sudo apt -y update + sudo apt -y install software-properties-common nginx php php-common php-fpm php-gd php-mysql php-curl php-imap php-mbstring php-xml php-cli mariadb-server +elif [[ $(grep stretch /etc/os-release) ]]; then + sudo apt -y install lsb-release apt-transport-https ca-certificates + sudo wget -O /etc/apt/trusted.gpg.d/php.gpg https://packages.sury.org/php/apt.gpg + echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" | sudo tee /etc/apt/sources.list.d/php7.3.list + sudo apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xF1656F24C74CD1D8 + echo -e "deb [arch=amd64,i386,ppc64el] http://sfo1.mirrors.digitalocean.com/mariadb/repo/10.4/debian stretch main\ndeb-src http://sfo1.mirrors.digitalocean.com/mariadb/repo/10.4/debian stretch main" > /etc/apt/sources.list.d/mariadb.list + sudo apt -y update + sudo apt -y install software-properties-common dirmngr nginx php7.3 php7.3-common php7.3-fpm php7.3-gd php7.3-mysql php7.3-curl php7.3-imap php7.3-mbstring php7.3-xml php7.3-cli mariadb-server +else + echo "${c_red}Votre système n'est pas pris en charge par ce script d'installation.$c_" + exit 1 +fi ## Create database @@ -21,6 +37,7 @@ if [[ ! $(sudo mysql -e "show databases;" | grep playsms) ]]; then fi ## Clone repo playSMS +[[ -d playsms ]] && sudo rm -rf playsms git clone https://github.com/antonraharja/playSMS.git $MY_PATH/playsms cp $MY_PATH/templates/install-playsms.conf $MY_PATH/playsms/install.conf @@ -31,7 +48,7 @@ sudo chmod u+x $MY_PATH/playsms/install-playsms.sh cd $MY_PATH/playsms sudo ./install-playsms.sh cd $MY_PATH -sudo rm -rf playsms +##kopa sudo rm -rf playsms ## Start playsmsd on boot @@ -61,13 +78,20 @@ manageSSL() { [[ ! $action =~ ^(on|off|certif)$ ]] && echo "Veuillez choisir ssl, nonssl ou certif pour créer un certificat ssl" && exit 1 install_certbot(){ + sudo apt update if [[ $(grep buster /etc/os-release) ]]; then [[ -z $(cat /etc/apt/sources.list | grep "buster-backports main") ]] && echo "deb http://deb.debian.org/debian buster-backports main" >> /etc/apt/sources.list - sudo apt update sudo apt install certbot python-certbot-nginx -t buster-backports -y elif [[ $(grep stretch /etc/os-release) ]]; then - sudo apt update sudo apt install certbot python-certbot-nginx -y + elif [[ $(grep -E '16.|17.|18.|19.' /etc/os-release) ]]; then + sudo apt install software-properties-common + sudo add-apt-repository universe + sudo add-apt-repository ppa:certbot/certbot + sudo apt update + sudo apt install certbot python-certbot-nginx + else + echo "OS non supporté pour certbot." && exit 1 fi } @@ -105,7 +129,7 @@ manageSSL() { } echo -e "${c_yellow}playSMS ne fonctionne pas sans certifcat SSL.$c_" -printf "${c_yellow}Voulez activer installer un certificat SSL maintenant pour $PSMS_DOMAIN ? (o/n) $c_" +printf "${c_yellow}Voulez-vous installer et activer un certificat SSL maintenant pour $PSMS_DOMAIN ? (o/n) $c_" read askSSL if [[ $askSSL =~ ^(o|y|yes|oui|Y|O|YES)$ ]]; then manageSSL certif From ec9a4032fb4c1d439a8623e912b65b65decdd17b Mon Sep 17 00:00:00 2001 From: poka Date: Tue, 10 Dec 2019 19:17:34 +0000 Subject: [PATCH 28/41] install zip, unzip, tree, htop ... --- .install/1-install_requirements.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.install/1-install_requirements.sh b/.install/1-install_requirements.sh index 9ce3823..ee7b58c 100755 --- a/.install/1-install_requirements.sh +++ b/.install/1-install_requirements.sh @@ -6,7 +6,7 @@ isARM=$(uname -a | grep arm) # Basics sudo apt update -sudo apt install curl jq -y +sudo apt install curl jq zip unzip htop tree -y # Silkaj + Duniterpy libsodium=$(sudo apt search libsodium | grep -v "header" | grep "Network communication" -B1 | head -n1 | awk -F '/' '{ print $1 }') From 04f36b73cf0b4a9cf7edc90123bac8c7605c86df Mon Sep 17 00:00:00 2001 From: poka Date: Tue, 10 Dec 2019 19:20:05 +0000 Subject: [PATCH 29/41] PSMS in profile --- .install/templates/.profile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.install/templates/.profile b/.install/templates/.profile index c4a4d75..8af8300 100644 --- a/.install/templates/.profile +++ b/.install/templates/.profile @@ -4,4 +4,4 @@ ADMINPSEUDO= ADMINPHONE= MASTERPHONE= ADRESSE= - +PSMS= From ce7ab33e0d253c323549c00b7b7e70684cc8be7c Mon Sep 17 00:00:00 2001 From: poka Date: Tue, 10 Dec 2019 19:24:20 +0000 Subject: [PATCH 30/41] PSMS in profile --- .install/4-install_playsms.sh | 4 ++-- .install/templates/.profile | 2 +- install.sh | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.install/4-install_playsms.sh b/.install/4-install_playsms.sh index 4717c20..6703ba4 100755 --- a/.install/4-install_playsms.sh +++ b/.install/4-install_playsms.sh @@ -3,10 +3,10 @@ MY_PATH="`dirname \"$0\"`" # relative MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized +[[ -f $MY_PATH/../.profile ]] && source $MY_PATH/../.profile unset err -echo -e "${c_yellow}Choisissez un nom de domain pour playsms: $c_" -read PSMS_DOMAIN +[[ ! $PSMS_DOMAIN ]] && echo -e "${c_yellow}Choisissez un nom de domain pour playsms: $c_" && read PSMS_DOMAIN sudo apt -y update if [[ $(grep buster /etc/os-release) ]]; then diff --git a/.install/templates/.profile b/.install/templates/.profile index 8af8300..c7a7778 100644 --- a/.install/templates/.profile +++ b/.install/templates/.profile @@ -4,4 +4,4 @@ ADMINPSEUDO= ADMINPHONE= MASTERPHONE= ADRESSE= -PSMS= +PSMS_DOMAIN= diff --git a/install.sh b/install.sh index 16e9716..77c3666 100755 --- a/install.sh +++ b/install.sh @@ -8,6 +8,7 @@ MY_PATH="`dirname \"$0\"`" # relative MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized init_loc="$MY_PATH/shell/init.sh" now=$(date +%Y-%m-%d) +[[ -f $MY_PATH/.profile ]] && source $MY_PATH/.profile args="$@" [[ $args =~ all ]] && repOption=o @@ -42,7 +43,6 @@ fi echo -e "${c_yellow}Ce script va désormais configurer votre noeud G1sms+$c_" YOU=$(ps auxf --sort=+utime | grep -w ipfs | grep -v -E 'color=auto|grep' | tail -n 1 | cut -d " " -f 1); -[[ -f .profile ]] && source .profile if [[ -f $MY_PATH/.install/templates/init.sh ]]; then [[ ! $ADMINPSEUDO ]] && echo -e "${c_light}Votre PSEUDO? (celui de votre Compte membre Duniter)$c_" && read ADMINPSEUDO [[ "$ADMINPSEUDO" == "" ]] && echo -e "${c_red}IMPOSSIBLE DE CONTINUER$c_" && exit 1 From 3254d4b24ff1a4e4b3ba0083484b9ab519d52808 Mon Sep 17 00:00:00 2001 From: poka Date: Tue, 10 Dec 2019 20:45:13 +0100 Subject: [PATCH 31/41] Fix database password setting --- .install/4-install_playsms.sh | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/.install/4-install_playsms.sh b/.install/4-install_playsms.sh index 6703ba4..657b554 100755 --- a/.install/4-install_playsms.sh +++ b/.install/4-install_playsms.sh @@ -5,6 +5,7 @@ MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized [[ -f $MY_PATH/../.profile ]] && source $MY_PATH/../.profile unset err +pwdDB=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 42 | head -n 1) [[ ! $PSMS_DOMAIN ]] && echo -e "${c_yellow}Choisissez un nom de domain pour playsms: $c_" && read PSMS_DOMAIN @@ -19,7 +20,7 @@ elif [[ $(grep stretch /etc/os-release) ]]; then sudo wget -O /etc/apt/trusted.gpg.d/php.gpg https://packages.sury.org/php/apt.gpg echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" | sudo tee /etc/apt/sources.list.d/php7.3.list sudo apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xF1656F24C74CD1D8 - echo -e "deb [arch=amd64,i386,ppc64el] http://sfo1.mirrors.digitalocean.com/mariadb/repo/10.4/debian stretch main\ndeb-src http://sfo1.mirrors.digitalocean.com/mariadb/repo/10.4/debian stretch main" > /etc/apt/sources.list.d/mariadb.list + echo -e "deb [arch=amd64,i386,ppc64el] http://sfo1.mirrors.digitalocean.com/mariadb/repo/10.4/debian stretch main\ndeb-src http://sfo1.mirrors.digitalocean.com/mariadb/repo/10.4/debian stretch main" | sudo tee /etc/apt/sources.list.d/mariadb.list sudo apt -y update sudo apt -y install software-properties-common dirmngr nginx php7.3 php7.3-common php7.3-fpm php7.3-gd php7.3-mysql php7.3-curl php7.3-imap php7.3-mbstring php7.3-xml php7.3-cli mariadb-server else @@ -31,17 +32,18 @@ fi if [[ ! $(sudo mysql -e "show databases;" | grep playsms) ]]; then sudo mysql -e "CREATE DATABASE playsms" - sudo mysql -e "CREATE USER 'playsms'@'localhost' IDENTIFIED BY 'playsms@mdp+';" + sudo mysql -e "CREATE USER 'playsms'@'localhost' IDENTIFIED BY '$pwdDB';" sudo mysql -e "GRANT ALL PRIVILEGES ON playsms.* TO 'playsms'@'localhost';" sudo mysql -e "FLUSH PRIVILEGES;" +else + sudo mysql -e "ALTER USER 'playsms'@'localhost' IDENTIFIED BY '$pwdDB';" fi ## Clone repo playSMS -[[ -d playsms ]] && sudo rm -rf playsms +[[ -d $MY_PATH/playsms ]] && sudo rm -rf $MY_PATH/playsms git clone https://github.com/antonraharja/playSMS.git $MY_PATH/playsms cp $MY_PATH/templates/install-playsms.conf $MY_PATH/playsms/install.conf -pwdDB=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 42 | head -n 1) sed -i "s/_pwdDB/$pwdDB/g" $MY_PATH/playsms/install.conf sudo chmod u+x $MY_PATH/playsms/install-playsms.sh @@ -53,7 +55,12 @@ cd $MY_PATH ## Start playsmsd on boot sudo /usr/local/bin/playsmsd start -[[ ! $(grep playsmsd /etc/rc.local) ]] && sudo sed -i '/^exit 0.*/i /usr/local/bin/playsmsd start' /etc/rc.local + +if [[ -f /etc/rc.local ]]; then + [[ ! $(grep playsmsd /etc/rc.local) ]] && sudo sed -i '/^exit 0.*/i /usr/local/bin/playsmsd start' /etc/rc.local +else + echo "/usr/local/bin/playsmsd start" | sudo tee /etc/rc.local +fi ## Tests if [[ $(sudo playsmsd status) =~ "is running" ]]; then From e42796aa8da6ff09b1b12a727879ccd568cf4670 Mon Sep 17 00:00:00 2001 From: poka Date: Wed, 11 Dec 2019 14:28:29 +0000 Subject: [PATCH 32/41] Add noask argument to install playsms --- .install/4-install_playsms.sh | 16 +++++++++------- install.sh | 2 -- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/.install/4-install_playsms.sh b/.install/4-install_playsms.sh index 657b554..c3f17e6 100755 --- a/.install/4-install_playsms.sh +++ b/.install/4-install_playsms.sh @@ -7,9 +7,13 @@ MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized unset err pwdDB=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 42 | head -n 1) +args=$@ +[[ $args =~ noask ]] && noask=o + [[ ! $PSMS_DOMAIN ]] && echo -e "${c_yellow}Choisissez un nom de domain pour playsms: $c_" && read PSMS_DOMAIN sudo apt -y update +sudo apt -y install unzip zip if [[ $(grep buster /etc/os-release) ]]; then sudo apt-key adv --recv-keys --keyserver keyserver.ubuntu.com 0xF1656F24C74CD1D8 sudo add-apt-repository 'deb [arch=amd64] http://mariadb.mirror.liquidtelecom.com/repo/10.4/debian buster main' @@ -46,8 +50,10 @@ git clone https://github.com/antonraharja/playSMS.git $MY_PATH/playsms cp $MY_PATH/templates/install-playsms.conf $MY_PATH/playsms/install.conf sed -i "s/_pwdDB/$pwdDB/g" $MY_PATH/playsms/install.conf +[[ -d /var/www/playsms ]] && sudo rm -rf /var/www/playsms sudo chmod u+x $MY_PATH/playsms/install-playsms.sh cd $MY_PATH/playsms +sed -i "s/read /confirm=y; #read /g" install-playsms.sh sudo ./install-playsms.sh cd $MY_PATH ##kopa sudo rm -rf playsms @@ -86,11 +92,8 @@ manageSSL() { install_certbot(){ sudo apt update - if [[ $(grep buster /etc/os-release) ]]; then - [[ -z $(cat /etc/apt/sources.list | grep "buster-backports main") ]] && echo "deb http://deb.debian.org/debian buster-backports main" >> /etc/apt/sources.list - sudo apt install certbot python-certbot-nginx -t buster-backports -y - elif [[ $(grep stretch /etc/os-release) ]]; then - sudo apt install certbot python-certbot-nginx -y + if [[ $(grep -E 'stretch|buster' /etc/os-release) ]]; then + sudo apt install certbot python-certbot-nginx -y elif [[ $(grep -E '16.|17.|18.|19.' /etc/os-release) ]]; then sudo apt install software-properties-common sudo add-apt-repository universe @@ -136,8 +139,7 @@ manageSSL() { } echo -e "${c_yellow}playSMS ne fonctionne pas sans certifcat SSL.$c_" -printf "${c_yellow}Voulez-vous installer et activer un certificat SSL maintenant pour $PSMS_DOMAIN ? (o/n) $c_" -read askSSL +[[ ! $noask ]] && printf "${c_yellow}Voulez-vous installer et activer un certificat SSL maintenant pour $PSMS_DOMAIN ? (o/n) $c_" && read askSSL if [[ $askSSL =~ ^(o|y|yes|oui|Y|O|YES)$ ]]; then manageSSL certif if sudo test -f /etc/letsencrypt/live/$PSMS_DOMAIN/fullchain.pem; then manageSSL on; else manageSSL off && echo "Une erreur s'est produite, basculement vers le mode non SSL"; fi diff --git a/install.sh b/install.sh index 77c3666..ab7251e 100755 --- a/install.sh +++ b/install.sh @@ -66,8 +66,6 @@ if [[ -f $MY_PATH/.install/templates/init.sh ]]; then sed -i s/au\ G1FabLab\ de\ Toulouse/$ADRESSE/g $init_loc sed -i s/+33647683646/$ADMINPHONE/g $init_loc sed -i s/Fred/$ADMINPSEUDO/g $init_loc - - cat $init_loc || err=1 else echo -e "${c_red}init.sh introuvable...$c_" err=1 From cc35674a4f09abe309cf94fb62ad052f58b2326d Mon Sep 17 00:00:00 2001 From: poka Date: Wed, 11 Dec 2019 15:15:13 +0000 Subject: [PATCH 33/41] Add noask argument to install playsms --- .install/4-install_playsms.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.install/4-install_playsms.sh b/.install/4-install_playsms.sh index c3f17e6..d010369 100755 --- a/.install/4-install_playsms.sh +++ b/.install/4-install_playsms.sh @@ -8,7 +8,7 @@ unset err pwdDB=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 42 | head -n 1) args=$@ -[[ $args =~ noask ]] && noask=o +[[ $args =~ noask ]] && noask=o && askSSL=o [[ ! $PSMS_DOMAIN ]] && echo -e "${c_yellow}Choisissez un nom de domain pour playsms: $c_" && read PSMS_DOMAIN From b7dc137a804d33ce2dfcf4405524926144f2e418 Mon Sep 17 00:00:00 2001 From: poka Date: Wed, 11 Dec 2019 23:01:17 +0000 Subject: [PATCH 34/41] Fix playsms install --- .install/1-install_requirements.sh | 5 +++-- .install/2-configure_ipfs_layer.sh | 1 + .install/4-install_playsms.sh | 1 + shell/bad.nodes.txt | 1 + shell/checknodes.sh | 5 +++-- shell/good.nodes.txt | 4 +++- shell/nodes.txt | 12 ++++++------ silkaj/src/constants.py | 2 +- 8 files changed, 19 insertions(+), 12 deletions(-) diff --git a/.install/1-install_requirements.sh b/.install/1-install_requirements.sh index ee7b58c..07bee41 100755 --- a/.install/1-install_requirements.sh +++ b/.install/1-install_requirements.sh @@ -6,12 +6,13 @@ isARM=$(uname -a | grep arm) # Basics sudo apt update -sudo apt install curl jq zip unzip htop tree -y +sudo apt install curl jq zip unzip htop tree ntpdate -y # Silkaj + Duniterpy libsodium=$(sudo apt search libsodium | grep -v "header" | grep "Network communication" -B1 | head -n1 | awk -F '/' '{ print $1 }') sudo apt install python3-pip $libsodium -y -pip3 install silkaj +pip3 install duniterpy +pip3 install silkaj --user # Install IPFS [[ -f /usr/local/bin/ipfs ]] && sudo service ipfs stop diff --git a/.install/2-configure_ipfs_layer.sh b/.install/2-configure_ipfs_layer.sh index b17c3ef..b1b3981 100755 --- a/.install/2-configure_ipfs_layer.sh +++ b/.install/2-configure_ipfs_layer.sh @@ -42,6 +42,7 @@ ipfs bootstrap rm --all ipfs bootstrap add /ip6/fe80::207:cbff:fe0b:75bb/tcp/4001/ipfs/QmSX7gFRPHui5A2DWFk2VmBvq6hynj2hubhJLQAwPWe4Lh ipfs bootstrap add /ip4/51.15.2.211/tcp/4001/ipfs/QmSX7gFRPHui5A2DWFk2VmBvq6hynj2hubhJLQAwPWe4Lh ### ADD NEW SWARM LEADERS SERVER HERE ### +cp $MY_PATH/templates/swarm.key ~/.ipfs/ # ALLOW REMOTE SSH CONNECTION FROM rec OR onelove (For swarm.key & keystore exchange ) # ADD SSH ADMIN/SUPPORT USERS $(cat .ssh/id_rsa.pub) diff --git a/.install/4-install_playsms.sh b/.install/4-install_playsms.sh index d010369..91c7a89 100755 --- a/.install/4-install_playsms.sh +++ b/.install/4-install_playsms.sh @@ -55,6 +55,7 @@ sudo chmod u+x $MY_PATH/playsms/install-playsms.sh cd $MY_PATH/playsms sed -i "s/read /confirm=y; #read /g" install-playsms.sh sudo ./install-playsms.sh +sudo sed -i 's/['ishttps'] = false;/['ishttps'] = true;/g' /var/www/playsms/config.php cd $MY_PATH ##kopa sudo rm -rf playsms diff --git a/shell/bad.nodes.txt b/shell/bad.nodes.txt index 4d45c3e..b810579 100644 --- a/shell/bad.nodes.txt +++ b/shell/bad.nodes.txt @@ -1 +1,2 @@ duniter.moul.re:443 +duniter-g1.p2p.legal:443 diff --git a/shell/checknodes.sh b/shell/checknodes.sh index ac41ae5..1195192 100755 --- a/shell/checknodes.sh +++ b/shell/checknodes.sh @@ -5,7 +5,7 @@ # Version: 0.1 # License: AGPL-3.0 (https://choosealicense.com/licenses/agpl-3.0/) ################################################################################ -# Checks the current block number of nodes.txt (is run in parallel) and output random (from last synchronized) node +# Checks the current block number of nodes.txt (is run in parallel) and output random (from last synchronized) node # pip3 install duniterpy # pip3 install silkaj --user @@ -63,7 +63,8 @@ BAN=$1 if [[ "$BAN" == "BAN" ]]; then # Get actual Duniter node used by silkaj SERVER=$(cat ./silkaj/src/constants.py | grep G1_DEFAULT_ENDPOINT | awk '{print $3}' | sed s/\"\,//g | sed s/\"//g) - echo $SERVER:443 >> ./shell/bad.nodes.txt + [[ ! $(grep $SERVER:443 shell/bad.nodes.txt) ]] && echo $SERVER:443 >> shell/bad.nodes.txt + sed -i "/$SERVER:443/d" ./shell/good.nodes.txt echo "$SERVER:443 IS NOW in ./shell/bad.nodes.txt" fi diff --git a/shell/good.nodes.txt b/shell/good.nodes.txt index b38fa55..c3a8035 100644 --- a/shell/good.nodes.txt +++ b/shell/good.nodes.txt @@ -1,5 +1,7 @@ +duniter-g1.p2p.legal:443 g1.duniter.fr:443 +g1.duniter.inso.ovh:443 g1.duniter.org:443 g1.le-sou.org:443 g1.monnaielibreoccitanie.org:443 -duniter-g1.p2p.legal:443 +g1.presles.fr:443 diff --git a/shell/nodes.txt b/shell/nodes.txt index dac4a03..bd8c901 100644 --- a/shell/nodes.txt +++ b/shell/nodes.txt @@ -1,9 +1,9 @@ -g1.le-sou.org:443 -follow.the.white-rabbit.net:443 -duniter.moul.re:443 -g1.monnaielibreoccitanie.org:443 g1.duniter.inso.ovh:443 g1.duniter.fr:443 -g1.presles.fr:443 -g1.duniter.org:443 +g1.monnaielibreoccitanie.org:443 +g1.le-sou.org:443 monit.g1.nordstrom.duniter.org:443 +g1.duniter.org:443 +g1.presles.fr:443 +duniter.moul.re:443 +duniter-g1.p2p.legal:443 diff --git a/silkaj/src/constants.py b/silkaj/src/constants.py index 3612867..b49f415 100644 --- a/silkaj/src/constants.py +++ b/silkaj/src/constants.py @@ -2,4 +2,4 @@ SILKAJ_VERSION = "silkaj 0.5.0" NO_MATCHING_ID = "No matching identity" G1_SYMBOL = "Ğ1" GTEST_SYMBOL = "ĞTest" -G1_DEFAULT_ENDPOINT = "duniter-g1.p2p.legal", "443" +G1_DEFAULT_ENDPOINT = "duniter.moul.re", "443" From e971c80fd5e6021a5bfd0026d75df04226db2898 Mon Sep 17 00:00:00 2001 From: poka Date: Wed, 11 Dec 2019 23:23:27 +0000 Subject: [PATCH 35/41] Fix playsms install --- .install/4-install_playsms.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.install/4-install_playsms.sh b/.install/4-install_playsms.sh index 91c7a89..978e6b8 100755 --- a/.install/4-install_playsms.sh +++ b/.install/4-install_playsms.sh @@ -55,7 +55,8 @@ sudo chmod u+x $MY_PATH/playsms/install-playsms.sh cd $MY_PATH/playsms sed -i "s/read /confirm=y; #read /g" install-playsms.sh sudo ./install-playsms.sh -sudo sed -i 's/['ishttps'] = false;/['ishttps'] = true;/g' /var/www/playsms/config.php +sudo sed -i "/ishttps/d" /var/www/playsms/config.php +sudo sed -i "/http or https*/a \$core_config['ishttps'] = true;" /var/www/playsms/config.php cd $MY_PATH ##kopa sudo rm -rf playsms From ac01655d13b3e1340ed357eac7675a701ab0682a Mon Sep 17 00:00:00 2001 From: poka Date: Wed, 11 Dec 2019 23:39:23 +0000 Subject: [PATCH 36/41] remove useless playsms folder --- .install/4-install_playsms.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.install/4-install_playsms.sh b/.install/4-install_playsms.sh index 978e6b8..a42e10b 100755 --- a/.install/4-install_playsms.sh +++ b/.install/4-install_playsms.sh @@ -57,9 +57,8 @@ sed -i "s/read /confirm=y; #read /g" install-playsms.sh sudo ./install-playsms.sh sudo sed -i "/ishttps/d" /var/www/playsms/config.php sudo sed -i "/http or https*/a \$core_config['ishttps'] = true;" /var/www/playsms/config.php +[[ -d $MY_PATH/playsms ]] && sudo rm -rf $MY_PATH/playsms cd $MY_PATH -##kopa sudo rm -rf playsms - ## Start playsmsd on boot sudo /usr/local/bin/playsmsd start From a8514b286c9ae11202b3b47800f5d8682771cf12 Mon Sep 17 00:00:00 2001 From: poka Date: Thu, 12 Dec 2019 15:35:33 +0000 Subject: [PATCH 37/41] Update README.md --- README.md | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 2a9d600..84a1967 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,6 @@ ### Lien du pad : https://pad.p2p.legal/G1sms-install - > LE DRAPEAU DE LA MONNAIE LIBRE EST PLANTE DANS LE SYSTEME DE FICHIER INTERPLANETAIRE!! :: [G1Forge / G1FabLab](https://www.g1sms.fr/fr/blog) :: Il s'agit de la seconde version de G1sms. Cette mouture utilise une carte fille GSM (à la place d'un dongle USB) et ajoute une couche de communication inter noeuds grâce à l'utilisation de IPFS. @@ -28,6 +27,16 @@ https://www.youtube.com/watch?v=QDnG3Jni7sY https://www.youtube.com/watch?v=LqV65iPTmnc https://www.youtube.com/watch?v=_PVwf9nRAA0 + +## Installation + + git clone https://git.p2p.legal/axiom-team/G1sms + mv G1sms G1sms+ + cd G1sms+ + chmod u+x install.sh + ./install.sh + + ## Matériel A découvrir sur la page [G1SMS:small_orange_diamond:](https://www.g1sms.fr/fr/blog/g1smsplus) From 84e46bbb55ece8a1246fefbca0cc0013cc71d061 Mon Sep 17 00:00:00 2001 From: poka Date: Thu, 12 Dec 2019 17:15:04 +0000 Subject: [PATCH 38/41] Update README.md --- README.md | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 84a1967..cb5f637 100644 --- a/README.md +++ b/README.md @@ -30,11 +30,18 @@ https://www.youtube.com/watch?v=_PVwf9nRAA0 ## Installation - git clone https://git.p2p.legal/axiom-team/G1sms - mv G1sms G1sms+ - cd G1sms+ - chmod u+x install.sh - ./install.sh + git clone https://git.p2p.legal/axiom-team/G1sms + mv G1sms G1sms+ + cd G1sms+ + chmod u+x install.sh + +### Options + ./install.sh : Cycle normale, va détecter si les éléments sont installés ne va pas les réinstaller. Demande confirmations, et propose d'installer les outils otionnels + ./install.sh force : Réinstalle les éléments même si ils sont déjà installés + ./install.sh noask : Ne pose pas de questions de confirmation pendant l'install, il y va + ./install.sh all : Install les outils optionnels sans poser de question + ./install.sh noptions : N'installe pas les outils optionnels + ## Matériel From 7c1ed25c14767f7db027d60286382c39ba745ea9 Mon Sep 17 00:00:00 2001 From: poka Date: Thu, 12 Dec 2019 17:48:03 +0000 Subject: [PATCH 39/41] Update README.md --- README.md | 232 ++++++++---------------------------------------------- 1 file changed, 31 insertions(+), 201 deletions(-) diff --git a/README.md b/README.md index cb5f637..8161365 100644 --- a/README.md +++ b/README.md @@ -27,36 +27,21 @@ https://www.youtube.com/watch?v=QDnG3Jni7sY https://www.youtube.com/watch?v=LqV65iPTmnc https://www.youtube.com/watch?v=_PVwf9nRAA0 +## I. Matériel -## Installation +**A découvrir sur la page [G1SMS:small_orange_diamond:](https://www.g1sms.fr/fr/blog/g1smsplus)** - git clone https://git.p2p.legal/axiom-team/G1sms - mv G1sms G1sms+ - cd G1sms+ - chmod u+x install.sh +## II. Préparation -### Options - ./install.sh : Cycle normale, va détecter si les éléments sont installés ne va pas les réinstaller. Demande confirmations, et propose d'installer les outils otionnels - ./install.sh force : Réinstalle les éléments même si ils sont déjà installés - ./install.sh noask : Ne pose pas de questions de confirmation pendant l'install, il y va - ./install.sh all : Install les outils optionnels sans poser de question - ./install.sh noptions : N'installe pas les outils optionnels +### 1. Installer Raspbian Stretch ou Buster (9 ou 10) :ice_cream: - - -## Matériel - -A découvrir sur la page [G1SMS:small_orange_diamond:](https://www.g1sms.fr/fr/blog/g1smsplus) - -## **Installer Raspbian Stretch** :ice_cream: - -* Téléchargez "[Raspbian Stretch Lite](https://www.raspberrypi.org/downloads/raspbian/)" et flashez l'image sur une carte microSD +* Téléchargez "[Raspbian Buster Lite](https://www.raspberrypi.org/downloads/raspbian/)" et flashez l'image sur une carte microSD * Installez Raspbian ([comment faire sur un RaspberryPi Zero sans écran?](https://projetsdiy.fr/comment-installer-raspbian-raspberry-pi-zero-sans-ecran-clavier/)). Terminez cette phase par une mise à jour > **sudo apt update; sudo apt upgrade -y** -### 1. Installation carte GSM (pour commandes par SMS)? +### 2. Installation carte GSM (pour commandes par SMS)? L'interface de commande par SMS permet d'ouvrir l'usage de la monnaie libre à ceux qui ne possèdent pas de smartphone et n'ont aucun ordinateur connecté à disposition... Et permet l'utilisation du réseau 2G des opérateurs, peut encombré et presque gratuit (1€/ mois chez Free je crois) @@ -68,7 +53,7 @@ Elles ont besoin d'être testées et d'améliorer leur compatibilité CLI. En fo Les scripts "./shell/cron" en cours d'écriture/test et sont à activer soi-même. -### 2. **Activer le GSM pHAT** +### 3. **Activer le GSM pHAT** La carte utilise une connexion UART sur l'interface GPIO du Rpi pour communiquer (en commandes AT). Placer le jumper dans la position B pour activer ce mode. On prendra soin de désactiver la console (tty) établie par le système sur le port série qui rentre en conflit autrement... @@ -77,7 +62,7 @@ La carte utilise une connexion UART sur l'interface GPIO du Rpi pour communiquer * Effacer **console=serial0,115200** de **/boot/cmdline.txt** * Redémarrer... -### 3. Démarrer la carte GSM ! +### 4. Démarrer la carte GSM ! il faudra appuyer 3 secondes sur le bouton d'allumage. Nous allons le faire par un script qui manipule le GPIO. @@ -99,157 +84,44 @@ il faudra appuyer 3 secondes sur le bouton d'allumage. Nous allons le faire par Ajouter le lancement de ce script au démarrage (dans /etc/rc.local) -### 4. Installer gammu et gammu-smsd +## III. Installation de Ḡ1sms+ avec ses prérequis (Gammu, IPFS) et ses modules +### Clonez le dépôt G1sms+ + git clone https://git.p2p.legal/axiom-team/G1sms + mv G1sms G1sms+ + cd G1sms+ + chmod u+x install.sh -Afin de dialoguer avec le réseau GSM, recevoir et envoyer des SMS. Nous utiliserons le serveur gammu. Suivre la procédure détaillée ici: https://tutoandco.colas-delmas.fr/software/envoyer-sms-gammu-deamon/ +### Options + ./install.sh : Cycle normale, va détecter si les éléments sont installés ne va pas les réinstaller. Demande confirmations, et propose d'installer les outils otionnels + ./install.sh force : Réinstalle les éléments même si ils sont déjà installés + ./install.sh noask : Ne pose pas de questions de confirmation pendant l'install, il y va + ./install.sh all : Install les outils optionnels sans poser de question + ./install.sh noptions : N'installe pas les outils optionnels - sudo apt-get install ppp screen git python3-pip minicom gammu gammu-smsd - sudo usermod -aG gammu pi; - -Vérifier que la carte GSM pHAT est démarrée, sinon lancer - sudo ./GSM_powerkey.sh +**VOILA! Le système peut maintenant dialoguer par SMS.** -Identification de la carte +## IV. Tests - sudo gammu --identify - -> Device : /dev/ttyS0 -> Manufacturer : SIMCOM_Ltd -> Model : unknown (SIMCOM_SIM868) -> Firmware : Revision:1418B03SIM868M32_BT -> IMEI : 868183033532677 +### Envoyer un SMS + echo "Mon premier SMS envoyé !" | gammu-smsd-inject TEXT 06xxxxxxxx -Création du fichier de configuration gammurc à partir de ces infos... -**sudo nano /etc/gammurc** +**TODO :** +- Ajouter un test silkaj +- Notif d'une alert admin par G1sms - [gammu] - port = /dev/ttyS0 - model = SIMCOM_Ltd (SIMCOM_SIM868) - connection = at19200 - synchronizetime = yes - logfile = /tmp/smsd.log - logformat = nothing -TEST: Envoyer un SMS. +--- +--- +--- - sudo gammu sendsms TEXT 06nnnnnnnn -text "NOUVEAU G1sms+" +**La partie qui suis doit être mise à jours !** -Tout ce passe bien? Alors on installe le daemon gammu smsd - sudo apt install gammu-smsd -y -Préparer le fichier de configuration ([DOC gammu...](https://wammu.eu/docs/manual/smsd/config.html)) -Adaptez selon le code PIN de votre carte SIM. -**sudo nano /etc/gammu-smsdrc** - [gammu] - device = /dev/ttyS0 - name = SIMCOM_Ltd (SIMCOM_SIM868) - connection = at19200 - synchronizetime = yes - gammucoding = utf8 - logformat = textall - [smsd] - service = files - Logfile = /tmp/smsd.log - DeliveryReport = log - debuglevel = 3 - CommTimeout = 5 - ReceiveFrequency = 5 - CheckSecurity = 1 - PIN = 0000 - - # Paths where messages are stored - inboxpath = /var/spool/gammu/inbox/ - outboxpath = /var/spool/gammu/outbox/ - sentsmspath = /var/spool/gammu/sent/ - errorsmspath = /var/spool/gammu/error/ - - # Run G1SMS Script RunOnReceive - RunOnReceive = /home/pi/G1sms+/sms_received.sh - -Le fichier de configuration maintenant prêt, on peut redémarrer le démon smsd - -**sudo service gammu-smsd restart** - -Vous voyez cette ligne dans vos processus? Tudo Bom :smiley: ! - - ps auxf - usr/bin/gammu-smsd --pid=/var/run/gammu-smsd.pid --daemon - -VOILA! Le système peut maintenant dialoguer par SMS. - -## Installer le coeur de G1sms+ -:warning: Le code appelé par gammu s'exécute en tant qu'utilisateur root. - -On pourra ajouter **umask 027** à **/root/.bashrc** pour isoler l'appartenance des fichiers de ce compte. - -### 1. Installer Silkaj & Duniterpy - - # Exécuter les commandes suivante en root - sudo -s - - # Silkaj + Duniterpy - sudo apt install python3-pip - sudo apt install libsodium18 - sudo pip3 install silkaj - -Voila ces 2 super connecteurs python à Duniter installés :cool: Ils seront utilisés par G1sms+ pour gérer les wallets et leurs TX, récupérer le profil des membres dans Cesium+, etc... - -En fait pour l'instant l'API CLI de silkaj n'étant pas encore disponible. C'est la version 0.50 patchée de G1sms qui continue à être utilisée (TODO !!!). Dans ce cas, il faudra peut-être installer les librairies pythons à la main... - - cd ./silkaj - pip3 install -r requirements.txt - -Dans cette version. Le dialogue avec les serveurs Duniter a été améliorée par un "load-balacing" régulier sur le groupe de serveurs en plus grand consensus et ayant un timeout correct... - -### 2. Installer IPFS - -Installer ipfs par son programme de mise à niveau permettra de facilement suivre l'évolution de l'Univers Interplanétaire :crystal_ball: - - sudo -s - cd /usr/src/ - wget https://dist.ipfs.io/ipfs-update/v1.5.2/ipfs-update_v1.5.2_linux-arm.tar.gz - tar xvzf ipfs-update_v1.5.2_linux-arm.tar.gz - cd ipfs-update - ./install.sh - ipfs-update install latest - - -Maintenant on peut choisir entre 3 façons de faire: -1. Opérer IPFS en Réseau Privé (swarm.key & Environment="LIBP2P_FORCE_PNET=1") et gérer ses serveurs de bootstrap. https://pad.p2p.legal/ipfs-onelove#Rejoindre-l%E2%80%99Essaim -2. Opérer sur IPFS Global en prenant soin de crypter les données échangées. https://medium.com/@mycoralhealth/learn-to-securely-share-files-on-the-blockchain-with-ipfs-219ee47df54c -~~3. Utiliser l'application ipfs-cluster: https://cluster.ipfs.io/documentation/quickstart/~~ - -C'est finalement l'option 2 qui a été choisie, en chiffrant les fichiers mis dans IPFS par la clef GPG du SWARM, du NODE, ou du TAG, la sécurité est assurée (regarder dans ./shell/init_keys.sh, [Generer une clef GPG pour le NODE](https://serverfault.com/a/960673), partager les clefs publiques des Nodes ./wallets/SWARM/IPFSID/gpgpubkey) - -Ici, chaque noeud reste propritéaire des G1sms wallet qu'il a créé est reste le seul à pouvoir interagir avec. - -Configurer le démon **ipfs** pour le user **pi** - - -Configurer et initialiser le démon avec des options p2p trop pratiques (communication, publication et surveillance de canal, forward de ports, reverse ssh, etc... on accède à tout par son hash, y compris un noeud...) - - su pi - ipfs init -p lowpower - # Activate pubsub (mode gossip) - ipfs config Pubsub.Router gossipsub - # Define max storage - ipfs config Datastore.StorageMax 6GB - ## Port Forwarding on P2P (SSH: ipfs p2p listen /x/ssh /ip4/127.0.0.1/tcp/22 ) - ipfs config --json Experimental.Libp2pStreamMounting true - -On ajoute au BOOTSTRAP le(s) noeud(s) leader (always on) du SWARM - - ######### UPDATE BOOTSTRAP LIST ########### - ipfs bootstrap rm --all - ### fred@onelove.madeinzion.org ### - # ID: QmSX7gFRPHui5A2DWFk2VmBvq6hynj2hubhJLQAwPWe4Lh - ipfs bootstrap add /ip6/fe80::207:cbff:fe0b:75bb/tcp/4001/ipfs/QmSX7gFRPHui5A2DWFk2VmBvq6hynj2hubhJLQAwPWe4Lh - ipfs bootstrap add /ip4/51.15.2.211/tcp/4001/ipfs/QmSX7gFRPHui5A2DWFk2VmBvq6hynj2hubhJLQAwPWe4Lh ### 3. ACTIVER LE SUPPORT A DISTANCE @@ -277,43 +149,6 @@ FAIRE APPEL AU SUPPORT ssh pi@localhost -p 2222 - -### 4. Lancement de ipfs au démarrage du système - -**sudo nano /etc/systemd/system/ipfs.service** - - [Unit] - Description=IPFS daemon - After=network.target - - [Service] - User=pi - ExecStart=/usr/local/bin/ipfs daemon --enable-pubsub-experiment --enable-namesys-pubsub --routing=dhtclient --enable-gc - Restart=on-failure - - [Install] - WantedBy=multi-user.target - - -Activer et lancer le service ipfs - - sudo systemctl daemon-reload - sudo systemctl enable ipfs - sudo systemctl start ipfs - - sudo systemctl status ipfs - - -### 5. Installer la Suite: logiciels et périphériques - -On installe **gnupg** ntpdate pour synchroniser nos horloges plus de quoi manipuler les images, les qrcodes, les chiffres et le json (dialogue avec DUNITER et CESIUM) - - sudo apt install gnupg ntpdate - sudo apt install ssmtp mpack - - # Pour manipuler les images, les chiffres et le json - sudo apt install imagemagick qrencode bc jq libttspico-utils - - Configurer un serveur relai email :a: https://wiki.archlinux.org/index.php/SSMTP :b: http://ozzmaker.com/send-email-from-the-raspberry-pi-or-linux-command-line-with-attachments/ @@ -419,8 +254,3 @@ https://ethereum.stackexchange.com/questions/63109/ipfs-versioning-how-to-get-al * What is InterPlanetary Naming System(IPNS)? https://hackernoon.com/understanding-ipfs-in-depth-3-6-what-is-interplanetary-naming-system-ipns-9aca71e4c13b -# INSTALL - -A venir... préparer un script qui effectue ce qui est décrit dans ce document pour lancer des installations plus automatiques de NODE G1sms+ - - From 2a626348dc449233e481e8d66216dbf14c829879 Mon Sep 17 00:00:00 2001 From: poka Date: Thu, 12 Dec 2019 17:50:13 +0000 Subject: [PATCH 40/41] Update .install/1-install_requirements.sh --- .install/1-install_requirements.sh | 4 +++- .install/4-install_playsms.sh | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/.install/1-install_requirements.sh b/.install/1-install_requirements.sh index 07bee41..03b4c0f 100755 --- a/.install/1-install_requirements.sh +++ b/.install/1-install_requirements.sh @@ -6,7 +6,7 @@ isARM=$(uname -a | grep arm) # Basics sudo apt update -sudo apt install curl jq zip unzip htop tree ntpdate -y +sudo apt install curl jq zip unzip htop tree ntpdate gnupg ssmtp mpack imagemagick qrencode bc jq libttspico-utils libttspico0 libttspico-data -y # Silkaj + Duniterpy libsodium=$(sudo apt search libsodium | grep -v "header" | grep "Network communication" -B1 | head -n1 | awk -F '/' '{ print $1 }') @@ -48,4 +48,6 @@ sudo apt install gammu-smsd -y || sudo apt install -f sudo usermod -aG gammu $USER +umask 027 à /root/.bashrc + exit 0 diff --git a/.install/4-install_playsms.sh b/.install/4-install_playsms.sh index a42e10b..377fd2d 100755 --- a/.install/4-install_playsms.sh +++ b/.install/4-install_playsms.sh @@ -18,7 +18,7 @@ if [[ $(grep buster /etc/os-release) ]]; then sudo apt-key adv --recv-keys --keyserver keyserver.ubuntu.com 0xF1656F24C74CD1D8 sudo add-apt-repository 'deb [arch=amd64] http://mariadb.mirror.liquidtelecom.com/repo/10.4/debian buster main' sudo apt -y update - sudo apt -y install software-properties-common nginx php php-common php-fpm php-gd php-mysql php-curl php-imap php-mbstring php-xml php-cli mariadb-server + sudo apt -y install software-properties-common nginx php php-common php-fpm php-gettext php-gd php-mysql php-curl php-imap php-mbstring php-xml php-cli mariadb-server elif [[ $(grep stretch /etc/os-release) ]]; then sudo apt -y install lsb-release apt-transport-https ca-certificates sudo wget -O /etc/apt/trusted.gpg.d/php.gpg https://packages.sury.org/php/apt.gpg @@ -26,7 +26,7 @@ elif [[ $(grep stretch /etc/os-release) ]]; then sudo apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xF1656F24C74CD1D8 echo -e "deb [arch=amd64,i386,ppc64el] http://sfo1.mirrors.digitalocean.com/mariadb/repo/10.4/debian stretch main\ndeb-src http://sfo1.mirrors.digitalocean.com/mariadb/repo/10.4/debian stretch main" | sudo tee /etc/apt/sources.list.d/mariadb.list sudo apt -y update - sudo apt -y install software-properties-common dirmngr nginx php7.3 php7.3-common php7.3-fpm php7.3-gd php7.3-mysql php7.3-curl php7.3-imap php7.3-mbstring php7.3-xml php7.3-cli mariadb-server + sudo apt -y install software-properties-common dirmngr nginx php7.3 php7.3-common php7.3-gettext php7.3-fpm php7.3-gd php7.3-mysql php7.3-curl php7.3-imap php7.3-mbstring php7.3-xml php7.3-cli mariadb-server else echo "${c_red}Votre système n'est pas pris en charge par ce script d'installation.$c_" exit 1 From 2bad497ae2bf31e781efff591cd135e2014f9b03 Mon Sep 17 00:00:00 2001 From: poka Date: Thu, 12 Dec 2019 17:54:24 +0000 Subject: [PATCH 41/41] Update README.md --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 8161365..47ab8ac 100644 --- a/README.md +++ b/README.md @@ -84,7 +84,9 @@ il faudra appuyer 3 secondes sur le bouton d'allumage. Nous allons le faire par Ajouter le lancement de ce script au démarrage (dans /etc/rc.local) -## III. Installation de Ḡ1sms+ avec ses prérequis (Gammu, IPFS) et ses modules +## III. Installation automatique de Ḡ1sms+ avec ses prérequis (Gammu, IPFS) et ses modules +*Pour une installation manuelle: https://pad.p2p.legal/G1sms-install* + ### Clonez le dépôt G1sms+ git clone https://git.p2p.legal/axiom-team/G1sms mv G1sms G1sms+