Merge remote-tracking branch 'origin/master' into dev-fred

This commit is contained in:
qo-op 2019-12-12 22:03:03 +01:00
commit 48e4c5865a
26 changed files with 648 additions and 755 deletions

5
.gitignore vendored
View File

@ -11,4 +11,7 @@ TAG/
billets/
history.*
*~
.install/errors
.install/log
shell/init.sh.old
.profile

View File

@ -0,0 +1,53 @@
#!/bin/bash
MY_PATH="`dirname \"$0\"`" # relative
MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized
isARM=$(uname -a | grep arm)
# Basics
sudo apt update
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 }')
sudo apt install python3-pip $libsodium -y
pip3 install duniterpy
pip3 install silkaj --user
# Install IPFS
[[ -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
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"
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"
[[ -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
sudo systemctl daemon-reload
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 -f
sudo usermod -aG gammu $USER
umask 027 à /root/.bashrc
exit 0

View File

@ -0,0 +1,56 @@
#!/bin/bash
################################################################################
# Author: Fred (support@qo-op.com)
# 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
stamp=$(date +%s)
templates="$MY_PATH/templates"
#######################################
# CONFIGURE IPFS for G1sms+ Pi NODES
#######################################
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
else echo -e "${c_yellow}OK $USER, let's go!$c_";
fi
[[ -d ~/.ipfs/ ]] && rm -rf ~/.ipfs-old && mv ~/.ipfs/ ~/.ipfs-old
################
# BECOME $USER
# INIT ipfs
ipfs init -p lowpower
# ACTIVATE CONFIG OPTIONS
# PUBSUB
ipfs config Pubsub.Router gossipsub
# MAXSTORAGE
ipfs config Datastore.StorageMax 12GB
## PORT FORWARD (SSH)
ipfs config --json Experimental.Libp2pStreamMounting true
######### 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
### 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)
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
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_"

View File

@ -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 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 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 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 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
sudo dpkg -i $MY_PATH/libttspico-utils.deb
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
# 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

157
.install/4-install_playsms.sh Executable file
View File

@ -0,0 +1,157 @@
#!/bin/bash
MY_PATH="`dirname \"$0\"`" # relative
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)
args=$@
[[ $args =~ noask ]] && noask=o && askSSL=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'
sudo apt -y update
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
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" | 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-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
fi
## 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 '$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 $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
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
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
## Start playsmsd on boot
sudo /usr/local/bin/playsmsd start
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
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(){
sudo apt update
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
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
}
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_"
[[ ! $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
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

View File

@ -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.

32
.install/export_colors.sh Executable file
View File

@ -0,0 +1,32 @@
#!/bin/bash
[[ -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"
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
source ~/.bash_aliases

View File

@ -1,91 +0,0 @@
#!/bin/bash
################################################################################
# Author: Fred (support@qo-op.com)
# 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
#
### 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"
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)"
# 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)"
read ADMINPSEUDO
if [[ "$ADMINPSEUDO" == "" ]]; then ADMINPSEUDO="Fred"; fi
echo "Le Numéro de téléphone SMS Admin? Votre numéro de portable (defaut: +33647683646)"
read ADMINPHONE
if [[ "$ADMINPHONE" == "" ]]; then ADMINPHONE="+33647683646"; 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)"
read ADRESSE
z
cp /home/$YOU/G1sms+/shell/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 "========================================="
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 "========================================="
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)"
fi

View File

@ -1,131 +0,0 @@
#!/bin/bash
################################################################################
# Author: Fred (support@qo-op.com)
# 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
stamp=$(date +%s)
[ -z "$MY_PATH" ] && exit 1
echo $MY_PATH
templates="$MY_PATH/templates"
#######################################
# INSTALL IPFS on 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
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;
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
################
# BECOME $USER
# INIT ipfs
ipfs init -p lowpower
# ACTIVATE CONFIG OPTIONS
# PUBSUB
ipfs config Pubsub.Router gossipsub
# MAXSTORAGE
ipfs config Datastore.StorageMax 12GB
## PORT FORWARD (SSH)
ipfs config --json Experimental.Libp2pStreamMounting true
######### 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
### ADD NEW SWARM LEADERS SERVER HERE ###
# 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
# 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

View File

@ -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]

View File

@ -0,0 +1,7 @@
#!/bin/bash
ADMINPSEUDO=
ADMINPHONE=
MASTERPHONE=
ADRESSE=
PSMS_DOMAIN=

View File

@ -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"

View File

@ -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"

View File

@ -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

View File

@ -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;
}

View File

@ -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;

View File

@ -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;

View File

@ -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

219
README.md
View File

@ -1,5 +1,7 @@
# 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.
@ -25,19 +27,21 @@ https://www.youtube.com/watch?v=QDnG3Jni7sY
https://www.youtube.com/watch?v=LqV65iPTmnc
https://www.youtube.com/watch?v=_PVwf9nRAA0
## Matériel
## I. Matériel
A découvrir sur la page [G1SMS:small_orange_diamond:](https://www.g1sms.fr/fr/blog/g1smsplus)
**A découvrir sur la page [G1SMS:small_orange_diamond:](https://www.g1sms.fr/fr/blog/g1smsplus)**
## **Installer Raspbian Stretch** :ice_cream:
## II. Préparation
* Téléchargez "[Raspbian Stretch Lite](https://www.raspberrypi.org/downloads/raspbian/)" et flashez l'image sur une carte microSD
### 1. Installer Raspbian Stretch ou Buster (9 ou 10) :ice_cream:
* 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)
@ -49,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...
@ -58,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.
@ -80,157 +84,46 @@ 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 automatique de Ḡ1sms+ avec ses prérequis (Gammu, IPFS) et ses modules
*Pour une installation manuelle: https://pad.p2p.legal/G1sms-install*
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/
### 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
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
### 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 ./GSM_powerkey.sh
Identification de la carte
**VOILA! Le système peut maintenant dialoguer par SMS.**
sudo gammu --identify
> Device : /dev/ttyS0
> Manufacturer : SIMCOM_Ltd
> Model : unknown (SIMCOM_SIM868)
> Firmware : Revision:1418B03SIM868M32_BT
> IMEI : 868183033532677
## IV. Tests
Création du fichier de configuration gammurc à partir de ces infos...
**sudo nano /etc/gammurc**
### Envoyer un SMS
echo "Mon premier SMS envoyé !" | gammu-smsd-inject TEXT 06xxxxxxxx
[gammu]
port = /dev/ttyS0
model = SIMCOM_Ltd (SIMCOM_SIM868)
connection = at19200
synchronizetime = yes
logfile = /tmp/smsd.log
logformat = nothing
**TODO :**
- Ajouter un test silkaj
- Notif d'une alert admin par G1sms
TEST: Envoyer un SMS.
sudo gammu sendsms TEXT 06nnnnnnnn -text "NOUVEAU G1sms+"
---
---
---
Tout ce passe bien? Alors on installe le daemon gammu smsd
**La partie qui suis doit être mise à jours !**
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
@ -258,43 +151,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/
@ -400,8 +256,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+

View File

@ -1,44 +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+ (effacez ./shell/init.sh avant de le lancer)"
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
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
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
echo "LES PARAMETRES SONT BONS? Appliquer? ENTER ou CTRL-C ?"
read
cp ./shell/init.sh.template ./shell/init.sh
fi

88
install.sh Executable file
View File

@ -0,0 +1,88 @@
#!/bin/bash
################################################################################
# Author: Fred (support@qo-op.com)
# 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)
[[ -f $MY_PATH/.profile ]] && source $MY_PATH/.profile
args="$@"
[[ $args =~ all ]] && repOption=o
[[ $args =~ noptions ]] && repOption=n
[[ $args =~ force ]] && force_req=o
[[ $args =~ noask ]] && noask=o
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/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_"
YOU=$(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
[[ ! $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
[[ ! $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
[[ ! $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"
[[ ! $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 "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 || err=1
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
else
echo -e "${c_red}init.sh introuvable...$c_"
err=1
exit 1
fi
## 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|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

View File

@ -1,23 +0,0 @@
#!/bin/bash
# Silkaj + Duniterpy
apt install python3-pip
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
# Install gammu
apt install ppp screen git minicom gammu gammu-smsd
usermod -aG gammu pi
exit 0

View File

@ -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

View File

@ -1,2 +1,6 @@
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

View File

@ -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

View File

@ -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"