Compare commits
2 Commits
Author | SHA1 | Date |
---|---|---|
poka | b81b550b0a | |
poka | cc18e8f8de |
|
@ -0,0 +1,50 @@
|
||||||
|
### Variables d'environnement
|
||||||
|
|
||||||
|
LOG_FILE="/tmp/g1sms.log"
|
||||||
|
|
||||||
|
export YOU=$(ps aux --sort=+utime | grep ipfs | tail -n 1 | cut -d " " -f 1)
|
||||||
|
export CHEMIN="/home/$YOU/G1sms+"
|
||||||
|
cd $CHEMIN
|
||||||
|
##################################################################
|
||||||
|
# Activate logging to /tmp/g1sms.log (YES/NO)
|
||||||
|
export DOLOG="YES"
|
||||||
|
export CPERROR="NOYES"
|
||||||
|
##################################################################
|
||||||
|
# Country Node Phone international prefix (TODO Worldwide)
|
||||||
|
export COUNTRY="+33"
|
||||||
|
##################################################################
|
||||||
|
# DU has a G1 value changed every 6 month!
|
||||||
|
# ./_DU Updated by cron_CODE.backup.sh
|
||||||
|
if [[ -f "./_DU" ]]; then export DUFACTOR=$(bc <<< "scale=2; $(cat "./_DU") / 100"); else log "__SUB:init.sh: FAILING TO FIND ./_DU EXIT!!!"; exit; fi
|
||||||
|
##################################################################
|
||||||
|
# Choose Default Unit: G1, DU, LOVE (DU cents), ZEN (G1 cents)
|
||||||
|
export COIN="G1"
|
||||||
|
##################################################################
|
||||||
|
# Limit and commission values
|
||||||
|
export LIMIT=2 # Solde minimum = 2 G1
|
||||||
|
# FIXED COMMISSION SYSTEM
|
||||||
|
export COMMISSION=1 # transaction commission amount (G1)
|
||||||
|
export BILLCOM=20
|
||||||
|
##################################################################
|
||||||
|
# COMMISSION PARTS FROM TX FOR NODE & G1SMS NETWORK
|
||||||
|
# PART COMMISSION SYSTEM
|
||||||
|
export SWARMCOMM=10
|
||||||
|
# TODO: NODE G1sms Wallet can receive rewards from SWARM or WALLETS/FILES
|
||||||
|
export NODECOMM=10
|
||||||
|
##################################################################
|
||||||
|
# SMS SIM Card Phone Number
|
||||||
|
export MASTERPHONE="+33660780131"
|
||||||
|
export ADRESSE="au G1FabLab de Toulouse"
|
||||||
|
export G1DAB="NO"
|
||||||
|
##################################################################
|
||||||
|
# ADMIN COMMAND PHONE ORIGIN
|
||||||
|
export ADMINPHONE="+33647683646"
|
||||||
|
export ADMINPSEUDO="Fred"
|
||||||
|
##################################################################
|
||||||
|
# DUNITER/CESIUM+ DEFAULT SERVERS
|
||||||
|
export DUNITER="https://g1.duniter.org"
|
||||||
|
export CESIUM="https://g1.data.le-sou.org"
|
||||||
|
|
||||||
|
# TODO Use latest Silkaj from "sudo pip3 install silkaj"
|
||||||
|
# export SILKAJ="/usr/local/bin/silkaj"
|
||||||
|
source $CHEMIN/shell/init_keys.sh
|
|
@ -1,19 +0,0 @@
|
||||||
authfile
|
|
||||||
g1sms.bfproject
|
|
||||||
g1sms.priv.key
|
|
||||||
g1sms.preoni.priv.key
|
|
||||||
g1sms.preoni.pub.key
|
|
||||||
shell/init.sh
|
|
||||||
shell/bad.nodes.txt
|
|
||||||
shell/good.nodes.txt
|
|
||||||
shell/trash/
|
|
||||||
wallets/
|
|
||||||
wallets_swarm/
|
|
||||||
TAG/
|
|
||||||
billets/
|
|
||||||
history.*
|
|
||||||
*~
|
|
||||||
.install/errors
|
|
||||||
.install/log
|
|
||||||
.install/.OS
|
|
||||||
.profile
|
|
|
@ -1 +0,0 @@
|
||||||
GPATH=/home/pi/G1sms+
|
|
|
@ -1,99 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
MY_PATH="`dirname \"$0\"`" # relative
|
|
||||||
MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized
|
|
||||||
|
|
||||||
OS=$(head -n1 $MY_PATH/.OS)
|
|
||||||
isARM=$(cat $MY_PATH/.OS | grep YES)
|
|
||||||
unset err
|
|
||||||
|
|
||||||
# Basics
|
|
||||||
sudo apt update
|
|
||||||
echo -e "${c_yellow}Mise à jours des prérequis...$c_"
|
|
||||||
sudo apt install curl jq zip unzip htop tree ntpdate gnupg ssmtp mpack imagemagick qrencode bc libttspico-utils libttspico0 libttspico-data python-fourletterphat -y
|
|
||||||
|
|
||||||
# Silkaj + Duniterpy
|
|
||||||
silkaj() {
|
|
||||||
echo -e "${c_yellow}Installation de Silkaj...$c_"
|
|
||||||
libsodium=$(sudo apt search libsodium 2>/dev/null | grep -v -E "header|debug symbols" | grep "Network communication" -B1 | head -n1 | awk -F '/' '{ print $1 }')
|
|
||||||
[[ $libsodium =~ " " ]] && libsodium=$(echo $libsodium | awk '{ print $2 }')
|
|
||||||
sudo apt install python3-pip $libsodium -y || err+="Install python3 and $libsodium"
|
|
||||||
pip3 install duniterpy || err+="Install duniterpy"
|
|
||||||
pip3 install silkaj --user || err+="Install Silkaj"
|
|
||||||
}
|
|
||||||
|
|
||||||
# Install IPFS
|
|
||||||
ipfs() {
|
|
||||||
echo -e "${c_yellow}Installation d'IPFS...$c_"
|
|
||||||
[[ -f /usr/local/bin/ipfs ]] && sudo service ipfs stop
|
|
||||||
if [[ $isARM ]]; then
|
|
||||||
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 || err+="Download ipfs-update"
|
|
||||||
else
|
|
||||||
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 || err+="Download ipfs-update"
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "INSTALL ipfs-update"
|
|
||||||
sudo tar -xvzf $MY_PATH/ipfs-update.tar.gz -C /usr/src/ || err+="Untar ipfs-update"
|
|
||||||
rm $MY_PATH/ipfs-update.tar.gz
|
|
||||||
cd /usr/src/ipfs-update/
|
|
||||||
sudo ./install.sh || err+="Install ipfs-update"
|
|
||||||
cd $MY_PATH
|
|
||||||
|
|
||||||
echo "INSTALL latest ipfs"
|
|
||||||
sudo ipfs-update install latest || err+="Install IPFS"
|
|
||||||
|
|
||||||
echo "CREATE SYSTEMD ipfs SERVICE"
|
|
||||||
[[ -f /etc/systemd/system/ipfs.service ]] && sudo rm /etc/systemd/system/ipfs.service
|
|
||||||
sudo cp -f $MY_PATH/templates/1/ipfs.service /etc/systemd/system/
|
|
||||||
sudo sed -i "s/_USER/$USER/g" /etc/systemd/system/ipfs.service
|
|
||||||
|
|
||||||
sudo systemctl daemon-reload || err+="Restart IPFS"
|
|
||||||
sudo systemctl enable ipfs || err+="Enable IPFS daemon"
|
|
||||||
}
|
|
||||||
|
|
||||||
# Install gammu
|
|
||||||
gammu() {
|
|
||||||
echo -e "${c_yellow}Installation de gammu...$c_"
|
|
||||||
sudo apt install wvdial ppp screen git minicom gammu -y || err+="Install gammu requirements"
|
|
||||||
sleep 1
|
|
||||||
sudo apt install gammu-smsd -y || sudo apt install -f || err+="Install gammu"
|
|
||||||
|
|
||||||
sudo usermod -aG gammu $USER
|
|
||||||
}
|
|
||||||
|
|
||||||
# Install PHP + MySQL
|
|
||||||
php() {
|
|
||||||
echo -e "${c_yellow}Installation de PHP et MySQL$c_"
|
|
||||||
if [[ $OS == "buster" ]]; then
|
|
||||||
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 || err+="Install PHP and MySQL"
|
|
||||||
elif [[ $OS == "stretch" ]]; then
|
|
||||||
sudo apt -y install lsb-release apt-transport-https ca-certificates || err+="Install apt-transport-https"
|
|
||||||
sudo wget -O /etc/apt/trusted.gpg.d/php.gpg https://packages.sury.org/php/apt.gpg || err+="Download PHP key"
|
|
||||||
echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" | sudo tee /etc/apt/sources.list.d/php7.3.list
|
|
||||||
sudo apt 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 || err+="Install PHP and MySQL"
|
|
||||||
else
|
|
||||||
echo "${c_red}Votre système n'est pas pris en charge par ce script d'installation.$c_"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
isLocalhostUsers=$(sudo mysql -e "select user from mysql.user;" | grep "localhost")
|
|
||||||
isTestDB=$(sudo mysql -e "show databases" | grep "test")
|
|
||||||
[[ -n $isLocalhostUsers ]] && sudo mysql -e "DROP USER ''@'localhost'; DROP USER ''@'$(hostname)'"
|
|
||||||
[[ -n $isTestDB ]] && sudo mysql -e "DROP DATABASE test"
|
|
||||||
sudo mysql -e "FLUSH PRIVILEGES"
|
|
||||||
}
|
|
||||||
|
|
||||||
# Read arguments
|
|
||||||
for i in $@; do
|
|
||||||
echo -e "${c_yellow}Installation de $c_light$i$c_"
|
|
||||||
$i
|
|
||||||
done
|
|
||||||
|
|
||||||
if [[ $err ]]; then
|
|
||||||
echo -e "${c_red}Installation des prérequis incomplète: $err$c_"
|
|
||||||
exit 1
|
|
||||||
else
|
|
||||||
echo -e "${c_green}Les prérequis ont été correctement installés$c_"
|
|
||||||
exit 0
|
|
||||||
fi
|
|
|
@ -1,56 +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)
|
|
||||||
templates="$MY_PATH/templates/2a"
|
|
||||||
|
|
||||||
#######################################
|
|
||||||
# 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_"
|
|
|
@ -1,36 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
MY_PATH="`dirname \"$0\"`" # relative
|
|
||||||
MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized
|
|
||||||
source $MY_PATH/../.install/.GPATH
|
|
||||||
|
|
||||||
## Récupère les données du profile
|
|
||||||
[[ -f $MY_PATH/../.profile ]] && source $MY_PATH/../.profile
|
|
||||||
|
|
||||||
## Désactive les processus écoutant le tty1
|
|
||||||
[[ $(sudo systemctl status getty@tty1.service | grep "loaded" 2>/dev/null) ]] && sudo systemctl stop getty@tty1.service && sudo systemctl disable getty@tty1.service
|
|
||||||
|
|
||||||
if [[ -z $(grep "PIN" /etc/gammu-smsdrc) ]]; then
|
|
||||||
## Copie et sed de /etc/gammu-smsdrc
|
|
||||||
[[ -f /etc/gammu-smsdrc ]] && sudo mv /etc/gammu-smsdrc /etc/gammu-smsdrc.old && echo "/etc/gammu-smsdrc a été renommé en /etc/gammu-smsdrc.old"
|
|
||||||
sudo cp $MY_PATH/templates/2b/gammu-smsdrc /etc/
|
|
||||||
|
|
||||||
GPATHS=$(echo $GPATH | sed 's./.\\/.g')
|
|
||||||
sudo sed -i "s/_GPATH/$GPATHS/g" /etc/gammu-smsdrc
|
|
||||||
sudo sed -i "s/_PIN/$PIN/g" /etc/gammu-smsdrc
|
|
||||||
|
|
||||||
## Redémarre gammu-smsd
|
|
||||||
sudo service gammu-smsd restart && echo -e "${c_green}Gammu a été correctement configuré$c_" || echo -e "${c_green}Un problème est survenu lors de la configuration de gammu$c_"
|
|
||||||
fi
|
|
||||||
|
|
||||||
## Configure correctement le UART
|
|
||||||
|
|
||||||
[[ ! $(grep enable_uart=1 /boot/config.txt) ]] && echo "enable_uart=1" | sudo tee -a /boot/config.txt
|
|
||||||
[[ $(grep "console=serial0" /boot/cmdline.txt) ]] && sudo sed -i "s/console=serial0,115200//g" /boot/cmdline.txt
|
|
||||||
[[ $(grep "console=serial0" /boot/cmdline.txt) ]] && echo -e "${c_red}Attention, console=serial0 est toujours présent dans /boot/cmdline.txt !$c_" && err=1
|
|
||||||
|
|
||||||
## Configure rc.local
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
exit 0
|
|
|
@ -1,70 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
MY_PATH="`dirname \"$0\"`" # relative
|
|
||||||
MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized
|
|
||||||
templates="$MY_PATH/templates/3"
|
|
||||||
|
|
||||||
isARM=$(cat $MY_PATH/.OS | grep YES)
|
|
||||||
|
|
||||||
##################################
|
|
||||||
## INSTALL TOOLS
|
|
||||||
######## YOUTUBE-DL ##########
|
|
||||||
sudo wget https://yt-dl.org/downloads/latest/youtube-dl -O /usr/local/bin/youtube-dl || err=1
|
|
||||||
sudo chmod a+rx /usr/local/bin/youtube-dl
|
|
||||||
sudo apt install libid3-tools mpd mpc lame omxplayer -y || err=1
|
|
||||||
|
|
||||||
## CONFIG MPD
|
|
||||||
sudo cp -f $templates/mpd.conf /etc/mpd.conf
|
|
||||||
sudo sed -i "s/_USER/$USER/g" /etc/mpd.conf || err=1
|
|
||||||
|
|
||||||
sudo chown -R $USER /var/lib/mpd/ /var/run/mpd /run/mpd /var/log/mpd
|
|
||||||
sudo service mpd restart || err=1
|
|
||||||
|
|
||||||
|
|
||||||
sudo apt-get install nginx php-curl php-sqlite3 php-gd php-json php-xml php-mbstring php-fpm sqlite -y || err=1
|
|
||||||
sudo apt-get install lame sox libsox-fmt-mp3 eyed3 python-chardet imagemagick curl -y #libav-tools || err=1
|
|
||||||
sudo apt-get install ca-certificates git-core binutils rsync alsa-utils bc libid3-tools espeak mpg321 fuse atomicparsley -y || err=1
|
|
||||||
|
|
||||||
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 [[ $isARM ]]; then
|
|
||||||
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
|
|
||||||
else
|
|
||||||
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
|
|
||||||
fi
|
|
||||||
sudo dpkg -i $MY_PATH/libttspico-data.deb || err=1
|
|
||||||
sudo dpkg -i $MY_PATH/libttspico0.deb || err=1
|
|
||||||
sudo dpkg -i $MY_PATH/libttspico-utils.deb || err=1
|
|
||||||
sudo dpkg -i $MY_PATH/libav-tools.deb || sudo apt --fix-broken install -y || err=1
|
|
||||||
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 || err=1
|
|
||||||
|
|
||||||
#################################
|
|
||||||
## 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
|
|
||||||
|
|
||||||
if [[ $err ]]; then
|
|
||||||
echo -e "${c_red}Installation de copylaradio incomplète$c_"
|
|
||||||
exit 1
|
|
||||||
else
|
|
||||||
echo -e "${c_green}CopyLaRadio a été installé avec succès$c_"
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
|
|
|
@ -1,125 +0,0 @@
|
||||||
#!/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
|
|
||||||
|
|
||||||
args=$@
|
|
||||||
[[ $args =~ noask ]] && noask=o && askSSL=o
|
|
||||||
|
|
||||||
OS=$(head -n1 $MY_PATH/.OS)
|
|
||||||
IP=$(ifconfig | grep "inet " | grep -v "127.0.0.1" | awk '{ print $2 }')
|
|
||||||
if [[ -z $KSMS_DOMAIN ]]; then
|
|
||||||
echo -e "${c_yellow}Choisissez un nom de domaine pour KALKUN (Sinon $IP sera choisi): $c_" && read KSMS_DOMAIN
|
|
||||||
[[ -z $KSMS_DOMAIN ]] && KSMS_DOMAIN=$IP && askSSL=n && noask=o
|
|
||||||
sed -i "s/\<KSMS_DOMAIN=/&$KSMS_DOMAIN/" $MY_PATH/../.profile
|
|
||||||
fi
|
|
||||||
|
|
||||||
DOMAIN=$KSMS_DOMAIN
|
|
||||||
|
|
||||||
## Install PHP + MySQL
|
|
||||||
$MY_PATH/1-install_requirements.sh php
|
|
||||||
|
|
||||||
## Create database
|
|
||||||
if [[ $(sudo mysql -e "select * from mysql.user;" | grep gammu) ]]; then
|
|
||||||
pwdDB=$(cat /etc/gammu-smsdrc | grep "password" | grep -v "# " | awk '{ print $3 }')
|
|
||||||
else
|
|
||||||
pwdDB=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 42 | head -n 1)
|
|
||||||
sudo mysql -e "CREATE USER 'gammu'@'localhost' IDENTIFIED BY '$pwdDB';"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ ! $(sudo mysql -e "show databases;" | grep gammu) ]]; then
|
|
||||||
echo -e "${c_yellow}Création de la base de donnée...$c_"
|
|
||||||
sudo mysql -e "CREATE DATABASE gammu"
|
|
||||||
sudo mysql -e "GRANT ALL PRIVILEGES ON gammu.* TO 'gammu'@'localhost';"
|
|
||||||
sudo mysql -e "FLUSH PRIVILEGES;"
|
|
||||||
fi
|
|
||||||
if [[ -z $(sudo mysql gammu -e "SHOW TABLES LIKE 'outbox';") ]]; then
|
|
||||||
echo -e "${c_yellow}Importation du dump gammu...$c_"
|
|
||||||
if [[ $OS == "buster" ]]; then
|
|
||||||
sudo mysql gammu < $MY_PATH/templates/4a/mysql.sql || err+="Import dump MySQL"
|
|
||||||
elif [[ $OS == "stretch" ]]; then
|
|
||||||
sudo mysql gammu < $MY_PATH/templates/4a/mysql-stretch.sql || err+="Import dump MySQL"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
if [[ -z $(sudo mysql gammu -e "SHOW TABLES LIKE 'kalkun';") ]]; then
|
|
||||||
echo -e "${c_yellow}Importation du dump kalkun...$c_"
|
|
||||||
[[ ! $ADRESSE ]] && ADRESSE=G1GROUPE
|
|
||||||
sed -i "s/_GROUPDEF/$ADRESSE/g" $MY_PATH/templates/4a/kalkun.sql
|
|
||||||
sudo mysql gammu < $MY_PATH/templates/4a/kalkun.sql || err+="Import dump Kalkun"
|
|
||||||
fi
|
|
||||||
|
|
||||||
## Clone repo KALKUN
|
|
||||||
|
|
||||||
[[ -d $MY_PATH/kalkun ]] && sudo rm -rf $MY_PATH/kalkun
|
|
||||||
echo -e "${c_yellow}Clonage du dépot de Kalkun...$c_"
|
|
||||||
git clone https://github.com/back2arie/Kalkun.git $MY_PATH/kalkun
|
|
||||||
|
|
||||||
cp $MY_PATH/templates/4a/database.php $MY_PATH/kalkun/application/config/
|
|
||||||
cp $MY_PATH/templates/4a/daemon.sh $MY_PATH/templates/4a/daemon.php $MY_PATH/kalkun/scripts
|
|
||||||
sed -i "s/_PWD/$pwdDB/g" $MY_PATH/kalkun/application/config/database.php || err+="Sed database password"
|
|
||||||
sed -i "s/_DOMAIN/$DOMAIN/g" $MY_PATH/templates/4a/daemon.php || err+="Sed domaine to daemon.php"
|
|
||||||
sed -i "s/$config\['append_username_message'\] = \"Sender: @username\";/$config\['append_username_message'\] = \"\";/g" $MY_PATH/kalkun/application/config/kalkun_settings.php
|
|
||||||
|
|
||||||
# touch $MY_PATH/kalkun/install
|
|
||||||
|
|
||||||
## Place le dossier kalkun dans /var/www/
|
|
||||||
[[ -d /var/www/kalkun ]] && sudo rm -rf /var/www/kalkun
|
|
||||||
sudo mv $MY_PATH/kalkun /var/www/ || err+="Move kalkun to /var/www"
|
|
||||||
sudo chown -R www-data:www-data /var/www/kalkun || err+="Chown www-data to kalkun"
|
|
||||||
sudo chmod u+x /var/www/kalkun/scripts/*
|
|
||||||
|
|
||||||
## Add daemon launcher in sms_received.sh
|
|
||||||
[[ ! $(grep "Execute Kalkun daemon" $MY_PATH/../sms_received.sh) ]] && sed -i "/^export YOU/i # Execute Kalkun daemon\n/var/www/kalkun/scripts/daemon.sh &\n" $MY_PATH/../sms_received.sh
|
|
||||||
|
|
||||||
## Active gammu in MySQL mode
|
|
||||||
if [[ $(grep "service = files" /etc/gammu-smsdrc) ]]; then
|
|
||||||
echo -e "${c_yellow}Activation de gammu-smsd en mode MySQL...$c_"
|
|
||||||
sudo sed -i "/^service = files/a service = sql\ndriver = native_mysql\nhost = localhost\nuser = gammu\npassword = $pwdDB\ndatabase = gammu" /etc/gammu-smsdrc || err+="Sed gammu-smsd"
|
|
||||||
sudo sed -i "/service = files/d" /etc/gammu-smsdrc || err+="Sed delete in gammu-smsd"
|
|
||||||
$MY_PATH/../debug/gammu-restart.sh || err+="Restart gammu"
|
|
||||||
fi
|
|
||||||
|
|
||||||
## Config NGINX
|
|
||||||
|
|
||||||
echo -e "${c_yellow}Configuration de Nginx...$c_"
|
|
||||||
[[ ! -d /etc/nginx/def_conf ]] && sudo mkdir /etc/nginx/def_conf/
|
|
||||||
sudo cp $MY_PATH/templates/rproxy/proxypass.conf /etc/nginx/def_conf/ || err+="Copy proxypass.conf"
|
|
||||||
sudo cp $MY_PATH/templates/4a/kalkun.conf /etc/nginx/conf.d/ || err+="Copy kalkun.conf"
|
|
||||||
sudo sed -i "s/_DOMAIN/$DOMAIN/g" /etc/nginx/conf.d/kalkun.conf || err+="Sed domain in kalkun.conf"
|
|
||||||
|
|
||||||
## Active SSL
|
|
||||||
|
|
||||||
[[ ! $noask ]] && printf "${c_yellow}Voulez-vous installer et activer un certificat SSL maintenant pour $DOMAIN ? (o/n) $c_" && read askSSL
|
|
||||||
if [[ $askSSL =~ ^(o|y|yes|oui|Y|O|YES)$ ]]; then
|
|
||||||
if sudo test ! -f /etc/letsencrypt/live/$DOMAIN/fullchain.pem; then
|
|
||||||
$MY_PATH/ssl.sh certif APP=kalkun DOMAIN=$DOMAIN || err+="Create SSL certification"
|
|
||||||
fi
|
|
||||||
if sudo test -f /etc/letsencrypt/live/$DOMAIN/fullchain.pem; then
|
|
||||||
$MY_PATH/ssl.sh on APP=kalkun DOMAIN=$DOMAIN || err+="Enable SSL certification"
|
|
||||||
else
|
|
||||||
echo -e "${c_red}Une erreur s'est produite, basculement vers le mode non SSL$c_"
|
|
||||||
$MY_PATH/ssl.sh off APP=kalkun DOMAIN=$DOMAIN || err+="Disable SSL certification"
|
|
||||||
fi
|
|
||||||
http=https
|
|
||||||
sudo sed -i "s/http/https/g" /var/www/kalkun/scripts/daemon.php || err+="Sed http to https in daemon.php"
|
|
||||||
else
|
|
||||||
$MY_PATH/ssl.sh off APP=kalkun DOMAIN=$DOMAIN || err+="Disable SSL certification"
|
|
||||||
http=http
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo -e "${c_yellow}Redémarrage de Nginx...$c_"
|
|
||||||
sudo service nginx restart || err+="Restart Nginx"
|
|
||||||
echo -e "${c_yellow}Redémarrage de gammu-smsd...$c_"
|
|
||||||
$MY_PATH/../debug/gammu-restart.sh || err+="Restart gammu"
|
|
||||||
|
|
||||||
if [[ $err ]]; then
|
|
||||||
echo -e "${c_red}Installation incomplète: $err$c_"
|
|
||||||
exit 1
|
|
||||||
else
|
|
||||||
echo -e "${c_green}Kalkun est accessible via l'URL$c_light $http://$DOMAIN$c_"
|
|
||||||
echo -e "${c_green}Les identifiants de connexion par defaut sont:$c_light admin / admin$c_"
|
|
||||||
exit 0
|
|
||||||
fi
|
|
|
@ -1,102 +0,0 @@
|
||||||
#!/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
|
|
||||||
|
|
||||||
IP=$(ifconfig | grep "inet " | grep -v "127.0.0.1" | awk '{ print $2 }')
|
|
||||||
[[ ! $PSMS_DOMAIN ]] && echo -e "${c_yellow}Choisissez un nom de domaine pour PlaySMS (Sinon $IP sera choisi): $c_" && read PSMS_DOMAIN
|
|
||||||
[[ ! $PSMS_DOMAIN ]] && PSMS_DOMAIN=$IP && askSSL=n && noask=o
|
|
||||||
|
|
||||||
|
|
||||||
DOMAIN=$PSMS_DOMAIN
|
|
||||||
|
|
||||||
## Install PHP + MySQL
|
|
||||||
$MY_PATH/1-install_requirements.sh php
|
|
||||||
|
|
||||||
## Create database
|
|
||||||
|
|
||||||
if [[ $(sudo mysql -e "show databases;" | grep gammu) ]]; then
|
|
||||||
pwdDB=$(cat /etc/gammu-smsdrc | grep "password" | grep -v "# " | awk '{ print $3 }')
|
|
||||||
else
|
|
||||||
sudo mysql -e "CREATE DATABASE gammu"
|
|
||||||
sudo mysql -e "CREATE USER 'gammu'@'localhost' IDENTIFIED BY '$pwdDB';"
|
|
||||||
sudo mysql -e "GRANT ALL PRIVILEGES ON gammu.* TO 'gammu'@'localhost';"
|
|
||||||
sudo mysql -e "FLUSH PRIVILEGES;"
|
|
||||||
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/4b/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/rproxy/proxypass.conf /etc/nginx/def_conf/
|
|
||||||
sudo cp $MY_PATH/templates/4b/playsms.conf /etc/nginx/conf.d/
|
|
||||||
sudo sed -i "s/_DOMAIN/$DOMAIN/" /etc/nginx/conf.d/playsms.conf
|
|
||||||
|
|
||||||
## Active SSL
|
|
||||||
|
|
||||||
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 $DOMAIN ? (o/n) $c_" && read askSSL
|
|
||||||
if [[ $askSSL =~ ^(o|y|yes|oui|Y|O|YES)$ ]]; then
|
|
||||||
$MY_PATH/ssl.sh certif APP=playsms DOMAIN=$DOMAIN
|
|
||||||
if sudo test -f /etc/letsencrypt/live/$DOMAIN/fullchain.pem; then
|
|
||||||
$MY_PATH/ssl.sh on APP=playsms DOMAIN=$DOMAIN
|
|
||||||
else
|
|
||||||
echo -e "${c_red}Une erreur s'est produite, basculement vers le mode non SSL$c_"
|
|
||||||
$MY_PATH/ssl.sh off APP=playsms DOMAIN=$DOMAIN
|
|
||||||
fi
|
|
||||||
http=https
|
|
||||||
else
|
|
||||||
$MY_PATH/ssl.sh off APP=playsms DOMAIN=$DOMAIN
|
|
||||||
http=http
|
|
||||||
fi
|
|
||||||
|
|
||||||
sudo service nginx restart
|
|
||||||
|
|
||||||
if [[ $err ]]; then
|
|
||||||
echo -e "${c_red}Installation incomplète$c_"
|
|
||||||
exit 1
|
|
||||||
else
|
|
||||||
echo -e "${c_green}PlaySMS est accessible via l'URL $http://$DOMAIN$c_"
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
|
|
|
@ -1,14 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
MY_PATH="`dirname \"$0\"`" # relative
|
|
||||||
MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized
|
|
||||||
source $MY_PATH/../.install/.GPATH
|
|
||||||
|
|
||||||
GPATHS=$(echo $GPATH | sed 's./.\\/.g')
|
|
||||||
|
|
||||||
sudo cp $MY_PATH/templates/5/youtube-dl.php $GPATH/www/rompr/REC/youtube-dl.php
|
|
||||||
sudo sed -i "s/_GPATH/$GPATHS/g" $GPATH/www/rompr/REC/youtube-dl.php
|
|
||||||
|
|
||||||
## TODO
|
|
||||||
# Tout les reste ...
|
|
||||||
|
|
||||||
exit 0
|
|
|
@ -1,32 +0,0 @@
|
||||||
#!/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
|
|
|
@ -1,74 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
MY_PATH="`dirname \"$0\"`" # relative
|
|
||||||
MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized
|
|
||||||
|
|
||||||
### Vars
|
|
||||||
args=$(echo $@ | tr " " "\n")
|
|
||||||
|
|
||||||
if [[ "$args" =~ "DOMAIN=" ]]; then
|
|
||||||
DOMAIN=$(echo "$args" | grep "\<DOMAIN=" | awk -F '=' '{ print $2 }')
|
|
||||||
else
|
|
||||||
echo "Veuillez sélectionner un domaine avec DOMAIN=mondommain.com"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
if [[ "$args" =~ "APP=" ]]; then
|
|
||||||
APP=$(echo "$args" | grep "\<APP=" | awk -F '=' '{ print $2 }')
|
|
||||||
else
|
|
||||||
echo "Veuillez sélectionner une application avec APP=monapp"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
action=$(echo "$args" | grep -v "=")
|
|
||||||
[[ ! $action =~ ^(on|off|certif)$ ]] && echo "Veuillez choisir on, off 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@$DOMAIN -d $DOMAIN && echo "Le certificat de $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/rproxy/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/g' /etc/nginx/conf.d/$APP.conf
|
|
||||||
sudo sed -i 's/ #add/ add/g' /etc/nginx/conf.d/$APP.conf
|
|
||||||
|
|
||||||
sudo sed -i "s/listen 443;/listen 443 ssl;/g" /etc/nginx/conf.d/$APP.conf
|
|
||||||
[[ ! -d /etc/nginx/includes ]] && sudo mkdir /etc/nginx/includes
|
|
||||||
sudo cp $MY_PATH/templates/rproxy/ssl.conf /etc/nginx/includes/
|
|
||||||
sudo sed -i "/Content-Security-Policy/a \ include includes/ssl.conf;\n ssl_certificate /etc/letsencrypt/live/$DOMAIN/fullchain.pem;\n ssl_certificate_key /etc/letsencrypt/live/$DOMAIN/privkey.pem;" /etc/nginx/conf.d/$APP.conf
|
|
||||||
;;
|
|
||||||
|
|
||||||
off)
|
|
||||||
sudo sed -i "s/ if/ #if/g" /etc/nginx/conf.d/$APP.conf
|
|
||||||
sudo sed -i "s/ add/ #add/g" /etc/nginx/conf.d/$APP.conf
|
|
||||||
|
|
||||||
sudo sed -i "/ssl.conf;/d" /etc/nginx/conf.d/$APP.conf
|
|
||||||
sudo sed -i "/ssl_certificate/d" /etc/nginx/conf.d/$APP.conf
|
|
||||||
;;
|
|
||||||
certif)
|
|
||||||
[[ ! $(which certbot) ]] && install_certbot
|
|
||||||
if sudo test ! -f /etc/letsencrypt/live/$DOMAIN/fullchain.pem; then create_certificate; fi
|
|
||||||
;;
|
|
||||||
|
|
||||||
esac
|
|
|
@ -1,6 +0,0 @@
|
||||||
ADMINPSEUDO=_ADMINPSEUDO
|
|
||||||
ADMINPHONE=_ADMINPHONE
|
|
||||||
MASTERPHONE=_MASTERPHONE
|
|
||||||
ADRESSE="_ADRESSE"
|
|
||||||
PIN=_PIN
|
|
||||||
KSMS_DOMAIN=
|
|
|
@ -1,34 +0,0 @@
|
||||||
# Configuration file for Gammu SMS Daemon
|
|
||||||
|
|
||||||
# Gammu library configuration, see gammurc(5)
|
|
||||||
[gammu]
|
|
||||||
# Please configure this!
|
|
||||||
port = /dev/ttyUSB0
|
|
||||||
synchronizetime = yes
|
|
||||||
gammucoding = utf8
|
|
||||||
connection = at
|
|
||||||
# Debugging
|
|
||||||
logformat = textall
|
|
||||||
|
|
||||||
# SMSD configuration, see gammu-smsdrc(5)
|
|
||||||
[smsd]
|
|
||||||
#service = files
|
|
||||||
service = sql
|
|
||||||
driver = native_mysql
|
|
||||||
host = localhost
|
|
||||||
user = playsms
|
|
||||||
password = DlNHoAZQbuCBJYYI0a1TWfu8X6197pDY6GfARLLUSB
|
|
||||||
database = kalkun
|
|
||||||
|
|
||||||
logfile = /var/log/gammu-smsd.log
|
|
||||||
# Increase for debugging information
|
|
||||||
smsc = 33695000695
|
|
||||||
PIN = 1234
|
|
||||||
|
|
||||||
# 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/
|
|
||||||
|
|
||||||
debuglevel = 4
|
|
|
@ -1,11 +0,0 @@
|
||||||
[Unit]
|
|
||||||
Description=IPFS daemon
|
|
||||||
After=network.target
|
|
||||||
|
|
||||||
[Service]
|
|
||||||
User=_USER
|
|
||||||
ExecStart=/usr/local/bin/ipfs daemon --enable-pubsub-experiment --enable-namesys-pubsub --routing=dhtclient --enable-gc
|
|
||||||
Restart=on-failure
|
|
||||||
|
|
||||||
[Install]
|
|
||||||
WantedBy=multi-user.target
|
|
|
@ -1,26 +0,0 @@
|
||||||
# Configuration file for Gammu SMS Daemon
|
|
||||||
|
|
||||||
[gammu]
|
|
||||||
port = /dev/ttyAMA0
|
|
||||||
synchronizetime = yes
|
|
||||||
gammucoding = utf8
|
|
||||||
connection = at
|
|
||||||
# Debugging
|
|
||||||
logformat = textall
|
|
||||||
|
|
||||||
# SMSD configuration, see gammu-smsdrc(5)
|
|
||||||
[smsd]
|
|
||||||
service = files
|
|
||||||
|
|
||||||
logfile = /var/log/gammu-smsd.log
|
|
||||||
PIN = _PIN
|
|
||||||
|
|
||||||
# Paths where messages are stored (Not use if service = sql)
|
|
||||||
inboxpath = /var/spool/gammu/inbox/
|
|
||||||
outboxpath = /var/spool/gammu/outbox/
|
|
||||||
sentsmspath = /var/spool/gammu/sent/
|
|
||||||
errorsmspath = /var/spool/gammu/error/
|
|
||||||
|
|
||||||
RunOnReceive = _GPATH/sms_received.sh
|
|
||||||
#IncludeSMSCFile = _GPATH/debug/smsc.txt
|
|
||||||
debuglevel = 3
|
|
|
@ -1,35 +0,0 @@
|
||||||
server {
|
|
||||||
listen 80 default_server;
|
|
||||||
listen [::]:80 default_server;
|
|
||||||
|
|
||||||
root /home/_USER/G1sms+/www/rompr;
|
|
||||||
index index.html index.htm index.nginx-debian.html;
|
|
||||||
|
|
||||||
server_name _;
|
|
||||||
|
|
||||||
location /g1tag {
|
|
||||||
proxy_pass http://127.0.0.1:81;
|
|
||||||
proxy_set_header Host $host;
|
|
||||||
proxy_set_header X-Forwarded-For $remote_addr;
|
|
||||||
}
|
|
||||||
|
|
||||||
location /code/ {
|
|
||||||
proxy_pass http://127.0.0.1:8080/ipns/QmZHTne3bjtMgaXWRqSbdKchJbgq2NaAeVSzFUN7ceYpif/;
|
|
||||||
proxy_set_header Host $host;
|
|
||||||
proxy_set_header X-Real-IP $remote_addr;
|
|
||||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
||||||
}
|
|
||||||
|
|
||||||
location /ipfs {
|
|
||||||
proxy_pass http://127.0.0.1:8080;
|
|
||||||
proxy_set_header Host $host;
|
|
||||||
proxy_set_header X-Forwarded-For $remote_addr;
|
|
||||||
}
|
|
||||||
|
|
||||||
location /ipns {
|
|
||||||
proxy_pass http://127.0.0.1:8080;
|
|
||||||
proxy_set_header Host $host;
|
|
||||||
proxy_set_header X-Forwarded-For $remote_addr;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,27 +0,0 @@
|
||||||
music_directory "/home/_USER/music"
|
|
||||||
playlist_directory "/home/_USER/playlists"
|
|
||||||
user "$USER"
|
|
||||||
bind_to_address "any"
|
|
||||||
auto_update "yes"
|
|
||||||
zeroconf_enabled "yes"
|
|
||||||
zeroconf_name "CopyLaRadio Music Recorder"
|
|
||||||
|
|
||||||
filesystem_charset "UTF-8"
|
|
||||||
id3v1_encoding "UTF-8"
|
|
||||||
###############################
|
|
||||||
|
|
||||||
audio_output {
|
|
||||||
type "pulse"
|
|
||||||
name "My Pulse Output"
|
|
||||||
server "127.0.0.1"
|
|
||||||
}
|
|
||||||
|
|
||||||
audio_output {
|
|
||||||
type "httpd"
|
|
||||||
name "CopyLaRadio HTTP Stream"
|
|
||||||
encoder "lame"
|
|
||||||
port "8000"
|
|
||||||
quality "5.0"
|
|
||||||
# bitrate "128"
|
|
||||||
format "44100:16:1"
|
|
||||||
}
|
|
|
@ -1,10 +0,0 @@
|
||||||
<?php
|
|
||||||
// Make sure it's run from CLI
|
|
||||||
if(php_sapi_name() != 'cli' && !empty($_SERVER['REMOTE_ADDR'])) exit("Access Denied.");
|
|
||||||
|
|
||||||
// Please configure this
|
|
||||||
$url = "http://_DOMAIN";
|
|
||||||
|
|
||||||
fclose(fopen($url."/index.php/daemon/message_routine/", "r"));
|
|
||||||
|
|
||||||
?>
|
|
|
@ -1,8 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
|
|
||||||
# Configure this (use absolute path)
|
|
||||||
PHP=/usr/bin/php # php cli path
|
|
||||||
DAEMON=/var/www/kalkun/scripts/daemon.php # daemon.php path
|
|
||||||
|
|
||||||
# Execute
|
|
||||||
$PHP $DAEMON
|
|
|
@ -1,58 +0,0 @@
|
||||||
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
|
||||||
/*
|
|
||||||
| -------------------------------------------------------------------
|
|
||||||
| DATABASE CONNECTIVITY SETTINGS
|
|
||||||
| -------------------------------------------------------------------
|
|
||||||
| This file will contain the settings needed to access your database.
|
|
||||||
|
|
|
||||||
| For complete instructions please consult the "Database Connection"
|
|
||||||
| page of the User Guide.
|
|
||||||
|
|
|
||||||
| -------------------------------------------------------------------
|
|
||||||
| EXPLANATION OF VARIABLES
|
|
||||||
| -------------------------------------------------------------------
|
|
||||||
|
|
|
||||||
| ['hostname'] The hostname of your database server.
|
|
||||||
| ['username'] The username used to connect to the database
|
|
||||||
| ['password'] The password used to connect to the database
|
|
||||||
| ['database'] The name of the database you want to connect to
|
|
||||||
| ['dbdriver'] The database type. ie: mysql. Currently supported:
|
|
||||||
mysql, mysqli, postgre, odbc, mssql, sqlite, oci8
|
|
||||||
| ['dbprefix'] You can add an optional prefix, which will be added
|
|
||||||
| to the table name when using the Active Record class
|
|
||||||
| ['pconnect'] TRUE/FALSE - Whether to use a persistent connection
|
|
||||||
| ['db_debug'] TRUE/FALSE - Whether database errors should be displayed.
|
|
||||||
| ['cache_on'] TRUE/FALSE - Enables/disables query caching
|
|
||||||
| ['cachedir'] The path to the folder where cache files should be stored
|
|
||||||
| ['char_set'] The character set used in communicating with the database
|
|
||||||
| ['dbcollat'] The character collation used in communicating with the database
|
|
||||||
|
|
|
||||||
| The $active_group variable lets you choose which connection group to
|
|
||||||
| make active. By default there is only one group (the "default" group).
|
|
||||||
|
|
|
||||||
| The $active_record variables lets you determine whether or not to load
|
|
||||||
| the active record class
|
|
||||||
*/
|
|
||||||
|
|
||||||
$active_group = "default";
|
|
||||||
$active_record = TRUE;
|
|
||||||
|
|
||||||
$db['default']['hostname'] = "127.0.0.1";
|
|
||||||
|
|
||||||
// MySQL
|
|
||||||
$db['default']['username'] = "gammu";
|
|
||||||
$db['default']['password'] = "_PWD";
|
|
||||||
$db['default']['database'] = "gammu";
|
|
||||||
$db['default']['dbdriver'] = "mysqli";
|
|
||||||
|
|
||||||
$db['default']['dbprefix'] = "";
|
|
||||||
$db['default']['pconnect'] = FALSE;
|
|
||||||
$db['default']['db_debug'] = TRUE;
|
|
||||||
$db['default']['cache_on'] = FALSE;
|
|
||||||
$db['default']['cachedir'] = "";
|
|
||||||
$db['default']['char_set'] = "utf8";
|
|
||||||
$db['default']['dbcollat'] = "utf8_general_ci";
|
|
||||||
|
|
||||||
|
|
||||||
/* End of file database.php */
|
|
||||||
/* Location: ./application/config/database.php */
|
|
|
@ -1,38 +0,0 @@
|
||||||
server {
|
|
||||||
listen 80;
|
|
||||||
listen 443;
|
|
||||||
listen [::]:443 ssl;
|
|
||||||
server_name _DOMAIN;
|
|
||||||
|
|
||||||
#add_header Content-Security-Policy upgrade-insecure-requests;
|
|
||||||
#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/kalkun;
|
|
||||||
|
|
||||||
# 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/kalkun_error.log;
|
|
||||||
access_log /var/log/nginx/kalkun_access.log;
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,340 +0,0 @@
|
||||||
-- phpMyAdmin SQL Dump
|
|
||||||
-- version 3.2.0.1
|
|
||||||
-- http://www.phpmyadmin.net
|
|
||||||
--
|
|
||||||
-- Host: localhost
|
|
||||||
-- Generation Time: Feb 22, 2011 at 05:38 PM
|
|
||||||
-- Server version: 5.1.37
|
|
||||||
-- PHP Version: 5.3.0
|
|
||||||
|
|
||||||
SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
|
|
||||||
|
|
||||||
|
|
||||||
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
|
|
||||||
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
|
|
||||||
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
|
|
||||||
/*!40101 SET NAMES utf8 */;
|
|
||||||
|
|
||||||
--
|
|
||||||
-- Database: `kalkun`
|
|
||||||
--
|
|
||||||
|
|
||||||
-- --------------------------------------------------------
|
|
||||||
|
|
||||||
--
|
|
||||||
-- Table structure for table `kalkun`
|
|
||||||
--
|
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS `kalkun` (
|
|
||||||
`version` text NOT NULL
|
|
||||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
|
|
||||||
|
|
||||||
-- --------------------------------------------------------
|
|
||||||
|
|
||||||
--
|
|
||||||
-- Table structure for table `sms_used`
|
|
||||||
--
|
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS `sms_used` (
|
|
||||||
`id_sms_used` int(11) NOT NULL AUTO_INCREMENT,
|
|
||||||
`sms_date` date NOT NULL,
|
|
||||||
`id_user` int(11) NOT NULL,
|
|
||||||
`out_sms_count` int(11) NOT NULL DEFAULT '0',
|
|
||||||
`in_sms_count` int(11) NOT NULL DEFAULT '0',
|
|
||||||
PRIMARY KEY (`id_sms_used`)
|
|
||||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ;
|
|
||||||
|
|
||||||
-- --------------------------------------------------------
|
|
||||||
|
|
||||||
--
|
|
||||||
-- Table structure for table `user`
|
|
||||||
--
|
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS `user` (
|
|
||||||
`id_user` int(11) NOT NULL AUTO_INCREMENT,
|
|
||||||
`username` varchar(12) NOT NULL,
|
|
||||||
`realname` varchar(100) NOT NULL,
|
|
||||||
`password` varchar(255) NOT NULL,
|
|
||||||
`phone_number` varchar(15) NOT NULL,
|
|
||||||
`level` enum('admin','user') NOT NULL DEFAULT 'user',
|
|
||||||
PRIMARY KEY (`id_user`),
|
|
||||||
UNIQUE KEY `username` (`username`),
|
|
||||||
UNIQUE KEY `phone_number` (`phone_number`)
|
|
||||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=2 ;
|
|
||||||
|
|
||||||
--
|
|
||||||
-- Dumping data for table `user`
|
|
||||||
--
|
|
||||||
|
|
||||||
INSERT INTO `user` (`id_user`, `username`, `realname`, `password`, `phone_number`, `level`) VALUES
|
|
||||||
(1, 'admin', 'G1Admin', 'd033e22ae348aeb5660fc2140aec35850c4da997', '0600000000', 'admin');
|
|
||||||
|
|
||||||
|
|
||||||
-- --------------------------------------------------------
|
|
||||||
|
|
||||||
--
|
|
||||||
-- Table structure for table `user_folders`
|
|
||||||
--
|
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS `user_folders` (
|
|
||||||
`id_folder` int(11) NOT NULL AUTO_INCREMENT,
|
|
||||||
`name` varchar(50) NOT NULL,
|
|
||||||
`id_user` int(11) NOT NULL,
|
|
||||||
PRIMARY KEY (`id_folder`)
|
|
||||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=11 ;
|
|
||||||
|
|
||||||
--
|
|
||||||
-- Dumping data for table `user_folders`
|
|
||||||
--
|
|
||||||
|
|
||||||
INSERT INTO `user_folders` (`id_folder`, `name`, `id_user`) VALUES
|
|
||||||
(1, 'inbox', 0),
|
|
||||||
(2, 'outbox', 0),
|
|
||||||
(3, 'sent_items', 0),
|
|
||||||
(4, 'draft', 0),
|
|
||||||
(5, 'Trash', 0),
|
|
||||||
(6, 'Spam', 0);
|
|
||||||
|
|
||||||
-- --------------------------------------------------------
|
|
||||||
|
|
||||||
--
|
|
||||||
-- Table structure for table `user_inbox`
|
|
||||||
--
|
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS `user_inbox` (
|
|
||||||
`id_inbox` int(11) NOT NULL,
|
|
||||||
`id_user` int(11) NOT NULL,
|
|
||||||
`trash` tinyint(1) NOT NULL DEFAULT '0',
|
|
||||||
PRIMARY KEY (`id_inbox`)
|
|
||||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
|
|
||||||
|
|
||||||
-- --------------------------------------------------------
|
|
||||||
|
|
||||||
--
|
|
||||||
-- Table structure for table `user_outbox`
|
|
||||||
--
|
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS `user_outbox` (
|
|
||||||
`id_outbox` int(11) NOT NULL,
|
|
||||||
`id_user` int(11) NOT NULL,
|
|
||||||
PRIMARY KEY (`id_outbox`)
|
|
||||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
|
|
||||||
|
|
||||||
-- --------------------------------------------------------
|
|
||||||
|
|
||||||
--
|
|
||||||
-- Table structure for table `user_sentitems`
|
|
||||||
--
|
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS `user_sentitems` (
|
|
||||||
`id_sentitems` int(11) NOT NULL,
|
|
||||||
`id_user` int(11) NOT NULL,
|
|
||||||
`trash` tinyint(1) NOT NULL DEFAULT '0',
|
|
||||||
PRIMARY KEY (`id_sentitems`)
|
|
||||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
|
|
||||||
|
|
||||||
-- --------------------------------------------------------
|
|
||||||
|
|
||||||
--
|
|
||||||
-- Table structure for table `user_settings`
|
|
||||||
--
|
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS `user_settings` (
|
|
||||||
`id_user` int(11) NOT NULL,
|
|
||||||
`theme` varchar(10) NOT NULL DEFAULT 'blue',
|
|
||||||
`signature` varchar(50) NOT NULL,
|
|
||||||
`permanent_delete` enum('true','false') NOT NULL DEFAULT 'false',
|
|
||||||
`paging` int(2) NOT NULL DEFAULT '10',
|
|
||||||
`bg_image` varchar(50) NOT NULL,
|
|
||||||
`delivery_report` enum('default','yes','no') NOT NULL DEFAULT 'default',
|
|
||||||
`language` varchar(20) NOT NULL DEFAULT 'french',
|
|
||||||
`conversation_sort` enum('asc','desc') NOT NULL DEFAULT 'asc',
|
|
||||||
`country_code` varchar(2) NOT NULL DEFAULT 'FR',
|
|
||||||
PRIMARY KEY (`id_user`)
|
|
||||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
|
|
||||||
|
|
||||||
--
|
|
||||||
-- Dumping data for table `user_settings`
|
|
||||||
--
|
|
||||||
|
|
||||||
INSERT INTO `user_settings` (`id_user`, `theme`, `signature`, `permanent_delete`, `paging`, `bg_image`, `delivery_report`, `language`, `conversation_sort`) VALUES
|
|
||||||
(1, 'green', 'false;--\nVotre signature ici', 'false', 20, 'true;background.jpg', 'default' , 'french', 'asc');
|
|
||||||
|
|
||||||
|
|
||||||
-- --------------------------------------------------------
|
|
||||||
|
|
||||||
--
|
|
||||||
-- Alter table structure for table `inbox`
|
|
||||||
--
|
|
||||||
|
|
||||||
ALTER TABLE `inbox` ADD `id_folder` INT( 11 ) NOT NULL DEFAULT '1',
|
|
||||||
ADD `readed` ENUM( 'false', 'true' ) NOT NULL DEFAULT 'false';
|
|
||||||
|
|
||||||
|
|
||||||
-- --------------------------------------------------------
|
|
||||||
|
|
||||||
--
|
|
||||||
-- Alter table structure for table `sentitems`
|
|
||||||
--
|
|
||||||
|
|
||||||
ALTER TABLE `sentitems` ADD `id_folder` INT( 11 ) NOT NULL DEFAULT '3';
|
|
||||||
|
|
||||||
|
|
||||||
-- --------------------------------------------------------
|
|
||||||
-- mulai versi db 16, pbk dan pbk__groups dihapus di gammu
|
|
||||||
--
|
|
||||||
-- Alter table structure for table `pbk`
|
|
||||||
--
|
|
||||||
CREATE TABLE `pbk` (
|
|
||||||
`ID` integer NOT NULL auto_increment,
|
|
||||||
`GroupID` integer NOT NULL default '-1',
|
|
||||||
`Name` text NOT NULL,
|
|
||||||
`Number` text NOT NULL,
|
|
||||||
PRIMARY KEY (`ID`)
|
|
||||||
);
|
|
||||||
|
|
||||||
--
|
|
||||||
-- Dumping data for table `pbk`
|
|
||||||
--
|
|
||||||
|
|
||||||
|
|
||||||
-- --------------------------------------------------------
|
|
||||||
|
|
||||||
--
|
|
||||||
-- Table structure for table `pbk_groups`
|
|
||||||
--
|
|
||||||
|
|
||||||
CREATE TABLE `pbk_groups` (
|
|
||||||
`Name` text NOT NULL,
|
|
||||||
`ID` integer NOT NULL auto_increment,
|
|
||||||
PRIMARY KEY `ID` (`ID`)
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
ALTER TABLE `pbk` ADD `id_user` INT( 11 ) NOT NULL;
|
|
||||||
ALTER TABLE `pbk` ADD `is_public` enum('true','false') NOT NULL DEFAULT 'false';
|
|
||||||
|
|
||||||
-- --------------------------------------------------------
|
|
||||||
|
|
||||||
--
|
|
||||||
-- Alter table structure for table `pbk_groups`
|
|
||||||
--
|
|
||||||
|
|
||||||
ALTER TABLE `pbk_groups` ADD `id_user` INT( 11 ) NOT NULL;
|
|
||||||
ALTER TABLE `pbk_groups` ADD `is_public` enum('true','false') NOT NULL DEFAULT 'false';
|
|
||||||
|
|
||||||
|
|
||||||
-- --------------------------------------------------------
|
|
||||||
|
|
||||||
--
|
|
||||||
-- Table structure for table `user_group`
|
|
||||||
--
|
|
||||||
|
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS `user_group` (
|
|
||||||
`id_group` int(11) NOT NULL AUTO_INCREMENT,
|
|
||||||
`id_pbk` int(11) NOT NULL,
|
|
||||||
`id_pbk_groups` int(11) NOT NULL,
|
|
||||||
`id_user` int(11) NOT NULL,
|
|
||||||
PRIMARY KEY (`id_group`)
|
|
||||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ;
|
|
||||||
|
|
||||||
|
|
||||||
-- --------------------------------------------------------
|
|
||||||
|
|
||||||
--
|
|
||||||
-- Table structure for table `user_templates`
|
|
||||||
--
|
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS `user_templates` (
|
|
||||||
`id_template` int(11) NOT NULL AUTO_INCREMENT,
|
|
||||||
`id_user` int(11) NOT NULL,
|
|
||||||
`Name` varchar(64) NOT NULL,
|
|
||||||
`Message` text NOT NULL,
|
|
||||||
PRIMARY KEY (`id_template`)
|
|
||||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ;
|
|
||||||
|
|
||||||
|
|
||||||
-- --------------------------------------------------------
|
|
||||||
|
|
||||||
--
|
|
||||||
-- Table structure for table `b8_wordlist`
|
|
||||||
--
|
|
||||||
|
|
||||||
CREATE TABLE `b8_wordlist` (
|
|
||||||
`token` varchar(255) character set utf8 collate utf8_bin NOT NULL,
|
|
||||||
`count` varchar(255) default NULL,
|
|
||||||
PRIMARY KEY (`token`)
|
|
||||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
|
|
||||||
|
|
||||||
INSERT INTO `b8_wordlist` VALUES ('bayes*dbversion', '2');
|
|
||||||
INSERT INTO `b8_wordlist` VALUES ('bayes*texts.ham', '0');
|
|
||||||
INSERT INTO `b8_wordlist` VALUES ('bayes*texts.spam', '0');
|
|
||||||
|
|
||||||
-- --------------------------------------------------------
|
|
||||||
|
|
||||||
--
|
|
||||||
-- Table structure for table `plugins`
|
|
||||||
--
|
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS `plugins` (
|
|
||||||
`plugin_id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
|
|
||||||
`plugin_system_name` varchar(255) NOT NULL,
|
|
||||||
`plugin_name` varchar(255) NOT NULL,
|
|
||||||
`plugin_uri` varchar(120) DEFAULT NULL,
|
|
||||||
`plugin_version` varchar(30) NULL,
|
|
||||||
`plugin_description` text,
|
|
||||||
`plugin_author` varchar(120) DEFAULT NULL,
|
|
||||||
`plugin_author_uri` varchar(120) DEFAULT NULL,
|
|
||||||
`plugin_data` longtext,
|
|
||||||
PRIMARY KEY (`plugin_id`),
|
|
||||||
UNIQUE KEY `plugin_index` (`plugin_system_name`) USING BTREE
|
|
||||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
|
|
||||||
|
|
||||||
|
|
||||||
-- --------------------------------------------------------
|
|
||||||
|
|
||||||
--
|
|
||||||
-- Table structure for table `user_forgot_password`
|
|
||||||
--
|
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS `user_forgot_password` (
|
|
||||||
`id_user` int(11) NOT NULL,
|
|
||||||
`token` varchar(255) NOT NULL,
|
|
||||||
`valid_until` datetime NOT NULL,
|
|
||||||
PRIMARY KEY (`id_user`)
|
|
||||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
|
|
||||||
|
|
||||||
|
|
||||||
-- --------------------------------------------------------
|
|
||||||
|
|
||||||
--
|
|
||||||
-- Table structure for table `user_filters`
|
|
||||||
--
|
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS `user_filters` (
|
|
||||||
`id_filter` int(11) NOT NULL AUTO_INCREMENT,
|
|
||||||
`id_user` int(11) NOT NULL,
|
|
||||||
`from` varchar(15) NOT NULL,
|
|
||||||
`has_the_words` varchar(50) NOT NULL,
|
|
||||||
`id_folder` int(11) NOT NULL,
|
|
||||||
PRIMARY KEY (`id_filter`)
|
|
||||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
|
|
||||||
|
|
||||||
|
|
||||||
CREATE TABLE `ci_sessions` (
|
|
||||||
`id` varchar(40) NOT NULL,
|
|
||||||
`ip_address` varchar(45) NOT NULL,
|
|
||||||
`timestamp` int(10) unsigned NOT NULL DEFAULT '0',
|
|
||||||
`data` blob NOT NULL,
|
|
||||||
KEY `ci_sessions_timestamp` (`timestamp`)
|
|
||||||
) DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
|
|
||||||
|
|
||||||
-- --------------------------------------------------------
|
|
||||||
|
|
||||||
--
|
|
||||||
-- Insert default contact group
|
|
||||||
--
|
|
||||||
|
|
||||||
INSERT INTO `pbk_groups` (`ID`, `Name`, `id_user`, `is_public`) VALUES
|
|
||||||
('1', 'Blois', '1', 'false');
|
|
|
@ -1,227 +0,0 @@
|
||||||
--
|
|
||||||
-- Database for Gammu SMSD
|
|
||||||
--
|
|
||||||
-- In case you get errors about not supported charset, please
|
|
||||||
-- replace utf8mb4 with utf8.
|
|
||||||
|
|
||||||
-- --------------------------------------------------------
|
|
||||||
|
|
||||||
--
|
|
||||||
-- Table structure for table `gammu`
|
|
||||||
--
|
|
||||||
|
|
||||||
CREATE TABLE `gammu` (
|
|
||||||
`Version` integer NOT NULL default '0' PRIMARY KEY
|
|
||||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4;
|
|
||||||
|
|
||||||
--
|
|
||||||
-- Dumping data for table `gammu`
|
|
||||||
--
|
|
||||||
|
|
||||||
INSERT INTO `gammu` (`Version`) VALUES (16);
|
|
||||||
|
|
||||||
-- --------------------------------------------------------
|
|
||||||
|
|
||||||
--
|
|
||||||
-- Table structure for table `inbox`
|
|
||||||
--
|
|
||||||
|
|
||||||
CREATE TABLE `inbox` (
|
|
||||||
`UpdatedInDB` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
|
|
||||||
`ReceivingDateTime` timestamp NOT NULL default '0000-00-00 00:00:00',
|
|
||||||
`Text` text NOT NULL,
|
|
||||||
`SenderNumber` varchar(20) NOT NULL default '',
|
|
||||||
`Coding` enum('Default_No_Compression','Unicode_No_Compression','8bit','Default_Compression','Unicode_Compression') NOT NULL default 'Default_No_Compression',
|
|
||||||
`UDH` text NOT NULL,
|
|
||||||
`SMSCNumber` varchar(20) NOT NULL default '',
|
|
||||||
`Class` integer NOT NULL default '-1',
|
|
||||||
`TextDecoded` text NOT NULL,
|
|
||||||
`ID` integer unsigned NOT NULL auto_increment,
|
|
||||||
`RecipientID` text NOT NULL,
|
|
||||||
`Processed` enum('false','true') NOT NULL default 'false',
|
|
||||||
PRIMARY KEY `ID` (`ID`)
|
|
||||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 AUTO_INCREMENT=1 ;
|
|
||||||
|
|
||||||
--
|
|
||||||
-- Dumping data for table `inbox`
|
|
||||||
--
|
|
||||||
|
|
||||||
|
|
||||||
-- --------------------------------------------------------
|
|
||||||
|
|
||||||
--
|
|
||||||
-- Table structure for table `outbox`
|
|
||||||
--
|
|
||||||
|
|
||||||
CREATE TABLE `outbox` (
|
|
||||||
`UpdatedInDB` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
|
|
||||||
`InsertIntoDB` timestamp NOT NULL default '0000-00-00 00:00:00',
|
|
||||||
`SendingDateTime` timestamp NOT NULL default '0000-00-00 00:00:00',
|
|
||||||
`SendBefore` time NOT NULL DEFAULT '23:59:59',
|
|
||||||
`SendAfter` time NOT NULL DEFAULT '00:00:00',
|
|
||||||
`Text` text,
|
|
||||||
`DestinationNumber` varchar(20) NOT NULL default '',
|
|
||||||
`Coding` enum('Default_No_Compression','Unicode_No_Compression','8bit','Default_Compression','Unicode_Compression') NOT NULL default 'Default_No_Compression',
|
|
||||||
`UDH` text,
|
|
||||||
`Class` integer default '-1',
|
|
||||||
`TextDecoded` text NOT NULL,
|
|
||||||
`ID` integer unsigned NOT NULL auto_increment,
|
|
||||||
`MultiPart` enum('false','true') default 'false',
|
|
||||||
`RelativeValidity` integer default '-1',
|
|
||||||
`SenderID` varchar(255),
|
|
||||||
`SendingTimeOut` timestamp NULL default '0000-00-00 00:00:00',
|
|
||||||
`DeliveryReport` enum('default','yes','no') default 'default',
|
|
||||||
`CreatorID` text NOT NULL,
|
|
||||||
`Retries` int(3) default 0,
|
|
||||||
`Priority` integer default 0,
|
|
||||||
PRIMARY KEY `ID` (`ID`)
|
|
||||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4;
|
|
||||||
|
|
||||||
CREATE INDEX outbox_date ON outbox(SendingDateTime, SendingTimeOut);
|
|
||||||
CREATE INDEX outbox_sender ON outbox(SenderID(250));
|
|
||||||
|
|
||||||
--
|
|
||||||
-- Dumping data for table `outbox`
|
|
||||||
--
|
|
||||||
|
|
||||||
|
|
||||||
-- --------------------------------------------------------
|
|
||||||
|
|
||||||
--
|
|
||||||
-- Table structure for table `outbox_multipart`
|
|
||||||
--
|
|
||||||
|
|
||||||
CREATE TABLE `outbox_multipart` (
|
|
||||||
`Text` text,
|
|
||||||
`Coding` enum('Default_No_Compression','Unicode_No_Compression','8bit','Default_Compression','Unicode_Compression') NOT NULL default 'Default_No_Compression',
|
|
||||||
`UDH` text,
|
|
||||||
`Class` integer default '-1',
|
|
||||||
`TextDecoded` text,
|
|
||||||
`ID` integer unsigned NOT NULL default '0',
|
|
||||||
`SequencePosition` integer NOT NULL default '1',
|
|
||||||
PRIMARY KEY (`ID`, `SequencePosition`)
|
|
||||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4;
|
|
||||||
|
|
||||||
--
|
|
||||||
-- Dumping data for table `outbox_multipart`
|
|
||||||
--
|
|
||||||
|
|
||||||
-- --------------------------------------------------------
|
|
||||||
|
|
||||||
--
|
|
||||||
-- Table structure for table `phones`
|
|
||||||
--
|
|
||||||
|
|
||||||
CREATE TABLE `phones` (
|
|
||||||
`ID` text NOT NULL,
|
|
||||||
`UpdatedInDB` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
|
|
||||||
`InsertIntoDB` timestamp NOT NULL default '0000-00-00 00:00:00',
|
|
||||||
`TimeOut` timestamp NOT NULL default '0000-00-00 00:00:00',
|
|
||||||
`Send` enum('yes','no') NOT NULL default 'no',
|
|
||||||
`Receive` enum('yes','no') NOT NULL default 'no',
|
|
||||||
`IMEI` varchar(35) NOT NULL,
|
|
||||||
`IMSI` varchar(35) NOT NULL,
|
|
||||||
`NetCode` varchar(10) default 'ERROR',
|
|
||||||
`NetName` varchar(35) default 'ERROR',
|
|
||||||
`Client` text NOT NULL,
|
|
||||||
`Battery` integer NOT NULL DEFAULT -1,
|
|
||||||
`Signal` integer NOT NULL DEFAULT -1,
|
|
||||||
`Sent` int NOT NULL DEFAULT 0,
|
|
||||||
`Received` int NOT NULL DEFAULT 0,
|
|
||||||
PRIMARY KEY (`IMEI`)
|
|
||||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4;
|
|
||||||
|
|
||||||
--
|
|
||||||
-- Dumping data for table `phones`
|
|
||||||
--
|
|
||||||
|
|
||||||
-- --------------------------------------------------------
|
|
||||||
|
|
||||||
--
|
|
||||||
-- Table structure for table `sentitems`
|
|
||||||
--
|
|
||||||
|
|
||||||
CREATE TABLE `sentitems` (
|
|
||||||
`UpdatedInDB` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
|
|
||||||
`InsertIntoDB` timestamp NOT NULL default '0000-00-00 00:00:00',
|
|
||||||
`SendingDateTime` timestamp NOT NULL default '0000-00-00 00:00:00',
|
|
||||||
`DeliveryDateTime` timestamp NULL,
|
|
||||||
`Text` text NOT NULL,
|
|
||||||
`DestinationNumber` varchar(20) NOT NULL default '',
|
|
||||||
`Coding` enum('Default_No_Compression','Unicode_No_Compression','8bit','Default_Compression','Unicode_Compression') NOT NULL default 'Default_No_Compression',
|
|
||||||
`UDH` text NOT NULL,
|
|
||||||
`SMSCNumber` varchar(20) NOT NULL default '',
|
|
||||||
`Class` integer NOT NULL default '-1',
|
|
||||||
`TextDecoded` text NOT NULL,
|
|
||||||
`ID` integer unsigned NOT NULL default '0',
|
|
||||||
`SenderID` varchar(255) NOT NULL,
|
|
||||||
`SequencePosition` integer NOT NULL default '1',
|
|
||||||
`Status` enum('SendingOK','SendingOKNoReport','SendingError','DeliveryOK','DeliveryFailed','DeliveryPending','DeliveryUnknown','Error') NOT NULL default 'SendingOK',
|
|
||||||
`StatusError` integer NOT NULL default '-1',
|
|
||||||
`TPMR` integer NOT NULL default '-1',
|
|
||||||
`RelativeValidity` integer NOT NULL default '-1',
|
|
||||||
`CreatorID` text NOT NULL,
|
|
||||||
PRIMARY KEY (`ID`, `SequencePosition`)
|
|
||||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4;
|
|
||||||
|
|
||||||
CREATE INDEX sentitems_date ON sentitems(DeliveryDateTime);
|
|
||||||
CREATE INDEX sentitems_tpmr ON sentitems(TPMR);
|
|
||||||
CREATE INDEX sentitems_dest ON sentitems(DestinationNumber);
|
|
||||||
CREATE INDEX sentitems_sender ON sentitems(SenderID(250));
|
|
||||||
|
|
||||||
--
|
|
||||||
-- Dumping data for table `sentitems`
|
|
||||||
--
|
|
||||||
|
|
||||||
|
|
||||||
--
|
|
||||||
-- Triggers for setting default timestamps
|
|
||||||
--
|
|
||||||
|
|
||||||
DELIMITER //
|
|
||||||
|
|
||||||
CREATE TRIGGER inbox_timestamp BEFORE INSERT ON inbox
|
|
||||||
FOR EACH ROW
|
|
||||||
BEGIN
|
|
||||||
IF NEW.ReceivingDateTime = '0000-00-00 00:00:00' THEN
|
|
||||||
SET NEW.ReceivingDateTime = CURRENT_TIMESTAMP();
|
|
||||||
END IF;
|
|
||||||
END;//
|
|
||||||
|
|
||||||
CREATE TRIGGER outbox_timestamp BEFORE INSERT ON outbox
|
|
||||||
FOR EACH ROW
|
|
||||||
BEGIN
|
|
||||||
IF NEW.InsertIntoDB = '0000-00-00 00:00:00' THEN
|
|
||||||
SET NEW.InsertIntoDB = CURRENT_TIMESTAMP();
|
|
||||||
END IF;
|
|
||||||
IF NEW.SendingDateTime = '0000-00-00 00:00:00' THEN
|
|
||||||
SET NEW.SendingDateTime = CURRENT_TIMESTAMP();
|
|
||||||
END IF;
|
|
||||||
IF NEW.SendingTimeOut = '0000-00-00 00:00:00' THEN
|
|
||||||
SET NEW.SendingTimeOut = CURRENT_TIMESTAMP();
|
|
||||||
END IF;
|
|
||||||
END;//
|
|
||||||
|
|
||||||
CREATE TRIGGER phones_timestamp BEFORE INSERT ON phones
|
|
||||||
FOR EACH ROW
|
|
||||||
BEGIN
|
|
||||||
IF NEW.InsertIntoDB = '0000-00-00 00:00:00' THEN
|
|
||||||
SET NEW.InsertIntoDB = CURRENT_TIMESTAMP();
|
|
||||||
END IF;
|
|
||||||
IF NEW.TimeOut = '0000-00-00 00:00:00' THEN
|
|
||||||
SET NEW.TimeOut = CURRENT_TIMESTAMP();
|
|
||||||
END IF;
|
|
||||||
END;//
|
|
||||||
|
|
||||||
CREATE TRIGGER sentitems_timestamp BEFORE INSERT ON sentitems
|
|
||||||
FOR EACH ROW
|
|
||||||
BEGIN
|
|
||||||
IF NEW.InsertIntoDB = '0000-00-00 00:00:00' THEN
|
|
||||||
SET NEW.InsertIntoDB = CURRENT_TIMESTAMP();
|
|
||||||
END IF;
|
|
||||||
IF NEW.SendingDateTime = '0000-00-00 00:00:00' THEN
|
|
||||||
SET NEW.SendingDateTime = CURRENT_TIMESTAMP();
|
|
||||||
END IF;
|
|
||||||
END;//
|
|
||||||
|
|
||||||
DELIMITER ;
|
|
|
@ -1,180 +0,0 @@
|
||||||
--
|
|
||||||
-- Database for Gammu SMSD
|
|
||||||
--
|
|
||||||
-- In case you get errors about not supported charset, please
|
|
||||||
-- replace utf8mb4 with utf8.
|
|
||||||
|
|
||||||
-- --------------------------------------------------------
|
|
||||||
|
|
||||||
--
|
|
||||||
-- Table structure for table `gammu`
|
|
||||||
--
|
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS `gammu` (
|
|
||||||
`Version` integer NOT NULL default '0' PRIMARY KEY
|
|
||||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4;
|
|
||||||
|
|
||||||
--
|
|
||||||
-- Dumping data for table `gammu`
|
|
||||||
--
|
|
||||||
|
|
||||||
INSERT IGNORE INTO `gammu` (`Version`) VALUES (17);
|
|
||||||
|
|
||||||
-- --------------------------------------------------------
|
|
||||||
|
|
||||||
--
|
|
||||||
-- Table structure for table `inbox`
|
|
||||||
--
|
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS `inbox` (
|
|
||||||
`UpdatedInDB` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
|
|
||||||
`ReceivingDateTime` timestamp NOT NULL default CURRENT_TIMESTAMP,
|
|
||||||
`Text` text NOT NULL,
|
|
||||||
`SenderNumber` varchar(20) NOT NULL default '',
|
|
||||||
`Coding` enum('Default_No_Compression','Unicode_No_Compression','8bit','Default_Compression','Unicode_Compression') NOT NULL default 'Default_No_Compression',
|
|
||||||
`UDH` text NOT NULL,
|
|
||||||
`SMSCNumber` varchar(20) NOT NULL default '',
|
|
||||||
`Class` integer NOT NULL default '-1',
|
|
||||||
`TextDecoded` text NOT NULL,
|
|
||||||
`ID` integer unsigned NOT NULL auto_increment,
|
|
||||||
`RecipientID` text NOT NULL,
|
|
||||||
`Processed` enum('false','true') NOT NULL default 'false',
|
|
||||||
`Status` integer NOT NULL default '-1',
|
|
||||||
PRIMARY KEY `ID` (`ID`)
|
|
||||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 AUTO_INCREMENT=1 ;
|
|
||||||
|
|
||||||
--
|
|
||||||
-- Dumping data for table `inbox`
|
|
||||||
--
|
|
||||||
|
|
||||||
|
|
||||||
-- --------------------------------------------------------
|
|
||||||
|
|
||||||
--
|
|
||||||
-- Table structure for table `outbox`
|
|
||||||
--
|
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS `outbox` (
|
|
||||||
`UpdatedInDB` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
|
|
||||||
`InsertIntoDB` timestamp NOT NULL default CURRENT_TIMESTAMP,
|
|
||||||
`SendingDateTime` timestamp NOT NULL default CURRENT_TIMESTAMP,
|
|
||||||
`SendBefore` time NOT NULL DEFAULT '23:59:59',
|
|
||||||
`SendAfter` time NOT NULL DEFAULT '00:00:00',
|
|
||||||
`Text` text,
|
|
||||||
`DestinationNumber` varchar(20) NOT NULL default '',
|
|
||||||
`Coding` enum('Default_No_Compression','Unicode_No_Compression','8bit','Default_Compression','Unicode_Compression') NOT NULL default 'Default_No_Compression',
|
|
||||||
`UDH` text,
|
|
||||||
`Class` integer default '-1',
|
|
||||||
`TextDecoded` text NOT NULL,
|
|
||||||
`ID` integer unsigned NOT NULL auto_increment,
|
|
||||||
`MultiPart` enum('false','true') default 'false',
|
|
||||||
`RelativeValidity` integer default '-1',
|
|
||||||
`SenderID` varchar(255),
|
|
||||||
`SendingTimeOut` timestamp NULL default CURRENT_TIMESTAMP,
|
|
||||||
`DeliveryReport` enum('default','yes','no') default 'default',
|
|
||||||
`CreatorID` text NOT NULL,
|
|
||||||
`Retries` int(3) default 0,
|
|
||||||
`Priority` integer default 0,
|
|
||||||
`Status` enum('SendingOK','SendingOKNoReport','SendingError','DeliveryOK','DeliveryFailed','DeliveryPending','DeliveryUnknown','Error','Reserved') NOT NULL default 'Reserved',
|
|
||||||
`StatusCode` integer NOT NULL default '-1',
|
|
||||||
PRIMARY KEY `ID` (`ID`)
|
|
||||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4;
|
|
||||||
|
|
||||||
CREATE INDEX outbox_date ON outbox(SendingDateTime, SendingTimeOut);
|
|
||||||
CREATE INDEX outbox_sender ON outbox(SenderID(250));
|
|
||||||
|
|
||||||
--
|
|
||||||
-- Dumping data for table `outbox`
|
|
||||||
--
|
|
||||||
|
|
||||||
|
|
||||||
-- --------------------------------------------------------
|
|
||||||
|
|
||||||
--
|
|
||||||
-- Table structure for table `outbox_multipart`
|
|
||||||
--
|
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS `outbox_multipart` (
|
|
||||||
`Text` text,
|
|
||||||
`Coding` enum('Default_No_Compression','Unicode_No_Compression','8bit','Default_Compression','Unicode_Compression') NOT NULL default 'Default_No_Compression',
|
|
||||||
`UDH` text,
|
|
||||||
`Class` integer default '-1',
|
|
||||||
`TextDecoded` text,
|
|
||||||
`ID` integer unsigned NOT NULL default '0',
|
|
||||||
`SequencePosition` integer NOT NULL default '1',
|
|
||||||
`Status` enum('SendingOK','SendingOKNoReport','SendingError','DeliveryOK','DeliveryFailed','DeliveryPending','DeliveryUnknown','Error','Reserved') NOT NULL default 'Reserved',
|
|
||||||
`StatusCode` integer NOT NULL default '-1',
|
|
||||||
PRIMARY KEY (`ID`, `SequencePosition`)
|
|
||||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4;
|
|
||||||
|
|
||||||
--
|
|
||||||
-- Dumping data for table `outbox_multipart`
|
|
||||||
--
|
|
||||||
|
|
||||||
-- --------------------------------------------------------
|
|
||||||
|
|
||||||
--
|
|
||||||
-- Table structure for table `phones`
|
|
||||||
--
|
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS `phones` (
|
|
||||||
`ID` text NOT NULL,
|
|
||||||
`UpdatedInDB` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
|
|
||||||
`InsertIntoDB` timestamp NOT NULL default CURRENT_TIMESTAMP,
|
|
||||||
`TimeOut` timestamp NOT NULL default CURRENT_TIMESTAMP,
|
|
||||||
`Send` enum('yes','no') NOT NULL default 'no',
|
|
||||||
`Receive` enum('yes','no') NOT NULL default 'no',
|
|
||||||
`IMEI` varchar(35) NOT NULL,
|
|
||||||
`IMSI` varchar(35) NOT NULL,
|
|
||||||
`NetCode` varchar(10) default 'ERROR',
|
|
||||||
`NetName` varchar(35) default 'ERROR',
|
|
||||||
`Client` text NOT NULL,
|
|
||||||
`Battery` integer NOT NULL DEFAULT -1,
|
|
||||||
`Signal` integer NOT NULL DEFAULT -1,
|
|
||||||
`Sent` int NOT NULL DEFAULT 0,
|
|
||||||
`Received` int NOT NULL DEFAULT 0,
|
|
||||||
PRIMARY KEY (`IMEI`)
|
|
||||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4;
|
|
||||||
|
|
||||||
--
|
|
||||||
-- Dumping data for table `phones`
|
|
||||||
--
|
|
||||||
|
|
||||||
-- --------------------------------------------------------
|
|
||||||
|
|
||||||
--
|
|
||||||
-- Table structure for table `sentitems`
|
|
||||||
--
|
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS `sentitems` (
|
|
||||||
`UpdatedInDB` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
|
|
||||||
`InsertIntoDB` timestamp NOT NULL default CURRENT_TIMESTAMP,
|
|
||||||
`SendingDateTime` timestamp NOT NULL default CURRENT_TIMESTAMP,
|
|
||||||
`DeliveryDateTime` timestamp NULL,
|
|
||||||
`Text` text NOT NULL,
|
|
||||||
`DestinationNumber` varchar(20) NOT NULL default '',
|
|
||||||
`Coding` enum('Default_No_Compression','Unicode_No_Compression','8bit','Default_Compression','Unicode_Compression') NOT NULL default 'Default_No_Compression',
|
|
||||||
`UDH` text NOT NULL,
|
|
||||||
`SMSCNumber` varchar(20) NOT NULL default '',
|
|
||||||
`Class` integer NOT NULL default '-1',
|
|
||||||
`TextDecoded` text NOT NULL,
|
|
||||||
`ID` integer unsigned NOT NULL default '0',
|
|
||||||
`SenderID` varchar(255) NOT NULL,
|
|
||||||
`SequencePosition` integer NOT NULL default '1',
|
|
||||||
`Status` enum('SendingOK','SendingOKNoReport','SendingError','DeliveryOK','DeliveryFailed','DeliveryPending','DeliveryUnknown','Error') NOT NULL default 'SendingOK',
|
|
||||||
`StatusError` integer NOT NULL default '-1',
|
|
||||||
`TPMR` integer NOT NULL default '-1',
|
|
||||||
`RelativeValidity` integer NOT NULL default '-1',
|
|
||||||
`CreatorID` text NOT NULL,
|
|
||||||
`StatusCode` integer NOT NULL default '-1',
|
|
||||||
PRIMARY KEY (`ID`, `SequencePosition`)
|
|
||||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4;
|
|
||||||
|
|
||||||
CREATE INDEX sentitems_date ON sentitems(DeliveryDateTime);
|
|
||||||
CREATE INDEX sentitems_tpmr ON sentitems(TPMR);
|
|
||||||
CREATE INDEX sentitems_dest ON sentitems(DestinationNumber);
|
|
||||||
CREATE INDEX sentitems_sender ON sentitems(SenderID(250));
|
|
||||||
|
|
||||||
--
|
|
||||||
-- Dumping data for table `sentitems`
|
|
||||||
--
|
|
|
@ -1,43 +0,0 @@
|
||||||
# MySQL database username
|
|
||||||
DBUSER="gammu"
|
|
||||||
|
|
||||||
# MySQL database password
|
|
||||||
DBPASS="_pwdDB"
|
|
||||||
|
|
||||||
# MySQL database name
|
|
||||||
DBNAME="gammu"
|
|
||||||
|
|
||||||
# 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"
|
|
||||||
|
|
|
@ -1,40 +0,0 @@
|
||||||
server {
|
|
||||||
listen 80;
|
|
||||||
listen 443;
|
|
||||||
listen [::]:443 ssl;
|
|
||||||
server_name _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;
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,128 +0,0 @@
|
||||||
<?php
|
|
||||||
/*
|
|
||||||
DONE!!!? WRITE THAT CODE IN infobar2.js : arrount line 158 before "return lines;"
|
|
||||||
// ZEEBOX HACK ZONE
|
|
||||||
var reclink = '/REC/youtube-dl.php?q=REC&artist=' + escape(encodeURIComponent(npinfo.Artist)) + '&title=' + escape(encodeURIComponent(npinfo.Title)) + '&radio='+ escape(encodeURIComponent(npinfo.stream)) +'&maxResults=1';
|
|
||||||
var zcopylink = ' <a id="REC" title="Enregistrer sur Youtube" href="#" onclick=\'javascript:window.open("'+ reclink +'","REC","menubar=no, scrollbars=no, top=10, left=10, width=384, height=546");return false;\'>[REC]</a>';
|
|
||||||
zcopylink += ' <a title="RECHERCHE LIBRE" href="/REC/youtube-dl.php" target="youtube">*</a>';
|
|
||||||
lines[0].text += zcopylink;
|
|
||||||
// ZEEBOX HACK ZONE
|
|
||||||
*/
|
|
||||||
// RUN CLI if($argc>1) parse_str(implode('&',array_slice($argv, 1)), $_REQUEST);
|
|
||||||
$search=$radio=$artist=$title=$lnk=$lnkform=$cmd=$len="";
|
|
||||||
$search = trim(urldecode($_REQUEST['q']));
|
|
||||||
|
|
||||||
$radio = urldecode($_REQUEST['radio']);
|
|
||||||
$artist = urldecode($_REQUEST['artist']);
|
|
||||||
$title = urldecode($_REQUEST['title']);
|
|
||||||
$lnk = trim(urldecode($_REQUEST['lnk']));
|
|
||||||
$cmd="$radio|$artist|$title";
|
|
||||||
$len=strlen($artist.$title);
|
|
||||||
|
|
||||||
//$result='<a href="#null" onclick="javascript:window.close();"><img src="/REC/REC.png"></a><br>';
|
|
||||||
$result='<a href="https://www.copylaradio.com" target="copylaradio"><img src="/REC/REC.png"></a><br>';
|
|
||||||
if( $radio == "" ) { $radio = "CopyLaRadio"; }
|
|
||||||
if( $radio == "Nova zz" ) {
|
|
||||||
$artist = "undefined";
|
|
||||||
$title = "undefined";
|
|
||||||
}
|
|
||||||
// Write request for copy.sh triggering
|
|
||||||
if( $search == "REC" ) {
|
|
||||||
///////////////////
|
|
||||||
$result.='<h2>♫ '.$radio.' ♫</h2>';
|
|
||||||
// LINK RECEIVED
|
|
||||||
if ($lnk) {
|
|
||||||
$artist="";
|
|
||||||
shell_exec('_GPATH/_CopyLaRadio/parle.sh "Lien reçu."');
|
|
||||||
// Not making double request
|
|
||||||
if( ! exec('grep '.escapeshellarg($lnk).' /tmp/ytdl.list') ) {
|
|
||||||
file_put_contents("/tmp/ytdl.list","CopyLibre||$lnk\n", FILE_APPEND);
|
|
||||||
}
|
|
||||||
$result.='<p><a href="'.$lnk.'" target="check">LIEN: '.$lnk.'</a></p>';
|
|
||||||
///////////////////
|
|
||||||
// TRACK COPY (not for undefined or local file)
|
|
||||||
} else if ($radio && $artist != $title && $artist != "undefined" && $title != "undefined" && strlen(explode(".", $title)[1]) != 3 && explode(".", $title)[1] != "opus" ) {
|
|
||||||
// Not making double request
|
|
||||||
if( ! exec('grep '.escapeshellarg($cmd).' /tmp/ytdl.list') ) {
|
|
||||||
shell_exec('_GPATH/_CopyLaRadio/parle.sh "Enregistrement ajouté."');
|
|
||||||
file_put_contents("/tmp/ytdl.list","$cmd\n", FILE_APPEND);
|
|
||||||
} else {
|
|
||||||
shell_exec('_GPATH/_CopyLaRadio/parle.sh "Copie déjà lancée"');
|
|
||||||
}
|
|
||||||
$result.='<a style="color:#FFFFFF" href="https://www.youtube.com/results?search_query='.urlencode($artist).'%20'.urlencode($title).'" target="check">
|
|
||||||
<h4>'.$artist.' / '.$title.'</h4>
|
|
||||||
</a>';
|
|
||||||
///////////////////
|
|
||||||
// RADIO EXTERNAL TRACK SCRAPER
|
|
||||||
} else if($radio != "" && $artist == "undefined" && $title == "undefined" ){
|
|
||||||
shell_exec('_GPATH/_CopyLaRadio/parle.sh "Recherche externe pour '.$radio.'"');
|
|
||||||
file_put_contents("/tmp/youtube-dl.log", "_GPATH/_CopyLaRadio/libradio/".escapeshellcmd($radio).".php".PHP_EOL, FILE_APPEND);
|
|
||||||
if ( file_exists("_GPATH/_CopyLaRadio/libradio/".escapeshellcmd($radio).".php") ) {
|
|
||||||
file_put_contents("/tmp/ytdl.list","$radio||".PHP_EOL, FILE_APPEND);
|
|
||||||
} else {
|
|
||||||
shell_exec('_GPATH/_CopyLaRadio/parle.sh "Aucun module"');
|
|
||||||
}
|
|
||||||
|
|
||||||
} else {
|
|
||||||
shell_exec('_GPATH/_CopyLaRadio/parle.sh "Identification imprécise. Podcast? Fichier local?"');
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
$ytform = '<form action="/REC/youtube-dl.php" method="GET">
|
|
||||||
<div>
|
|
||||||
<h3>ARTISTE: <input type="search" id="artist" name="artist" size="17" placeholder="Indiquez un artiste" value="'.$artist.'"></h3>
|
|
||||||
<h3>TITRE: <input type="search" id="title" name="title" size="20" placeholder="Titre de la chanson" value="'.$title.'"></h3>
|
|
||||||
</div>
|
|
||||||
<input type="hidden" id="radio" name="radio" value="'.$radio.'">
|
|
||||||
<input type="hidden" id="q" name="q" value="REC">
|
|
||||||
<br>
|
|
||||||
<input type="submit" value="♫ Copie Youtube ♫">
|
|
||||||
</form>
|
|
||||||
';
|
|
||||||
|
|
||||||
$lnkform.='<form action="/REC/youtube-dl.php" method="GET">
|
|
||||||
<a href="https://youtube.com" target="search"><img src="/REC/youtube.png"></a>
|
|
||||||
<p><h1>youtube-dl</h1>
|
|
||||||
<a style="color:#FFFFFF" href="https://ytdl-org.github.io/youtube-dl/supportedsites.html" target="_blank">- Sites compatibles -</a>
|
|
||||||
<input type="search" id="lnk" name="lnk" placeholder="Inscrivez le lien à copier" value="" size="40">
|
|
||||||
<input type="hidden" id="q" name="q" value="REC">
|
|
||||||
</p>
|
|
||||||
<div>
|
|
||||||
<input type="submit" value="Copie du Lien">
|
|
||||||
</div>
|
|
||||||
</form>';
|
|
||||||
|
|
||||||
?>
|
|
||||||
<!doctype html>
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
||||||
<meta name="description" content="">
|
|
||||||
<meta name="author" content="fred" >
|
|
||||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" >
|
|
||||||
<title><?php echo $search;?> - Recherche YouTube & Copie privée</title>
|
|
||||||
<link href="/REC/bootstrap.css" rel="stylesheet">
|
|
||||||
</head>
|
|
||||||
<body style='background: url("/REC/fond.jpg") no-repeat scroll center center / cover rgb(0, 0, 0); color:#FFFFFF;'>
|
|
||||||
<section class="content-section text-center">
|
|
||||||
<div class="container-fluid">
|
|
||||||
<div class="container" id="result" >
|
|
||||||
<div class="col-lg-8 col-lg-offset-2 page-scroll">
|
|
||||||
<ul>
|
|
||||||
<?php echo $result; ?>
|
|
||||||
<hr>
|
|
||||||
</ul>
|
|
||||||
<ul>
|
|
||||||
<?php echo $ytform; ?>
|
|
||||||
<hr>
|
|
||||||
<?php echo $lnkform; ?>
|
|
||||||
<hr>
|
|
||||||
</ul>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</section>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
|
@ -1,84 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
##################################################################
|
|
||||||
# Author: Fred (support@qo-op.com)
|
|
||||||
# Version: 0.1
|
|
||||||
# License: GPL (http://www.google.com/search?q=GPL)
|
|
||||||
##################################################################
|
|
||||||
|
|
||||||
MY_PATH="`dirname \"$0\"`" # relative
|
|
||||||
MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized
|
|
||||||
if [[ -f $MY_PATH/.install/.GPATH ]]; then source $MY_PATH/.install/.GPATH; fi
|
|
||||||
if [[ -f $MY_PATH/../.install/.GPATH ]]; then source $MY_PATH/../.install/.GPATH; fi
|
|
||||||
|
|
||||||
# Adapter les valeurs au contexte spatio-temporel du NODE G1SMS
|
|
||||||
function log () {
|
|
||||||
# log ($1=text)
|
|
||||||
if [ "$DOLOG" == "YES" ]
|
|
||||||
then
|
|
||||||
echo "$PHONE:$1" >> /tmp/g1sms.log
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
###################################################################################################################################
|
|
||||||
fn_exists() {
|
|
||||||
# appended double quote is an ugly trick to make sure we do get a string -- if $1 is not a known command, type does not output anything
|
|
||||||
[ `type -t $1`"" == 'file' ]
|
|
||||||
}
|
|
||||||
# ATOMATIC gammu-smsd-inject desactivation if no gammu is installed on system
|
|
||||||
if ! fn_exists gammu-smsd-inject; then
|
|
||||||
log ":p) DESACTIVATION ENVOI DE SMS .............."
|
|
||||||
function gammu-smsd-inject () {
|
|
||||||
log "$PHONE: >>> SENDING SMS $4 TO $2 "
|
|
||||||
}
|
|
||||||
else
|
|
||||||
export G1SMS="YES"
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
|
||||||
export YOU=$(ps auxf --sort=+utime | grep -w ipfs | grep -v -E 'color=auto|grep' | tail -n 1 | cut -d " " -f 1);
|
|
||||||
cd $GPATH
|
|
||||||
##################################################################
|
|
||||||
# Activate logging to /tmp/g1sms.log (YES/NO)
|
|
||||||
export DOLOG="YES"
|
|
||||||
export CPERROR="NOYES"
|
|
||||||
##################################################################
|
|
||||||
# Country Node Phone international prefix (TODO Worldwide)
|
|
||||||
export COUNTRY="+33"
|
|
||||||
##################################################################
|
|
||||||
# DU has a G1 value changed every 6 month!
|
|
||||||
# ./_DU Updated by cron_CODE.backup.sh
|
|
||||||
if [[ -f "./_DU" ]]; then export DUFACTOR=$(bc <<< "scale=2; $(cat "./_DU") / 100"); else log "__SUB:init.sh: FAILING TO FIND ./_DU EXIT!!!"; exit; fi
|
|
||||||
##################################################################
|
|
||||||
# Choose Default Unit: G1, DU, LOVE (DU cents), ZEN (G1 cents)
|
|
||||||
export COIN="G1"
|
|
||||||
##################################################################
|
|
||||||
# Limit and commission values
|
|
||||||
export LIMIT=2 # Solde minimum = 2 G1
|
|
||||||
# FIXED COMMISSION SYSTEM
|
|
||||||
export COMMISSION=1 # transaction commission amount (G1)
|
|
||||||
export BILLCOM=20
|
|
||||||
##################################################################
|
|
||||||
# COMMISSION PARTS FROM TX FOR NODE & G1SMS NETWORK
|
|
||||||
# PART COMMISSION SYSTEM
|
|
||||||
export SWARMCOMM=10
|
|
||||||
# TODO: NODE G1sms Wallet can receive rewards from SWARM or WALLETS/FILES
|
|
||||||
export NODECOMM=10
|
|
||||||
##################################################################
|
|
||||||
# SMS SIM Card Phone Number
|
|
||||||
export MASTERPHONE="_MASTERPHONE"
|
|
||||||
export ADRESSE="_ADRESSE"
|
|
||||||
export G1DAB="NO"
|
|
||||||
##################################################################
|
|
||||||
# ADMIN COMMAND PHONE ORIGIN
|
|
||||||
export ADMINPHONE="_ADMINPHONE"
|
|
||||||
export ADMINPSEUDO="_ADMINPSEUDO"
|
|
||||||
##################################################################
|
|
||||||
# DUNITER/CESIUM+ DEFAULT SERVERS
|
|
||||||
export DUNITER="https://g1.duniter.org"
|
|
||||||
export CESIUM="https://g1.data.le-sou.org"
|
|
||||||
|
|
||||||
# TODO Use latest Silkaj from "sudo fredp3 install silkaj"
|
|
||||||
# export SILKAJ="/usr/local/bin/silkaj"
|
|
||||||
source $GPATH/shell/init_keys.sh
|
|
||||||
|
|
|
@ -1,9 +0,0 @@
|
||||||
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;
|
|
||||||
|
|
|
@ -1,16 +0,0 @@
|
||||||
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;
|
|
|
@ -1,26 +0,0 @@
|
||||||
#!/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
|
|
220
README.md
|
@ -1,7 +1,5 @@
|
||||||
# G1sms+
|
# 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) ::
|
> 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.
|
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.
|
||||||
|
@ -27,21 +25,19 @@ https://www.youtube.com/watch?v=QDnG3Jni7sY
|
||||||
https://www.youtube.com/watch?v=LqV65iPTmnc
|
https://www.youtube.com/watch?v=LqV65iPTmnc
|
||||||
https://www.youtube.com/watch?v=_PVwf9nRAA0
|
https://www.youtube.com/watch?v=_PVwf9nRAA0
|
||||||
|
|
||||||
## I. Matériel
|
## 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)
|
||||||
|
|
||||||
## II. Préparation
|
## **Installer Raspbian Stretch** :ice_cream:
|
||||||
|
|
||||||
### 1. Installer Raspbian Stretch ou Buster (9 ou 10) :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/)).
|
* 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
|
Terminez cette phase par une mise à jour
|
||||||
> **sudo apt update; sudo apt upgrade -y**
|
> **sudo apt update; sudo apt upgrade -y**
|
||||||
|
|
||||||
### 2. Installation carte GSM (pour commandes par SMS)?
|
### 1. 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)
|
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)
|
||||||
|
|
||||||
|
@ -53,7 +49,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.
|
Les scripts "./shell/cron" en cours d'écriture/test et sont à activer soi-même.
|
||||||
|
|
||||||
### 3. **Activer le GSM pHAT**
|
### 2. **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...
|
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...
|
||||||
|
|
||||||
|
@ -62,7 +58,7 @@ La carte utilise une connexion UART sur l'interface GPIO du Rpi pour communiquer
|
||||||
* Effacer **console=serial0,115200** de **/boot/cmdline.txt**
|
* Effacer **console=serial0,115200** de **/boot/cmdline.txt**
|
||||||
* Redémarrer...
|
* Redémarrer...
|
||||||
|
|
||||||
### 4. Démarrer la carte GSM !
|
### 3. 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.
|
il faudra appuyer 3 secondes sur le bouton d'allumage. Nous allons le faire par un script qui manipule le GPIO.
|
||||||
|
|
||||||
|
@ -84,47 +80,157 @@ 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)
|
Ajouter le lancement de ce script au démarrage (dans /etc/rc.local)
|
||||||
|
|
||||||
|
|
||||||
## III. Installation automatique de Ḡ1sms+ avec ses prérequis (Gammu, IPFS) et ses modules
|
### 4. Installer gammu et gammu-smsd
|
||||||
*Pour une installation manuelle: https://pad.p2p.legal/G1sms-install*
|
|
||||||
|
|
||||||
### Clonez le dépôt G1sms+
|
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/
|
||||||
sudo apt update && sudo apt install git
|
|
||||||
git clone https://git.p2p.legal/axiom-team/G1sms
|
|
||||||
mv G1sms G1sms+
|
|
||||||
cd G1sms+
|
|
||||||
chmod u+x install.sh
|
|
||||||
|
|
||||||
### Options
|
sudo apt-get install ppp screen git python3-pip minicom gammu gammu-smsd
|
||||||
./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
|
sudo usermod -aG gammu pi;
|
||||||
./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
|
Vérifier que la carte GSM pHAT est démarrée, sinon lancer
|
||||||
./install.sh all : Install les outils optionnels sans poser de question
|
|
||||||
./install.sh noptions : N'installe pas les outils optionnels
|
|
||||||
|
|
||||||
|
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
|
Création du fichier de configuration gammurc à partir de ces infos...
|
||||||
echo "Mon premier SMS envoyé !" | gammu-smsd-inject TEXT 06xxxxxxxx
|
**sudo nano /etc/gammurc**
|
||||||
|
|
||||||
**TODO :**
|
[gammu]
|
||||||
- Ajouter un test silkaj
|
port = /dev/ttyS0
|
||||||
- Notif d'une alert admin par G1sms
|
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
|
### 3. ACTIVER LE SUPPORT A DISTANCE
|
||||||
|
|
||||||
|
@ -152,6 +258,43 @@ FAIRE APPEL AU SUPPORT
|
||||||
ssh pi@localhost -p 2222
|
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
|
- Configurer un serveur relai email
|
||||||
:a: https://wiki.archlinux.org/index.php/SSMTP
|
:a: https://wiki.archlinux.org/index.php/SSMTP
|
||||||
:b: http://ozzmaker.com/send-email-from-the-raspberry-pi-or-linux-command-line-with-attachments/
|
:b: http://ozzmaker.com/send-email-from-the-raspberry-pi-or-linux-command-line-with-attachments/
|
||||||
|
@ -257,3 +400,8 @@ 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
|
* 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+
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,92 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
MY_PATH="`dirname \"$0\"`" # relative
|
|
||||||
MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized
|
|
||||||
source $MY_PATH/../.install/.GPATH
|
|
||||||
|
|
||||||
# Clean /tmp/ytdl.list
|
|
||||||
#echo > /tmp/ytdl.list
|
|
||||||
|
|
||||||
function replace_accents (){
|
|
||||||
INPUT="$1"
|
|
||||||
declare -a acc
|
|
||||||
declare -a noa
|
|
||||||
acc=('$' 'è' 'ê' 'é' 'À' 'Á' 'Â' 'Ã' 'Ä' 'Å' 'Æ' 'Ç' 'È' 'É' 'Ê' 'Ë' 'Ì' 'Í' 'Î' 'Ï' 'Ð' 'Ñ' 'Ò' 'Ó' 'Ô' 'Õ' 'Ö' 'Ø' 'Ù' 'Ú' 'Û' 'Ü' 'Ý' 'ß' 'à' 'á' 'â' 'ã' 'ä' 'å' 'æ' 'ç' 'è' 'é' 'ê' 'ë' 'ì' 'í' 'î' 'ï' 'ñ' 'ò' 'ó' 'ô' 'õ' 'ö' 'ø' 'ù' 'ú' 'û' 'ü' 'ý' 'ÿ' 'Ā' 'ā' 'Ă' 'ă' 'Ą' 'ą' 'Ć' 'ć' 'Ĉ' 'ĉ' 'Ċ' 'ċ' 'Č' 'č' 'Ď' 'ď' 'Đ' 'đ' 'Ē' 'ē' 'Ĕ' 'ĕ' 'Ė' 'ė' 'Ę' 'ę' 'Ě' 'ě' 'Ĝ' 'ĝ' 'Ğ' 'ğ' 'Ġ' 'ġ' 'Ģ' 'ģ' 'Ĥ' 'ĥ' 'Ħ' 'ħ' 'Ĩ' 'ĩ' 'Ī' 'ī' 'Ĭ' 'ĭ' 'Į' 'į' 'İ' 'ı' 'IJ' 'ij' 'Ĵ' 'ĵ' 'Ķ' 'ķ' 'Ĺ' 'ĺ' 'Ļ' 'ļ' 'Ľ' 'ľ' 'Ŀ' 'ŀ' 'Ł' 'ł' 'Ń' 'ń' 'Ņ' 'ņ' 'Ň' 'ň' 'ʼn' 'Ō' 'ō' 'Ŏ' 'ŏ' 'Ő' 'ő' 'Œ' 'œ' 'Ŕ' 'ŕ' 'Ŗ' 'ŗ' 'Ř' 'ř' 'Ś' 'ś' 'Ŝ' 'ŝ' 'Ş' 'ş' 'Š' 'š' 'Ţ' 'ţ' 'Ť' 'ť' 'Ŧ' 'ŧ' 'Ũ' 'ũ' 'Ū' 'ū' 'Ŭ' 'ŭ' 'Ů' 'ů' 'Ű' 'ű' 'Ų' 'ų' 'Ŵ' 'ŵ' 'Ŷ' 'ŷ' 'Ÿ' 'Ź' 'ź' 'Ż' 'ż' 'Ž' 'ž' 'ſ' 'ƒ' 'Ơ' 'ơ' 'Ư' 'ư' 'Ǎ' 'ǎ' 'Ǐ' 'ǐ' 'Ǒ' 'ǒ' 'Ǔ' 'ǔ' 'Ǖ' 'ǖ' 'Ǘ' 'ǘ' 'Ǚ' 'ǚ' 'Ǜ' 'ǜ' 'Ǻ' 'ǻ' 'Ǽ' 'ǽ' 'Ǿ' 'ǿ');
|
|
||||||
noa=('S' 'e' 'e' 'e' 'A' 'A' 'A' 'A' 'A' 'A' 'AE' 'C' 'E' 'E' 'E' 'E' 'I' 'I' 'I' 'I' 'D' 'N' 'O' 'O' 'O' 'O' 'O' 'O' 'U' 'U' 'U' 'U' 'Y' 's' 'a' 'a' 'a' 'a' 'a' 'a' 'ae' 'c' 'e' 'e' 'e' 'e' 'i' 'i' 'i' 'i' 'n' 'o' 'o' 'o' 'o' 'o' 'o' 'u' 'u' 'u' 'u' 'y' 'y' 'A' 'a' 'A' 'a' 'A' 'a' 'C' 'c' 'C' 'c' 'C' 'c' 'C' 'c' 'D' 'd' 'D' 'd' 'E' 'e' 'E' 'e' 'E' 'e' 'E' 'e' 'E' 'e' 'G' 'g' 'G' 'g' 'G' 'g' 'G' 'g' 'H' 'h' 'H' 'h' 'I' 'i' 'I' 'i' 'I' 'i' 'I' 'i' 'I' 'i' 'IJ' 'ij' 'J' 'j' 'K' 'k' 'L' 'l' 'L' 'l' 'L' 'l' 'L' 'l' 'l' 'l' 'N' 'n' 'N' 'n' 'N' 'n' 'n' 'O' 'o' 'O' 'o' 'O' 'o' 'OE' 'oe' 'R' 'r' 'R' 'r' 'R' 'r' 'S' 's' 'S' 's' 'S' 's' 'S' 's' 'T' 't' 'T' 't' 'T' 't' 'U' 'u' 'U' 'u' 'U' 'u' 'U' 'u' 'U' 'u' 'U' 'u' 'W' 'w' 'Y' 'y' 'Y' 'Z' 'z' 'Z' 'z' 'Z' 'z' 's' 'f' 'O' 'o' 'U' 'u' 'A' 'a' 'I' 'i' 'O' 'o' 'U' 'u' 'U' 'u' 'U' 'u' 'U' 'u' 'U' 'u' 'A' 'a' 'AE' 'ae' 'O' 'o');
|
|
||||||
|
|
||||||
OUTPUT=""
|
|
||||||
i=0
|
|
||||||
length=${#INPUT}
|
|
||||||
while [[ $i -lt $length ]]; do
|
|
||||||
char=${INPUT:$i:1};
|
|
||||||
#echo $i:$char
|
|
||||||
j=0
|
|
||||||
for letter in "${acc[@]}"
|
|
||||||
do
|
|
||||||
if [[ "$letter" == "$char" ]]; then
|
|
||||||
char="${noa[$j]}"
|
|
||||||
fi
|
|
||||||
((j++))
|
|
||||||
done
|
|
||||||
((i++))
|
|
||||||
OUTPUT=$OUTPUT$char
|
|
||||||
done
|
|
||||||
echo $OUTPUT
|
|
||||||
}
|
|
||||||
|
|
||||||
# SCAN NEW LINE IN NEW RECORD LIST AND RUN youtube-dl search and copy
|
|
||||||
tail -fn 1 /tmp/ytdl.list | while read -r line
|
|
||||||
do
|
|
||||||
#################################################
|
|
||||||
radio=$(echo $line | cut -d "|" -f 1)
|
|
||||||
artist=$(echo $line | cut -d "|" -f 2)
|
|
||||||
song=$(echo $line | cut -d "|" -f 3)
|
|
||||||
echo "######## $radio ########" >> /tmp/youtube-dl.log 2>&1
|
|
||||||
echo $(date) >> /tmp/youtube-dl.log 2>&1
|
|
||||||
echo ${line} >> /tmp/youtube-dl.log 2>&1
|
|
||||||
|
|
||||||
#################################################
|
|
||||||
# YOUTUBE-DL SEARCH & COPY : "radio|artist|song"
|
|
||||||
if [[ "$artist" != "" && "$song" != "" && "$radio" != "" && "$radio" != "$song" && "$radio" != "undefined" && "$artist" != "$song" ]]; then
|
|
||||||
mkdir -p "/home/pi/music/${artist}/${song}"
|
|
||||||
~/parle.sh "Démarrage Enregistrement $radio."
|
|
||||||
~/parle.sh "$artist" "en-US"
|
|
||||||
~/parle.sh "$song" "en-US"
|
|
||||||
echo "Copy youtube-dl: $artist | $song ($radio)" >> /tmp/youtube-dl.log 2>&1
|
|
||||||
# Clean search string
|
|
||||||
mysearch=$(replace_accents "$artist $song")
|
|
||||||
if [[ "$mysearch" == "" ]]; then ~/parle.sh "Aucune recherche reçue!"; continue; fi
|
|
||||||
# Search & Download bestaudio from 1st video result (ogg / opus / m4a): MEDIUM CPU
|
|
||||||
# OPTION: --embed-thumbnail --metadata-from-title "%(artist)s - %(title)s" --add-metadata
|
|
||||||
youtube-dl --default-search ytsearch1: --download-archive /home/pi/.ytdl.list --continue --no-overwrites --metadata-from-title "$artist - %(title)s" --add-metadata --embed-thumbnail --ignore-errors -f m4a --extract-audio -o "/home/pi/music/${artist}/${song}/%(id)s.%(title)s.%(uploader_id)s.%(ext)s" "$mysearch" >> /tmp/youtube-dl.log 2>&1
|
|
||||||
# TODO: CHOOSE --metadata-from-title "$artist - %(title)s" or --metadata-from-title %(title)s"
|
|
||||||
# Update mpd playlist
|
|
||||||
curl -b "currenthost=Default;player_backend=mpd" http://localhost/albums.php?rebuild=yes > /dev/null
|
|
||||||
~/parle.sh "Enregistrement $radio terminé!"
|
|
||||||
######################################################
|
|
||||||
#### COPY LINK : "CopyLaRadio||https://link2media.url"
|
|
||||||
elif [[ "$radio" != "" && "$artist" == "" && "$song" != "" ]]; then
|
|
||||||
# LINK COPY
|
|
||||||
~/parle.sh "Copie du lien!"
|
|
||||||
echo "Copy LINK: $song" >> /tmp/youtube-dl.log 2>&1
|
|
||||||
mkdir -p /home/pi/download/
|
|
||||||
youtube-dl --download-archive /home/pi/.ytdl.list --continue --no-overwrites --embed-thumbnail --metadata-from-title "%(artist)s - %(title)s" --add-metadata -o "/home/pi/download/%(title)s.%(ext)s" "$song" >> /tmp/youtube-dl.log 2>&1
|
|
||||||
~/parle.sh "Enregistrement du lien terminé!"
|
|
||||||
######################################################
|
|
||||||
#### COPY LINK : "radio||"
|
|
||||||
elif [[ "$radio" != "" && "$artist" == "" && "$song" == "" ]]; then
|
|
||||||
# EXTERNAL PARSER: ADD SCRAPERS IN ./libradio
|
|
||||||
~/parle.sh "Recherche RADIO ${radio}"
|
|
||||||
echo "External search: ${radio}" >> /tmp/youtube-dl.log 2>&1
|
|
||||||
if [[ -f $GPATH/_CopyLaRadio/libradio/${radio}.php ]]; then
|
|
||||||
~/parle.sh "Module existant"
|
|
||||||
php "$GPATH/_CopyLaRadio/libradio/${radio}.php"
|
|
||||||
else
|
|
||||||
~/parle.sh "Aucun module de décodage pour cette radio."
|
|
||||||
fi
|
|
||||||
#### NOTHING GOOD
|
|
||||||
else
|
|
||||||
~/parle.sh "Rien à copier"
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
|
@ -1,75 +0,0 @@
|
||||||
<?php
|
|
||||||
/*
|
|
||||||
################################################################################
|
|
||||||
# FROM CopyLaRadio MODULE_TEMPLATE_0.1
|
|
||||||
# Author: Fred (support@qo-op.com)
|
|
||||||
# Date: 2019 04 01
|
|
||||||
# License: AGPL-3.0 (https://choosealicense.com/licenses/agpl-3.0/)
|
|
||||||
################################################################################
|
|
||||||
*/
|
|
||||||
// VARS INIT
|
|
||||||
$obj=$title=$artist=$emission=$ERR=$ontheair="";
|
|
||||||
///////////////////////////
|
|
||||||
// SET TO 1 DURING DEVLT
|
|
||||||
$debug=0;
|
|
||||||
///////////////////////////
|
|
||||||
// MODULE RADIO PARAMETERS
|
|
||||||
///////////////////////////
|
|
||||||
$RADIO = "FIP Electro";
|
|
||||||
$referer = "https://www.fip.fr/";
|
|
||||||
$radiourl = 'https://www.fip.fr/latest/api/graphql?operationName=Now&variables=%7B%22bannerPreset%22%3A%221400x1400%22%2C%22stationId%22%3A74%7D&extensions=%7B%22persistedQuery%22%3A%7B%22version%22%3A1%2C%22sha256Hash%22%3A%229551487ee4a6810ec4afa35e70dd1c204fa84db3519d39eb3176e5a3a8b0e482%22%7D%7D';
|
|
||||||
|
|
||||||
// TWEEK CLIENT & REFERER
|
|
||||||
ini_set('user_agent', 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:64.0) Gecko/20100101 Firefox/64.0');
|
|
||||||
$ctx = stream_context_create(array(
|
|
||||||
'http' => array(
|
|
||||||
'header'=>array("Referer: ".$referer.PHP_EOL),
|
|
||||||
'timeout' => 5
|
|
||||||
)
|
|
||||||
)
|
|
||||||
);
|
|
||||||
///////////////////////////
|
|
||||||
// LOAD RADIO PAGE INTO PARSER
|
|
||||||
$ontheair = file_get_contents($radiourl); // JSON CONTENT
|
|
||||||
$ontheair = utf8_encode($ontheair);
|
|
||||||
$obj = json_decode($ontheair, true);
|
|
||||||
|
|
||||||
|
|
||||||
// GET TRACK INFO: ADAPT WITH DATA STRUCTURE
|
|
||||||
// ADPAPT HERE
|
|
||||||
$current = $obj['data']['now']['playing_item'];
|
|
||||||
// GET TRACK INFO
|
|
||||||
if ( $current ) {
|
|
||||||
// ADPAPT HERE
|
|
||||||
$artist = ucwords(strtolower($current['title']));
|
|
||||||
$title = ucwords(strtolower($current['subtitle']));
|
|
||||||
|
|
||||||
if ( $debug != 0 ) $ERR .= "\nTITRE = ".print_r($title, true);
|
|
||||||
if ( $debug != 0 ) $ERR .= "\nARTISTE = ".print_r($artist, true);
|
|
||||||
|
|
||||||
}
|
|
||||||
///////////////////////////
|
|
||||||
// PREPARE COPY COMMAND
|
|
||||||
$cmd = $RADIO.'|'.$artist.'|'.$title;
|
|
||||||
|
|
||||||
///////////////////////////
|
|
||||||
// DEBUG OR PROD
|
|
||||||
if($debug == 1) {
|
|
||||||
print_r($obj);
|
|
||||||
print_r($cmd);
|
|
||||||
} else {
|
|
||||||
if( $artist != "" && $title != "" ) {
|
|
||||||
// TODO Clean strings?!
|
|
||||||
if (! exec('grep '.escapeshellarg($cmd).' /tmp/ytdl.list')) {
|
|
||||||
file_put_contents("/tmp/youtube-dl.log", "ARTIST: ".$artist.". SONG: ".$title, FILE_APPEND);
|
|
||||||
file_put_contents("/tmp/ytdl.list","$cmd\n", FILE_APPEND);
|
|
||||||
} else {
|
|
||||||
file_put_contents("/tmp/youtube-dl.log", "ALREADY THERE!", FILE_APPEND);
|
|
||||||
file_put_contents("/tmp/ytdl.list","||".PHP_EOL, FILE_APPEND);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
file_put_contents("/tmp/youtube-dl.log", "NO TRACK. TRY PODCAST!", FILE_APPEND);
|
|
||||||
file_put_contents("/tmp/ytdl.list","||".PHP_EOL, FILE_APPEND);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
?>
|
|
|
@ -1 +0,0 @@
|
||||||
radionova.php
|
|
|
@ -1 +0,0 @@
|
||||||
FIP autour de llectro.php
|
|
|
@ -1,74 +0,0 @@
|
||||||
<?php
|
|
||||||
/*
|
|
||||||
################################################################################
|
|
||||||
# FROM CopyLaRadio MODULE_TEMPLATE_0.1
|
|
||||||
# Author: Fred (support@qo-op.com)
|
|
||||||
# Date: 2019 04 01
|
|
||||||
# License: AGPL-3.0 (https://choosealicense.com/licenses/agpl-3.0/)
|
|
||||||
################################################################################
|
|
||||||
*/
|
|
||||||
// VARS INIT
|
|
||||||
$obj=$title=$artist=$emission=$ERR=$ontheair="";
|
|
||||||
///////////////////////////
|
|
||||||
// SET TO 1 DURING DEVLT
|
|
||||||
$debug=0;
|
|
||||||
///////////////////////////
|
|
||||||
// MODULE RADIO PARAMETERS
|
|
||||||
///////////////////////////
|
|
||||||
$RADIO = "RADIO NOVA";
|
|
||||||
$referer = "http://www.nova.fr/";
|
|
||||||
$radiourl = 'http://www.nova.fr/radio/19577/player';
|
|
||||||
|
|
||||||
// TWEEK CLIENT & REFERER
|
|
||||||
ini_set('user_agent', 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:64.0) Gecko/20100101 Firefox/64.0');
|
|
||||||
$ctx = stream_context_create(array(
|
|
||||||
'http' => array(
|
|
||||||
'header'=>array("Referer: ".$referer.PHP_EOL),
|
|
||||||
'timeout' => 5
|
|
||||||
)
|
|
||||||
)
|
|
||||||
);
|
|
||||||
///////////////////////////
|
|
||||||
// LOAD RADIO PAGE INTO PARSER
|
|
||||||
$ontheair = file_get_contents($radiourl); // JSON CONTENT
|
|
||||||
$ontheair = utf8_encode($ontheair);
|
|
||||||
$obj = json_decode($ontheair, true);
|
|
||||||
|
|
||||||
|
|
||||||
// GET TRACK INFO: ADAPT WITH DATA STRUCTURE
|
|
||||||
// ADPAPT HERE
|
|
||||||
if ( $obj['currentTrack'] ) {
|
|
||||||
|
|
||||||
// ADPAPT HERE
|
|
||||||
$title = ucwords(strtolower($obj['currentTrack']['title']));
|
|
||||||
$artist = ucwords(strtolower($obj['currentTrack']['artist']));
|
|
||||||
|
|
||||||
if ( $debug != 0 ) $ERR .= "\nTITRE = ".print_r($title, true);
|
|
||||||
if ( $debug != 0 ) $ERR .= "\nARTISTE = ".print_r($artist, true);
|
|
||||||
|
|
||||||
}
|
|
||||||
///////////////////////////
|
|
||||||
// PREPARE COPY COMMAND
|
|
||||||
$cmd = $RADIO.'|'.$artist.'|'.$title;
|
|
||||||
|
|
||||||
///////////////////////////
|
|
||||||
// DEBUG OR PROD
|
|
||||||
if($debug == 1) {
|
|
||||||
print_r($obj);
|
|
||||||
print_r($cmd);
|
|
||||||
} else {
|
|
||||||
if( $artist != "" && $title != "" ) {
|
|
||||||
// TODO Clean strings?!
|
|
||||||
if (! exec('grep '.escapeshellarg($cmd).' /tmp/ytdl.list')) {
|
|
||||||
file_put_contents("/tmp/youtube-dl.log", "ARTIST: ".$artist.". SONG: ".$title, FILE_APPEND);
|
|
||||||
file_put_contents("/tmp/ytdl.list","$cmd\n", FILE_APPEND);
|
|
||||||
} else {
|
|
||||||
file_put_contents("/tmp/youtube-dl.log", "ALREADY THERE!", FILE_APPEND);
|
|
||||||
file_put_contents("/tmp/ytdl.list","||".PHP_EOL, FILE_APPEND);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
file_put_contents("/tmp/youtube-dl.log", "NO TRACK. TRY PODCAST!", FILE_APPEND);
|
|
||||||
file_put_contents("/tmp/ytdl.list","||".PHP_EOL, FILE_APPEND);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
?>
|
|
|
@ -1,12 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
f=$(echo "$1" | sed 's/ //g' )
|
|
||||||
echo "parle.sh: $1 | $2 = $f" >> /tmp/youtube-dl.log 2>&1
|
|
||||||
if [[ "$2" == "" ]]; then
|
|
||||||
lang="fr-FR"
|
|
||||||
else
|
|
||||||
lang="en-US"
|
|
||||||
fi
|
|
||||||
if [[ ! -f "/tmp/$lang_${f}.wav" ]]; then
|
|
||||||
pico2wave -l $lang -w /tmp/$lang_${f}.wav "$1"
|
|
||||||
fi
|
|
||||||
aplay -q /tmp/$lang_${f}.wav
|
|
|
@ -1,212 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
# BUTTONS GPIO NUMBERS FOR PHAT BEAT
|
|
||||||
# https://pinout.xyz/pinout/phat_beat#
|
|
||||||
# ADD TO /etc/local for autostart
|
|
||||||
#
|
|
||||||
ONOFF=12
|
|
||||||
VOLUP=16
|
|
||||||
VOLDO=26
|
|
||||||
BCK=13
|
|
||||||
PLAY=6
|
|
||||||
FWD=5
|
|
||||||
|
|
||||||
# ADD YOUR DEFAULT RADIO STREAM / PLAYLIST HERE - TRACK INFORMATION FOR RECORDING ;)
|
|
||||||
PLAYLIST="/home/pi/playlists/default.m3u"
|
|
||||||
|
|
||||||
function trim() {
|
|
||||||
local var="$*"
|
|
||||||
# remove slashes
|
|
||||||
var=$(echo "$var" | sed 's/\// /g')
|
|
||||||
var=${var//[^a-zA-Z0-9_\. ]/}
|
|
||||||
# remove leading whitespace characters
|
|
||||||
var="${var#"${var%%[![:space:]]*}"}"
|
|
||||||
# remove trailing whitespace characters
|
|
||||||
var="${var%"${var##*[![:space:]]}"}"
|
|
||||||
|
|
||||||
echo -n "$var"
|
|
||||||
}
|
|
||||||
|
|
||||||
function button() {
|
|
||||||
pin=$1
|
|
||||||
gpio -g mode $pin in # make sure pin is configured as an input
|
|
||||||
gpio -g mode $pin up # enable pull-up resistor
|
|
||||||
boucle=0
|
|
||||||
|
|
||||||
while :; do
|
|
||||||
gpio -g wfi $pin falling # wait for a button action
|
|
||||||
sleep 0.2
|
|
||||||
echo $pin
|
|
||||||
while [[ $(gpio -g read $pin) -eq 0 ]]
|
|
||||||
do
|
|
||||||
aplay bip.wav
|
|
||||||
sleep 0.5 # COUNT 1/2 SECOND PRESSED
|
|
||||||
boucle=$(bc -l <<< "$boucle + 1")
|
|
||||||
done
|
|
||||||
if [[ $boucle -gt 0 ]]; then
|
|
||||||
echo "LP-$pin-$boucle"
|
|
||||||
fi
|
|
||||||
boucle=0
|
|
||||||
done
|
|
||||||
}
|
|
||||||
|
|
||||||
boucle=0
|
|
||||||
|
|
||||||
# --- main loop ---
|
|
||||||
while :; do
|
|
||||||
read numbut
|
|
||||||
|
|
||||||
# WHAT IS ON AIR
|
|
||||||
watch="$(mpc | head -1):"
|
|
||||||
|
|
||||||
# EXTRACT ($radio :) $artist - $song
|
|
||||||
radio=$(echo "$watch" | cut -d ":" -f 1 | xargs)
|
|
||||||
if [[ "$radio" != "$watch" && $radio != "volume" && $radio != "http" ]]; then RADIO="$radio"; else radio="$watch"; RADIO=""; fi
|
|
||||||
play=$(echo "$watch" | cut -d ":" -f 2)
|
|
||||||
artist=$(echo "$play" | cut -d "-" -f 1)
|
|
||||||
artist=$(trim "$artist")
|
|
||||||
song=$(echo "$play" | cut -d "-" -f 2)
|
|
||||||
song=$(trim "$song")
|
|
||||||
if [[ "$song" == "" ]]; then
|
|
||||||
song=$(echo "$play" | cut -d " " -f 2)
|
|
||||||
song=$(trim "$song")
|
|
||||||
fi
|
|
||||||
|
|
||||||
# TODO: ADAPT BEHAVIOUR TO EACH RADIO STREAM
|
|
||||||
# NOVA RADIO PATCH
|
|
||||||
if [[ "$radio" == "Nova zz" ]]; then
|
|
||||||
artist=""
|
|
||||||
song=""
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "(CLICK $numbut) $RADIO: $artist / $song"
|
|
||||||
|
|
||||||
case "$numbut" in
|
|
||||||
$ONOFF)
|
|
||||||
echo "REC"
|
|
||||||
# BUTTON QUICK RELEASE
|
|
||||||
if [[ $(gpio -g read $ONOFF) -eq 1 ]]; then
|
|
||||||
# RECORD STREAMING SONG::GENERIC
|
|
||||||
if [[ "$RADIO" != "" && "$artist" != "" && "$song" != "" && "$artist" != "$song" ]]; then
|
|
||||||
what=$(grep "$RADIO|$artist|$song" /tmp/ytdl.list)
|
|
||||||
if [[ "$what" == "" ]]; then
|
|
||||||
~/parle.sh "Enregistrement ajouté."
|
|
||||||
echo "$RADIO|$artist|$song" >> /tmp/ytdl.list
|
|
||||||
else
|
|
||||||
~/parle.sh "Enregistrement déjà existant!"
|
|
||||||
fi
|
|
||||||
elif [[ "$artist" == "$song" ]]; then
|
|
||||||
~/parle.sh "Enregistrement $radio"
|
|
||||||
# USE COPY & MODULE FIFO
|
|
||||||
echo "$radio||" >> /tmp/ytdl.list # TODO REMOVE
|
|
||||||
else
|
|
||||||
~/parle.sh "Podcast ou Fichier local. Enregistrement inopérant."
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
LP-$ONOFF-*)
|
|
||||||
# LONG PRESS TRACK IDENTIFICATION
|
|
||||||
playing=$(mpc | head -1 | cut -d ":" -f 1 | cut -d "/" -f 1 | xargs)
|
|
||||||
playing=$(trim "$playing")
|
|
||||||
~/parle.sh "$playing"
|
|
||||||
if [[ "$RADIO" != "" && "$artist" != "" && "$song" != "" && "$artist" != "$song" ]]; then
|
|
||||||
~/parle.sh "$artist - $song"
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
$PLAY)
|
|
||||||
echo "PLAY"
|
|
||||||
if [[ $(gpio -g read $PLAY) -eq 1 ]]; then
|
|
||||||
mpc toggle
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
LP-$PLAY-*)
|
|
||||||
sec=$(echo "$numbut" | cut -d "-" -f 3)
|
|
||||||
case "$sec" in
|
|
||||||
1)
|
|
||||||
# 1SEC
|
|
||||||
# Check if USB drive connected
|
|
||||||
if [[ -b /dev/sda1 ]]; then
|
|
||||||
~/parle.sh "Synchronisation musique sur clé U S B. Veuillez patienter"
|
|
||||||
sudo mount /dev/sda1 /mnt
|
|
||||||
sudo mkdir -p /mnt/CopyLaRadio
|
|
||||||
sudo rsync -rtgoDv /home/pi/music/ /mnt/CopyLaRadio
|
|
||||||
sudo umount /dev/sda1
|
|
||||||
~/parle.sh "Transfert terminé. Vous pouvez débrancher votre clé..."
|
|
||||||
else
|
|
||||||
# STOP MUSIC
|
|
||||||
~/parle.sh "STOP"
|
|
||||||
mpc stop
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
2)
|
|
||||||
# 2SEC = CHANGE MODE SHUFFLE LOCAL / DEFAULT PLAYLIST
|
|
||||||
if [[ "$RADIO" != "" && "$mode" == "" ]]; then
|
|
||||||
mode="LOCAL"
|
|
||||||
~/parle.sh "Lecture musique locale"
|
|
||||||
mpc clear
|
|
||||||
mpc listall | mpc add
|
|
||||||
mpc shuffle
|
|
||||||
~/parle.sh "Aléatoire"
|
|
||||||
mpc play
|
|
||||||
else
|
|
||||||
mode=""
|
|
||||||
mpc clear
|
|
||||||
mpc load default
|
|
||||||
~/parle.sh "Lecture liste par défaut"
|
|
||||||
mpc play
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
3)
|
|
||||||
# 3 SEC = HALT SYSTEM
|
|
||||||
~/parle.sh "Arrêt RAIQUE MACHINE"
|
|
||||||
sudo halt
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
# > 3 SEC = REBOOT SYSTEM
|
|
||||||
~/parle.sh "Redémarrage RAIQUE MACHINE"
|
|
||||||
sudo reboot
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
;;
|
|
||||||
$BCK)
|
|
||||||
echo "BCK"
|
|
||||||
mpc -q prev
|
|
||||||
;;
|
|
||||||
$FWD)
|
|
||||||
echo "FWD"
|
|
||||||
mpc -q next
|
|
||||||
;;
|
|
||||||
$VOLUP)
|
|
||||||
echo "VOLUP"
|
|
||||||
if [[ $(gpio -g read $VOLUP) -eq 1 ]]; then
|
|
||||||
mpc -q volume +10
|
|
||||||
vol=$(mpc volume | cut -f 2 -d ":")
|
|
||||||
vol=$(trim "$vol")
|
|
||||||
if [ "$vol" == "100%" ]; then ~/parle.sh "VOLUME MAXIMUM"; fi
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
LP-$VOLUP-*)
|
|
||||||
sec=$(echo "$numbut" | cut -d "-" -f 3)
|
|
||||||
sec=+$(bc -l <<< "$sec * 10")
|
|
||||||
mpc -q volume $sec
|
|
||||||
;;
|
|
||||||
$VOLDO)
|
|
||||||
echo "VOLDO"
|
|
||||||
if [[ $(gpio -g read $VOLDO) -eq 1 ]]; then
|
|
||||||
mpc -q volume -10
|
|
||||||
vol=$(mpc volume | cut -f 2 -d ":")
|
|
||||||
vol=$(trim "$vol")
|
|
||||||
if [ "$vol" == "0%" ]; then ~/parle.sh "VOLUME MINIMUM"; fi
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
LP-$VOLDO-*)
|
|
||||||
sec=$(echo "$numbut" | cut -d "-" -f 3)
|
|
||||||
sec=-$(bc -l <<< "$sec * 10")
|
|
||||||
mpc -q volume $sec
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
echo $numbut
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
done < <( button $ONOFF & button $VOLUP & button $VOLDO & button $BCK & button $PLAY & button $FWD & ) # buttons on GPIOs to monitor
|
|
||||||
|
|
23
_comments
|
@ -162,26 +162,3 @@ OK
|
||||||
2019-11-25:
|
2019-11-25:
|
||||||
2019-11-26: clean
|
2019-11-26: clean
|
||||||
2019-11-27: sms
|
2019-11-27: sms
|
||||||
2019-12-10:
|
|
||||||
2019-12-10:
|
|
||||||
2019-12-10: fourletterphat
|
|
||||||
2019-12-11:
|
|
||||||
2019-12-14: G1 Tag READ WRITE
|
|
||||||
2019-12-14: Install backup change
|
|
||||||
2019-12-14: backup
|
|
||||||
2019-12-14: COMMENT
|
|
||||||
2019-12-14:
|
|
||||||
2019-12-14:
|
|
||||||
2019-12-17: Better G1Tx
|
|
||||||
2019-12-17: G1TAG REFRESH & more
|
|
||||||
2019-12-18: RAZ
|
|
||||||
2019-12-20: NOW
|
|
||||||
2019-12-21: Various
|
|
||||||
2019-12-24:
|
|
||||||
2020-01-02: Noel merge code
|
|
||||||
2020-01-02: g1sms.preoni
|
|
||||||
2020-01-04: BACKUP
|
|
||||||
2020-01-06: bugs
|
|
||||||
2020-01-06: silkaj TX init bad keys
|
|
||||||
2020-01-07:
|
|
||||||
2020-01-07: g1.presles.fr
|
|
||||||
|
|
BIN
_publishkey.gpg
|
@ -0,0 +1,42 @@
|
||||||
|
#!/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? (ex +33611223344)"
|
||||||
|
read MASTERPHONE
|
||||||
|
|
||||||
|
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/+33660780131/$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
|
|
@ -1,11 +0,0 @@
|
||||||
import RPi.GPIO as GPIO
|
|
||||||
import time
|
|
||||||
GPIO.setmode(GPIO.BOARD)
|
|
||||||
GPIO.setup(7, GPIO.OUT)
|
|
||||||
while True:
|
|
||||||
GPIO.output(7, GPIO.LOW)
|
|
||||||
time.sleep(4)
|
|
||||||
GPIO.output(7, GPIO.HIGH)
|
|
||||||
break
|
|
||||||
GPIO.cleanup()
|
|
||||||
|
|
|
@ -1,16 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
MY_PATH="`dirname \"$0\"`"
|
|
||||||
MY_PATH="`( cd \"$MY_PATH\" && pwd )`"
|
|
||||||
|
|
||||||
if [ ! -e /sys/class/gpio/gpio4 ]; then
|
|
||||||
echo "File doesn't exists."
|
|
||||||
echo "4" > /sys/class/gpio/export
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "out" > /sys/class/gpio/gpio4/direction
|
|
||||||
echo "1" > /sys/class/gpio/gpio4/value
|
|
||||||
|
|
||||||
sleep 3 && $MY_PATH/gammu-restart.sh
|
|
||||||
|
|
||||||
exit 0
|
|
|
@ -1,19 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
usbserial=($(lsmod | grep -w usbserial | awk '{ print $4 }' | awk -F, '{ print $1 " " $2 }'))
|
|
||||||
|
|
||||||
|
|
||||||
sudo modprobe -r option
|
|
||||||
sudo modprobe -r usbserial
|
|
||||||
|
|
||||||
sudo modprobe option
|
|
||||||
sudo modprobe usbserial
|
|
||||||
|
|
||||||
#for i in "${usbserial[@]}"; do
|
|
||||||
#echo "tata: $i"
|
|
||||||
# sudo modprobe -r $i
|
|
||||||
# sudo modprobe $i
|
|
||||||
#done
|
|
||||||
|
|
||||||
|
|
||||||
exit 0
|
|
|
@ -1,13 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
MY_PATH="`dirname \"$0\"`" # relative
|
|
||||||
MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized
|
|
||||||
|
|
||||||
[[ ! $1 ]] && echo "Veuillez choisir un niveau de log" && exit 1
|
|
||||||
|
|
||||||
sudo sed -i "/debuglevel/d" /etc/gammu-smsdrc
|
|
||||||
echo "debuglevel = $1" | sudo tee -a /etc/gammu-smsdrc
|
|
||||||
|
|
||||||
$MY_PATH/gammu-restart.sh
|
|
||||||
|
|
||||||
exit 0
|
|
|
@ -1,9 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
PID=$(sudo ps auxf | grep "/usr/bin/gammu-smsd" | grep -v -E "color=auto|grep" | awk '{ print $2 }')
|
|
||||||
|
|
||||||
[[ $PID ]] && sudo kill -9 "$PID"
|
|
||||||
|
|
||||||
sudo service gammu-smsd restart
|
|
||||||
|
|
||||||
exit 0
|
|
|
@ -1,5 +0,0 @@
|
||||||
+33695000695
|
|
||||||
+33695000647
|
|
||||||
+33695000646
|
|
||||||
+33695000643
|
|
||||||
+33695000636
|
|
163
install.sh
|
@ -4,117 +4,80 @@
|
||||||
# Version: 0.1
|
# Version: 0.1
|
||||||
# License: AGPL-3.0 (https://choosealicense.com/licenses/agpl-3.0/)
|
# License: AGPL-3.0 (https://choosealicense.com/licenses/agpl-3.0/)
|
||||||
################################################################################
|
################################################################################
|
||||||
MY_PATH="`dirname \"$0\"`" # relative
|
# LE Freaking LOL Hackathon de Noël https://framadate.org/sviOUlP6JLyWq5D2XLEdcKY9/admin
|
||||||
MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized
|
#
|
||||||
|
now=$(date -u +%Y-%m-%d)
|
||||||
|
|
||||||
echo "GPATH=$MY_PATH" > $MY_PATH/.install/.GPATH
|
echo "Bonjour $USER, je vous souhaite bon jour ($now)"
|
||||||
source $MY_PATH/.install/.GPATH
|
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
|
||||||
|
|
||||||
init_loc="$MY_PATH/shell/init.sh"
|
cd /home/$USER
|
||||||
now=$(date +%Y-%m-%d)
|
echo "Déplacement dans /home/$USER/"
|
||||||
unset err
|
echo "... Téléchargement de la dernière version du CODE G1sms+ (ipfs = $YOU)"
|
||||||
|
|
||||||
## Récupère les données du profile
|
# CODE is there?? Get it from ipns
|
||||||
[[ -f $MY_PATH/.profile ]] && source $MY_PATH/.profile
|
ipfs get --output=./ /ipns/QmZHTne3bjtMgaXWRqSbdKchJbgq2NaAeVSzFUN7ceYpif
|
||||||
|
|
||||||
## Récupère les arguments
|
if [ ! -d ./G1sms+ ]; then
|
||||||
args="$@"
|
|
||||||
[[ $args =~ all ]] && repOption=o
|
|
||||||
[[ $args =~ noptions ]] && repOption=n
|
|
||||||
[[ $args =~ force ]] && force_req=o
|
|
||||||
[[ $args =~ noask ]] && noask=o
|
|
||||||
|
|
||||||
## Vérifie le type de système
|
echo "RECHERCHE ET INSTALLATION DU CODE : G1sms+.latest.tgz "
|
||||||
[[ $(uname -a | grep arm) ]] && isARM=YES || unset isARM
|
if [[ -f "./CODE/G1sms+.latest.tgz" ]]; then
|
||||||
if [[ $(grep -E 'stretch|18.|19.' /etc/os-release) ]]; then OS=stretch;
|
tar xzf ./CODE/G1sms+.latest.tgz
|
||||||
elif [[ $(grep buster /etc/os-release) ]]; then OS=buster;
|
fi
|
||||||
else echo "${c_red}Votre OS n'est pas supporté$c_"; exit 1; fi
|
|
||||||
echo -e "$OS\n$isARM" > .install/.OS
|
|
||||||
|
|
||||||
unset err
|
echo "VOULEZ VOUS CONFIGURER VOTRE NODE G1sms+ ? ^C"
|
||||||
|
echo "Les paramètres se trouvent dans /home/$YOU/G1sms+/shell/init.sh"
|
||||||
|
read
|
||||||
|
|
||||||
## Vérifie si le script est en lancé par root
|
echo "Votre PSEUDO? Celui de votre compte membre Duniter. (defaut: Fred)"
|
||||||
if [ "$EUID" -eq 0 ]
|
read ADMINPSEUDO
|
||||||
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_"
|
if [[ "$ADMINPSEUDO" == "" ]]; then ADMINPSEUDO="Fred"; fi
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
## Update G1sms+ code
|
echo "Le Numéro de téléphone SMS Admin? Votre numéro de portable (defaut: +33647683646)"
|
||||||
git pull || err+=1
|
read ADMINPHONE
|
||||||
|
if [[ "$ADMINPHONE" == "" ]]; then ADMINPHONE="+33647683646"; fi
|
||||||
|
|
||||||
chmod u+x $MY_PATH/.install/*.sh
|
echo "Le numéro de la carte SIM, du module SMS. AUCUNE liaison SMS? Laissez vide (défaut: +33611223344)"
|
||||||
|
read MASTERPHONE
|
||||||
|
if [[ "$MASTERPHONE" == "" ]]; then MASTERPHONE="+33611223344"; fi
|
||||||
|
|
||||||
$MY_PATH/.install/export_colors.sh
|
# TODO ASK for GeoPoint
|
||||||
[[ -f ~/.bash_aliases ]] && source ~/.bash_aliases
|
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/+33660780131/$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
|
||||||
|
|
||||||
## Vérifie si IPFS est installé
|
echo "========================================="
|
||||||
if [[ $force_req == "o" || -z $(which ipfs) || -z $(which gammu) ]];then
|
echo "VERIFIEZ QUE LES PARAMETRES SONT BONS... "
|
||||||
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_"
|
echo "========================================="
|
||||||
$MY_PATH/.install/1-install_requirements.sh silkaj ipfs gammu || err+=1
|
cat /home/$YOU/G1sms+/shell/init.sh
|
||||||
$MY_PATH/.install/2a-configure_ipfs_layer.sh || err+=1
|
echo "========================================="
|
||||||
else
|
echo "CONFIG: vi /home/$YOU/G1sms+/shell/init.sh "
|
||||||
echo -e "${c_green}IPFS et gammu sont déjà installé !$c_"
|
echo "========================================="
|
||||||
fi
|
|
||||||
|
|
||||||
echo -e "${c_yellow}Ce script va désormais configurer votre noeud G1sms+$c_"
|
|
||||||
|
|
||||||
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
|
|
||||||
|
|
||||||
[[ ! $PIN ]] && echo -e "${c_light}Le code PIN de votre carte SIM ? (ex: 1234)$c_" && read PIN
|
|
||||||
[[ "$PIN" == "" ]] && PIN="1234"
|
|
||||||
|
|
||||||
echo -e "ADMINPSEUDO: $ADMINPSEUDO\nADMINPHONE: $ADMINPHONE\nMASTERPHONE: $MASTERPHONE\nADRESSE: $ADRESSE\nPIN: $PIN"
|
|
||||||
[[ $noask != "o" ]] && echo -e "${c_light}${c_blue}LES PARAMETRES SONT BONS? Appliquer? ENTER ou CTRL-C ? (Editez le fichier .profile si incorrect)$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/_MASTERPHONE/$MASTERPHONE/g $init_loc
|
|
||||||
sed -i s/_ADRESSE/$ADRESSE/g $init_loc
|
|
||||||
sed -i s/_ADMINPHONE/$ADMINPHONE/g $init_loc
|
|
||||||
sed -i s/_ADMINPSEUDO/$ADMINPSEUDO/g $init_loc
|
|
||||||
|
|
||||||
if [[ ! -f $MY_PATH/.profile ]]; then
|
|
||||||
cp $MY_PATH/.install/templates/.profile $MY_PATH/
|
|
||||||
sed -i s/_MASTERPHONE/$MASTERPHONE/g $MY_PATH/.profile
|
|
||||||
sed -i s/_ADRESSE/$ADRESSE/g $MY_PATH/.profile
|
|
||||||
sed -i s/_ADMINPHONE/$ADMINPHONE/g $MY_PATH/.profile
|
|
||||||
sed -i s/_ADMINPSEUDO/$ADMINPSEUDO/g $MY_PATH/.profile
|
|
||||||
sed -i s/_PIN/$PIN/g $MY_PATH/.profile
|
|
||||||
fi
|
|
||||||
|
|
||||||
else
|
else
|
||||||
echo -e "${c_red}init.sh introuvable...$c_"
|
echo "VOUS AVEZ UNE VERSION de G1sms+ DEJA INSTALLEE. MISE A JOUR..."
|
||||||
err+=1
|
tar xzf CODE/G1sms+.latest.tgz
|
||||||
exit 1
|
|
||||||
|
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
|
fi
|
||||||
|
|
||||||
## Configuration de gammu
|
|
||||||
$MY_PATH/.install/2b-configure_gammu.sh || err=1
|
|
||||||
|
|
||||||
## Installations optionnels
|
|
||||||
|
|
||||||
repOld=$repOption
|
|
||||||
[[ -z $repOption ]] && echo -e "${c_yellow}Voulez-vous installer les modules complémentaires de copylaradio ? (o/n)$c_" && read repOption
|
|
||||||
if [[ $repOption =~ ^(o|1|yes|options|a|all)$ ]]; then $MY_PATH/.install/3-install_copylaradio.sh || err+=1; fi; repOption=$repOld
|
|
||||||
[[ -z $repOption ]] && echo -e "${c_yellow}Voulez-vous installer l'interface web Kalkun ? (o/n)$c_" && read repOption
|
|
||||||
if [[ $repOption =~ ^(o|1|yes|options|a|all)$ ]]; then isKalkun=1; $MY_PATH/.install/4a-install_kalkun.sh || err+=1; fi; repOption=$repOld
|
|
||||||
[[ -z $repOption && -z $isKalkun ]] && echo -e "${c_yellow}Voulez-vous installer l'interface web playSMS ? (o/n)$c_" && read repOption
|
|
||||||
if [[ $repOption =~ ^(o|1|yes|options|a|all)$ ]]; then $MY_PATH/.install/4b-install_playsms.sh || err+=1; fi; repOption=$repOld
|
|
||||||
|
|
||||||
if [[ $err ]]; then
|
|
||||||
echo -e "---\n${c_red}L'installation générale n'est mal déroulé =($c_"
|
|
||||||
else
|
|
||||||
echo -e "---\n${c_green}Félécitation ! L'installation de votre noeud G1SMS s'est terminé avec succès !\nBienvenue à bord =)$c_"
|
|
||||||
fi
|
|
||||||
exit 0
|
|
||||||
|
|
|
@ -0,0 +1,179 @@
|
||||||
|
#!/bin/bash
|
||||||
|
################################################################################
|
||||||
|
# Author: Fred (support@qo-op.com)
|
||||||
|
# Version: 0.1
|
||||||
|
# License: AGPL-3.0 (https://choosealicense.com/licenses/agpl-3.0/)
|
||||||
|
###########################################################################################
|
||||||
|
#######################################
|
||||||
|
# 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"
|
||||||
|
cd /usr/src/
|
||||||
|
sudo wget 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 ipfs-update_v1.5.2_linux-arm.tar.gz
|
||||||
|
cd ipfs-update
|
||||||
|
sudo ./install.sh
|
||||||
|
|
||||||
|
echo "INSTALL latest ipfs"
|
||||||
|
sudo ipfs-update install latest
|
||||||
|
|
||||||
|
echo "CREATE SYSTEMD ipfs SERVICE"
|
||||||
|
sudo cat > /etc/systemd/system/ipfs.service << EOF
|
||||||
|
[Unit]
|
||||||
|
Description=IPFS daemon
|
||||||
|
After=network.target
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
User=$USER
|
||||||
|
ExecStart=/usr/local/bin/ipfs daemon --enable-pubsub-experiment --enable-namesys-pubsub --enable-gc
|
||||||
|
Restart=on-failure
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
||||||
|
EOF
|
||||||
|
|
||||||
|
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 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 cat > /etc/mpd.conf << EOF
|
||||||
|
music_directory "/home/$USER/music"
|
||||||
|
playlist_directory "/home/$USER/playlists"
|
||||||
|
user "$USER"
|
||||||
|
bind_to_address "any"
|
||||||
|
auto_update "yes"
|
||||||
|
zeroconf_enabled "yes"
|
||||||
|
zeroconf_name "CopyLaRadio Music Recorder"
|
||||||
|
|
||||||
|
filesystem_charset "UTF-8"
|
||||||
|
id3v1_encoding "UTF-8"
|
||||||
|
###############################
|
||||||
|
|
||||||
|
audio_output {
|
||||||
|
type "pulse"
|
||||||
|
name "My Pulse Output"
|
||||||
|
server "127.0.0.1"
|
||||||
|
}
|
||||||
|
|
||||||
|
audio_output {
|
||||||
|
type "httpd"
|
||||||
|
name "CopyLaRadio HTTP Stream"
|
||||||
|
encoder "lame"
|
||||||
|
port "8000"
|
||||||
|
quality "5.0"
|
||||||
|
# bitrate "128"
|
||||||
|
format "44100:16:1"
|
||||||
|
}
|
||||||
|
EOF
|
||||||
|
|
||||||
|
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 libav-tools imagemagick curl -y
|
||||||
|
sudo apt-get install ca-certificates git-core binutils rsync alsa-utils bc libid3-tools espeak mpg321 fuse libttspico-utils atomicparsley -y
|
||||||
|
|
||||||
|
# CONFIG NGINX
|
||||||
|
sudo cat > /etc/nginx/sites-available/default << EOF
|
||||||
|
server {
|
||||||
|
listen 80 default_server;
|
||||||
|
listen [::]:80 default_server;
|
||||||
|
|
||||||
|
root /home/$USER/G1sms+/www/rompr;
|
||||||
|
index index.html index.htm index.nginx-debian.html;
|
||||||
|
|
||||||
|
server_name _;
|
||||||
|
|
||||||
|
location /g1tag {
|
||||||
|
proxy_pass http://127.0.0.1:81;
|
||||||
|
proxy_set_header Host \$host;
|
||||||
|
proxy_set_header X-Forwarded-For \$remote_addr;
|
||||||
|
}
|
||||||
|
|
||||||
|
location /code/ {
|
||||||
|
proxy_pass http://127.0.0.1:8080/ipns/QmZHTne3bjtMgaXWRqSbdKchJbgq2NaAeVSzFUN7ceYpif/;
|
||||||
|
proxy_set_header Host \$host;
|
||||||
|
proxy_set_header X-Real-IP \$remote_addr;
|
||||||
|
proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for;
|
||||||
|
}
|
||||||
|
|
||||||
|
location /ipfs {
|
||||||
|
proxy_pass http://127.0.0.1:8080;
|
||||||
|
proxy_set_header Host \$host;
|
||||||
|
proxy_set_header X-Forwarded-For \$remote_addr;
|
||||||
|
}
|
||||||
|
|
||||||
|
location /ipns {
|
||||||
|
proxy_pass http://127.0.0.1:8080;
|
||||||
|
proxy_set_header Host \$host;
|
||||||
|
proxy_set_header X-Forwarded-For \$remote_addr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
EOF
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
45
rc.local.sh
|
@ -1,28 +1,17 @@
|
||||||
#!/bin/bash
|
#!/bin/sh
|
||||||
######################################################################
|
#
|
||||||
# Author: Fred (support@qo-op.com)
|
|
||||||
# Version: 0.1
|
|
||||||
# License: AGPL-3.0 (https://choosealicense.com/licenses/agpl-3.0/)
|
|
||||||
# This script modify rc.local to start G1sms+ G1Tag, G1Tx and _CopyLaRadio scripts
|
# This script modify rc.local to start G1sms+ G1Tag, G1Tx and _CopyLaRadio scripts
|
||||||
######################################################################
|
######################################################################
|
||||||
# INJECT it self into /etc/rc.local
|
# INJECT it self
|
||||||
######################################################################
|
|
||||||
MY_PATH="`dirname \"$0\"`" # relative
|
|
||||||
MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized
|
|
||||||
|
|
||||||
######################################################################
|
|
||||||
#################### INCEPTION / INSERTION ###########################
|
|
||||||
######################################################################
|
######################################################################
|
||||||
inserted=$(grep -Rw "rc.local.sh" /etc/rc.local)
|
inserted=$(grep -Rw "rc.local.sh" /etc/rc.local)
|
||||||
if [[ ! $inserted ]]; then
|
if [[ ! $inserted ]]; then
|
||||||
sudo sed -i s/exit\ 0//g /etc/rc.local
|
sed -i s/exit\ 0//g /etc/rc.local
|
||||||
sudo echo "include $MY_PATH/rc.local.sh" >> /etc/rc.local
|
echo "include /home/pi/G1sms+/rc.local.sh" >> /etc/rc.local
|
||||||
sudo echo "exit 0" >> /etc/rc.local
|
echo "exit 0" >> /etc/rc.local
|
||||||
fi
|
fi
|
||||||
|
######################################################################
|
||||||
|
|
||||||
######################################################################
|
|
||||||
#### WRITE SYSTEM STARTUP COMMANDS HERE........
|
|
||||||
######################################################################
|
|
||||||
# mpd Runs like pi and some rights are bad!!
|
# mpd Runs like pi and some rights are bad!!
|
||||||
chown -R pi /var/run/mpd
|
chown -R pi /var/run/mpd
|
||||||
chown -R pi /run/mpd
|
chown -R pi /run/mpd
|
||||||
|
@ -39,33 +28,33 @@ chmod 664 /tmp/youtube-dl.log
|
||||||
chown pi:www-data /tmp/youtube-dl.log
|
chown pi:www-data /tmp/youtube-dl.log
|
||||||
|
|
||||||
# LAUNCH BUTTONS WATCH
|
# LAUNCH BUTTONS WATCH
|
||||||
su pi -c "$MY_PATH/_CopyLaRadio/watch.sh &"
|
su pi -c "/home/pi/G1sms+/_CopyLaRadio/watch.sh &"
|
||||||
# LAUNCH COPY SCRIPT
|
# LAUNCH COPY SCRIPT
|
||||||
su pi -c "$MY_PATH/_CopyLaRadio/copy.sh &"
|
su pi -c "/home/pi/G1sms+/_CopyLaRadio/copy.sh &"
|
||||||
|
|
||||||
# Print the IP address
|
# Print the IP address
|
||||||
_IP=$(hostname -I | cut -d " " -f 1) || true
|
_IP=$(hostname -I | cut -d " " -f 1) || true
|
||||||
if [ "$_IP" ]; then
|
if [ "$_IP" ]; then
|
||||||
printf "IP address is %s\n" "$_IP"
|
printf "IP address is %s\n" "$_IP"
|
||||||
$MY_PATH/shell/parle.sh "Adresse IP: $_IP"
|
/home/pi/G1sms+/shell/parle.sh "Adresse IP: $_IP"
|
||||||
youtube-dl -U
|
youtube-dl -U
|
||||||
$MY_PATH/shell/parle.sh "Mise à jour de Youtube DL. Terminé!"
|
/home/pi/G1sms+/shell/parle.sh "Mise à jour de Youtube DL. Terminé!"
|
||||||
#IPFS
|
#IPFS
|
||||||
YOU=$(ps aux --sort=+utime | grep ipfs | tail -n 1 | cut -d " " -f 1)
|
YOU=$(ps aux --sort=+utime | grep ipfs | tail -n 1 | cut -d " " -f 1)
|
||||||
if [[ "$YOU" != "" && "$YOU" != "root" ]]; then
|
if [[ "$YOU" != "" && "$YOU" != "root" ]]; then
|
||||||
$MY_PATH/shell/parle.sh "IPFS OK. Système de fichier interplanétaire activé."
|
/home/pi/G1sms+/shell/parle.sh "IPFS OK. Système de fichier interplanétaire activé."
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
$MY_PATH/shell/parle.sh "Connexion Internet Impossible!"
|
/home/pi/G1sms+/shell/parle.sh "Connexion Internet Impossible!"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# LANCEMENT G1Tag READ
|
# LANCEMENT G1Tag READ
|
||||||
if [[ -e "/dev/ttyACM0" ]]; then
|
if [[ -e "/dev/ttyACM0" ]]; then
|
||||||
cd $MY_PATH && ./shell/tag_READ.sh &
|
cd /home/pi/G1sms+ && ./shell/tag_READ.sh &
|
||||||
$MY_PATH/shell/parle.sh "Lecteur G1 tag"
|
/home/pi/G1sms+/shell/parle.sh "Lecteur G1 tag"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ -d "$MY_PATH/www/rompr" ]]; then
|
if [[ -d "/home/pi/G1sms+/www/rompr" ]]; then
|
||||||
$MY_PATH/shell/parle.sh "Jukebox interplanétaire accessible"
|
/home/pi/G1sms+/shell/parle.sh "Jukebox interplanétaire accessible"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
4
search
|
@ -2,7 +2,7 @@
|
||||||
clear
|
clear
|
||||||
echo "------------------------------------------------------------------------------"
|
echo "------------------------------------------------------------------------------"
|
||||||
if [ "$1" == "" ]; then
|
if [ "$1" == "" ]; then
|
||||||
echo " Nothing to search for!"
|
echo " Nothing to search for!"
|
||||||
else
|
else
|
||||||
echo " Searching for "$1" recursively. Please Wait..."
|
echo " Searching for "$1" recursively. Please Wait..."
|
||||||
echo "------------------------------------------------------------------------------"
|
echo "------------------------------------------------------------------------------"
|
||||||
|
@ -10,7 +10,7 @@ else
|
||||||
fi
|
fi
|
||||||
echo "------------------------------------------------------------------------------"
|
echo "------------------------------------------------------------------------------"
|
||||||
if [ "$2" != "" ]; then
|
if [ "$2" != "" ]; then
|
||||||
echo " To replace \"$1\" whith \"$2\", please run"
|
echo " To replace \"$1\" whith \"$2\", please run"
|
||||||
echo " grep -rl '$1' ./ | xargs sed -i 's/$1/$2/g'"
|
echo " grep -rl '$1' ./ | xargs sed -i 's/$1/$2/g'"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
Before Width: | Height: | Size: 77 KiB |
After Width: | Height: | Size: 35 KiB |
Before Width: | Height: | Size: 253 KiB After Width: | Height: | Size: 253 KiB |
Before Width: | Height: | Size: 26 KiB After Width: | Height: | Size: 26 KiB |
|
@ -0,0 +1 @@
|
||||||
|
duniter.moul.re:443
|
|
@ -5,7 +5,7 @@
|
||||||
# Version: 0.1
|
# Version: 0.1
|
||||||
# License: AGPL-3.0 (https://choosealicense.com/licenses/agpl-3.0/)
|
# 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 duniterpy
|
||||||
# pip3 install silkaj --user
|
# pip3 install silkaj --user
|
||||||
|
|
||||||
|
@ -63,8 +63,7 @@ BAN=$1
|
||||||
if [[ "$BAN" == "BAN" ]]; then
|
if [[ "$BAN" == "BAN" ]]; then
|
||||||
# Get actual Duniter node used by silkaj
|
# 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)
|
SERVER=$(cat ./silkaj/src/constants.py | grep G1_DEFAULT_ENDPOINT | awk '{print $3}' | sed s/\"\,//g | sed s/\"//g)
|
||||||
[[ ! $(grep $SERVER:443 shell/bad.nodes.txt) ]] && echo $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"
|
echo "$SERVER:443 IS NOW in ./shell/bad.nodes.txt"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -144,7 +143,7 @@ done
|
||||||
silkaj=$(echo $DUNITER | cut -d ":" -f 1)
|
silkaj=$(echo $DUNITER | cut -d ":" -f 1)
|
||||||
if [[ "$silkaj" != "" && "$silkaj" != "https" ]]; then
|
if [[ "$silkaj" != "" && "$silkaj" != "https" ]]; then
|
||||||
#echo "PUT $silkaj SILKAJ PARAM"
|
#echo "PUT $silkaj SILKAJ PARAM"
|
||||||
cat ./silkaj/src/constants.default.py | sed s/duniter-g1.p2p.legal/$silkaj/g > ./silkaj/src/constants.py
|
cat ./silkaj/src/constants.default.py | sed s/duniter.moul.re/$silkaj/g > ./silkaj/src/constants.py
|
||||||
else
|
else
|
||||||
echo "RESTORE DEFAULT SILKAJ PARAM"
|
echo "RESTORE DEFAULT SILKAJ PARAM"
|
||||||
cp -f ./silkaj/src/constants.default.py ./silkaj/src/constants.py
|
cp -f ./silkaj/src/constants.default.py ./silkaj/src/constants.py
|
||||||
|
|
|
@ -3,15 +3,12 @@
|
||||||
# Author: Fred (support@qo-op.com)
|
# Author: Fred (support@qo-op.com)
|
||||||
# Version: 0.1
|
# Version: 0.1
|
||||||
# License: AGPL-3.0 (https://choosealicense.com/licenses/agpl-3.0/)
|
# License: AGPL-3.0 (https://choosealicense.com/licenses/agpl-3.0/)
|
||||||
# BACKUP G1sms+ current Devlt code and push it with SWARM_CODE_MASTER to IPFS
|
# BACKUP G1sms+ current Devlt code and push it with MASTERKEYFILE encryption to IPFS
|
||||||
################################################################################
|
################################################################################
|
||||||
source ./init.sh
|
source ./shell/init.sh
|
||||||
source ./functions.sh
|
source ./shell/functions.sh
|
||||||
now=$(date +%Y-%m-%d)
|
now=$(date +%Y-%m-%d)
|
||||||
|
|
||||||
MY_PATH="`dirname \"$0\"`" # relative
|
|
||||||
MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized
|
|
||||||
|
|
||||||
echo "COMMENTAIRES?"
|
echo "COMMENTAIRES?"
|
||||||
read COMMENT
|
read COMMENT
|
||||||
|
|
||||||
|
@ -37,11 +34,10 @@ cd ..
|
||||||
# with iterative update _chain, _nanodate, _zen, _g1cents values
|
# with iterative update _chain, _nanodate, _zen, _g1cents values
|
||||||
# + _external UID references & _comments lines
|
# + _external UID references & _comments lines
|
||||||
###########################################################################################
|
###########################################################################################
|
||||||
echo "PLEASE WAIT...."
|
echo "PLEASE WAIT.... INITIALIZING G1 Object ipfs chain files:"
|
||||||
echo "GIT" > "./$dir/_type"
|
echo "GIT" > "./$dir/_type"
|
||||||
hop=$(cat "./$dir/_chain")
|
hop=$(cat "./$dir/_chain")
|
||||||
LASTDU=$(curl -s ${DUNITER}/blockchain/with/ud | jq '.result.blocks[]' | tail -n 1);
|
LASTDU=$(curl -s ${DUNITER}/blockchain/with/ud | jq '.result.blocks[]' | tail -n 1); curl -s ${DUNITER}/blockchain/block/${LASTDU} | jq '.dividend' > "./$dir/_DU";
|
||||||
[[ $LASTDU != "" ]] && curl -s ${DUNITER}/blockchain/block/${LASTDU} | jq '.dividend' > "./$dir/_DU" || LASTDU=$(cat ./$dir/_DU)
|
|
||||||
echo "Valeur courante du DU=$(cat ./$dir/_DU) ZEN - CHAIN: $hop"
|
echo "Valeur courante du DU=$(cat ./$dir/_DU) ZEN - CHAIN: $hop"
|
||||||
read
|
read
|
||||||
|
|
||||||
|
@ -53,10 +49,12 @@ echo $(date +%s%N) > "./$dir/_nanodate"
|
||||||
|
|
||||||
echo "$now: $COMMENT" >> "./$dir/_comments"
|
echo "$now: $COMMENT" >> "./$dir/_comments"
|
||||||
|
|
||||||
# TAR G1sms+ FILES (WITH EXCLUSIONS!!)
|
# TAR ALL ARCHIVE FILES
|
||||||
tar -cvzf ~/G1sms+_backup_$now.tar.gz --exclude 'g1sms.preoni.*' --exclude 'authfile' --exclude 'init.sh' --exclude '.git' --exclude 'billets' --exclude 'constants.py' --exclude 'TAG' --exclude 'history*' --exclude 'trash' --exclude 'print' --exclude 'wallets' --exclude 'wallets_swarm' --exclude 'g1sms.priv.key' ./$dir
|
tar -cvzf G1sms+_backup_$now.tar.gz --exclude 'init.sh' --exclude 'constants.py' --exclude 'TAG' --exclude 'history*' --exclude 'trash' --exclude 'print' --exclude 'wallets' --exclude 'wallets_swarm' --exclude 'g1sms.priv.key' ./$dir
|
||||||
|
|
||||||
mkdir -p /tmp/CODE/ && tar xzf ~/G1sms+_backup_$now.tar.gz -C /tmp/CODE/ && rm -f ~/G1sms+_backup_$now.tar.gz
|
mkdir -p /tmp/CODE/
|
||||||
|
mv G1sms+_backup_$now.tar.gz /tmp/CODE/G1sms+.latest.tgz
|
||||||
|
cp ./$dir/install*.sh /tmp/CODE/
|
||||||
|
|
||||||
# PUBLISH IT
|
# PUBLISH IT
|
||||||
hash=$(su $YOU -c "ipfs add -rq /tmp/CODE/ -w | tail -n 1")
|
hash=$(su $YOU -c "ipfs add -rq /tmp/CODE/ -w | tail -n 1")
|
||||||
|
@ -69,3 +67,5 @@ rm -Rf /tmp/CODE
|
||||||
|
|
||||||
echo "_CHAIN: NEW /ipfs/$hash // $hop PUBLISHED with \"SWARM_CODE_MASTER\" key
|
echo "_CHAIN: NEW /ipfs/$hash // $hop PUBLISHED with \"SWARM_CODE_MASTER\" key
|
||||||
ipfs get --output=./ /ipns/$publish"
|
ipfs get --output=./ /ipns/$publish"
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
# Author: Fred (support@qo-op.com)
|
# Author: Fred (support@qo-op.com)
|
||||||
# Version: 0.1
|
# Version: 0.1
|
||||||
# License: AGPL-3.0 (https://choosealicense.com/licenses/agpl-3.0/)
|
# License: AGPL-3.0 (https://choosealicense.com/licenses/agpl-3.0/)
|
||||||
# BACKUP G1sms+ current Devlt code and push it with NODE_G1AUTHFILE encryption to IPFS
|
# BACKUP G1sms+ current Devlt code and push it with MASTERKEYFILE encryption to IPFS
|
||||||
################################################################################
|
################################################################################
|
||||||
## GET LATEST DEV $ROOT
|
## GET LATEST DEV $ROOT
|
||||||
source ./shell/init.sh
|
source ./shell/init.sh
|
||||||
|
|
|
@ -1,83 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
################################################################################
|
|
||||||
# Author: Fred (support@qo-op.com)
|
|
||||||
# Version: 0.1
|
|
||||||
# License: AGPL-3.0 (https://choosealicense.com/licenses/agpl-3.0/)
|
|
||||||
###########################################################################################
|
|
||||||
# cron_G1TAG_REFRESH.sh
|
|
||||||
# Scan all TAG created by current $IPFSNODEID
|
|
||||||
# Update local and Publish it
|
|
||||||
# Remove too old or empty ones
|
|
||||||
##################################################################
|
|
||||||
YOU=$(ps aux --sort=+utime | grep ipfs | tail -n 1 | cut -d " " -f 1)
|
|
||||||
IPFSNODEID=$(su $YOU -c "ipfs id -f='<id>\n'")
|
|
||||||
NANODATE=$(date -u +%s%N) #1569692075385428020
|
|
||||||
|
|
||||||
# PROTECT from null HASH
|
|
||||||
for tag in ./wallets/.$IPFSNODEID/TAG/*; do
|
|
||||||
function rmtag () {
|
|
||||||
echo "__SUB:cron_G1TAG_REFRESH.sh: rm -Rf ./wallets/.$IPFSNODEID/TAG/${tagj}"
|
|
||||||
rm -Rf ./TAG/${tagj}
|
|
||||||
rm -f ./wallets/.$IPFSNODEID/TAG/${tagj}
|
|
||||||
rm -f ./wallets_swarm/.$IPFSNODEID/TAG/${tagj}
|
|
||||||
rm -f /home/$YOU/.ipfs/keystore/${tagj}
|
|
||||||
}
|
|
||||||
|
|
||||||
# Refresh G1Tag created by this NODE
|
|
||||||
tagj=$(echo $tag | cut -d '/' -f 5)
|
|
||||||
if [[ "${tagj}" == "" ]]; then echo "__SUB:cron_G1TAG_REFRESH.sh: EMPTY"; continue; fi
|
|
||||||
echo "__SUB:cron_G1TAG_REFRESH.sh: WORKING ON ${tagj}"
|
|
||||||
RR=$($YOU -c "ipfs cat /ipns/${tagj}/TAG_id | sed s/\ //g");
|
|
||||||
if [[ "$RR" == "" ]]; then
|
|
||||||
echo "__SUB:cron_G1TAG_REFRESH.sh: G1Tag Destroyed !!!??";
|
|
||||||
|
|
||||||
rmtag
|
|
||||||
continue;
|
|
||||||
fi
|
|
||||||
|
|
||||||
# RE-SYNC LOCAL & SWARM G1TAG - TODO Check for G1Tag chain corruption
|
|
||||||
mv ./TAG/${RR} ./TAG/${RR}.old
|
|
||||||
mkdir -p ./TAG/${RR}
|
|
||||||
chown -R $YOU ./TAG/${RR}
|
|
||||||
su $YOU -c "ipfs get --output=./TAG/${RR} /ipns/${tagj}"
|
|
||||||
oldtagval=$(cat ./TAG/${RR}.old/TAG_amount)
|
|
||||||
curtagval=$(cat ./TAG/${RR}/TAG_amount)
|
|
||||||
oldtagn=$(cat ./TAG/${RR}.old/TAG_n)
|
|
||||||
curtagn=$(cat ./TAG/${RR}/TAG_n)
|
|
||||||
oldtagchain=$(cat ./TAG/${RR}.old/TAG_chain)
|
|
||||||
curtagchain=$(cat ./TAG/${RR}/TAG_chain)
|
|
||||||
echo "__SUB:cron_G1TAG_REFRESH.sh: ./TAG/$RR VALUE: ($oldtagn) $oldtagval ZEN -> ($curtagn) $curtagval ZEN"
|
|
||||||
echo "__SUB:cron_G1TAG_REFRESH.sh: $oldtagchain -> $curtagchain"
|
|
||||||
|
|
||||||
rm -Rf ./TAG/${RR}.old
|
|
||||||
if [[ $curtagval -eq 0 || "$curtagval" == "" ]]; then rmtag; continue; fi
|
|
||||||
|
|
||||||
# SHOULD PUBLISH ONLY MORE THAN 6h NO USE G1TAG
|
|
||||||
last=$(cat ./TAG/${RR}/TAG_nanodate)
|
|
||||||
timediff=$( echo "${NANODATE} - ${last}" | bc -l )
|
|
||||||
# G1TAG TIME SYNC 21600 milliards de nanosecondes = 6h
|
|
||||||
if [[ $timediff -gt 21600000000000 ]]; then
|
|
||||||
|
|
||||||
# GET PUBLISHKEY for that G1TAG
|
|
||||||
if [[ ! -f /home/$YOU/.ipfs/keystore/${RR} ]]; then
|
|
||||||
echo "__SUB:cron_G1TAG_REFRESH.sh: GET PUBLISHKEY for that G1TAG";
|
|
||||||
su $YOU -c "ipfs get -o /home/$YOU/.ipfs/keystore/${RR}.crypt /ipns/$tagj/TAG_publishkey.MASTER.crypt"
|
|
||||||
if [[ ! -f /home/$YOU/.ipfs/keystore/${RR}.crypt ]]; then log "__SUB:cron_MINUTE.sh: error getting publishkey"; continue; fi
|
|
||||||
./shell/natools.py decrypt -k "$NODE_G1AUTHFILE" -i /home/$YOU/.ipfs/keystore/${RR}.crypt -o /home/$YOU/.ipfs/keystore/$RR
|
|
||||||
rm /home/$YOU/.ipfs/keystore/${RR}.crypt
|
|
||||||
fi
|
|
||||||
echo "__SUB:cron_G1TAG_REFRESH.sh: G1Tag PUBLISHKEY OK : /home/$YOU/.ipfs/keystore/${RR}"
|
|
||||||
echo ${NANODATE} > ./TAG/${RR}/TAG_nanodate
|
|
||||||
# PUBLISH VERIFIED G1Tag VERSION
|
|
||||||
I=$(su $YOU -c "ipfs add -qr ./TAG/${RR} | tail -n 1")
|
|
||||||
# RECORD TAG_chain And HASH again
|
|
||||||
echo "$I" > "./TAG/${JDESTRR}/TAG_chain"
|
|
||||||
I=$(su $YOU -c "ipfs add -qr ./TAG/${RR} | tail -n 1")
|
|
||||||
# IPNS $JDESTRR PUBLISH
|
|
||||||
J=$(su $YOU -c "ipfs name publish -k ${RR} --quieter /ipfs/${I}")
|
|
||||||
echo "__SUB:cron_G1TAG_REFRESH.sh: G1Tag IPNS PUBLISH"
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
|
||||||
done
|
|
||||||
##################################################################
|
|
|
@ -1,23 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
################################################################################
|
|
||||||
# Author: Fred (support@qo-op.com)
|
|
||||||
# Version: 0.1
|
|
||||||
# License: AGPL-3.0 (https://choosealicense.com/licenses/agpl-3.0/)
|
|
||||||
################################################################################
|
|
||||||
# Activate SUPPORT MODE: open ssh over IPFS
|
|
||||||
MY_PATH="`dirname \"$0\"`" # relative
|
|
||||||
MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized
|
|
||||||
if [[ -f $MY_PATH/.install/.GPATH ]]; then source $MY_PATH/.install/.GPATH; fi
|
|
||||||
if [[ -f $MY_PATH/../.install/.GPATH ]]; then source $MY_PATH/../.install/.GPATH; fi
|
|
||||||
|
|
||||||
YOU=$(ps aux --sort=+utime | grep ipfs | tail -n 1 | cut -d " " -f 1)
|
|
||||||
if [[ "$USER" != "root" ]]; then echo "Hey, $USER you must at least be admin of your system (sudo $0)"; exit; fi
|
|
||||||
if [[ "$YOU" == "" || "$YOU" == "root" ]]; then echo "BAD IPFS. Aucune installation IPFS satisfaisante ici... Ciao $YOU !"; exit; fi
|
|
||||||
IPFSNODEID=$(su $YOU -c "ipfs id -f='<id>\n'")
|
|
||||||
cd $GPATH
|
|
||||||
|
|
||||||
su $YOU -c "ipfs p2p close --all"
|
|
||||||
su $YOU -c "ipfs p2p listen /x/ssh /ip4/127.0.0.1/tcp/22"
|
|
||||||
su $YOU -c "ipfs p2p listen /x/http /ip4/127.0.0.1/tcp/80"
|
|
||||||
su $YOU -c "ipfs p2p listen /x/https /ip4/127.0.0.1/tcp/443"
|
|
||||||
su $YOU -c "ipfs p2p ls"
|
|
|
@ -7,102 +7,103 @@
|
||||||
# CE FICHIER cron_MINUTE.sh EST EXECUTE TOUTES LES MINUTES
|
# CE FICHIER cron_MINUTE.sh EST EXECUTE TOUTES LES MINUTES
|
||||||
# IL CONSTITUE LE BATEMENT DE COEUR DU SYSTEME
|
# IL CONSTITUE LE BATEMENT DE COEUR DU SYSTEME
|
||||||
################################################################################
|
################################################################################
|
||||||
|
|
||||||
MY_PATH="`dirname \"$0\"`" # relative
|
|
||||||
MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized
|
|
||||||
if [[ -f $MY_PATH/.install/.GPATH ]]; then source $MY_PATH/.install/.GPATH; fi
|
|
||||||
if [[ -f $MY_PATH/../.install/.GPATH ]]; then source $MY_PATH/../.install/.GPATH; fi
|
|
||||||
|
|
||||||
YOU=$(ps aux --sort=+utime | grep ipfs | tail -n 1 | cut -d " " -f 1)
|
YOU=$(ps aux --sort=+utime | grep ipfs | tail -n 1 | cut -d " " -f 1)
|
||||||
if [[ "$USER" != "root" ]]; then echo "Hey, $USER you must at least be admin of your system (sudo $0)"; exit; fi
|
|
||||||
if [[ "$YOU" == "" || "$YOU" == "root" ]]; then echo "BAD IPFS. Aucune installation IPFS satisfaisante ici... Ciao $YOU !"; exit; fi
|
|
||||||
IPFSNODEID=$(su $YOU -c "ipfs id -f='<id>\n'")
|
IPFSNODEID=$(su $YOU -c "ipfs id -f='<id>\n'")
|
||||||
cd $GPATH
|
CHEMIN="/home/$YOU/G1sms+"
|
||||||
|
cd $CHEMIN
|
||||||
source ./shell/init.sh
|
source ./shell/init.sh
|
||||||
source ./shell/functions.sh
|
source ./shell/functions.sh
|
||||||
|
|
||||||
timebar=$(date +%H:%M)
|
timebar=$(date +%H%M)
|
||||||
|
|
||||||
|
if [[ "$USER" != "root" ]]; then echo "Hey, $USER you must at least be admin of your system. sudo -s ?"; exit; fi
|
||||||
|
if [[ "$YOU" == "" || "$YOU" == "root" ]]; then echo "BAD IPFS. Aucune installation IPFS satisfaisante ici... Ciao $YOU !"; exit; fi
|
||||||
|
|
||||||
|
|
||||||
##################################################################
|
##################################################################
|
||||||
if [[ "$1" == "" ]]; then
|
# Refresh All peers SWARM Wallets.
|
||||||
##################################################################
|
|
||||||
echo "It is $timebar in the morning, or in the night? It depends on your day..."
|
|
||||||
exit
|
|
||||||
fi
|
|
||||||
##################################################################
|
##################################################################
|
||||||
|
ipfs_swarm_wallets_refresh "SIMPLE"
|
||||||
|
|
||||||
##################################################################
|
################################################################################
|
||||||
if [[ "$1" == "PRINT" ]]; then
|
# PRINT G1Tag
|
||||||
##################################################################
|
# CREATE and REMOVE rr.bin -> done.rr
|
||||||
##################################################################
|
if [[ -d "./wallets_swarm/.$IPFSNODEID/PRINT/" ]]; then
|
||||||
# Refresh All peers SWARM Wallets.
|
log "__SUB:cron_MINUTE.sh: SEARCH NEW PRINT FOR ME .$IPFSNODEID"
|
||||||
##################################################################
|
mkdir -p ./wallets/.$IPFSNODEID/PRINT/
|
||||||
ipfs_swarm_wallets_refresh "SIMPLE"
|
|
||||||
|
|
||||||
################################################################################
|
for qrrtag in ./wallets_swarm/.$IPFSNODEID/PRINT/*.bin; do
|
||||||
# PRINT G1Tag PRINTED FROM ANOTHER NODE (TODO: Correct BAD Cypher KEY + BUG why last image png layers are not printed???)
|
rr=$(echo $qrrtag | cut -d '/' -f 5 | cut -d '.' -f 1)
|
||||||
# CREATE and REMOVE rr.bin -> done.rr
|
if [[ ! -f "./wallets/.$IPFSNODEID/PRINT/done.$rr" ]]; then
|
||||||
if [[ -d "./wallets_swarm/.$IPFSNODEID/PRINT/" ]]; then
|
log "__SUB:cron_MINUTE.sh: PRINT G1Tag $rr - START: $(date)"
|
||||||
log "__SUB:cron_MINUTE.sh: SEARCH NEW PRINT FOR ME .$IPFSNODEID"
|
./shell/natools.py decrypt -k "$MASTERKEYFILE" -i "${qrrtag}" -o "/tmp/G1Tag.png"
|
||||||
mkdir -p ./wallets/.$IPFSNODEID/PRINT/
|
log "__SUB:cron_MINUTE.sh: natools.py decrypt - $(date)"
|
||||||
|
brother_ql_create --model QL-700 "/tmp/G1Tag.png" --label-size 62 > "/tmp/G1Tag.bin"
|
||||||
for qrrtag in ./wallets_swarm/.$IPFSNODEID/PRINT/*.bin; do
|
log "__SUB:cron_MINUTE.sh: brother_ql_create - $(date)"
|
||||||
rr=$(echo $qrrtag | cut -d '/' -f 5 | cut -d '.' -f 1)
|
brother_ql_print "/tmp/G1Tag.bin" /dev/usb/lp0
|
||||||
if [[ ! -f "./wallets/.$IPFSNODEID/PRINT/done.$rr" ]]; then
|
log "__SUB:cron_MINUTE.sh: brother_ql_print - $(date)"
|
||||||
log "__SUB:cron_MINUTE.sh: PRINT G1Tag $rr - START: $(date)"
|
# INFORM PRINT DONE
|
||||||
./shell/natools.py decrypt -k "$NODE_G1AUTHFILE" -i "${qrrtag}" -o "/tmp/G1Tag.png"
|
echo "OK" > ./wallets/.$IPFSNODEID/PRINT/done.$rr
|
||||||
log "__SUB:cron_MINUTE.sh: natools.py decrypt - $(date)"
|
|
||||||
brother_ql_create --model QL-700 "/tmp/G1Tag.png" --label-size 62 > "/tmp/G1Tag.bin"
|
|
||||||
log "__SUB:cron_MINUTE.sh: brother_ql_create - $(date)"
|
|
||||||
brother_ql_print "/tmp/G1Tag.bin" /dev/usb/lp0
|
|
||||||
log "__SUB:cron_MINUTE.sh: brother_ql_print - $(date)"
|
|
||||||
# INFORM PRINT DONE
|
|
||||||
echo "OK" > ./wallets/.$IPFSNODEID/PRINT/done.$rr
|
|
||||||
I=$(ipfs_node_wallets_add)
|
|
||||||
else
|
|
||||||
lqrrtag=$(echo "${qrrtag}" | sed s/_swarm//g )
|
|
||||||
log "__SUB:cron_MINUTE.sh: REMOVE OLD DONE PRINT ${lqrrtag} + ./wallets/.$IPFSNODEID/PRINT/done.$rr"
|
|
||||||
rm -f "./wallets/.$IPFSNODEID/PRINT/done.$rr"
|
|
||||||
rm -f "${lqrrtag}"
|
|
||||||
I=$(ipfs_node_wallets_add)
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
log "__SUB:cron_MINUTE.sh: REMOVE OLD PRINT MARKED AS DONE"
|
|
||||||
for scan in ./wallets_swarm/.Qm*/PRINT/done.*; do
|
|
||||||
lscan=$(echo $scan | sed s/_swarm//g )
|
|
||||||
lid=$(echo $scan | cut -d '/' -f 3 | cut -d '.' -f 2 )
|
|
||||||
lrr=$(echo $scan | cut -d '/' -f 5 | cut -d '.' -f 2 )
|
|
||||||
log "__SUB:cron_MINUTE.sh: REMOVE ./wallets/.$lid/PRINT/$lrr.bin OLD PRINT ${lscan} SENT to $lid ($lrr.bin)"
|
|
||||||
rm -f ./wallets/.$lid/PRINT/$lrr.bin
|
|
||||||
rm -f "${lscan}"
|
|
||||||
I=$(ipfs_node_wallets_add)
|
I=$(ipfs_node_wallets_add)
|
||||||
done
|
else
|
||||||
|
lqrrtag=$(echo "${qrrtag}" | sed s/_swarm//g )
|
||||||
rm "/tmp/G1Tag.bin"
|
log "__SUB:cron_MINUTE.sh: REMOVE OLD DONE PRINT ${lqrrtag} + ./wallets/.$IPFSNODEID/PRINT/done.$rr"
|
||||||
rm "/tmp/G1Tag.png"
|
rm -f "./wallets/.$IPFSNODEID/PRINT/done.$rr"
|
||||||
fi
|
rm -f "${lqrrtag}"
|
||||||
fi
|
I=$(ipfs_node_wallets_add)
|
||||||
##################################################################
|
fi
|
||||||
|
|
||||||
##################################################################
|
|
||||||
if [[ "$1" == "KALKUN" ]]; then
|
|
||||||
##################################################################
|
|
||||||
for number in ./wallets/*; do
|
|
||||||
member=""
|
|
||||||
phone=$(echo $number | cut -d '/' -f 3);
|
|
||||||
if [[ -f $number/$phone.uidname ]]; then member=$(cat $number/$phone.uidname); fi
|
|
||||||
if [[ ! $member ]]; then member=$phone; fi
|
|
||||||
if [[ $phone && $member ]]; then add_contact $phone $member; log "__SUB:cron_MINUTE.sh: KALKUN add_contact $phone $member"; fi
|
|
||||||
done
|
done
|
||||||
|
|
||||||
|
log "__SUB:cron_MINUTE.sh: REMOVE OLD PRINT MARKED AS DONE"
|
||||||
|
for scan in ./wallets_swarm/.Qm*/PRINT/done.*; do
|
||||||
|
lscan=$(echo $scan | sed s/_swarm//g )
|
||||||
|
lid=$(echo $scan | cut -d '/' -f 3 | cut -d '.' -f 2 )
|
||||||
|
lrr=$(echo $scan | cut -d '/' -f 5 | cut -d '.' -f 2 )
|
||||||
|
log "__SUB:cron_MINUTE.sh: REMOVE ./wallets/.$lid/PRINT/$lrr.bin OLD PRINT ${lscan} SENT to $lid ($lrr.bin)"
|
||||||
|
rm -f ./wallets/.$lid/PRINT/$lrr.bin
|
||||||
|
rm -f "${lscan}"
|
||||||
|
I=$(ipfs_node_wallets_add)
|
||||||
|
done
|
||||||
|
|
||||||
|
rm "/tmp/G1Tag.bin"
|
||||||
|
rm "/tmp/G1Tag.png"
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
##################################################################
|
||||||
|
if [[ "$timebar" == "0300" ]]; then
|
||||||
|
##################################################################
|
||||||
|
##################################################################
|
||||||
|
# Refresh G1Tag created by this NODE
|
||||||
|
# PROTECT from null HASH
|
||||||
|
for tag in ./wallets/.$IPFSNODEID/TAG/*; do
|
||||||
|
tagj=$(echo $tag | cut -d '/' -f 5)
|
||||||
|
log "__SUB:cron_MINUTE.sh: WORKING ON ${tagj}"
|
||||||
|
RR=$(su $YOU -c "ipfs cat /ipns/${tagj}/TAG_id | sed s/\ //g");
|
||||||
|
if [[ ! $RR && "${tagj}" != "" ]]; then echo "G1 Tag Destroyed"; echo "TODO: rm -Rf ./wallets/.$IPFSNODEID/TAG/${tagj} ???"; continue; fi
|
||||||
|
|
||||||
|
# GET PUBLISHKEY for that G1TAG
|
||||||
|
su $YOU -c "ipfs get -o /home/$YOU/.ipfs/keystore/${RR}.crypt /ipns/$tagj/TAG_publishkey.MASTER.crypt"
|
||||||
|
if [[ ! -f /home/$YOU/.ipfs/keystore/${RR}.crypt ]]; then log "__SUB:cron_MINUTE.sh: error getting publishkey"; continue; fi
|
||||||
|
./shell/natools.py decrypt -k "$MASTERKEYFILE" -i /home/$YOU/.ipfs/keystore/${RR}.crypt -o /home/$YOU/.ipfs/keystore/$RR
|
||||||
|
|
||||||
|
log "__SUB:cron_MINUTE.sh: G1Tag PUBLISHKEY decrypted and loaded in /home/$YOU/.ipfs/keystore/${RR}"
|
||||||
|
|
||||||
|
# RE-SYNC LOCAL & SWARM G1TAG (TODO Check G1Tag chain validity)
|
||||||
|
rm -f ./TAG/${RR}/*
|
||||||
|
su $YOU -c "ipfs get --output=./TAG/${RR} /ipns/${tagj}"
|
||||||
|
|
||||||
|
# PUBLISH VERIFIED G1Tag VERSION
|
||||||
|
I=$(su $YOU -c "ipfs add -qr ./TAG/${RR} | tail -n 1")
|
||||||
|
# RECORD TAG_chain And HASH again
|
||||||
|
echo "$I" > "./TAG/${JDESTRR}/TAG_chain"
|
||||||
|
I=$(su $YOU -c "ipfs add -qr ./TAG/${RR} | tail -n 1")
|
||||||
|
# IPNS $JDESTRR PUBLISH
|
||||||
|
J=$(su $YOU -c "ipfs name publish -k ${RR} --quieter /ipfs/${I}")
|
||||||
|
|
||||||
|
done
|
||||||
|
##################################################################
|
||||||
fi
|
fi
|
||||||
##################################################################
|
##################################################################
|
||||||
|
|
||||||
##################################################################
|
|
||||||
if [[ "$1" == "TAG" ]]; then
|
|
||||||
##################################################################
|
|
||||||
for tag in ./TAG/*; do
|
|
||||||
echo $tag
|
|
||||||
done
|
|
||||||
fi
|
|
||||||
##################################################################
|
|
||||||
|
|
|
@ -7,13 +7,6 @@
|
||||||
###################################################################################################################################
|
###################################################################################################################################
|
||||||
|
|
||||||
###################################################################################################################################
|
###################################################################################################################################
|
||||||
|
|
||||||
MY_PATH="`dirname \"$0\"`" # relative
|
|
||||||
MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized
|
|
||||||
|
|
||||||
## Récupère les données du profile
|
|
||||||
[[ -f $MY_PATH/.profile ]] && source $MY_PATH/.profile
|
|
||||||
|
|
||||||
function sms_SEND () {
|
function sms_SEND () {
|
||||||
# sms_SEND ($1=phone, $2=message)
|
# sms_SEND ($1=phone, $2=message)
|
||||||
local dest="$1"
|
local dest="$1"
|
||||||
|
@ -21,7 +14,7 @@ function sms_SEND () {
|
||||||
if [[ ${#dest} -eq 10 || ${#dest} -eq 12 ]]; then
|
if [[ ${#dest} -eq 10 || ${#dest} -eq 12 ]]; then
|
||||||
if [[ -d ./wallets/$dest ]]; then
|
if [[ -d ./wallets/$dest ]]; then
|
||||||
# TEST IF $dest IS ON CURRENT NODE
|
# TEST IF $dest IS ON CURRENT NODE
|
||||||
gammu-smsd-inject TEXT "$dest" -text "$mess" 1>&2
|
gammu-smsd-inject -l TEXT "$dest" -text "$mess" 1>&2
|
||||||
else
|
else
|
||||||
# Send SMS through $dest NODE (TODO: send it like PRINT, TASK, ...)
|
# Send SMS through $dest NODE (TODO: send it like PRINT, TASK, ...)
|
||||||
DESTNODEID=$(cat ./wallets_swarm/$dest/MASTERPHONE.ipfsid)
|
DESTNODEID=$(cat ./wallets_swarm/$dest/MASTERPHONE.ipfsid)
|
||||||
|
@ -122,15 +115,14 @@ if [[ $PHONE ]]; then rm -Rf ./wallets_swarm/$PHONE; fi
|
||||||
#log "__SUB:ipfs_swarm_wallets_refresh: IPFS: ipfs get --output=./wallets_swarm/ /ipns/$IPFSNODEID"
|
#log "__SUB:ipfs_swarm_wallets_refresh: IPFS: ipfs get --output=./wallets_swarm/ /ipns/$IPFSNODEID"
|
||||||
su $YOU -c "ipfs get --output=./wallets_swarm/ /ipns/$IPFSNODEID"
|
su $YOU -c "ipfs get --output=./wallets_swarm/ /ipns/$IPFSNODEID"
|
||||||
count=1
|
count=1
|
||||||
# Search for All peers Nodes. TODO: To be changed when Swarm is too bug or not expendanding
|
#for id in $(su $YOU -c "ipfs swarm peers" | awk -F '/' '{print $7}');
|
||||||
#for id in ./wallets/.Qm*/;
|
for id in ./wallets_swarm/.Qm*/;
|
||||||
for id in $(su $YOU -c "ipfs swarm peers" | awk -F '/' '{print $7}');
|
|
||||||
do
|
do
|
||||||
count=$((count+1))
|
count=$((count+1))
|
||||||
id=$(echo $id | cut -d '.' -f 3 | cut -d '/' -f 1)
|
id=$(echo $id | cut -d '.' -f 3 | cut -d '/' -f 1)
|
||||||
log "__SUB:ipfs_swarm_wallets_refresh: IPFS: ipfs get --output=./wallets_swarm/ /ipns/$id"
|
#log "__SUB:ipfs_swarm_wallets_refresh: IPFS: ipfs get --output=./wallets_swarm/ /ipns/$id"
|
||||||
rm -Rf ./wallets_swarm/.$id
|
rm -Rf ./wallets_swarm/.$id
|
||||||
./shell/timeout.sh -t 20 su $YOU -c "ipfs get --output=./wallets_swarm/ /ipns/$id"
|
su $YOU -c "ipfs get --output=./wallets_swarm/ /ipns/$id"
|
||||||
done
|
done
|
||||||
log "__SUB:ipfs_swarm_wallets_refresh: ./wallets_swarm/ RENEW from $count peers .........OK!!!"
|
log "__SUB:ipfs_swarm_wallets_refresh: ./wallets_swarm/ RENEW from $count peers .........OK!!!"
|
||||||
|
|
||||||
|
@ -250,7 +242,7 @@ function sms_uid2key (){
|
||||||
|
|
||||||
# Search fo duplicate
|
# Search fo duplicate
|
||||||
DUP=$(grep -Rwl "$ASKWALLET" ./wallets/*/*.uidname | cut -f 3 -d '/')
|
DUP=$(grep -Rwl "$ASKWALLET" ./wallets/*/*.uidname | cut -f 3 -d '/')
|
||||||
if [[ "$DUP" != "" && "$DUP" != "$PHONE" ]]; then
|
if [[ "$DUP" != "" ]]; then
|
||||||
sms_SEND "$ADMINPHONE" "ADMIN! INFO: $PHONE prend le même $ASKWALLET, que $DUP"
|
sms_SEND "$ADMINPHONE" "ADMIN! INFO: $PHONE prend le même $ASKWALLET, que $DUP"
|
||||||
sms_SEND "$DUP" "Vous devez savoir que $ASKWALLET est associé à un autre téléphone que le votre également!"
|
sms_SEND "$DUP" "Vous devez savoir que $ASKWALLET est associé à un autre téléphone que le votre également!"
|
||||||
fi
|
fi
|
||||||
|
@ -313,7 +305,7 @@ log "__SUB:sms_INIT_ACCOUNT: ($1=phone, $2=NOSMS)"
|
||||||
SMSNODE="./wallets/$PHONE/MASTERPHONE.sms" # Contains G1sms+ SMS phone number
|
SMSNODE="./wallets/$PHONE/MASTERPHONE.sms" # Contains G1sms+ SMS phone number
|
||||||
PINFILE="./wallets/$PHONE/$PHONE.pin" # Contains phone wallet diceware password
|
PINFILE="./wallets/$PHONE/$PHONE.pin" # Contains phone wallet diceware password
|
||||||
GPGPINFILE="./wallets/$PHONE/$PHONE.pin.gpg" # Contains g1smsnode cypher phone wallet diceware password
|
GPGPINFILE="./wallets/$PHONE/$PHONE.pin.gpg" # Contains g1smsnode cypher phone wallet diceware password
|
||||||
AUTHCRYPTFILE="./wallets/$PHONE/$PHONE.authfile.crypt" # Crypt with $NODE_G1PUBKEY
|
AUTHCRYPTFILE="./wallets/$PHONE/$PHONE.authfile.crypt" # TEST!!! crypt with $PHONE wallet keypair
|
||||||
PUBKEYFILE="./wallets/$PHONE/$PHONE.pub" # Contains phone wallet public key (RIB)
|
PUBKEYFILE="./wallets/$PHONE/$PHONE.pub" # Contains phone wallet public key (RIB)
|
||||||
UNITFILE="./wallets/$PHONE/$PHONE.unit" # Contains phone wallet prefered unit (LOVE,G1,DU)
|
UNITFILE="./wallets/$PHONE/$PHONE.unit" # Contains phone wallet prefered unit (LOVE,G1,DU)
|
||||||
|
|
||||||
|
@ -332,7 +324,6 @@ log "__SUB:sms_INIT_ACCOUNT: ($1=phone, $2=NOSMS)"
|
||||||
DABUIDF="./wallets/$PHONE/uidna.G1TAGNODE" # Contains G1Dab Name
|
DABUIDF="./wallets/$PHONE/uidna.G1TAGNODE" # Contains G1Dab Name
|
||||||
# GET CURRENT NODE UIDNA (default DABUID)
|
# GET CURRENT NODE UIDNA (default DABUID)
|
||||||
NODEUIDNA=$(cat "./wallets/.$IPFSNODEID/$IPFSNODEID.uidna")
|
NODEUIDNA=$(cat "./wallets/.$IPFSNODEID/$IPFSNODEID.uidna")
|
||||||
[[ $NODEUIDNA == "" ]] && NODEUIDNA=$(cat "./wallets/.$IPFSNODEID/_uidna")
|
|
||||||
######################################################################
|
######################################################################
|
||||||
# (NO PIN) = FIRST ACCOUNT: Create wallet
|
# (NO PIN) = FIRST ACCOUNT: Create wallet
|
||||||
if [ ! -f "$PINFILE" ]; then
|
if [ ! -f "$PINFILE" ]; then
|
||||||
|
@ -348,7 +339,7 @@ log "__SUB:sms_INIT_ACCOUNT: ($1=phone, $2=NOSMS)"
|
||||||
|
|
||||||
# BACKUP authfile available to authfile or PIN owner (DOUBLON AVEC PIN) TEST
|
# BACKUP authfile available to authfile or PIN owner (DOUBLON AVEC PIN) TEST
|
||||||
log "__SUB:sms_INIT_ACCOUNT: ./shell/natools.py encrypt -p $PUBKEY -i ""./authfile"" -o ""$AUTHCRYPTFILE"""
|
log "__SUB:sms_INIT_ACCOUNT: ./shell/natools.py encrypt -p $PUBKEY -i ""./authfile"" -o ""$AUTHCRYPTFILE"""
|
||||||
./shell/natools.py encrypt -p $NODE_G1PUBKEY -i "./authfile" -o "$AUTHCRYPTFILE"
|
./shell/natools.py encrypt -p $PUBKEY -i "./authfile" -o "$AUTHCRYPTFILE"
|
||||||
rm -f ./authfile
|
rm -f ./authfile
|
||||||
log "__SUB:sms_INIT_ACCOUNT: !! G1 Wallet CREATED: $PHONE $PIN : $PUBKEY"
|
log "__SUB:sms_INIT_ACCOUNT: !! G1 Wallet CREATED: $PHONE $PIN : $PUBKEY"
|
||||||
|
|
||||||
|
@ -366,11 +357,11 @@ log "__SUB:sms_INIT_ACCOUNT: ($1=phone, $2=NOSMS)"
|
||||||
#######################
|
#######################
|
||||||
# ACTIVATE G1SMS WALLET
|
# ACTIVATE G1SMS WALLET
|
||||||
#######################
|
#######################
|
||||||
# log "$NODE_G1AUTHFILE $PUBKEY THIRD_PARTY_MANAGER:$NODE_G1PUBKEY"
|
# log "$MASTERKEYFILE $PUBKEY THIRD_PARTY_MANAGER:$MASTERPUB"
|
||||||
TX_IN=$(./silkaj/silkaj transaction --auth-file -file="$NODE_G1AUTHFILE" --amount=3.24 --output=$PUBKEY --comment="[G1sms+] $UIDNA$TAIL 3RD:$NODE_G1PUBKEY " -y)
|
TX_IN=$(./silkaj/silkaj transaction --auth-file -file="$MASTERKEYFILE" --amount=3.15 --output=$PUBKEY --comment="[G1sms+] $UIDNA$TAIL 3RD:$MASTERPUB " -y)
|
||||||
log "__SUB:sms_INIT_ACCOUNT: G1 Wallet TX IN: $TX_IN"
|
log "__SUB:sms_INIT_ACCOUNT: G1 Wallet TX IN: $TX_IN"
|
||||||
sleep 2
|
sleep 2
|
||||||
TX_OUT=$(./silkaj/silkaj transaction --auth-scrypt -salt="$PHONE" -password="$PIN" --amount=0.1 --output=$NODE_G1PUBKEY --comment="[G1sms+] $UIDNA$TAIL 3RD:$NODE_G1PUBKEY:ACK" -y)
|
TX_OUT=$(./silkaj/silkaj transaction --auth-scrypt -salt="$PHONE" -password="$PIN" --amount=0.1 --output=$MASTERPUB --comment="[G1sms+] $UIDNA$TAIL 3RD:$MASTERPUB:ACK" -y)
|
||||||
log "__SUB:sms_INIT_ACCOUNT: G1 Wallet TX OUT: $TX_OUT"
|
log "__SUB:sms_INIT_ACCOUNT: G1 Wallet TX OUT: $TX_OUT"
|
||||||
|
|
||||||
################
|
################
|
||||||
|
@ -379,7 +370,7 @@ log "__SUB:sms_INIT_ACCOUNT: ($1=phone, $2=NOSMS)"
|
||||||
echo "$PIN" > "$PINFILE"
|
echo "$PIN" > "$PINFILE"
|
||||||
echo "${GPGPASS}" | gpg -q --output "$GPGPINFILE" --yes --pinentry-mode loopback --symmetric --passphrase-fd 0 "$PINFILE"
|
echo "${GPGPASS}" | gpg -q --output "$GPGPINFILE" --yes --pinentry-mode loopback --symmetric --passphrase-fd 0 "$PINFILE"
|
||||||
PIN=$(cat "$PINFILE" | xargs)
|
PIN=$(cat "$PINFILE" | xargs)
|
||||||
# [[ "$PIN" != "" ]] && echo "" > "$PINFILE" || log "SYSTEM ERROR :: PIN EMPTY !!! GPG???"
|
echo "" > "$PINFILE"
|
||||||
|
|
||||||
echo "114" > "$G1COUNTFILE"
|
echo "114" > "$G1COUNTFILE"
|
||||||
echo "$PUBKEY" > "$PUBKEYFILE"
|
echo "$PUBKEY" > "$PUBKEYFILE"
|
||||||
|
@ -414,7 +405,6 @@ log "__SUB:sms_INIT_ACCOUNT: ($1=phone, $2=NOSMS)"
|
||||||
PIN=$(cat "$PINFILE" | xargs)
|
PIN=$(cat "$PINFILE" | xargs)
|
||||||
log "__SUB:sms_INIT_ACCOUNT: Old G1sms wallet ;) SECURITY HOLE... Chiffrage PGP du PIN !!!"
|
log "__SUB:sms_INIT_ACCOUNT: Old G1sms wallet ;) SECURITY HOLE... Chiffrage PGP du PIN !!!"
|
||||||
echo "${GPGPASS}" | gpg -q --output "$GPGPINFILE" --yes --pinentry-mode loopback --symmetric --passphrase-fd 0 "$PINFILE";
|
echo "${GPGPASS}" | gpg -q --output "$GPGPINFILE" --yes --pinentry-mode loopback --symmetric --passphrase-fd 0 "$PINFILE";
|
||||||
./shell/natools.py encrypt -p $NODE_G1PUBKEY -i "$PINFILE" -o "$PINFILE.$NODE_UIDNA.crypt"
|
|
||||||
else
|
else
|
||||||
# ------------>8------------------
|
# ------------>8------------------
|
||||||
log "__SUB:sms_INIT_ACCOUNT: Déchiffrage PGP PIN..."
|
log "__SUB:sms_INIT_ACCOUNT: Déchiffrage PGP PIN..."
|
||||||
|
@ -422,14 +412,13 @@ log "__SUB:sms_INIT_ACCOUNT: ($1=phone, $2=NOSMS)"
|
||||||
# TODO make decypher less stress on filesystem, use /tmp and ramdisk
|
# TODO make decypher less stress on filesystem, use /tmp and ramdisk
|
||||||
echo "${GPGPASS}" | gpg -d -q --output "$PINFILE" --yes --pinentry-mode loopback --passphrase-fd 0 "$GPGPINFILE"
|
echo "${GPGPASS}" | gpg -d -q --output "$PINFILE" --yes --pinentry-mode loopback --passphrase-fd 0 "$GPGPINFILE"
|
||||||
PIN=$(cat "$PINFILE" | xargs)
|
PIN=$(cat "$PINFILE" | xargs)
|
||||||
[[ "$PIN" == "" && -f "$PINFILE.$NODE_UIDNA.crypt" ]] && ./shell/natools.py decrypt -k "$NODE_G1AUTHFILE" -i "$PINFILE.$NODE_UIDNA.crypt" -o "$PINFILE" && PIN=$(cat "$PINFILE");
|
echo "" > "$PINFILE";
|
||||||
# [[ "$PIN" != "" ]] && echo "" > "$PINFILE" || log "SYSTEM ERROR :: PIN EMPTY !!! GPG???"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# CYPHER EMAIL FILE
|
# CYPHER EMAIL FILE
|
||||||
if [[ ! -f "$GPGMAILFILE" ]]; then
|
if [[ ! -f "$GPGMAILFILE" ]]; then
|
||||||
# ------------8<------------------
|
# ------------8<------------------
|
||||||
log "__SUB:sms_INIT_ACCOUNT: NO EMAIL .gpg file, CREATING it"
|
# NO .gpg file, CREATING it (OLD G1sms accounts)
|
||||||
if [ -f "$MAILFILE" ]; then
|
if [ -f "$MAILFILE" ]; then
|
||||||
MAIL=$(cat "$MAILFILE");
|
MAIL=$(cat "$MAILFILE");
|
||||||
echo "${GPGPASS}" | gpg -q --output "$GPGMAILFILE" --yes --pinentry-mode loopback --symmetric --passphrase-fd 0 "$MAILFILE";
|
echo "${GPGPASS}" | gpg -q --output "$GPGMAILFILE" --yes --pinentry-mode loopback --symmetric --passphrase-fd 0 "$MAILFILE";
|
||||||
|
@ -438,12 +427,10 @@ log "__SUB:sms_INIT_ACCOUNT: ($1=phone, $2=NOSMS)"
|
||||||
fi
|
fi
|
||||||
# ------------>8------------------
|
# ------------>8------------------
|
||||||
else
|
else
|
||||||
log "__SUB:sms_INIT_ACCOUNT: DECODING EMAIL .gpg... "
|
# Already existing gpg DECODING IT
|
||||||
echo "${GPGPASS}" | gpg -d -q --output "$MAILFILE" --yes --pinentry-mode loopback --passphrase-fd 0 "$GPGMAILFILE"
|
echo "${GPGPASS}" | gpg -d -q --output "$MAILFILE" --yes --pinentry-mode loopback --passphrase-fd 0 "$GPGMAILFILE"
|
||||||
MAIL=$(cat "$MAILFILE");
|
MAIL=$(cat "$MAILFILE");
|
||||||
[[ $MAIL == "" && -f "$MAILFILE.node.crypt" ]] && ./shell/natools.py decrypt -k "$NODE_G1AUTHFILE" -i "$MAILFILE.node.crypt" -o "$MAILFILE" && MAIL=$(cat "$MAILFILE");
|
echo "" > "$MAILFILE";
|
||||||
# EMPTY CLEAR EMAIL FILE
|
|
||||||
[[ $MAIL != "" ]] && echo "" > "$MAILFILE" || log "SYSTEM ERROR :: MAIL EMPTY !!! GPG???"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# ------------8<------------------
|
# ------------8<------------------
|
||||||
|
@ -499,8 +486,8 @@ log "__SUB:sms_INIT_ACCOUNT: ($1=phone, $2=NOSMS)"
|
||||||
|
|
||||||
#################################################################################################################################
|
#################################################################################################################################
|
||||||
function check_account (){
|
function check_account (){
|
||||||
log "__SUB:check_account: SILKAJ...... max 30 sec....."
|
log "__SUB:check_account: SILKAJ...... max 15 sec....."
|
||||||
AMOUNTG1=$(./shell/timeout.sh -t 30 ./silkaj/silkaj amount "$PUBKEY")
|
AMOUNTG1=$(./shell/timeout.sh -t 15 ./silkaj/silkaj amount "$PUBKEY")
|
||||||
AMOUNTDU=$(bc <<< "scale=2; $AMOUNTG1 / $DUFACTOR")
|
AMOUNTDU=$(bc <<< "scale=2; $AMOUNTG1 / $DUFACTOR")
|
||||||
AMOUNTLOVE=$(bc <<< "$AMOUNTG1 * 100 / $DUFACTOR")
|
AMOUNTLOVE=$(bc <<< "$AMOUNTG1 * 100 / $DUFACTOR")
|
||||||
|
|
||||||
|
@ -563,7 +550,8 @@ esac
|
||||||
# GET G1sms wallet AMOUNTG1 and CHECK for right balance
|
# GET G1sms wallet AMOUNTG1 and CHECK for right balance
|
||||||
log "__SUB:make_accounting: LOCAL $VIR amount for $PHONE : $PUBKEY"
|
log "__SUB:make_accounting: LOCAL $VIR amount for $PHONE : $PUBKEY"
|
||||||
# Try to ask silkaj. If timeout, use SWARM last known $PHONE.g1cents value
|
# Try to ask silkaj. If timeout, use SWARM last known $PHONE.g1cents value
|
||||||
AMOUNTG1=$(./shell/timeout.sh -t 30 ./silkaj/silkaj amount "$PUBKEY")
|
AMOUNTG1=$(./shell/timeout.sh -t 20 ./silkaj/silkaj amount "$PUBKEY")
|
||||||
|
if [[ ! $AMOUNTG1 ]]; then AMOUNTG1=$(bc -l <<< "scale=2; $(cat ./wallets_swarm/$PHONE/$PHONE.g1cents) / 100"); fi
|
||||||
if [[ "$AMOUNTG1" == "" ]]; then AMOUNTG1=0; fi
|
if [[ "$AMOUNTG1" == "" ]]; then AMOUNTG1=0; fi
|
||||||
# TAX AND MINIMUM WALLET ACCOUNT CALCULATION
|
# TAX AND MINIMUM WALLET ACCOUNT CALCULATION
|
||||||
PERCENT=0$(bc -l <<< "scale=2; $VIR / $SWARMCOMM")
|
PERCENT=0$(bc -l <<< "scale=2; $VIR / $SWARMCOMM")
|
||||||
|
@ -611,11 +599,11 @@ function move_g1cents (){
|
||||||
# MUST ASK MANAGER NODE TO CORRECT g1cents FOR $winnerphone WALLET
|
# MUST ASK MANAGER NODE TO CORRECT g1cents FOR $winnerphone WALLET
|
||||||
# WRITE TASK TO .$NODEID CHANNEL
|
# WRITE TASK TO .$NODEID CHANNEL
|
||||||
mkdir -p ./wallets/.$NODEID/TASK/
|
mkdir -p ./wallets/.$NODEID/TASK/
|
||||||
# USE natools with NODEPUB crypt
|
# USE natools with NODEG1PUB crypt
|
||||||
echo "$zenvalue" > "/tmp/move_g1cents.$winnerphone"
|
echo "$zenvalue" > "/tmp/move_g1cents.$winnerphone"
|
||||||
# GET NODE G1sms Wallet PUBKEY
|
# GET NODE G1sms Wallet PUBKEY
|
||||||
NODEPUB=$(cat ./wallets_swarm/.$NODEID/$NODEID.pub)
|
NODEG1PUB=$(cat ./wallets_swarm/.$NODEID/$NODEID.pub)
|
||||||
./shell/natools.py encrypt -p $NODEPUB -i "/tmp/move_g1cents.$winnerphone" -o "./wallets/.$NODEID/TASK/$NANODATE.move_g1cents.$winnerphone.NODEPUB.crypt"
|
./shell/natools.py encrypt -p $NODEG1PUB -i "/tmp/move_g1cents.$winnerphone" -o "./wallets/.$NODEID/TASK/$NANODATE.move_g1cents.$winnerphone.NODEPUB.crypt"
|
||||||
log "__SUB:move_g1cents: CREDIT: WRITE TASK TO ./wallets/.$NODEID/$NANODATE.move_g1cents.$winnerphone.NODEPUB.crypt "
|
log "__SUB:move_g1cents: CREDIT: WRITE TASK TO ./wallets/.$NODEID/$NANODATE.move_g1cents.$winnerphone.NODEPUB.crypt "
|
||||||
rm -f /tmp/move_g1cents.$winnerphone
|
rm -f /tmp/move_g1cents.$winnerphone
|
||||||
fi
|
fi
|
||||||
|
@ -625,48 +613,3 @@ function move_g1cents (){
|
||||||
# UPDATE MY new ./wallet STATUS to SWARM
|
# UPDATE MY new ./wallet STATUS to SWARM
|
||||||
I=$(ipfs_node_wallets_add)
|
I=$(ipfs_node_wallets_add)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#################################################################################################################################
|
|
||||||
# Contact database management
|
|
||||||
function add_contact(){
|
|
||||||
userDB="gammu"
|
|
||||||
pwdDB=$(cat /etc/gammu-smsdrc | grep "password =" | awk '{ print $3 }' || exit 1)
|
|
||||||
local sql="mysql -N -u$userDB -p$pwdDB gammu -e"
|
|
||||||
|
|
||||||
local PHONE=$1
|
|
||||||
local MEMBERUID=$2
|
|
||||||
|
|
||||||
[[ -z $MEMBERUID ]] && MEMBERUID=$PHONE
|
|
||||||
|
|
||||||
[[ -z $($sql "SELECT * FROM pbk_groups WHERE ID='1'") ]] && $sql "INSERT INTO pbk_groups (ID, Name, id_user, is_public) VALUES ('1', '$(grep "ADRESSE" $MY_PATH/../.profile | awk -F= '{ print $2 }' | tr -d '"')', '1', 'false')"
|
|
||||||
|
|
||||||
if [[ -z $($sql "SELECT * FROM pbk WHERE Number=$PHONE") ]]; then
|
|
||||||
$sql "INSERT INTO pbk (GroupID, Name, Number, id_user, is_public) VALUES ('1', '$MEMBERUID', '$PHONE', '1', 'false')" || exit 1
|
|
||||||
local id_user=$($sql "SELECT ID FROM pbk WHERE Number=$PHONE" || exit 1)
|
|
||||||
$sql "INSERT INTO user_group (id_group, id_pbk, id_pbk_groups, id_user) VALUES ('$id_user', '$id_user', '1', '1')" || exit 1
|
|
||||||
else
|
|
||||||
log "${red}Contact already exist$c_"
|
|
||||||
fi
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
function rm_contact(){
|
|
||||||
userDB="gammu"
|
|
||||||
pwdDB=$(cat /etc/gammu-smsdrc | grep "password =" | awk '{ print $3 }' || exit 1)
|
|
||||||
local sql="mysql -N -u$userDB -p$pwdDB gammu -e"
|
|
||||||
|
|
||||||
local PHONE=$1
|
|
||||||
local MEMBERUID=$2
|
|
||||||
|
|
||||||
[[ -z $MEMBERUID ]] && MEMBERUID=$PHONE
|
|
||||||
|
|
||||||
if [[ ! -z $($sql "SELECT * FROM pbk WHERE Number=$PHONE") ]]; then
|
|
||||||
local id_user=$($sql "SELECT ID FROM pbk WHERE Number=$PHONE" || exit 1)
|
|
||||||
$sql "DELETE FROM pbk WHERE Number=$PHONE" || exit 1
|
|
||||||
$sql "DELETE FROM user_group WHERE id_group='$id_user'" || exit 1
|
|
||||||
else
|
|
||||||
log "${red}Contact doesn't exist$c_"
|
|
||||||
fi
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
import sys
|
import sys
|
||||||
from duniterpy.key import SigningKey
|
from duniterpy.key import SigningKey
|
||||||
|
|
||||||
|
|
||||||
def generate_public_key(salt: str, password: str) -> str:
|
def generate_public_key(salt: str, password: str) -> str:
|
||||||
"""
|
"""
|
||||||
Return public key from credentials
|
Return public key from credentials
|
||||||
|
@ -39,4 +38,3 @@ if __name__ == '__main__':
|
||||||
|
|
||||||
# exit with status code ok
|
# exit with status code ok
|
||||||
exit(0)
|
exit(0)
|
||||||
|
|
Before Width: | Height: | Size: 23 KiB |
BIN
shell/g1tag.png
Before Width: | Height: | Size: 32 KiB After Width: | Height: | Size: 23 KiB |
|
@ -1,6 +1,5 @@
|
||||||
duniter.moul.re:443
|
duniter.moul.re:443
|
||||||
g1.duniter.fr:443
|
g1.duniter.fr:443
|
||||||
g1.duniter.org:443
|
g1.duniter.org:443
|
||||||
g1.le-sou.org:443
|
|
||||||
g1.monnaielibreoccitanie.org:443
|
g1.monnaielibreoccitanie.org:443
|
||||||
g1.presles.fr:443
|
g1.presles.fr:443
|
||||||
|
|
|
@ -1,83 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
##################################################################
|
|
||||||
# Author: Fred (support@qo-op.com)
|
|
||||||
# Version: 0.1
|
|
||||||
# License: GPL (http://www.google.com/search?q=GPL)
|
|
||||||
##################################################################
|
|
||||||
|
|
||||||
MY_PATH="`dirname \"$0\"`" # relative
|
|
||||||
MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized
|
|
||||||
source $MY_PATH/.install/.GPATH
|
|
||||||
|
|
||||||
# Adapter les valeurs au contexte spatio-temporel du NODE G1SMS
|
|
||||||
function log () {
|
|
||||||
# log ($1=text)
|
|
||||||
if [ "$DOLOG" == "YES" ]
|
|
||||||
then
|
|
||||||
echo "$PHONE:$1" >> /tmp/g1sms.log
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
###################################################################################################################################
|
|
||||||
fn_exists() {
|
|
||||||
# appended double quote is an ugly trick to make sure we do get a string -- if $1 is not a known command, type does not output anything
|
|
||||||
[ `type -t $1`"" == 'file' ]
|
|
||||||
}
|
|
||||||
# ATOMATIC gammu-smsd-inject desactivation if no gammu is installed on system
|
|
||||||
if ! fn_exists gammu-smsd-inject; then
|
|
||||||
log ":p) DESACTIVATION ENVOI DE SMS .............."
|
|
||||||
function gammu-smsd-inject () {
|
|
||||||
log "$PHONE: >>> SENDING SMS $4 TO $2 "
|
|
||||||
}
|
|
||||||
else
|
|
||||||
export G1SMS="YES"
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
|
||||||
export YOU=$(ps auxf --sort=+utime | grep -w ipfs | grep -v -E 'color=auto|grep' | tail -n 1 | cut -d " " -f 1);
|
|
||||||
cd $GPATH
|
|
||||||
##################################################################
|
|
||||||
# Activate logging to /tmp/g1sms.log (YES/NO)
|
|
||||||
export DOLOG="YES"
|
|
||||||
export CPERROR="NOYES"
|
|
||||||
##################################################################
|
|
||||||
# Country Node Phone international prefix (TODO Worldwide)
|
|
||||||
export COUNTRY="+33"
|
|
||||||
##################################################################
|
|
||||||
# DU has a G1 value changed every 6 month!
|
|
||||||
# ./_DU Updated by cron_CODE.backup.sh
|
|
||||||
if [[ -f "./_DU" ]]; then export DUFACTOR=$(bc <<< "scale=2; $(cat "./_DU") / 100"); else log "__SUB:init.sh: FAILING TO FIND ./_DU EXIT!!!"; exit; fi
|
|
||||||
##################################################################
|
|
||||||
# Choose Default Unit: G1, DU, LOVE (DU cents), ZEN (G1 cents)
|
|
||||||
export COIN="G1"
|
|
||||||
##################################################################
|
|
||||||
# Limit and commission values
|
|
||||||
export LIMIT=2 # Solde minimum = 2 G1
|
|
||||||
# FIXED COMMISSION SYSTEM
|
|
||||||
export COMMISSION=1 # transaction commission amount (G1)
|
|
||||||
export BILLCOM=20
|
|
||||||
##################################################################
|
|
||||||
# COMMISSION PARTS FROM TX FOR NODE & G1SMS NETWORK
|
|
||||||
# PART COMMISSION SYSTEM
|
|
||||||
export SWARMCOMM=10
|
|
||||||
# TODO: NODE G1sms Wallet can receive rewards from SWARM or WALLETS/FILES
|
|
||||||
export NODECOMM=10
|
|
||||||
##################################################################
|
|
||||||
# SMS SIM Card Phone Number
|
|
||||||
export MASTERPHONE="+33651136520"
|
|
||||||
export ADRESSE="G1_Fablab_Toulouse"
|
|
||||||
export G1DAB="NO"
|
|
||||||
##################################################################
|
|
||||||
# ADMIN COMMAND PHONE ORIGIN
|
|
||||||
export ADMINPHONE="+33647683646"
|
|
||||||
export ADMINPSEUDO="Fred"
|
|
||||||
##################################################################
|
|
||||||
# DUNITER/CESIUM+ DEFAULT SERVERS
|
|
||||||
export DUNITER="https://g1.duniter.org"
|
|
||||||
export CESIUM="https://g1.data.le-sou.org"
|
|
||||||
|
|
||||||
# TODO Use latest Silkaj from "sudo fredp3 install silkaj"
|
|
||||||
# export SILKAJ="/usr/local/bin/silkaj"
|
|
||||||
source $GPATH/shell/init_keys.sh
|
|
||||||
|
|
|
@ -0,0 +1,31 @@
|
||||||
|
#!/bin/bash
|
||||||
|
##################################################################
|
||||||
|
# Author: Fred (support@qo-op.com)
|
||||||
|
# Version: 0.1
|
||||||
|
# License: GPL (http://www.google.com/search?q=GPL)
|
||||||
|
##################################################################
|
||||||
|
# Adapter les valeurs au contexte spatio-temporel du NODE G1SMS
|
||||||
|
function log () {
|
||||||
|
# log ($1=text)
|
||||||
|
if [ "$DOLOG" == "YES" ]
|
||||||
|
then
|
||||||
|
echo "$PHONE:$1" >> $LOG_FILE
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
### Déclaration de l'environnement
|
||||||
|
source .env
|
||||||
|
|
||||||
|
fn_exists() {
|
||||||
|
# appended double quote is an ugly trick to make sure we do get a string -- if $1 is not a known command, type does not output anything
|
||||||
|
[ `type -t $1`"" == 'file' ]
|
||||||
|
}
|
||||||
|
# ATOMATIC gammu-smsd-inject desactivation if no gammu is installed on system
|
||||||
|
if ! fn_exists gammu-smsd-inject; then
|
||||||
|
log ":p) DESACTIVATION ENVOI DE SMS .............."
|
||||||
|
function gammu-smsd-inject () {
|
||||||
|
log "$PHONE: >>> SENDING SMS $4 TO $2 "
|
||||||
|
}
|
||||||
|
else
|
||||||
|
export G1SMS="YES"
|
||||||
|
fi
|
|
@ -1,148 +1,129 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
##################################################################
|
##################################################################
|
||||||
# Author: Fred (support@qo-op.com)
|
# Author: Fred (support@qo-op.com)
|
||||||
# Version: 0.2
|
# Version: 0.1
|
||||||
# License: GPL (http://www.google.com/search?q=GPL)
|
# License: GPL (http://www.google.com/search?q=GPL)
|
||||||
##################################################################
|
##################################################################
|
||||||
# CHECK & WARN | CREATE Keys (gpg encrypt, G1wallet, IPNS publish)
|
# CHECK & WARN | CREATE Keys (gpg encrypt, G1wallet, IPNS publish)
|
||||||
##################################################################
|
##################################################################
|
||||||
|
|
||||||
MY_PATH="`dirname \"$0\"`" # relative
|
|
||||||
MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized
|
|
||||||
if [[ -f $MY_PATH/.install/.GPATH ]]; then source $MY_PATH/.install/.GPATH; fi
|
|
||||||
if [[ -f $MY_PATH/../.install/.GPATH ]]; then source $MY_PATH/../.install/.GPATH; fi
|
|
||||||
|
|
||||||
YOU=$(ps aux --sort=+utime | grep ipfs | tail -n 1 | cut -d " " -f 1)
|
YOU=$(ps aux --sort=+utime | grep ipfs | tail -n 1 | cut -d " " -f 1)
|
||||||
IPFSNODEID=$(su $YOU -c "ipfs id -f='<id>\n'")
|
# TODO Make it directory independant. (for now it is tested for pi running ipfs and code in $HOME/G1sms+
|
||||||
NANODATE=$(date -u +%s%N) #1569692075385428020
|
CHEMIN="/home/$YOU/G1sms+"
|
||||||
|
|
||||||
##################################################################
|
##################################################################
|
||||||
# G1sms+ Node KEYS (G1wallet, gpg, IPNS)
|
# G1sms+ Node KEYS (G1wallet, gpg, IPNS)
|
||||||
##################################################################
|
##################################################################
|
||||||
export GPGPASS=$(cat "/home/$YOU/.ipfs/config" | jq '.Identity.PrivKey' | sed s/\"//g) #"
|
export GPGPASS=$(cat "/home/$YOU/.ipfs/config" | jq '.Identity.PrivKey' | sed s/\"//g)
|
||||||
if [ ! $GPGPASS ]; then echo "FATAL ERROR:: IPFS Node.Identity.PrivKey GPGPASS EMPTY"; exit; fi
|
|
||||||
|
|
||||||
# GET SWARM KEY G1sms+ .ipfs/swarm.key
|
|
||||||
# export SWARMKEY=$(cat "/home/$YOU/.ipfs/swarm.key" | tail -n 1)
|
|
||||||
# if [ ! $SWARMKEY ]; then echo "FATAL ERROR:: .ipfs/swarm.key EMPTY"; exit; fi
|
|
||||||
|
|
||||||
##################################################################
|
##################################################################
|
||||||
# G1sms+ Swarm KEYS
|
# G1sms+ Swarm KEYS
|
||||||
##################################################################
|
##################################################################
|
||||||
# G1sms Service - G1Wallet
|
# G1sms Service - G1Wallet
|
||||||
#
|
if [[ -f "${CHEMIN}/g1sms.pub.key" && -f "${CHEMIN}/g1sms.priv.key" ]]; then
|
||||||
# CLEF G1 DU SWARM
|
chown root:root ${CHEMIN}/g1sms.priv.key
|
||||||
SWARM_G1PUBKEY=$(cat "${GPATH}/g1sms.pub.key")
|
chmod 600 ${CHEMIN}/g1sms.priv.key
|
||||||
SWARM_G1AUTHFILE="${GPATH}/g1sms.priv.key"
|
export MASTERPUB=$(cat "${CHEMIN}/g1sms.pub.key")
|
||||||
|
export MASTERKEYFILE="${CHEMIN}/g1sms.priv.key"
|
||||||
# CLEF G1 NODE = CLEF G1 SWARM !!
|
else
|
||||||
if [[ ! -e "./g1sms.preoni.pub.key" && -f "./g1sms.priv.key" ]]; then
|
echo "ATTENTION!! Vous devez posséder la clef du G1 Wallet utilisé par le SWARM G1sms!!"
|
||||||
log "__SUB:initkeys.sh: Linking preoni Keys to SWARM G1 Keys"
|
./shell/parle.sh "Les clefs du portefeuille essaim G1 SMS sont absente. Au revoir."
|
||||||
ln -s ./g1sms.priv.key ./g1sms.preoni.priv.key
|
echo "Fichiers manquants:"
|
||||||
ln -s ./g1sms.pub.key ./g1sms.preoni.pub.key
|
echo "${CHEMIN}/g1sms.pub.key"
|
||||||
elif [[ ! -f ./g1sms.preoni.priv.key ]]; then
|
echo "${CHEMIN}/g1sms.priv.key"
|
||||||
# CREATE NODE G1 KEYS AND FILES
|
echo "Contactez nous sur https://g1sms.fr"
|
||||||
mkdir -p ./wallets/.$IPFSNODEID/TASK
|
gammu-smsd-inject -l TEXT "$ADMINPHONE" -text "Clef de G1Wallet du SWARM g1sms.priv.key manquante! contactez-nous pour la recevoir https://g1sms.fr" 1>&2
|
||||||
################################################
|
exit
|
||||||
# GIVE NAME TO NODE G1 WALLET: "0000diceware"
|
|
||||||
# CREATE "preoni" KeyS & ./wallets/.Qm***/_files
|
|
||||||
################################################
|
|
||||||
# 4 derniers chiffres du MASTERPHONE + diceware
|
|
||||||
PRE=${MASTERPHONE:8:4}
|
|
||||||
ZUID=$(./shell/diceware.sh 1 | xargs)
|
|
||||||
# Check if already existing among all swarm wallets
|
|
||||||
while [[ $(grep -Rwl "$PRE$ZUID" ./wallets_swarm/.*/_uidna) ]]; do ZUID=$(./shell/diceware.sh 1 | xargs); done
|
|
||||||
NODE_UIDNA="$PRE$ZUID"
|
|
||||||
NODE_PIN=$(./shell/diceware.sh | xargs)
|
|
||||||
|
|
||||||
NODE_G1PUBKEY=$(./silkaj/silkaj generate_auth_file --auth-scrypt -salt="$NODE_UIDNA" -password="$NODE_PIN")
|
|
||||||
if [[ ! $NODE_G1PUBKEY ]]; then log "PROBLEME CREATION DU WALLET G1 POUR $NODE_UIDNA = $IPFSNODEID"; exit; fi
|
|
||||||
log "__SUB:initkeys.sh: NODE G1WALLET CESIUM: $NODE_UIDNA / $NODE_PIN CREATED..."
|
|
||||||
|
|
||||||
# WRITE NODE_UIDNA
|
|
||||||
echo "$NODE_UIDNA" > "./wallets/.$IPFSNODEID/_uidna" ################# _uidna
|
|
||||||
|
|
||||||
############ SYSTEM MODIFY hosts & hostname ################
|
|
||||||
# WRITE NODE uidna NAME TO /etc/hosts & .Qm*/_uidna file
|
|
||||||
echo "127.0.0.101 $NODE_UIDNA" >> "/etc/hosts"
|
|
||||||
echo $NODE_UIDNA > "/etc/hostname"
|
|
||||||
############################################################
|
|
||||||
|
|
||||||
# BACKUP AUTHFILE FOR FOR SWARM USE (TODO: Refine Swarm, Node access): GIVES SMARM WITHDRAW ACTION
|
|
||||||
./shell/natools.py encrypt -p $SWARM_G1PUBKEY -i "./authfile" -o "./wallets/.$IPFSNODEID/_authfile.swarm.crypt"
|
|
||||||
|
|
||||||
echo $NODE_G1PUBKEY > "./wallets/.$IPFSNODEID/_pub" ################# _pub
|
|
||||||
echo $IPFSNODEID > "./wallets/.$IPFSNODEID/_ipfsid" ################# _ipfsid
|
|
||||||
log "__SUB:initkeys.sh: [ADMIN] G1sms+ CREATE G1WALLET FOR: $IPFSNODEID: _pub = $NODE_G1PUBKEY "
|
|
||||||
|
|
||||||
# BACKUP $IPFSNODEID config ################# _ipfsconfig.swarm.crypt : GIVES SMARM NODE RESTORE ACTION
|
|
||||||
./shell/natools.py encrypt -p $SWARM_G1PUBKEY -i "/home/$YOU/.ipfs/config" -o "./wallets/.$IPFSNODEID/_ipfsconfig.swarm.crypt"
|
|
||||||
log "__SUB:initkeys.sh: [ADMIN] BACKUP IPFS NODE CONFIG to ./wallets/.$IPFSNODEID/_ipfsconfig.swarm.crypt"
|
|
||||||
|
|
||||||
# Cyper & Empty PIN
|
|
||||||
echo "${NODE_PIN}" > "./wallets/.$IPFSNODEID/_pin" ################# _pin / _pin.node.crypt / _pin.gpg
|
|
||||||
./shell/natools.py encrypt -p $NODE_G1PUBKEY -i "./wallets/.$IPFSNODEID/_pin" -o "./wallets/.$IPFSNODEID/_pin.node.crypt"
|
|
||||||
echo "${GPGPASS}" | gpg -q --output "./wallets/.$IPFSNODEID/_pin.gpg" --yes --pinentry-mode loopback --symmetric --passphrase-fd 0 "./wallets/.$IPFSNODEID/_pin"
|
|
||||||
echo "" > "./wallets/.$IPFSNODEID/_pin"
|
|
||||||
|
|
||||||
echo "314" > "./wallets/.$IPFSNODEID/_g1cents" ################# _g1cents
|
|
||||||
echo $NANODATE > "./wallets/.$IPFSNODEID/_nanodate" ################# _nanodate
|
|
||||||
|
|
||||||
# SILKAJ INIT G1 NODE WALLET
|
|
||||||
TX_IN=$(./silkaj/silkaj transaction --auth-file -file="$SWARM_G1AUTHFILE" --amount=3.24 --output=$NODE_G1PUBKEY --comment="[G1sms+] G1NODE ($ADMINPSEUDO) $NODE_UIDNA $IPFSNODEID" -y)
|
|
||||||
TX_OUT=$(./silkaj/silkaj transaction --auth-scrypt -salt="$NODE_UIDNA" -password="$NODE_PIN" --amount=0.1 --output=$SWARM_G1PUBKEY --comment="[G1sms+] G1NODE ($ADMINPSEUDO) $NODE_UIDNA $IPFSNODEID:ACK" -y)
|
|
||||||
|
|
||||||
log "__SUB:initkeys.sh: [ADMIN] NODE G1sms+ $NODE_UIDNA : ls ./wallets/.$IPFSNODEID"
|
|
||||||
gammu-smsd-inject -l TEXT "$ADMINPHONE" -text "[ADMIN] G1sms+ NODE $NODE_UIDNA ($IPFSNODEID)" 1>&2
|
|
||||||
gammu-smsd-inject -l TEXT "$ADMINPHONE" -text "$NODE_G1PUBKEY" 1>&2
|
|
||||||
|
|
||||||
# CREATE preoni FILES
|
|
||||||
mv ./authfile ./g1sms.preoni.priv.key
|
|
||||||
echo $NODE_G1PUBKEY > ./g1sms.preoni.pub.key
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
NODE_UIDNA=$(cat "./wallets/.$IPFSNODEID/_uidna")
|
##################################################################
|
||||||
## INIT NODE G1 PUB & PRIV KEY
|
# NODE KEYS (SCRIPT CALLED BY ROOT !!! gammu is root)
|
||||||
NODE_G1PUBKEY=$(cat "${GPATH}/g1sms.preoni.pub.key")
|
##################################################################
|
||||||
NODE_G1AUTHFILE="${GPATH}/g1sms.preoni.priv.key"
|
export IPFSNODEID=$(su $YOU -c "ipfs id -f='<id>\n'")
|
||||||
|
export NANODATE=$(date -u +%s%N) #1569692075385428020
|
||||||
|
|
||||||
##########################################################
|
# CHECK LAST TIME NODE HAD ACTION
|
||||||
# MEMORIZE NODE NANODATE EXECUTION TIME (for ntpdate regular sync)
|
if [[ -f ./wallets/.$IPFSNODEID/$IPFSNODEID.nanodate ]]; then
|
||||||
if [[ -f ./wallets/.$IPFSNODEID/_nanodate ]]; then
|
last=$(cat ./wallets/.$IPFSNODEID/$IPFSNODEID.nanodate)
|
||||||
last=$(cat ./wallets/.$IPFSNODEID/_nanodate)
|
|
||||||
timediff=$( echo "${NANODATE} - ${last}" | bc -l )
|
timediff=$( echo "${NANODATE} - ${last}" | bc -l )
|
||||||
# NODE TIME SYNC 600 milliards de nanosecondes = 600 s = 10 mn
|
# Get median nanodate before
|
||||||
if [[ $timediff -gt 600000000000 ]]; then
|
# NODE TIME SYNC 120 milliards de nanosecondes
|
||||||
# RUN & LOG ntpdate
|
if [[ $timediff -gt 120000000000 ]]; then
|
||||||
log "__SUB:ntpdate pool.ntp.org: $timediff $(ntpdate pool.ntp.org)"
|
log "__SUB:ntpdate pool.ntp.org: $timediff $(ntpdate pool.ntp.org)"
|
||||||
export NANODATE=$(date -u +%s%N)
|
export NANODATE=$(date -u +%s%N)
|
||||||
fi
|
fi
|
||||||
echo $NANODATE > ./wallets/.$IPFSNODEID/_nanodate
|
fi
|
||||||
|
|
||||||
|
echo $NANODATE > ./wallets/.$IPFSNODEID/$IPFSNODEID.nanodate
|
||||||
|
|
||||||
|
#################################################################
|
||||||
|
# CREATE NODE .$IPFSNODEID SPACE (G1Wallet + TASK + NODE DETAILS)
|
||||||
|
#################################################################
|
||||||
|
# Create G1sms Wallet with that NODE G1 wallet as member reference
|
||||||
|
if [[ ! -f "./wallets/.$IPFSNODEID/$IPFSNODEID.pub" ]]; then
|
||||||
|
mkdir -p ./wallets/.$IPFSNODEID/TASK
|
||||||
|
NODEG1WALLET=$(./silkaj/silkaj generate_auth_file --auth-scrypt -salt="$IPFSNODEID" -password="$GPGPASS")
|
||||||
|
echo "${GPGPASS}" | gpg -q --output "./wallets/.$IPFSNODEID/$IPFSNODEID.authfile.GPGPASS.gpg" --yes --pinentry-mode loopback --symmetric --passphrase-fd 0 "./authfile"
|
||||||
|
./shell/natools.py encrypt -p $NODEG1WALLET -i "./authfile" -o "./wallets/.$IPFSNODEID/$IPFSNODEID.authfile.crypt"
|
||||||
|
rm -f ./authfile
|
||||||
|
|
||||||
|
echo $NODEG1WALLET > "./wallets/.$IPFSNODEID/$IPFSNODEID.pub"
|
||||||
|
echo $IPFSNODEID > "./wallets/.$IPFSNODEID/$IPFSNODEID.ipfsid"
|
||||||
|
log "__SUB:initkeys.sh: [ADMIN] G1sms+ CREATE G1WALLET FOR: $IPFSNODEID: pub = $NODEG1WALLET "
|
||||||
|
|
||||||
|
# BACKUP $IPFSNODEID config
|
||||||
|
./shell/natools.py encrypt -p $MASTERPUB -i "/home/$YOU/.ipfs/config" -o "./wallets/.$IPFSNODEID/$IPFSNODEID.ipfsconfig.crypt"
|
||||||
|
log "__SUB:initkeys.sh: [ADMIN] BACKUP $IPFSNODEID NODE CONFIG to ./wallets/.$IPFSNODEID/$IPFSNODEID.ipfsconfig.crypt "
|
||||||
|
|
||||||
|
#######################
|
||||||
|
# GIVE NAME TO WALLET
|
||||||
|
#######################
|
||||||
|
# 4 derniers chiffres du numéro de téléphone
|
||||||
|
TAIL=${MASTERPHONE:8:4}
|
||||||
|
# No UIDNA yet. Create new
|
||||||
|
UIDNA=$(./shell/diceware.sh 1 | xargs)
|
||||||
|
# Check if already existing among all swarm wallets
|
||||||
|
while [[ $(grep -Rwl "$UIDNA$TAIL" ./wallets_swarm/*/*.uidna) ]]; do UIDNA=$(./shell/diceware.sh 1 | xargs); done
|
||||||
|
echo "$UIDNA$TAIL" > "./wallets/.$IPFSNODEID/$IPFSNODEID.uidna"
|
||||||
|
|
||||||
|
# CREATE NODE WALLET LIKE A PHONE (Stored in wallets/.$IPFSNODEID)
|
||||||
|
echo "${GPGPASS}" > "./wallets/.$IPFSNODEID/$IPFSNODEID.pin"
|
||||||
|
echo "${GPGPASS}" | gpg -q --output "./wallets/.$IPFSNODEID/$IPFSNODEID.pin.gpg" --yes --pinentry-mode loopback --symmetric --passphrase-fd 0 "./wallets/.$IPFSNODEID/$IPFSNODEID.pin"
|
||||||
|
echo "" > "./wallets/.$IPFSNODEID/$IPFSNODEID.pin"
|
||||||
|
echo "$UIDNA$TAIL" > "./wallets/.$IPFSNODEID/$IPFSNODEID.uidna"
|
||||||
|
echo "314" > "./wallets/.$IPFSNODEID/$IPFSNODEID.g1cents"
|
||||||
|
echo $NODEG1WALLET > "./wallets/.$IPFSNODEID/$IPFSNODEID.pub"
|
||||||
|
|
||||||
|
# SILKAJ INIT G1 NODE WALLET
|
||||||
|
TX_IN=$(./silkaj/silkaj transaction --auth-file -file="$MASTERKEYFILE" --amount=3.15 --output=$NODEG1WALLET --comment="[G1sms+] G1NODE ($ADMINPSEUDO) $UIDNA$TAIL $IPFSNODEID" -y)
|
||||||
|
TX_OUT=$(./silkaj/silkaj transaction --auth-scrypt -salt="$IPFSNODEID" -password="$GPGPASS" --amount=0.1 --output=$MASTERPUB --comment="[G1sms+] G1NODE $IPFSNODEID:ACK" -y)
|
||||||
|
log "__SUB:initkeys.sh: [ADMIN] G1sms+ $ADMINPSEUDO-$UIDNA$TAIL OUVERT POUR NODE: ls ./wallet/.$IPFSNODEID"
|
||||||
|
gammu-smsd-inject -l TEXT "$ADMINPHONE" -text "[ADMIN] G1sms+ $ADMINPSEUDO-$UIDNA$TAIL OUVERT POUR NODE: ls ./wallets/.$IPFSNODEID" 1>&2
|
||||||
|
gammu-smsd-inject -l TEXT "$ADMINPHONE" -text "$NODEG1WALLET" 1>&2
|
||||||
fi
|
fi
|
||||||
|
|
||||||
################################################################
|
################################################################
|
||||||
#INFORM ABOUT NODE CAPACITIES
|
#INFORM ABOUT NODE CAPACITIES
|
||||||
export NODEPUB=$(cat "./wallets/.$IPFSNODEID/_pub")
|
export NODEG1PUB=$(cat "./wallets/.$IPFSNODEID/$IPFSNODEID.pub")
|
||||||
|
|
||||||
## IS IT A SMS NODE (gammu-smsd is installed)??
|
## IS IT A SMS NODE (gammu-smsd is installed)??
|
||||||
if [[ $G1SMS ]]; then
|
if [[ $G1SMS ]]; then
|
||||||
echo $MASTERPHONE > "./wallets/.$IPFSNODEID/_sms"
|
echo $MASTERPHONE > "./wallets/.$IPFSNODEID/$IPFSNODEID.sms"
|
||||||
else
|
else
|
||||||
if [ -f "./wallets/.$IPFSNODEID/_sms" ]; then rm -f "./wallets/.$IPFSNODEID/_sms"; fi
|
if [ -f "./wallets/.$IPFSNODEID/$IPFSNODEID.sms" ]; then rm -f "./wallets/.$IPFSNODEID/$IPFSNODEID.sms"; fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
## IS THERE USB PRINTER CONNECTED?
|
## IS THERE USB PRINTER CONNECTED?
|
||||||
if [[ -e "/dev/usb/lp0" ]]; then
|
if [[ -e "/dev/usb/lp0" ]]; then
|
||||||
log "G1CORE: IMPRESSION G1Tag ACTIF .............."
|
log "G1CORE: IMPRESSION G1Tag ACTIF .............."
|
||||||
echo $ADRESSE > "./wallets/.$IPFSNODEID/_where"
|
echo $ADRESSE > "./wallets/.$IPFSNODEID/$IPFSNODEID.where"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
## IS THERE SERIAL QR CODE READER CONNECTED?
|
## IS THERE SERIAL QR CODE READER CONNECTED?
|
||||||
if [[ -e "/dev/ttyACM0" ]]; then
|
if [[ -e "/dev/ttyACM0" ]]; then
|
||||||
log "G1CORE: SCAN G1Tag ACTIF .............."
|
log "G1CORE: SCAN G1Tag ACTIF .............."
|
||||||
export G1TX="YES"
|
export G1TX="YES"
|
||||||
echo "/dev/ttyACM0" > "./wallets/.$IPFSNODEID/_scan"
|
echo "/dev/ttyACM0" > "./wallets/.$IPFSNODEID/$IPFSNODEID.scan"
|
||||||
else
|
else
|
||||||
if [ -f "./wallets/.$IPFSNODEID/_scan" ]; then rm -f "./wallets/.$IPFSNODEID/_scan"; fi
|
if [ -f "./wallets/.$IPFSNODEID/$IPFSNODEID.scan" ]; then rm -f "./wallets/.$IPFSNODEID/$IPFSNODEID.scan"; fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
|
@ -1,64 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
################################################################################
|
|
||||||
# Author: Fred (support@qo-op.com)
|
|
||||||
# Version: 0.1
|
|
||||||
# License: AGPL-3.0 (https://choosealicense.com/licenses/agpl-3.0/)
|
|
||||||
################################################################################
|
|
||||||
# TODO: Before June 2020: Get "./billets/$bpath/note.authfile.GPGPASS.gpg" for automatic Payback
|
|
||||||
# Search for old G1Billets for final CHK : Forget & Transfer G1 ?
|
|
||||||
source ./shell/init.sh
|
|
||||||
source ./shell/functions.sh
|
|
||||||
|
|
||||||
# Existence days number can be $1
|
|
||||||
if [[ "$1" ]]; then vieux="$1"; else vieux=210; fi
|
|
||||||
if [[ "$2" ]]; then dest="$2"; else dest=$NODE_G1PUBKEY; fi
|
|
||||||
|
|
||||||
echo "Recherche de G1Billets plus vieux que $vieux jours."
|
|
||||||
Nbillets=$(find billets/ -daystart -mtime +$vieux -type f -name "*.pubkey" | wc -l)
|
|
||||||
echo "$Nbillets G1Billets trouvés..."
|
|
||||||
|
|
||||||
for result in $(find billets/ -daystart -mtime +$vieux -type d -name "*"); do
|
|
||||||
billetname=$(echo $result | cut -d '/' -f 2)
|
|
||||||
if [[ $billetname && "$billetname" != "MEMBERS" ]]; then
|
|
||||||
((Nbillets --))
|
|
||||||
numero=$(echo $billetname | sed s/_/\ /g )
|
|
||||||
creator=$(cat "$result/note.creator")
|
|
||||||
value=$(cat "$result/note.value")
|
|
||||||
unit=$(cat "$result/note.unit")
|
|
||||||
pubkey=$(cat "$result/note.pubkey")
|
|
||||||
salt=$(cat "$result/note.salt")
|
|
||||||
secret=$(cat "$result/note.secret")
|
|
||||||
|
|
||||||
solde=$(/usr/local/bin/silkaj -p duniter-g1.p2p.legal:443 balance $pubkey | grep Quantitative | cut -d '=' -f 2 | cut -d ' ' -f 2)
|
|
||||||
|
|
||||||
# GET creator member wallet ($dest) and refund if still at initial G1 value (lost or unused BILL).
|
|
||||||
virement=$solde
|
|
||||||
[[ -f "$result/note.g1" ]] && initialvalue=$(cat "$result/note.g1") && if [[ $solde -eq $initialvalue ]]; then virement=$solde; else virement=1; fi
|
|
||||||
[[ -f "$result/note.memrib" ]] && dest=$(cat "$result/memrib")
|
|
||||||
|
|
||||||
echo ">>> $billetname $pubkey créé par $creator, valeur initiale $virement G1 (initialement $initialvalue G1)."
|
|
||||||
echo ">>> Virer à $dest $virement G1 du G1billet !! ID / Pass:"
|
|
||||||
echo $numero
|
|
||||||
echo $secret $salt
|
|
||||||
echo "/usr/local/bin/silkaj tx --amount=\"$virement\" --output=\"$dest\""
|
|
||||||
|
|
||||||
if [[ "$virement" == "0.0" ]]; then
|
|
||||||
echo "G1Billet déjà vide, suppression de $result"; rm -Rf $result;
|
|
||||||
else
|
|
||||||
PAY=$(/usr/local/bin/silkaj -p duniter-g1.p2p.legal:443 tx --amount="$virement" --output="$dest" --comment="[G1Billet] $numero" -y)
|
|
||||||
if [[ ! $(echo $PAY | grep "successfully sent") ]]; then
|
|
||||||
echo "!!!! ERREUR: $virement Something Wrong happened with $result. Moving to /tmp/ERROR_BILL_$billetname (please check or remove)"
|
|
||||||
mkdir -p /tmp/ERROR_BILL_$billetname
|
|
||||||
mv $result/* /tmp/ERROR_BILL_$billetname
|
|
||||||
else
|
|
||||||
echo $PAY
|
|
||||||
echo "OK! On supprime $result et continue avec le billet $Nbillets"
|
|
||||||
echo
|
|
||||||
rm -Rf $result
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
echo "MEMBER:" $result
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
|
@ -1,11 +1,9 @@
|
||||||
duniter.moul.re:443
|
|
||||||
duniter.dethegeek.eu.org:443
|
|
||||||
g1.presles.fr:443
|
|
||||||
g1.duniter.fr:443
|
|
||||||
monit.g1.nordstrom.duniter.org:443
|
|
||||||
g1.le-sou.org:443
|
g1.le-sou.org:443
|
||||||
g1.duniter.org:443
|
|
||||||
g1.monnaielibreoccitanie.org:443
|
|
||||||
follow.the.white-rabbit.net:443
|
follow.the.white-rabbit.net:443
|
||||||
g1.acostey.fr:443
|
duniter.moul.re:443
|
||||||
duniter.acostey.fr:443
|
g1.monnaielibreoccitanie.org:443
|
||||||
|
g1.duniter.inso.ovh:443
|
||||||
|
g1.duniter.fr:443
|
||||||
|
g1.presles.fr:443
|
||||||
|
g1.duniter.org:443
|
||||||
|
monit.g1.nordstrom.duniter.org:443
|
||||||
|
|
0
shell/tools/G1_request_cesium_profile.py → shell/request_cesium_profile.py
Executable file → Normal file
|
@ -11,24 +11,12 @@
|
||||||
# TODO: Create information Channels and moderate OPT IN/OUT
|
# TODO: Create information Channels and moderate OPT IN/OUT
|
||||||
source ./shell/init.sh
|
source ./shell/init.sh
|
||||||
source ./shell/functions.sh
|
source ./shell/functions.sh
|
||||||
log "__SUB:sms_ABO.sh: START ($1=PHONE, $2=SERVICE)"
|
log "__SUB:sms_ABO.sh: START ($1=SERVICE, $2=YESNO)"
|
||||||
PHONE=$1
|
SERVICE=$1
|
||||||
SERVICE=$2
|
YESNO=$2
|
||||||
|
PARAMS=$3
|
||||||
sms_INIT_ACCOUNT "$PHONE"
|
|
||||||
|
|
||||||
case "$SERVICE" in
|
case "$SERVICE" in
|
||||||
ON)
|
|
||||||
log "Abonnement Kalkun"
|
|
||||||
add_contact $PHONE $MEMBER && log "${c_green}Contact has been added to database$c_" || log "${c_red}Contact can't be added to database$c_";
|
|
||||||
sms_SEND "$PHONE" "$MEMBER votre inscription annuaire est active"
|
|
||||||
;;
|
|
||||||
OFF)
|
|
||||||
log "Retrait Kalkun"
|
|
||||||
rm_contact $PHONE $MEMBER && log "${c_green}Contact has been deleted from database$c_" || log "${c_red}Contact can't be deleted database$c_";
|
|
||||||
sms_SEND "$PHONE" "$MEMBER retrait annuaire prise en compte..."
|
|
||||||
;;
|
|
||||||
|
|
||||||
MARCHE)
|
MARCHE)
|
||||||
log "Avertissement G1 marchés"
|
log "Avertissement G1 marchés"
|
||||||
# PARAMS could be "$distance" to Member GeoPoint...
|
# PARAMS could be "$distance" to Member GeoPoint...
|
||||||
|
|
|
@ -11,20 +11,23 @@ log "X sms_AIDE.sh ($1=phone)"
|
||||||
sms_INIT_ACCOUNT "$1" "NOSMS"
|
sms_INIT_ACCOUNT "$1" "NOSMS"
|
||||||
|
|
||||||
MESS="[Aide]
|
MESS="[Aide]
|
||||||
N Pseudo (membre ou nom de portefeuille) : Création portefeuille
|
N Id-M (Relier au portefeuille Id-M)
|
||||||
U G1/DU/LOVE : Unité
|
U G1/DU/LOVE (UNIT)
|
||||||
S : Solde
|
S (Solde)
|
||||||
P 06nnnnnnnn 300 : Payer 300 à 06nnnnnnnn"
|
P 06nnnnnnnn 300 (Envoyer 300 UNIT à 06nnnnnnnn)"
|
||||||
# Send response SMS
|
# Send response SMS
|
||||||
sms_SEND "$1" "$MESS"
|
sms_SEND "$1" "$MESS"
|
||||||
|
|
||||||
MESS="EMAIL moi@email : Indiquer son email
|
MESS="EMAIL moi@email.tld (Recevoir vos commandes par email)
|
||||||
VIR 50 Pseudo : Virer 50 à Pseudo (membre ou Portefeuille SMS)"
|
TAG 10 5 (Créer 5 G1Tag de 10 G1)
|
||||||
|
VIR 50 Idw (Virer 50 UNIT vers Idw)"
|
||||||
sms_SEND "$1" "$MESS"
|
sms_SEND "$1" "$MESS"
|
||||||
|
|
||||||
MESS="REC 50 Dest S 4 : Virer 50 à Dest pendant 4 Semaines (J/S/M/A)
|
MESS="REC (Pour un payement récurrent)
|
||||||
BILL n : Recevoir 6 G1Billets remplis de n LOVE par email!
|
D (Détail de votre compte)
|
||||||
https://g1sms.fr - $ADMINPSEUDO ($ADMINPHONE)"
|
A votre service.
|
||||||
|
$ADMINPSEUDO / G1sms+ / $ADMINPHONE
|
||||||
|
https://g1sms.fr"
|
||||||
sms_SEND "$1" "$MESS"
|
sms_SEND "$1" "$MESS"
|
||||||
|
|
||||||
log "END sms_AIDE.sh"
|
log "END sms_AIDE.sh"
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
# Create and print 6 G1Billets de nn LOVE
|
# Create and print 6 G1Billets de nn LOVE
|
||||||
source ./shell/init.sh
|
source ./shell/init.sh
|
||||||
source ./shell/functions.sh
|
source ./shell/functions.sh
|
||||||
log "__SUB:sms_BILLET.sh: ($1=phone, $2=VALbillet)"
|
log "X sms_BILLET.sh ($1=phone, $2=VALbillet)"
|
||||||
|
|
||||||
phone="$1"
|
phone="$1"
|
||||||
VALbillet="$2"
|
VALbillet="$2"
|
||||||
|
@ -20,7 +20,7 @@ sms_INIT_ACCOUNT "$phone" "NOSMS"
|
||||||
# FIXED LOVE UNIT (6 month maximum validity)
|
# FIXED LOVE UNIT (6 month maximum validity)
|
||||||
UNIT="LOVE"
|
UNIT="LOVE"
|
||||||
|
|
||||||
log "__SUB:sms_BILLET.sh: MEMBER? $PHONE => $MEMBER"
|
log "MEMBER? $PHONE => $MEMBER"
|
||||||
|
|
||||||
if [[ $UNKNOWN == "unknown" || "$MEMBER" == "" ]]; then
|
if [[ $UNKNOWN == "unknown" || "$MEMBER" == "" ]]; then
|
||||||
sms_ERROR "$phone" "Porte-monnaie non identifié.
|
sms_ERROR "$phone" "Porte-monnaie non identifié.
|
||||||
|
@ -54,113 +54,90 @@ amount=$(bc <<< "$NBbillets * $VALbillet")
|
||||||
VIR=$(bc -l <<< "scale=2; $amount * $DUFACTOR / 100")
|
VIR=$(bc -l <<< "scale=2; $amount * $DUFACTOR / 100")
|
||||||
|
|
||||||
# Need at least $MIN G1 available! $BILLCOM G1 commission
|
# Need at least $MIN G1 available! $BILLCOM G1 commission
|
||||||
MIN=$(bc -l <<< "$AMOUNTG1 - $LIMIT - $BILLCOM")
|
MIN=$(bc -l <<< "$AMOUNTG1 - $LIMIT - 21")
|
||||||
testmin=$( echo "${VIR} < ${MIN}" | bc -l )
|
testmin=$( echo "${VIR} < ${MIN}" | bc -l )
|
||||||
log "__SUB:sms_BILLET.sh: TEST : $VIR < $MIN ? $testmin"
|
log "TEST : $VIR < $MIN ? $testmin"
|
||||||
|
|
||||||
# silkaj NODE CHANGE !!!
|
# silkaj NODE CHANGE !!!
|
||||||
#SILKAJNODE=$(./shell/checknodes.sh)
|
SILKAJNODE=$(./shell/checknodes.sh)
|
||||||
#log "NEW SILKAJ NODE: $SILKAJNODE"
|
log "NEW SILKAJ NODE: $SILKAJNODE"
|
||||||
|
|
||||||
if [[ "$testmin" -eq "1" ]]
|
if [[ "$testmin" -eq "1" ]]
|
||||||
then
|
then
|
||||||
# Clean MEMBER directory
|
|
||||||
rm -f ./billets/MEMBERS/$MEMBER/*.jpg
|
|
||||||
boucle=0;
|
boucle=0;
|
||||||
while [ $boucle -lt $NBbillets ]
|
while [ $boucle -lt $NBbillets ]
|
||||||
do
|
do
|
||||||
# Creation du numéro de billet
|
# Creation du numéro de billet
|
||||||
NUMBER=$(./shell/diceware.sh 2 | xargs)
|
NUMBER=$(./shell/diceware.sh 4 | xargs)
|
||||||
bpath=$(echo $NUMBER | sed 's/ /_/g')
|
bpath=$(echo $NUMBER | sed 's/ /_/g')
|
||||||
|
|
||||||
# Cas d'un billet existant
|
# Cas d'un billet existant
|
||||||
while [ -d "./billets/$bpath" ]
|
while [ -d "./billets/$bpath" ]
|
||||||
do
|
do
|
||||||
NUMBER=$(./shell/diceware.sh 2 | xargs)
|
NUMBER=$(./shell/diceware.sh 4 | xargs)
|
||||||
bpath=$(echo $NUMBER | sed 's/ /_/g')
|
bpath=$(echo $NUMBER | sed 's/ /_/g')
|
||||||
done
|
done
|
||||||
|
|
||||||
SECRET=$(./shell/diceware.sh 4 | xargs)
|
SECRET=$(./shell/diceware.sh 3 | xargs)
|
||||||
|
SALT=$(./shell/diceware.sh 3 | xargs)
|
||||||
|
|
||||||
boucle=$(bc -l <<< "$boucle + 1")
|
boucle=$(bc -l <<< "$boucle + 1")
|
||||||
|
|
||||||
log "__SUB:sms_BILLET.sh: ->BILLET:$PHONE:$NUMBER:$VALbillet:$UNIT"
|
log "->BILLET:$PHONE:$NUMBER:$VALbillet:$UNIT"
|
||||||
# CREATE "NUMBER SECRET" ACCOUNT for G1 transfert
|
# CREATE "NUMBER SECRET SALT" ACCOUNT for G1 transfert
|
||||||
TRANSAC=$(bc -l <<< "scale=2; $VIR / $NBbillets")
|
TRANSAC=$(bc -l <<< "scale=2; $VIR / $NBbillets")
|
||||||
BILLETPUBKEY=$(./silkaj/silkaj generate_auth_file --auth-scrypt -salt="$NUMBER" -password="$SECRET")
|
BILLETPUBKEY=$(./silkaj/silkaj generate_auth_file --auth-scrypt -salt="$NUMBER" -password="$SECRET $SALT")
|
||||||
# COPY authfile for Usage in 6 month...
|
log_history $PHONE "BILLET, $TRANSAC, $BILLETPUBKEY"
|
||||||
log "__SUB:sms_BILLET.sh: authfile KEY : ./billets/$bpath/note.authfile.GPGPASS.gpg"
|
|
||||||
mkdir -p "./billets/$bpath"
|
|
||||||
echo "${GPGPASS}" | gpg -q --output "./billets/$bpath/note.authfile.GPGPASS.gpg" --yes --pinentry-mode loopback --symmetric --passphrase-fd 0 "./authfile"
|
|
||||||
./shell/natools.py encrypt -p $NODE_G1PUBKEY -i "./authfile" -o "./billets/$bpath/note.authfile.$NODE_UIDNA.crypt"
|
|
||||||
rm -f "./authfile"
|
|
||||||
|
|
||||||
log_history $PHONE "G1BILLET, $TRANSAC, $BILLETPUBKEY"
|
|
||||||
sleep 3
|
sleep 3
|
||||||
# Fill BILLET with TRANSAC amount
|
# Fill BILLET with TRANSAC amount
|
||||||
PAY=$(./silkaj/silkaj transaction --auth-scrypt -salt="$PHONE" -password="$PIN" --amount="$TRANSAC" --output="$BILLETPUBKEY" --comment="G1Billet $NUMBER" -y)
|
PAY=$(./silkaj/silkaj transaction --auth-scrypt -salt="$PHONE" -password="$PIN" --amount="$TRANSAC" --output="$BILLETPUBKEY" --comment="THIRD_PARTY_MANAGER:$MASTERPUB:G1SMS:BILLET" -y)
|
||||||
if [[ "$(echo $PAY | cut -d '|' -f 1)" != "KO" ]]; then
|
if [[ "$(echo $PAY | cut -d '|' -f 1)" != "KO" ]]; then
|
||||||
|
mkdir -p "./billets/$bpath"
|
||||||
# NOTES ARE FILES STORED IN DICEWARE COMPOSED SUBDIR
|
# NOTES ARE FILES STORED IN DICEWARE COMPOSED SUBDIR
|
||||||
echo "$(date +%Y%m%d)" > "./billets/$bpath/note.creationdate"
|
|
||||||
echo "$MEMBER" > "./billets/$bpath/note.creator"
|
echo "$MEMBER" > "./billets/$bpath/note.creator"
|
||||||
echo "$MEMRIB" > "./billets/$bpath/note.memrib"
|
|
||||||
echo "$NUMBER" > "./billets/$bpath/note.number"
|
echo "$NUMBER" > "./billets/$bpath/note.number"
|
||||||
echo "$PHONE" > "./billets/$bpath/note.phone"
|
echo "$PHONE" > "./billets/$bpath/note.phone"
|
||||||
echo "$SECRET" > "./billets/$bpath/note.secret"
|
echo "$SECRET" > "./billets/$bpath/note.secret"
|
||||||
echo "$VALbillet" > "./billets/$bpath/note.love"
|
echo "$SALT" > "./billets/$bpath/note.salt"
|
||||||
echo "$TRANSAC" > "./billets/$bpath/note.g1"
|
echo "$VALbillet" > "./billets/$bpath/note.value"
|
||||||
|
echo "$UNIT" > "./billets/$bpath/note.unit"
|
||||||
echo "$BILLETPUBKEY" > "./billets/$bpath/note.pubkey"
|
echo "$BILLETPUBKEY" > "./billets/$bpath/note.pubkey"
|
||||||
log "Remplissage: $TRANSAC G1... $BILLETPUBKEY = $PAY"
|
log "Remplissage: $TRANSAC G1... $BILLETPUBKEY = $PAY"
|
||||||
|
|
||||||
# CREATION FICHIER IMAGE BILLET
|
# CREATION FICHIER IMAGE BILLET
|
||||||
$(./shell/sms_BILLET_MAKE.sh "$NUMBER" "$SECRET" "$VALbillet" "$UNIT" "$TRANSAC" "$BILLETPUBKEY" "$MEMBER" "$TRANSAC" "$PHONE")
|
$(./shell/sms_BILLET_MAKE.sh "$NUMBER" "$SECRET" "$VALbillet" "$UNIT" "$DUFACTOR" "$BILLETPUBKEY" "$MEMBER" "$TRANSAC")
|
||||||
log "./shell/sms_BILLET_MAKE.sh \"$NUMBER\" \"$SECRET\" \"$VALbillet\" \"$UNIT\" \"$TRANSAC\" \"$BILLETPUBKEY\" \"$MEMBER\" \"$TRANSAC\" \"$PHONE\""
|
log "./shell/sms_BILLET_MAKE.sh \"$NUMBER\" \"$SECRET\" \"$VALbillet\" \"$UNIT\" \"$DUFACTOR\" \"$BILLETPUBKEY\" \"$MEMBER\" \"$TRANSAC\""
|
||||||
|
|
||||||
# Transaction to create Link BILLET <-> MEMBER RIB => Decrease BILLET value !
|
# Transaction to create Link BILLET <-> MEMBER RIB => Decrease BILLET value !
|
||||||
sleep 2
|
sleep 2
|
||||||
# PAY=$(./silkaj/silkaj transaction --auth-scrypt -salt="$NUMBER" -password="$SECRET" --amount="0.05" --output="$MEMRIB" --comment="THIRD_PARTY_MANAGER:$NODE_G1PUBKEY:G1SMS:BILLET:$VALbillet:$UNIT:$NUMBER" -y)
|
# PAY=$(./silkaj/silkaj transaction --auth-scrypt -salt="$NUMBER" -password="$SECRET $SALT" --amount="0.05" --output="$MEMRIB" --comment="THIRD_PARTY_MANAGER:$MASTERPUB:G1SMS:BILLET:$VALbillet:$UNIT:$NUMBER" -y)
|
||||||
else
|
else
|
||||||
sms_ERROR "$PHONE" "Un problème est survenu. Contactez $ADMINPSEUDO au $ADMINPHONE"
|
sms_ERROR "$PHONE" "Un problème est survenu. Contactez $ADMINPSEUDO au $ADMINPHONE"
|
||||||
# Copy & Send produced files
|
|
||||||
zip /tmp/$PHONE_Bills_$bpath.zip ./billets/MEMBERS/$MEMBER/*.*
|
|
||||||
mpack -s "[G1sms+]_G1Billets ($bpath) Erreur... création G1Billets..." -d /tmp/message_body.txt /tmp/$PHONE_Bills_$bpath.zip $MAIL && mv /tmp/$PHONE_Bills_$bpath.zip ./billets/MEMBERS/$MEMBER/ && log "__SUB:sms_BILLET.sh: ALERT sent....."
|
|
||||||
|
|
||||||
log "__SUB:sms_BILLET.sh: ERROR SILKAJ $(cat ./silkaj/src/constants.py)"
|
|
||||||
exit
|
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
# + G1SMS Commission
|
# + G1SMS Commission
|
||||||
sleep 2
|
sleep 2
|
||||||
COM=$(./silkaj/silkaj transaction --auth-scrypt -salt="$PHONE" -password="$PIN" --amount="$BILLCOM" --output="$NODE_G1PUBKEY" --comment="[G1sms+] Achat G1Billets" -y)
|
COM=$(./silkaj/silkaj transaction --auth-scrypt -salt="$PHONE" -password="$PIN" --amount="$BILLCOM" --output="$MASTERPUB" --comment="[G1SMS] G1billet Commission" -y)
|
||||||
|
|
||||||
# POUR IMPRIMER LES BILLETS! Brancher votre imprimante, configurer cups, activer code lp ;)
|
# IMPRIMER LES BILLETS! Brancher votre imprimante et configurer cups avant ;)
|
||||||
num=$(date +%Y%m%d)
|
num=$(date +%Y%m%d)
|
||||||
log "__SUB:sms_BILLET.sh: PRINT $num $MEMBER"
|
log "PRINT $num $MEMBER"
|
||||||
montage ./billets/MEMBERS/$MEMBER/*.jpg -tile 2x3 -geometry 964x459 /tmp/$PHONE_Bills_$bpath.pdf && rm -f ./billets/MEMBERS/$MEMBER/*.jpg && log "__SUB:sms_BILLET.sh: PDF made /tmp/$PHONE_Bills_$bpath.pdf"
|
montage ./billets/MEMBERS/$MEMBER/*.jpg -tile 2x3 -geometry 964x459 /tmp/$PHONE_Bills_$bpath.pdf
|
||||||
cd /tmp && zip $PHONE_Bills_$bpath.zip $PHONE_Bills_$bpath.pdf && log "__SUB:sms_BILLET.sh: Zip DONE :: /tmp$PHONE_Bills_$bpath.zip !!" && cd -
|
# lp /tmp/$PHONE_Bills_$bpath.pdf
|
||||||
# rm -f /tmp/$PHONE_Bills_$bpath.pdf
|
cp /tmp/$PHONE_Bills_$bpath.pdf ./billets/MEMBERS/$MEMBER/
|
||||||
|
zip ./_Bill_$MEMBER_$num.zip ./billets/MEMBERS/$MEMBER/*.jpg && rm -f ./billets/MEMBERS/$MEMBER/*.jpg
|
||||||
|
|
||||||
# SEND EMAIL ZIP attached
|
# SEND EMAIL
|
||||||
echo "Commande #$NANODATE/$bpath
|
# Détruit ce mail et le pdf après impression et fabrication des billets au code caché.
|
||||||
>> Planche de 6 G1Billets : $VALbillet LOVE <<
|
# Créer la monnaie implique une grande responsabilité!
|
||||||
Envoyez-nous vos remarques...
|
|
||||||
|
|
||||||
https://g1sms.fr" > /tmp/message_body.txt
|
|
||||||
|
|
||||||
mpack -s "[G1sms+]_G1Billets ($bpath) A IMPRIMER et détruire cet email..." -d /tmp/message_body.txt /tmp/$PHONE_Bills_$bpath.zip $MAIL && log "__SUB:sms_BILLET.sh: EMAIL sent....."
|
|
||||||
|
|
||||||
log "__SUB:sms_BILLET.sh: G1Billets $PHONE_Bills_$bpath.pdf envoyé par email à $MEMBER : $MAIL "
|
|
||||||
mess="[G1SMS]
|
mess="[G1SMS]
|
||||||
$NBbillets G1Billets de $VALbillet $UNIT ($TRANSAC G1) créé(s).
|
$NBbillets billet(s) de $VALbillet $UNIT ($TRANSAC G1) créé(s).
|
||||||
Envoyés vers $MAIL, vérifiez vos SPAM...
|
Contactez $ADMINPSEUDO au $ADMINPHONE pour les recevoir...
|
||||||
Support: $ADMINPSEUDO ($ADMINPHONE)
|
http://g1sms.fr/g1sms/aide"
|
||||||
"
|
|
||||||
|
|
||||||
sms_SEND "$phone" "$mess"
|
sms_SEND "$phone" "$mess"
|
||||||
# ADMIN ALERT SMS + TODO Add ADMINEMAIL parameter in "install.sh"
|
|
||||||
sms_SEND "$ADMINPHONE" "$MEMBER vient de créer $NBbillets G1Billets de $VALbillet $UNIT ($TRANSAC G1): $MAIL"
|
|
||||||
cat ./email.txt | sed s/EMAIL/frenault@linkeo.com/g | sed s/SUBJECT/Creation_G1Billets/g | sed s/MESSAGE/"$MEMBER ($PHONE) vient de creer $NBbillets G1Billets de $VALbillet $UNIT ($TRANSAC G1) vers $MAIL"/g | ssmtp "frenault@linkeo.com"
|
|
||||||
|
|
||||||
#####################################
|
#####################################
|
||||||
# Amount too High, solde insuffisant
|
# Amount too High, solde insuffisant
|
||||||
|
@ -174,7 +151,7 @@ Insuffisant pour créer $NBbillets billet(s) de $VALbillet $UNIT
|
||||||
https://g1.duniter.fr/api/#/v1/payment/$PUBKEY?amount=$VIR"
|
https://g1.duniter.fr/api/#/v1/payment/$PUBKEY?amount=$VIR"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
log "__SUB:sms_BILLET.sh: END sms_BILLET.sh"
|
log "END sms_BILLET.sh"
|
||||||
log "~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
|
log "~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
|
||||||
|
|
||||||
exit
|
exit
|
||||||
|
|
|
@ -7,8 +7,8 @@ source ./shell/functions.sh
|
||||||
log "X sms_BILLETCHK.sh $0"
|
log "X sms_BILLETCHK.sh $0"
|
||||||
|
|
||||||
PHONE="$1"
|
PHONE="$1"
|
||||||
CODE="$2 $3"
|
CODE="$2 $3 $4 $5"
|
||||||
SEC="$4 $5 $6 $7"
|
SEC="$6 $7 $8"
|
||||||
|
|
||||||
# Construct billet path
|
# Construct billet path
|
||||||
bpath=$(echo "$CODE" | sed 's/ /_/g')
|
bpath=$(echo "$CODE" | sed 's/ /_/g')
|
||||||
|
@ -21,7 +21,7 @@ then
|
||||||
UNIT=$(cat "./billets/$bpath/note.unit")
|
UNIT=$(cat "./billets/$bpath/note.unit")
|
||||||
BILLETPUBKEY=$(cat "./billets/$bpath/note.pubkey")
|
BILLETPUBKEY=$(cat "./billets/$bpath/note.pubkey")
|
||||||
|
|
||||||
AMOUNTG1=$(./silkaj/silkaj -p g1.presles.fr:443 amount "$BILLETPUBKEY")
|
AMOUNTG1=$(./silkaj/silkaj amount "$BILLETPUBKEY")
|
||||||
log "Billet: $AMOUNTG1 ($VALbillet $UNIT): $BILLETPUBKEY"
|
log "Billet: $AMOUNTG1 ($VALbillet $UNIT): $BILLETPUBKEY"
|
||||||
|
|
||||||
# NO GOOD SECRET
|
# NO GOOD SECRET
|
||||||
|
@ -41,22 +41,24 @@ https://www.g1sms.fr/contact"
|
||||||
# Account creation
|
# Account creation
|
||||||
sms_INIT_ACCOUNT "$PHONE"
|
sms_INIT_ACCOUNT "$PHONE"
|
||||||
fi
|
fi
|
||||||
log "./silkaj/silkaj transaction -p g1.presles.fr:443 --auth-scrypt -salt=\"$CODE\" -password=\"$SEC$SALT\" --amount=\"$AMOUNTG1\" --output=\"$PUBKEY\" --comment=\"THIRD_PARTY_MANAGER:$NODE_G1PUBKEY:G1SMS:ENCAISSEMENT:$CODE\" -y"
|
log "./silkaj/silkaj transaction --auth-scrypt -salt=\"$CODE\" -password=\"$SEC $SALT\" --amount=\"$AMOUNTG1\" --output=\"$PUBKEY\" --comment=\"THIRD_PARTY_MANAGER:$MASTERPUB:G1SMS:ENCAISSEMENT:$CODE\" -y"
|
||||||
PAY=$(./silkaj/silkaj transaction -p g1.presles.fr:443 --auth-scrypt -salt="$CODE" -password="$SEC$SALT" --amount="$AMOUNTG1" --output="$PUBKEY" --comment="THIRD_PARTY_MANAGER:$NODE_G1PUBKEY:ENCAISSEMENT:$CODE" -y)
|
PAY=$(./silkaj/silkaj transaction --auth-scrypt -salt="$CODE" -password="$SEC $SALT" --amount="$AMOUNTG1" --output="$PUBKEY" --comment="THIRD_PARTY_MANAGER:$MASTERPUB:ENCAISSEMENT:$CODE" -y)
|
||||||
|
|
||||||
if [[ "$(echo $PAY | cut -d '|' -f 1)" != "KO" ]]; then
|
if [[ "$(echo $PAY | cut -d '|' -f 1)" != "KO" ]]; then
|
||||||
# DESTROY BILLET
|
# DESTROY BILLET
|
||||||
rm -Rf ./billets/$bpath
|
rm -f ./billets/$bpath/note.*
|
||||||
|
rmdir ./billets/$bpath
|
||||||
# DESTROY PUBLIC CACHE in /tmp
|
# DESTROY PUBLIC CACHE in /tmp
|
||||||
if [ -d "/tmp/billets_valides/$bpath" ]; then
|
if [ -d "/tmp/billets_valides/$bpath" ]; then
|
||||||
rm -Rf /tmp/billets_valides/$bpath
|
rm -f /tmp/billets_valides/$bpath/*
|
||||||
|
rmdir /tmp/billets_valides/$bpath
|
||||||
fi
|
fi
|
||||||
|
|
||||||
SOLDE=$(./silkaj/silkaj amount "$PUBKEY")
|
SOLDE=$(./silkaj/silkaj amount "$PUBKEY")
|
||||||
|
|
||||||
mess="[G1SMS]
|
mess="[G1SMS]
|
||||||
ENCAISSEMENT de $VALbillet $UNIT ($AMOUNTG1 G1)
|
ENCAISSEMENT de $VALbillet $UNIT ($AMOUNTG1 G1)
|
||||||
dans portefeuille $UIDNA ($PHONE)
|
ds le porte-monnaie $PHONE ($PUBKEY)
|
||||||
OK!
|
OK!
|
||||||
Solde: $SOLDE G1"
|
Solde: $SOLDE G1"
|
||||||
sms_SEND "$PHONE" "$mess"
|
sms_SEND "$PHONE" "$mess"
|
||||||
|
@ -64,7 +66,7 @@ Solde: $SOLDE G1"
|
||||||
log "=> $PUBKEY"
|
log "=> $PUBKEY"
|
||||||
log_history $PHONE "BILLET_CHK, $AMOUNTG1, $bpath, $PUBKEY"
|
log_history $PHONE "BILLET_CHK, $AMOUNTG1, $bpath, $PUBKEY"
|
||||||
else
|
else
|
||||||
sms_ERROR "$PHONE" "Erreur! Transaction Impossible! Valeur du G1Billet $AMOUNTG1 G1. Contactez $ADMINPSEUDO : $ADMINPHONE"
|
sms_ERROR "$PHONE" "Erreur! Transaction Impossible... Réessayez plus tard ou contactez $ADMINPSEUDO : $ADMINPHONE"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
|
|
|
@ -17,12 +17,11 @@ NUMERO="$1"
|
||||||
SECRET="$2"
|
SECRET="$2"
|
||||||
MONTANT="$3"
|
MONTANT="$3"
|
||||||
UNIT="$4"
|
UNIT="$4"
|
||||||
JUNE="$5"
|
DUFACTOR="$5"
|
||||||
NOTERIB="$6"
|
NOTERIB="$6"
|
||||||
MEMBER="$7"
|
MEMBER="$7"
|
||||||
TRANSAC="$8"
|
TRANSAC="$8"
|
||||||
PHONE="$9"
|
log "X ./shell/sms_BILLET_MAKE.sh \"$1\" \"$2\" \"$3\" \"$4\" \"$5\" \"$6\" \"$7\" \"$8\""
|
||||||
log "X sudo ./shell/sms_BILLET_MAKE.sh \"$1\" \"$2\" \"$3\" \"$4\" \"$5\" \"$6\" \"$7\" \"$8\""
|
|
||||||
|
|
||||||
if [[ "$NOTERIB" == "" || "$MEMBER" == "" ]]
|
if [[ "$NOTERIB" == "" || "$MEMBER" == "" ]]
|
||||||
then
|
then
|
||||||
|
@ -44,24 +43,17 @@ fi
|
||||||
valid="0${valid:0:2}"
|
valid="0${valid:0:2}"
|
||||||
# ADD VALIDITY to convert: -pointsize 20 -draw 'text 380,410 "'"A encaisser avant le 01/$valid/$year"'"' \
|
# ADD VALIDITY to convert: -pointsize 20 -draw 'text 380,410 "'"A encaisser avant le 01/$valid/$year"'"' \
|
||||||
|
|
||||||
# ADD Avatar on G1 Logo SouthEast
|
# Add G1sms logo (250px)
|
||||||
if [[ $(file "./wallets/$PHONE/$PHONE.avatar.png" | grep 'PNG') ]]; then
|
composite -compose Over -gravity SouthWest -geometry +50+50 "./shell/G1sms.png" "./shell/Oeuro.jpg" "/tmp/$NUMERO.jpg"
|
||||||
composite -compose Over -gravity East -geometry +15+0 -dissolve 33% "./wallets/$PHONE/$PHONE.avatar.png" "./shell/Oeuro.jpg" "/tmp/$NUMERO.jpg"
|
|
||||||
composite -compose Over -gravity West -geometry +15+0 -dissolve 33% "./wallets/$PHONE/$PHONE.avatar.png" "/tmp/$NUMERO.jpg" "/tmp/$NUMERO.jpg"
|
|
||||||
else
|
|
||||||
composite -compose Over -gravity East -geometry +15+0 -dissolve 33% "./shell/G1Anar.png" "./shell/Oeuro.jpg" "/tmp/$NUMERO.jpg"
|
|
||||||
composite -compose Over -gravity West -geometry +15+0 -dissolve 33% "./shell/G1Anar.png" "/tmp/$NUMERO.jpg" "/tmp/$NUMERO.jpg"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Add G1Billet_LOVE.png logo (250px)
|
|
||||||
composite -compose Over -gravity SouthWest -geometry +50+50 -dissolve 70% "./shell/G1Billet_LOVE.png" "/tmp/$NUMERO.jpg" "/tmp/$NUMERO.jpg"
|
|
||||||
|
|
||||||
# Prepare BILLET qrcode verification URL
|
# Prepare BILLET qrcode verification URL
|
||||||
qrencode -s 3 -o "/tmp/$NUMERO_NOTERIB.png" "$NOTERIB"
|
#qrencode "$NOTERIB" -o "/tmp/$NUMERO_NOTERIB.png"
|
||||||
|
REQ=$(echo $NUMERO | sed 's/ /_/g')
|
||||||
|
qrencode "https://www.g1sms.fr/$ADMINPSEUDO/check.php?code=$REQ" -o "/tmp/$NUMERO_NOTERIB.png"
|
||||||
|
|
||||||
# BILL PUBKEY means Someone can Add amount to it !!!
|
# BILL PUBKEY => Someone can Add amount to it !!!
|
||||||
# Add verification QRCode
|
# Add verification QRCode
|
||||||
composite -compose Over -gravity NorthEast -geometry +50+25 "/tmp/$NUMERO_NOTERIB.png" "/tmp/$NUMERO.jpg" "/tmp/$NUMERO.jpg"
|
composite -compose Over -gravity NorthEast -geometry +40+40 "/tmp/$NUMERO_NOTERIB.png" "/tmp/$NUMERO.jpg" "/tmp/$NUMERO.jpg"
|
||||||
|
|
||||||
# Add June logo
|
# Add June logo
|
||||||
case "$MONTANT" in
|
case "$MONTANT" in
|
||||||
|
@ -90,7 +82,7 @@ case "$MONTANT" in
|
||||||
cp "./shell/g1.png" "/tmp/g1.png"
|
cp "./shell/g1.png" "/tmp/g1.png"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
composite -compose Over -gravity SouthEast -geometry +20+20 -dissolve 90% "/tmp/g1.png" "/tmp/$NUMERO.jpg" "/tmp/$NUMERO.jpg"
|
composite -compose Over -gravity SouthEast -geometry +20+20 "/tmp/g1.png" "/tmp/$NUMERO.jpg" "/tmp/$NUMERO.jpg"
|
||||||
|
|
||||||
DUPART=$(bc -l <<< "scale=2; $MONTANT / 100")
|
DUPART=$(bc -l <<< "scale=2; $MONTANT / 100")
|
||||||
# ADD 0 to <1 DUPART
|
# ADD 0 to <1 DUPART
|
||||||
|
@ -98,17 +90,16 @@ testdu=$( echo "${DUPART} < 1" | bc -l )
|
||||||
if [[ "$testdu" -eq "1" ]]; then
|
if [[ "$testdu" -eq "1" ]]; then
|
||||||
DUPART="0${DUPART}"
|
DUPART="0${DUPART}"
|
||||||
fi
|
fi
|
||||||
|
#SECRET=$(echo $SECRET | sed 's/ /\n/g')
|
||||||
SIMPLEPHONE=$(echo $MASTERPHONE | sed 's/\+33/0/g')
|
|
||||||
|
|
||||||
convert -font 'Liberation-Sans' \
|
convert -font 'Liberation-Sans' \
|
||||||
-pointsize 120 -fill black -draw 'text 200,220 "'"$DUPART DU"'"' \
|
-pointsize 120 -fill black -draw 'text 200,220 "'"$DUPART DU"'"' \
|
||||||
-pointsize 45 -draw 'text 550,270 "'"$MONTANT $UNIT"'"' \
|
-pointsize 45 -draw 'text 550,270 "'"$MONTANT $UNIT"'"' \
|
||||||
-pointsize 35 -draw 'text 50,60 "'"https://g1sms.fr _ G1Billet _ $JUNE G1"'"' \
|
-pointsize 35 -draw 'text 50,60 "'"[G1sms] 06 66 80 57 20"'"' \
|
||||||
-pointsize 30 -draw 'text 60,100 "'"Identifiant: $NUMERO"'"' \
|
-pointsize 30 -draw 'text 60,100 "'"CHK $NUMERO"'"' \
|
||||||
-pointsize 22 -fill black -draw 'text 380,340 "'"Code Secret: $SECRET"'"' \
|
-pointsize 22 -fill black -draw 'text 520,340 "'"$SECRET"'"' \
|
||||||
-pointsize 22 -fill black -draw 'text 260,408 "'"Porte Monnaie Libre!! A utiliser avant le 01/$valid/$year"'"' \
|
-pointsize 22 -fill black -draw 'text 400,410 "'"Encaisser avant le 01/$valid/$year"'"' \
|
||||||
-pointsize 20 -draw 'text 15,442 "'"Utilisation: CHK $NUMERO (+ code secret) par SMS au $SIMPLEPHONE ou https://cesium.app"'"' \
|
-pointsize 20 -draw 'text 50,444 "'"Envoyer par sms, CHK $NUMERO + les mots découverts sous la zone à gratter"'"' \
|
||||||
"/tmp/$NUMERO.jpg" "/tmp/BILL.$year.$valid.$NUMERO.$MONTANT.$UNIT.jpg"
|
"/tmp/$NUMERO.jpg" "/tmp/BILL.$year.$valid.$NUMERO.$MONTANT.$UNIT.jpg"
|
||||||
|
|
||||||
# Payable par SMS en envoyant les codes grattant la case comportant le SECRET
|
# Payable par SMS en envoyant les codes grattant la case comportant le SECRET
|
||||||
|
|
|
@ -47,11 +47,10 @@ log "Solde = $AMOUNTG1 ($UNIT)"
|
||||||
if [ "$2" != "NOSMS" ]; then
|
if [ "$2" != "NOSMS" ]; then
|
||||||
if [[ "$AMOUNT" != "" ]]; then
|
if [[ "$AMOUNT" != "" ]]; then
|
||||||
mess="[G1sms+]
|
mess="[G1sms+]
|
||||||
ID: $UIDNA
|
ID: $UIDNA <=> $MEMBER
|
||||||
$AMOUNT $UNIT ($AMOUNTG1 G1)
|
$AMOUNT $UNIT ($AMOUNTG1 G1)
|
||||||
=> $MEMBER
|
|
||||||
$MEMRIB
|
Recharger avec https://cesium.app"
|
||||||
https://cesium.app"
|
|
||||||
# Send response SMS
|
# Send response SMS
|
||||||
sms_SEND "$PHONE" "$mess"
|
sms_SEND "$PHONE" "$mess"
|
||||||
sms_SEND "$PHONE" "$PUBKEY"
|
sms_SEND "$PHONE" "$PUBKEY"
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
################################################################################
|
################################################################################
|
||||||
source ./shell/init.sh
|
source ./shell/init.sh
|
||||||
source ./shell/functions.sh
|
source ./shell/functions.sh
|
||||||
log "${c_yellow}__SUB:sms_DESTROY.sh: START ($1=phone, $2=uid)$c_"
|
log "__SUB:sms_DESTROY.sh: START ($1=phone, $2=uid)"
|
||||||
|
|
||||||
PHONE="$1"
|
PHONE="$1"
|
||||||
MEMBERUID="$2"
|
MEMBERUID="$2"
|
||||||
|
@ -22,7 +22,7 @@ if [[ -f "./wallets/$PHONE/VIREMENTS" ]]; then
|
||||||
sms_ERROR "$PHONE" "Votre portefeuille comporte des virements non réglés... FERMETURE IMPOSSIBLE!"
|
sms_ERROR "$PHONE" "Votre portefeuille comporte des virements non réglés... FERMETURE IMPOSSIBLE!"
|
||||||
exit
|
exit
|
||||||
else
|
else
|
||||||
log "__SUB:sms_DESTROY.sh: VIREMENT $next ${c_green}OK$c_"
|
log "__SUB:sms_DESTROY.sh: VIREMENT $next OK "
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
@ -31,19 +31,35 @@ fi
|
||||||
sms_INIT_ACCOUNT "$PHONE"
|
sms_INIT_ACCOUNT "$PHONE"
|
||||||
if [[ "$MEMBERUID" == "DON" || "$MEMBERUID" == "" || "$MEMBERUID" == "$MEMBER" ]]; then
|
if [[ "$MEMBERUID" == "DON" || "$MEMBERUID" == "" || "$MEMBERUID" == "$MEMBER" ]]; then
|
||||||
# OK THAT GUYS KNOWS something (TODO Secure better with double authentification, with email or second phone number...)
|
# OK THAT GUYS KNOWS something (TODO Secure better with double authentification, with email or second phone number...)
|
||||||
# IF no Dest PubKey (no member) or DON, then NODE_G1PUBKEY is collecting LOVE money.
|
# IF no Dest PubKey (no member) or DON, then MASTERPUB is collecting LOVE money.
|
||||||
if [[ $MEMRIB == "" || "$MEMBERUID" == "DON" ]]; then MEMBER=$ADMINPSEUDO; MEMRIB=$NODE_G1PUBKEY; fi
|
if [[ $MEMRIB == "" || "$MEMBERUID" == "DON" ]]; then MEMBER=$ADMINPSEUDO; MEMRIB=$MASTERPUB; fi
|
||||||
|
|
||||||
AMOUNTG1=$(./silkaj/silkaj amount "$PUBKEY")
|
AMOUNTG1=$(./silkaj/silkaj amount "$PUBKEY")
|
||||||
GETLIMIT=$(bc <<< "$AMOUNTG1 - $LIMIT")
|
GETLIMIT=$(bc <<< "$AMOUNTG1 - $LIMIT")
|
||||||
PAY=$(./silkaj/silkaj transaction --auth-scrypt -salt="$PHONE" -password="$PIN" --amount="$GETLIMIT" --output="$MEMRIB" --comment="[G1sms+] Wallet DESTROY $MEMBER $MEMBERUID" -y)
|
PAY=$(./silkaj/silkaj transaction --auth-scrypt -salt="$PHONE" -password="$PIN" --amount="$GETLIMIT" --output="$MEMRIB" --comment="[G1sms+] Wallet DESTROY $MEMBER $MEMBERUID" -y)
|
||||||
sleep 5
|
sleep 5
|
||||||
back=$(./silkaj/silkaj transaction --auth-scrypt -salt="$PHONE" -password="$PIN" --amount="$LIMIT" --output="$NODEPUB" --comment="[G1sms+] Wallet DESTROY Send $LIMIT To NODE" -y)
|
back=$(./silkaj/silkaj transaction --auth-scrypt -salt="$PHONE" -password="$PIN" --amount="$LIMIT" --output="$NODEG1PUB" --comment="[G1sms+] Wallet DESTROY Send $LIMIT To NODE" -y)
|
||||||
|
|
||||||
if [[ "$(echo $PAY | cut -d '|' -f 1)" != "KO" && "$PAY" != "" && "$(echo $back | cut -d '|' -f 1)" != "KO" ]]; then
|
if [[ "$(echo $PAY | cut -d '|' -f 1)" != "KO" && "$PAY" != "" && "$(echo $back | cut -d '|' -f 1)" != "KO" ]]; then
|
||||||
# DESTROY FILESYSTEM AND G1sms WALLET SWARM REFERENCE
|
# DESTROY FILESYSTEM AND G1sms WALLET SWARM REFERENCE
|
||||||
if [[ "$PHONE" != "" ]]; then
|
if [[ "$PHONE" != "" ]]; then
|
||||||
# SEND SMS BEFORE DELETE FOLDER
|
rm -Rf ./wallets/$PHONE;
|
||||||
|
rm -Rf ./wallets_swarm/$PHONE;
|
||||||
|
cents=$(echo $(bc -l <<< "scale=0; $GETLIMIT * 100") | cut -d '.' -f 1)
|
||||||
|
move_g1cents "$PHONE" "$MEMRIB" "$cents"
|
||||||
|
cents=$(echo $(bc -l <<< "scale=0; $LIMIT * 100") | cut -d '.' -f 1)
|
||||||
|
move_g1cents "$PHONE" "$NODEG1PUB" "$cents"
|
||||||
|
I=$(ipfs_node_wallets_add)
|
||||||
|
log "__SUB:sms_DESTROY.sh: WALLET DESTROYED : $PHONE / $UIDNA / $MEMBER : OK"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
new=$(./shell/checknodes.sh "BAN")
|
||||||
|
sms_ERROR "$PHONE" "Problème de payement avec silkaj (changement de serveur $new): $PAY";
|
||||||
|
log "__SUB:sms_DESTROY.sh: END ~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
mess="[G1sms+] $PAY
|
mess="[G1sms+] $PAY
|
||||||
Portefeuille détruit!
|
Portefeuille détruit!
|
||||||
Viré vers $MEMBER
|
Viré vers $MEMBER
|
||||||
|
@ -52,27 +68,8 @@ $MEMRIB
|
||||||
Merci, à bientôt.
|
Merci, à bientôt.
|
||||||
$ADMINPSEUDO @ $NODEUIDNA
|
$ADMINPSEUDO @ $NODEUIDNA
|
||||||
$back"
|
$back"
|
||||||
|
|
||||||
sms_SEND "$PHONE" "$mess"
|
sms_SEND "$PHONE" "$mess"
|
||||||
|
|
||||||
rm -Rf ./wallets/$PHONE;
|
log "__SUB:sms_DESTROY.sh: END ~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
|
||||||
rm -Rf ./wallets_swarm/$PHONE;
|
|
||||||
cents=$(echo $(bc -l <<< "scale=0; $GETLIMIT * 100") | cut -d '.' -f 1)
|
|
||||||
move_g1cents "$PHONE" "$MEMRIB" "$cents"
|
|
||||||
cents=$(echo $(bc -l <<< "scale=0; $LIMIT * 100") | cut -d '.' -f 1)
|
|
||||||
move_g1cents "$PHONE" "$NODEPUB" "$cents"
|
|
||||||
I=$(ipfs_node_wallets_add)
|
|
||||||
log "__SUB:sms_DESTROY.sh: WALLET DESTROYED : $PHONE / $UIDNA / $MEMBER : ${c_green}OK$c_"
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
new=$(./shell/checknodes.sh "BAN")
|
|
||||||
sms_ERROR "$PHONE" "Problème de payement avec silkaj (changement de serveur $new): $PAY";
|
|
||||||
log "${c_red}__SUB:sms_DESTROY.sh: END WITH ERRORS ~~~~~~~~~~~~~~~~~~~~~~~~~~~~$c_"
|
|
||||||
exit
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Remove contact from database
|
|
||||||
rm_contact $PHONE $MEMBERUID && log "${c_green}Contact has been deleted from database$c_" || log "${c_red}Contact can't be deleted database$c_"
|
|
||||||
|
|
||||||
log "${c_yellow}__SUB:sms_DESTROY.sh: END ~~~~~~~~~~~~~~~~~~~~~~~~~~~~$c_"
|
|
||||||
exit
|
exit
|
||||||
|
|
|
@ -4,13 +4,8 @@
|
||||||
# Version: 0.1
|
# Version: 0.1
|
||||||
# License: AGPL-3.0 (https://choosealicense.com/licenses/agpl-3.0/)
|
# License: AGPL-3.0 (https://choosealicense.com/licenses/agpl-3.0/)
|
||||||
################################################################################
|
################################################################################
|
||||||
# sudo apt install ssmtp mpack
|
|
||||||
# Configure in /etc/ssmtp
|
|
||||||
# Send email with file attachement: mpack -s "Logo G1Tag" /home/pi/G1sms+/G1Tag.png dest@email.ext
|
|
||||||
|
|
||||||
source ./shell/init.sh
|
source ./shell/init.sh
|
||||||
source ./shell/functions.sh
|
source ./shell/functions.sh
|
||||||
|
|
||||||
log "__SUB:sms_EMAIL.sh.sh: START ($1=phone, $2=mail)"
|
log "__SUB:sms_EMAIL.sh.sh: START ($1=phone, $2=mail)"
|
||||||
|
|
||||||
phone="$1"
|
phone="$1"
|
||||||
|
@ -28,8 +23,6 @@ fi
|
||||||
|
|
||||||
if [[ "$mail" != "" ]]; then
|
if [[ "$mail" != "" ]]; then
|
||||||
echo "$mail" > "$MAILFILE"
|
echo "$mail" > "$MAILFILE"
|
||||||
./shell/natools.py encrypt -p $NODE_G1PUBKEY -i "$MAILFILE" -o "$MAILFILE.node.crypt"
|
|
||||||
echo "" > "$MAILFILE"
|
|
||||||
log "__SUB:sms_EMAIL.sh.sh: EMAIL $MEMBER ($PHONE) NOUVEAU: $mail... Publishing to IPFS"
|
log "__SUB:sms_EMAIL.sh.sh: EMAIL $MEMBER ($PHONE) NOUVEAU: $mail... Publishing to IPFS"
|
||||||
ipfs_node_wallets_add
|
ipfs_node_wallets_add
|
||||||
else
|
else
|
||||||
|
@ -37,18 +30,16 @@ else
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# SEND EMAIL WITH ssmtp
|
# SEND EMAIL WITH ssmtp
|
||||||
SUBJECT="[G1sms+] $MEMBER, Message de votre portefeuille monnaie libre $UIDNA ($PHONE)"
|
SUBJECT="[G1sms+] $MEMBER, message de votre portefeuille monnaie libre $UIDNA ($PHONE)"
|
||||||
MESSAGE="Bonjour $MEMBER\n\nVotre porte-monnaie G1sms $UIDNA ($PHONE) a choisi votre email comme contact.\nPour commander vos G1Billets, envoyez par SMS à $MASTERPHONE :\nBILL 10/20/50/100/200/500/1000\n\n\nA bientot <3\n$ADMINPSEUDO ($ADMINPHONE)"
|
MESSAGE="Bonjour $MEMBER\n\nLe detenteur du porte-monnaie G1sms $UIDNA ($PHONE) a choisi votre email comme contact.\nVous y recevrez nos prochains envois ...\n\n\nA bientot <3\n$ADMINPSEUDO - ($MASTERPHONE) Partenaire G1sms+"
|
||||||
cat ./email.txt | sed s/EMAIL/"${mail}"/g | sed s/SUBJECT/"${SUBJECT}"/g | sed s/MESSAGE/"${MESSAGE}"/g | ssmtp ${mail}
|
cat ./email.txt | sed s/EMAIL/"${mail}"/g | sed s/SUBJECT/"${SUBJECT}"/g | sed s/MESSAGE/"${MESSAGE}"/g | ssmtp ${mail}
|
||||||
mpack -s "[G1sms+] $PHONE, $UIDNA :: Envoyer 'BILL nnn' à $MASTERPHONE pour fabriquer des G1Billets (ci-joint exemple de verso)" ./Dos_G1Billets.odt ${mail}
|
|
||||||
|
|
||||||
log "__SUB:sms_EMAIL.sh.sh: Send welcome EMAIL to $mail via ssmtp"
|
log "__SUB:sms_EMAIL.sh.sh: Send welcome EMAIL to $mail via ssmtp"
|
||||||
log_history $PHONE "EMAIL, $mail"
|
log_history $PHONE "EMAIL, $mail"
|
||||||
|
|
||||||
mess="[G1sms+]
|
mess="[G1sms+]
|
||||||
$MEMBER
|
$MEMBER
|
||||||
Votre email est : $mail
|
Votre email est : $mail
|
||||||
Mettez le à jour, si cela est nécessaire..."
|
Mettez le à jour, quand cela est nécessaire..."
|
||||||
|
|
||||||
sms_SEND "$phone" "$mess"
|
sms_SEND "$phone" "$mess"
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
################################################################################
|
################################################################################
|
||||||
# Author: Fred (support@qo-op.com)
|
# Author: Fred (support@qo-op.com)
|
||||||
# Version: 0.2020
|
# Version: 0.1
|
||||||
# License: AGPL-3.0 (https://choosealicense.com/licenses/agpl-3.0/)
|
# License: AGPL-3.0 (https://choosealicense.com/licenses/agpl-3.0/)
|
||||||
###########################################################################################
|
###########################################################################################
|
||||||
# == G1tag ==
|
# == G1tag ==
|
||||||
|
@ -10,12 +10,9 @@
|
||||||
# BJ: WRITE G1Tag
|
# BJ: WRITE G1Tag
|
||||||
# WRITE ACCESS ONLY for B possessor and NODE G1Tag Creator
|
# WRITE ACCESS ONLY for B possessor and NODE G1Tag Creator
|
||||||
# TODO: MAKE http API for G1Tag accessible through local ipfs gateway !!!!
|
# TODO: MAKE http API for G1Tag accessible through local ipfs gateway !!!!
|
||||||
# https://github.com/typicode/lowdb USE json and ipfs DAG??!
|
|
||||||
#
|
|
||||||
# TAG 250 => Imprime un G1Tag rempli de 250 UNIT
|
# TAG 250 => Imprime un G1Tag rempli de 250 UNIT
|
||||||
# TAG 2 100 => Imprime 100 G1Tag BON de 2 UNIT
|
# TAG 2 100 => Imprime 100 G1Tag BON de 2 UNIT
|
||||||
# PHONE any ./wallets/IDs
|
# PHONE any ./wallets/IDs
|
||||||
# TODO: for multi-channel -> Use HASHLINK + UIDNA + NODE_UIDNA + AMOUNT ...
|
|
||||||
###########################################################################################
|
###########################################################################################
|
||||||
source ./shell/init.sh
|
source ./shell/init.sh
|
||||||
source ./shell/functions.sh
|
source ./shell/functions.sh
|
||||||
|
@ -49,12 +46,19 @@ if [[ $UNKNOWN == "unknown" ]]; then
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
## NEEDED FOR Avatar + GeoPoint
|
||||||
|
if [[ ! $PASSENGER && "$MEMBER" == "" ]]; then
|
||||||
|
sms_ERROR "$PHONE" "Aucun membre associé à votre Portefeuille!? Envoyer N suivi de votre Pseudo membre pour activer la création de G1Tag..."
|
||||||
|
log "__SUB:sms_G1TAG.sh: Aucun membre associé"
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
|
||||||
###########################################################
|
###########################################################
|
||||||
# CALCULATE if wallet have enough for VIR+PERCENT
|
# CALCULATE if wallet have enough for VIR+PERCENT
|
||||||
AMOUNT=$2 # BE CAREFULL AMOUNT was changed by 1st sms_INIT_ACCOUNT!!
|
AMOUNT=$2 # AMOUNT was changed by sms_INIT_ACCOUNT call !!
|
||||||
if [[ "$AMOUNT" == "" ]]; then AMOUNT=0; fi
|
if [[ "$AMOUNT" == "" ]]; then AMOUNT=0; fi
|
||||||
if [[ ! $PASSENGER && "$NUMBER" != "" ]]; then
|
if [[ ! $PASSENGER && "$NUMBER" != "" ]]; then
|
||||||
# MULTI TAG NUMBER ($NUMBER = How many tags to print)
|
# MULTI TAG NUMBER ($NUMBER = How many tags to print (with different R but same B)
|
||||||
AMOUNT=$(bc -l <<< "$AMOUNT * $NUMBER")
|
AMOUNT=$(bc -l <<< "$AMOUNT * $NUMBER")
|
||||||
else
|
else
|
||||||
NUMBER=1
|
NUMBER=1
|
||||||
|
@ -67,7 +71,7 @@ VIR=${accounting[1]}
|
||||||
PERCENT=${accounting[2]}
|
PERCENT=${accounting[2]}
|
||||||
CHARGE=${accounting[3]}
|
CHARGE=${accounting[3]}
|
||||||
if [[ $testmin -eq 0 ]]; then
|
if [[ $testmin -eq 0 ]]; then
|
||||||
sms_SEND "$PHONE" "Le solde de votre Porte-monnaie est insuffisant. Minimum requis = ${CHARGE} + ${PERCENT} (+ ${LIMIT}) G1! Rechargez avec https://cesium.app"
|
sms_SEND "$PHONE" "Le solde de votre Porte-monnaie est insuffisant. Minimum requis = ${CHARGE} G1! Rechargez avec https://cesium.app "
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -76,7 +80,7 @@ if [[ ! $PASSENGER && ! $G1DAB ]]; then
|
||||||
if [[ -f ./wallets/$PHONE/ipfsid.G1TAGNODE ]]; then
|
if [[ -f ./wallets/$PHONE/ipfsid.G1TAGNODE ]]; then
|
||||||
DABnode=$(cat ./wallets/$PHONE/ipfsid.G1TAGNODE)
|
DABnode=$(cat ./wallets/$PHONE/ipfsid.G1TAGNODE)
|
||||||
if [[ "$DABnode" == "$IPFSNODEID" ]]; then
|
if [[ "$DABnode" == "$IPFSNODEID" ]]; then
|
||||||
sms_ERROR "$PHONE" "IMPRIMANTE G1Tag sur $DABnode non détectée!! Choisissez un autre G1Dab..."
|
sms_ERROR "$PHONE" "IMPRIMANTE G1Tag non détectée!! Choisissez un autre NODE G1Dab... $spot"
|
||||||
log "__SUB:sms_G1TAG.sh: IMPRIMANTE G1Tag non détectée!!"
|
log "__SUB:sms_G1TAG.sh: IMPRIMANTE G1Tag non détectée!!"
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
|
@ -94,72 +98,64 @@ fi
|
||||||
###########################################
|
###########################################
|
||||||
# PAY VIR + PERCENT G1
|
# PAY VIR + PERCENT G1
|
||||||
ML=$(bc -l <<< "scale=2; $VIR + $PERCENT")
|
ML=$(bc -l <<< "scale=2; $VIR + $PERCENT")
|
||||||
PAY=$(./shell/timeout.sh -t 29 ./silkaj/silkaj transaction --auth-scrypt -salt="$PHONE" -password="$PIN" --amount="$ML" --output="$NODE_G1PUBKEY" --comment="[G1sms+] ACHAT $3 G1Tag(s) - $2 $UNIT" -y)
|
PAY=$(./shell/timeout.sh -t 20 ./silkaj/silkaj transaction --auth-scrypt -salt="$PHONE" -password="$PIN" --amount="$ML" --output="$MASTERPUB" --comment="[G1sms+] ACHAT $3 G1Tag(s) - $2 $UNIT" -y)
|
||||||
if [[ "$PAY" == "" || "$(echo $PAY | cut -d '|' -f 1)" == "KO" ]]; then
|
if [[ "$PAY" == "" || "$(echo $PAY | cut -d '|' -f 1)" == "KO" ]]; then
|
||||||
# new=$(./shell/checknodes.sh "BAN")
|
new=$(./shell/checknodes.sh "BAN")
|
||||||
sms_ERROR "$PHONE" "Il est survenu un problème lors de votre virement: $PAY / Silkaj: $new";
|
sms_ERROR "$PHONE" "Il est survenu un problème lors de votre virement: $PAY / Silkaj: $new";
|
||||||
exit
|
exit
|
||||||
else
|
else
|
||||||
cents=$(echo $(bc -l <<< "scale=0; $ML * 100") | cut -d '.' -f 1)
|
cents=$(echo $(bc -l <<< "scale=0; $ML * 100") | cut -d '.' -f 1)
|
||||||
move_g1cents "$PHONE" "$NODE_G1PUBKEY" "$cents"
|
move_g1cents "$PHONE" "$MASTERPUB" "$cents"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#############################################
|
#############################################
|
||||||
log "__SUB:sms_G1TAG.sh: CREATE $NUMBER x $2 $UNIT G1Tag(s) for $MEMBER ($PHONE) : PAYEMENT $ML G1 to $NODE_G1PUBKEY: $PAY"
|
log "__SUB:sms_G1TAG.sh: CREATE $NUMBER x $2 $UNIT G1Tag(s) for $MEMBER ($PHONE) : PAYEMENT $ML G1 to $MASTERPUB: $PAY"
|
||||||
c=0
|
c=0
|
||||||
while [[ $c -lt $NUMBER ]]; do
|
while [[ $c -lt $NUMBER ]]; do
|
||||||
((c++))
|
((c++))
|
||||||
# Nom du G1Tag imprimé du le QRCode RJ
|
# Create Unique SWARM G1tag!
|
||||||
AA=$(./shell/diceware.sh 6 | xargs); # Nom = Diceware de 6 mots
|
AA=$(./shell/diceware.sh 6 | xargs); RR=$(echo ${AA} | sed s/\ //g );
|
||||||
RR=$(echo ${AA} | sed s/\ //g ); # Nom concaténé
|
while [ -d "./wallets_swarm/TAG/${RR}" ]; do
|
||||||
PR=$(echo ${AA} | cut -d ' ' -f 1 ); # Prénom du G1Tag
|
AA=$(./shell/diceware.sh 6 | xargs);
|
||||||
# Create Unique G1tag in all SWARM!
|
RR=$(echo ${AA} | sed s/\ //g );
|
||||||
while [[ $(ls ./wallets_swarm/.Qm*/TAG/${RR}) ]]; do
|
|
||||||
AA=$(./shell/diceware.sh 6 | xargs); RR=$(echo ${AA} | sed s/\ //g ); PR=$(echo ${AA} | cut -d ' ' -f 1 );
|
|
||||||
done
|
done
|
||||||
# Clef de chiffrage PGP imprimée sur le QRCode BJ
|
|
||||||
BB=$(date +%N | sha256sum | base64 | head -c 32) #YjY4MDc3OTVjNmUxN2JhYWVjYmU3MDcy
|
BB=$(date +%N | sha256sum | base64 | head -c 32) #YjY4MDc3OTVjNmUxN2JhYWVjYmU3MDcy
|
||||||
# BB=$(openssl rand -base64 32 | base64) #Yk8yMnVtdzZmendJbHNoK2Q0b0liakRpNHNJUk9UQW5Dd042cFdDODlJTT0K
|
# BB=$(openssl rand -base64 32 | base64) #Yk8yMnVtdzZmendJbHNoK2Q0b0liakRpNHNJUk9UQW5Dd042cFdDODlJTT0K
|
||||||
|
|
||||||
# G1Tag init : Nom et usage des fichiers du G1Tag
|
# G1Tag init
|
||||||
# TODO CHECK _nanodate to detect bad nodes/tx behaviour... and banish them)
|
# TODO CHECK _nanodate to detect bad nodes/tx behaviour... and banish them)
|
||||||
TAGDATE="./TAG/${RR}/TAG_nanodate" # Nanodate notification (ntpdate in init.sh for NODE sync in case of
|
TAGDATE="./TAG/${RR}/TAG_nanodate" # Nanodate notification (ntpdate in init.sh for NODE sync in case of
|
||||||
TAGNODEID="./TAG/${RR}/TAG_nodeid" # G1sms+ NODE IPFS ID managing that G1Tag
|
TAGNID="./TAG/${RR}/TAG_nodeid" # G1sms+ NODE IPFS ID managing that G1Tag
|
||||||
TAGID="./TAG/${RR}/TAG_id" #Nom du TAG
|
TAGID="./TAG/${RR}/TAG_id" #Nom du TAG
|
||||||
|
TAGN="./TAG/${RR}/TAG_n" # Tag modification number (0 first)
|
||||||
TAGCURRENCY="./TAG/${RR}/TAG_currency" # ZEN (0.01 G1)
|
TAGCURRENCY="./TAG/${RR}/TAG_currency" # ZEN (0.01 G1)
|
||||||
TAGAMOUNT="./TAG/${RR}/TAG_amount" # Tag amount. It is!
|
TAGAMOUNT="./TAG/${RR}/TAG_amount" # Tag amount. It is!
|
||||||
TAGTYPE="./TAG/${RR}/TAG_type" # G1 Tag type
|
TAGTYPE="./TAG/${RR}/TAG_type" # G1 Tag type
|
||||||
TAGPASSENGER="./TAG/${RR}/TAG_passenger" # Reference to G1Tag owner/counter put in "./wallets/.$IPFSNODEID/TAG/${J}"
|
TAGPASSENGER="./TAG/${RR}/TAG_passenger" # Reference to G1Tag owner/counter put in "./wallets/.$IPFSNODEID/TAG/${J}"
|
||||||
# ... GESTION DE LA CLEF DE PUBLICATION IPNS ".ipfs/keystore/${RR}" ...
|
# ... GESTION DE LA CLEF DE PUBLICATION IPNS ".ipfs/keystore/${RR}" ...
|
||||||
TAGPUBLISH_B_GPG="./TAG/${RR}/TAG_publishkey.B.gpg" # ipns publish key B PGP cyphered
|
TAGBKEY="./TAG/${RR}/TAG_publishkey.B.gpg" # ipns publish key B cyphered
|
||||||
TAGPUBLISH_PHONE_CRYPT="./TAG/${RR}/TAG_publishkey.phone.crypt" # natools.py crypt with creator G1sms Wallet PUBKEY
|
TAGG1smsWKEY="./TAG/${RR}/TAG_publishkey.$PHONE.crypt" # natools.py crypt with creator G1sms Wallet PUBKEY
|
||||||
TAGPUBLISH_NODE_CRYPT="./TAG/${RR}/TAG_publishkey.$NODE_UIDNA.crypt" # natools.py crypt with NODE G1sms Wallet PUBKEY
|
TAGSWARMKEY="./TAG/${RR}/TAG_publishkey.MASTER.crypt" # natools.py crypt with creator G1sms Wallet PUBKEY
|
||||||
TAGPUBLISH_SWARM_CRYPT="./TAG/${RR}/TAG_publishkey.swarm.crypt" # natools.py crypt with SWARM G1sms Wallet PUBKEY
|
|
||||||
TAGN="./TAG/${RR}/TAG_n" # Tag modification number (0 first)
|
|
||||||
TAGIPNS="./TAG/${RR}/TAG_ipns" # /ipns/Qm... link to last G1Tag version
|
TAGIPNS="./TAG/${RR}/TAG_ipns" # /ipns/Qm... link to last G1Tag version
|
||||||
TAGCHAIN="./TAG/${RR}/TAG_chain" # contains IPFS current ipfs hash
|
TAGCHAIN="./TAG/${RR}/TAG_chain" # contains IPFS current ipfs hash
|
||||||
|
|
||||||
# WRITE MULTITAG FILES with AMOUNT
|
# WRITE MULTITAG FILES with AMOUNT
|
||||||
mkdir -p ./TAG/${RR}
|
mkdir -p ./TAG/${RR}
|
||||||
|
LIST="$LIST $RR ($2)"
|
||||||
log "__SUB:sms_G1TAG.sh: G1Tag: $RR / ${NANODATE}"
|
log "__SUB:sms_G1TAG.sh: G1tag: $RR / ${NANODATE}"
|
||||||
log "__SUB:sms_G1TAG.sh: MEMRIB: $MEMRIB"
|
log "__SUB:sms_G1TAG.sh: MEMRIB: $MEMRIB"
|
||||||
log "__SUB:sms_G1TAG.sh: A: ${AA}"
|
log "__SUB:sms_G1TAG.sh: A: ${AA}"
|
||||||
log "__SUB:sms_G1TAG.sh: B: ${BB}"
|
log "__SUB:sms_G1TAG.sh: B: ${BB}"
|
||||||
log "__SUB:sms_G1TAG.sh: USER_KEY: $TAGPUBLISH_B_GPG"
|
|
||||||
log "__SUB:sms_G1TAG.sh: PHONE G1WALLET_KEY: $TAGPUBLISH_PHONE_CRYPT"
|
|
||||||
log "__SUB:sms_G1TAG.sh: NODE G1WALLET_KEY: $TAGPUBLISH_NODE_CRYPT"
|
|
||||||
log "__SUB:sms_G1TAG.sh: SWARM G1WALLET_KEY: $TAGPUBLISH_SWARM_CRYPT"
|
|
||||||
####################
|
####################
|
||||||
|
|
||||||
####################################################
|
####################################################
|
||||||
# IPFS files are created and calculated immutable I
|
# IPFS files are created and calculated immutable I
|
||||||
####################################################
|
####################################################
|
||||||
# A or R is Human readable G1tag Name
|
# A or R is the Human readable G1tag ID (kind of TAG pubkey)
|
||||||
echo "${AA}" > "$TAGID"
|
echo "${AA}" > "$TAGID"
|
||||||
echo "0" > "$TAGN"
|
echo "0" > "$TAGN"
|
||||||
echo "${NANODATE}" > "$TAGDATE"
|
echo "${NANODATE}" > "$TAGDATE"
|
||||||
echo "${IPFSNODEID}" > "$TAGNODEID"
|
echo "${IPFSNODEID}" > "$TAGNID"
|
||||||
echo "${TYPE}" > "$TAGTYPE"
|
echo "${TYPE}" > "$TAGTYPE"
|
||||||
|
|
||||||
echo "ZEN" > "$TAGCURRENCY"
|
echo "ZEN" > "$TAGCURRENCY"
|
||||||
|
@ -171,19 +167,15 @@ TAGCHAIN="./TAG/${RR}/TAG_chain" # contains IPFS current ipfs hash
|
||||||
su $YOU -c "ipfs key gen -t rsa -s 2048 ${RR}"
|
su $YOU -c "ipfs key gen -t rsa -s 2048 ${RR}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# TODO: Regulate G1Tag Access to LostSecret OR PHONE ./wallets Pubkey OR SWARM G1 KEY
|
||||||
# GIVE QRCODE BJ ACCESS TO G1TAG
|
# GIVE QRCODE BJ ACCESS TO G1TAG
|
||||||
# Enregistrement de la clef de publication IPNS du wallet ${R} cryptée par B
|
# Enregistrement de la clef de publication IPNS du wallet ${R} cryptée par B
|
||||||
echo "${BB}" | gpg -q --output "$TAGPUBLISH_B_GPG" --yes --pinentry-mode loopback --symmetric --passphrase-fd 0 "/home/$YOU/.ipfs/keystore/${RR}"
|
echo "${BB}" | gpg -q --output "$TAGBKEY" --yes --pinentry-mode loopback --symmetric --passphrase-fd 0 "/home/$YOU/.ipfs/keystore/${RR}"
|
||||||
|
# GIVE CREATOR G1WALLET ACCESS TO ZEN TAG
|
||||||
# GIVE PHONE CREATOR G1WALLET ACCESS TO ZEN TAG
|
|
||||||
# Enregistrement de la clef de publication chiffrée par $PUBKEY la clef publique du portefeuille G1 createur.
|
# Enregistrement de la clef de publication chiffrée par $PUBKEY la clef publique du portefeuille G1 createur.
|
||||||
./shell/natools.py encrypt -p $PUBKEY -i "/home/$YOU/.ipfs/keystore/${RR}" -o "$TAGPUBLISH_PHONE_CRYPT"
|
./shell/natools.py encrypt -p $PUBKEY -i "/home/$YOU/.ipfs/keystore/${RR}" -o "$TAGG1smsWKEY"
|
||||||
|
|
||||||
# GIVE NODE_UIDNA ACCESS TO ZEN TAG
|
|
||||||
./shell/natools.py encrypt -p $NODE_G1PUBKEY -i "/home/$YOU/.ipfs/keystore/${RR}" -o "$TAGPUBLISH_NODE_CRYPT"
|
|
||||||
|
|
||||||
# GIVE SWARM ACCESS TO ZEN TAG
|
# GIVE SWARM ACCESS TO ZEN TAG
|
||||||
./shell/natools.py encrypt -p $SWARM_G1PUBKEY -i "/home/$YOU/.ipfs/keystore/${RR}" -o "$TAGPUBLISH_SWARM_CRYPT"
|
./shell/natools.py encrypt -p $MASTERPUB -i "/home/$YOU/.ipfs/keystore/${RR}" -o "$TAGSWARMKEY"
|
||||||
|
|
||||||
###########################################################
|
###########################################################
|
||||||
# TAG IPFS STORAGE & G1Tag IPNS PUBLISHING
|
# TAG IPFS STORAGE & G1Tag IPNS PUBLISHING
|
||||||
|
@ -200,15 +192,13 @@ TAGCHAIN="./TAG/${RR}/TAG_chain" # contains IPFS current ipfs hash
|
||||||
# KEEP G1Tag J MEMORY in NODE ./wallets/.$IPFSNODEID/TAG/ (TODO: OPTIMIZE SWARM SYNC and REPUBLISH)
|
# KEEP G1Tag J MEMORY in NODE ./wallets/.$IPFSNODEID/TAG/ (TODO: OPTIMIZE SWARM SYNC and REPUBLISH)
|
||||||
mkdir -p "./wallets/.$IPFSNODEID/TAG/"
|
mkdir -p "./wallets/.$IPFSNODEID/TAG/"
|
||||||
# WRITE PASSENGER to J Link (G1Tag is stick to it: PHONE, NODE, FILE )
|
# WRITE PASSENGER to J Link (G1Tag is stick to it: PHONE, NODE, FILE )
|
||||||
# TODO USE SHA256 ID !!!
|
|
||||||
echo "$PHONE" > "./wallets/.$IPFSNODEID/TAG/${J}"
|
echo "$PHONE" > "./wallets/.$IPFSNODEID/TAG/${J}"
|
||||||
if [[ $PASSENGER ]]; then
|
if [[ $PASSENGER ]]; then
|
||||||
HPASSENGER=$(echo -n $PASSENGER | sha256sum | cut -d ' ' -f 1)
|
echo "$PASSENGER" > "./wallets/.$IPFSNODEID/TAG/${J}";
|
||||||
echo "$HPASSENGER" > "./wallets/.$IPFSNODEID/TAG/${J}";
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
###########################################################
|
###########################################################
|
||||||
log "__SUB:sms_G1TAG.sh: TAG: ipfs ls /ipns/${J}"
|
log "__SUB:sms_G1TAG.sh: TAG: ipfs ls /ipns/$(cat $TAGIPNS)"
|
||||||
if [[ ! $PASSENGER ]]; then
|
if [[ ! $PASSENGER ]]; then
|
||||||
# QR CODE LECTURE
|
# QR CODE LECTURE
|
||||||
qrencode -s 5 -o "./TAG/${RR}/TAG_READ.png" "RJ:${RR}#${J}"
|
qrencode -s 5 -o "./TAG/${RR}/TAG_READ.png" "RJ:${RR}#${J}"
|
||||||
|
@ -220,27 +210,22 @@ TAGCHAIN="./TAG/${RR}/TAG_chain" # contains IPFS current ipfs hash
|
||||||
|
|
||||||
# COMPOSE G1TAG PRINT + TAG_READ.png + TAG_WRITE.png
|
# COMPOSE G1TAG PRINT + TAG_READ.png + TAG_WRITE.png
|
||||||
composite -compose Over -resize 133% -gravity West "./TAG/${RR}/TAG_READ.png" "./shell/g1tag.png" "./TAG/${RR}/${RR}.png"
|
composite -compose Over -resize 133% -gravity West "./TAG/${RR}/TAG_READ.png" "./shell/g1tag.png" "./TAG/${RR}/${RR}.png"
|
||||||
|
|
||||||
composite -compose Over -gravity SouthEast "./TAG/${RR}/TAG_WRITE.png" "./TAG/${RR}/${RR}.png" "./TAG/${RR}/${RR}.png"
|
composite -compose Over -gravity SouthEast "./TAG/${RR}/TAG_WRITE.png" "./TAG/${RR}/${RR}.png" "./TAG/${RR}/${RR}.png"
|
||||||
|
|
||||||
# ADD Avatar in the Center
|
# ADD Avatar in the Center
|
||||||
# if [[ $(file "./wallets/$PHONE/$PHONE.avatar.png" | grep 'PNG') ]]; then
|
if [[ $(file "./wallets/$PHONE/$PHONE.avatar.png" | grep 'PNG') ]]; then
|
||||||
# composite -compose Over -resize 150% -gravity Center "./wallets/$PHONE/$PHONE.avatar.png" "./TAG/${RR}/${RR}.png" "./TAG/${RR}/${RR}.png"
|
composite -compose Over -resize 150% -gravity Center "./wallets/$PHONE/$PHONE.avatar.png" "./TAG/${RR}/${RR}.png" "./TAG/${RR}/${RR}.png"
|
||||||
# else
|
else
|
||||||
# composite -compose Over -resize 100% -gravity Center "./shell/G1Anar.png" "./TAG/${RR}/${RR}.png" "./TAG/${RR}/${RR}.png"
|
composite -compose Over -resize 100% -gravity Center "./shell/Portefeuille.png" "./TAG/${RR}/${RR}.png" "./TAG/${RR}/${RR}.png"
|
||||||
# fi
|
fi
|
||||||
|
|
||||||
|
# WRITE G1Tag G1 amount
|
||||||
convert -pointsize 60 -fill black -gravity Center -draw 'text 0,-100 "'"$2"'"' "./TAG/${RR}/${RR}.png" "./TAG/${RR}/${RR}.png";
|
convert -pointsize 150 -fill black -gravity Center -draw 'text 240,-140 "'"$2"'"' "./TAG/${RR}/${RR}.png" "./TAG/${RR}/${RR}.png"
|
||||||
|
|
||||||
convert -pointsize 40 -fill black -gravity NorthEast -draw 'text 80,0 "'"${PR}"'"' "./TAG/${RR}/${RR}.png" "./TAG/${RR}/${RR}.png"
|
|
||||||
# WRITE G1Tag RR
|
# WRITE G1Tag RR
|
||||||
convert -pointsize 40 -fill black -gravity SouthWest -draw 'text 3,0 "'"${RR}"'"' "./TAG/${RR}/${RR}.png" "./TAG/${RR}/${RR}.png"
|
convert -pointsize 40 -fill black -gravity SouthWest -draw 'text 0,0 "'"${RR}"'"' "./TAG/${RR}/${RR}.png" "./TAG/${RR}/${RR}.png"
|
||||||
|
|
||||||
# ROTATION (FIXE AVATAR & CHIFFRE)?
|
# ROTATION (FIXE AVATAR & CHIFFRE)?
|
||||||
# convert "./TAG/${RR}/${RR}.png" -rotate -180 "./TAG/${RR}/${RR}.png"
|
# convert "./TAG/${RR}/${RR}.png" -rotate -180 "./TAG/${RR}/${RR}.png"
|
||||||
# QL-700 PRINT PREPARE
|
# QL-700 PRINT PREPARE
|
||||||
|
|
||||||
if [[ -f "./wallets/$PHONE/ipfsid.G1TAGNODE" ]]; then
|
if [[ -f "./wallets/$PHONE/ipfsid.G1TAGNODE" ]]; then
|
||||||
destnode=$(cat "./wallets/$PHONE/ipfsid.G1TAGNODE")
|
destnode=$(cat "./wallets/$PHONE/ipfsid.G1TAGNODE")
|
||||||
if [[ "$destnode" == "" || "$destnode" == "$IPFSNODEID" ]]; then
|
if [[ "$destnode" == "" || "$destnode" == "$IPFSNODEID" ]]; then
|
||||||
|
@ -248,11 +233,10 @@ TAGCHAIN="./TAG/${RR}/TAG_chain" # contains IPFS current ipfs hash
|
||||||
brother_ql_create --model QL-700 "./TAG/${RR}/${RR}.png" --label-size 62 > "./TAG/${RR}/${RR}.bin"
|
brother_ql_create --model QL-700 "./TAG/${RR}/${RR}.png" --label-size 62 > "./TAG/${RR}/${RR}.bin"
|
||||||
brother_ql_print "./TAG/${RR}/${RR}.bin" /dev/usb/lp0
|
brother_ql_print "./TAG/${RR}/${RR}.bin" /dev/usb/lp0
|
||||||
else
|
else
|
||||||
# PRINT ON ANOTHER G1Dab. Send files to G1Tag Printer TODO: Could use DESTNODEPUB instead of NODE_G1PUBKEY ?
|
# PRINT ON ANOTHER G1Dab. Send files to G1Tag Printer TODO: Could use DESTNODEPUB instead of MASTERPUB ?
|
||||||
log "__SUB:sms_G1TAG.sh: Remote PRINT :: ./wallets/.$destnode/PRINT/${RR}.bin "
|
log "__SUB:sms_G1TAG.sh: Remote PRINT :: ./wallets/.$destnode/PRINT/${RR}.bin "
|
||||||
mkdir -p "./wallets/.$destnode/PRINT/"
|
mkdir -p "./wallets/.$destnode/PRINT/"
|
||||||
# TODO: USE $DEST_G1PUBKEY is better
|
./shell/natools.py encrypt -p $MASTERPUB -i "./TAG/${RR}/${RR}.png" -o "./wallets/.$destnode/PRINT/${RR}.bin"
|
||||||
./shell/natools.py encrypt -p $NODE_G1PUBKEY -i "./TAG/${RR}/${RR}.png" -o "./wallets/.$destnode/PRINT/${RR}.bin"
|
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
#
|
#
|
||||||
|
@ -265,24 +249,16 @@ TAGCHAIN="./TAG/${RR}/TAG_chain" # contains IPFS current ipfs hash
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
####################################################
|
|
||||||
# PRINT $PHONE WALLET PUBKEY
|
|
||||||
####################################################
|
|
||||||
if [[ "$destnode" == "" || "$destnode" == "$IPFSNODEID" ]]; then
|
if [[ "$destnode" == "" || "$destnode" == "$IPFSNODEID" ]]; then
|
||||||
|
# PRINT $PHONE WALLET PUBKEY
|
||||||
qrencode -s 5 -o "/tmp/G1PubQR.$PHONE.png" "$(cat ./wallets/$PHONE/$PHONE.pub)"
|
qrencode -s 5 -o "/tmp/G1PubQR.$PHONE.png" "$(cat ./wallets/$PHONE/$PHONE.pub)"
|
||||||
composite -compose Over -gravity West "/tmp/G1PubQR.$PHONE.png" "./shell/g1tag.png" "/tmp/G1PubQR.$PHONE.png"
|
composite -compose Over -resize 133% -gravity West "/tmp/G1PubQR.$PHONE.png" "./shell/g1tag.png" "/tmp/G1PubQR.$PHONE.png"
|
||||||
|
|
||||||
if [[ $(file "./wallets/$PHONE/$PHONE.avatar.png" | grep 'PNG') ]]; then
|
if [[ $(file "./wallets/$PHONE/$PHONE.avatar.png" | grep 'PNG') ]]; then
|
||||||
composite -compose Over -gravity Center "./wallets/$PHONE/$PHONE.avatar.png" "/tmp/G1PubQR.$PHONE.png" "/tmp/G1PubQR.$PHONE.png"
|
composite -compose Over -resize 150% -gravity Center "./wallets/$PHONE/$PHONE.avatar.png" "/tmp/G1PubQR.$PHONE.png" "/tmp/G1PubQR.$PHONE.png"
|
||||||
fi
|
fi
|
||||||
if [[ -f ./wallets/$PHONE/$PHONE.uidrib ]]; then
|
convert -pointsize 60 -fill black -gravity Center -draw 'text 320,-160 "'"$MEMBER"'"' "/tmp/G1PubQR.$PHONE.png" "/tmp/G1PubQR.$PHONE.png"
|
||||||
qrencode -s 6 -o "/tmp/G1MemQR.$PHONE.png" "$(cat ./wallets/$PHONE/$PHONE.uidrib)";
|
convert -pointsize 70 -fill black -gravity Center -draw 'text 345, 0 "'"$UIDNA"'"' "/tmp/G1PubQR.$PHONE.png" "/tmp/G1PubQR.$PHONE.png"
|
||||||
composite -compose Over -gravity SouthEast "/tmp/G1MemQR.$PHONE.png" "/tmp/G1PubQR.$PHONE.png" "/tmp/G1PubQR.$PHONE.png" && rm /tmp/G1MemQR.$PHONE.png
|
convert -pointsize 60 -fill black -gravity Center -draw 'text 330,160 "'"$PHONE"'"' "/tmp/G1PubQR.$PHONE.png" "/tmp/G1PubQR.$PHONE.png"
|
||||||
fi
|
|
||||||
|
|
||||||
convert -pointsize 40 -fill black -gravity NorthEast -draw 'text 100,0 "'"G1 $MEMBER"'"' "/tmp/G1PubQR.$PHONE.png" "/tmp/G1PubQR.$PHONE.png"
|
|
||||||
convert -pointsize 40 -fill black -gravity SouthWest -draw 'text 10,0 "'"$UIDNA"'"' "/tmp/G1PubQR.$PHONE.png" "/tmp/G1PubQR.$PHONE.png"
|
|
||||||
#convert -pointsize 60 -fill black -gravity Center -draw 'text 350,80 "'"$PHONE"'"' "/tmp/G1PubQR.$PHONE.png" "/tmp/G1PubQR.$PHONE.png"
|
|
||||||
brother_ql_create --model QL-700 "/tmp/G1PubQR.$PHONE.png" --label-size 62 > "/tmp/G1PubQR.$PHONE.bin"
|
brother_ql_create --model QL-700 "/tmp/G1PubQR.$PHONE.png" --label-size 62 > "/tmp/G1PubQR.$PHONE.bin"
|
||||||
brother_ql_print "/tmp/G1PubQR.$PHONE.bin" /dev/usb/lp0
|
brother_ql_print "/tmp/G1PubQR.$PHONE.bin" /dev/usb/lp0
|
||||||
rm -f /tmp/G1PubQR.*
|
rm -f /tmp/G1PubQR.*
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
################################################################################
|
################################################################################
|
||||||
source ./shell/init.sh
|
source ./shell/init.sh
|
||||||
source ./shell/functions.sh
|
source ./shell/functions.sh
|
||||||
log "${c_yellow}X sms_NEW.sh ($1=phone, $2=uid)$c_"
|
log "X sms_NEW.sh ($1=phone, $2=uid)"
|
||||||
|
|
||||||
PHONE="$1"
|
PHONE="$1"
|
||||||
MEMBERUID="$2"
|
MEMBERUID="$2"
|
||||||
|
@ -15,9 +15,9 @@ MEMBERUID="$2"
|
||||||
sms_INIT_ACCOUNT "$PHONE"
|
sms_INIT_ACCOUNT "$PHONE"
|
||||||
if [[ "$MEMBERUID" != "" && "$MEMBERUID" != "N" && "$MEMBERUID" != "D" && "$MEMBERUID" != "NOUV" ]]; then
|
if [[ "$MEMBERUID" != "" && "$MEMBERUID" != "N" && "$MEMBERUID" != "D" && "$MEMBERUID" != "NOUV" ]]; then
|
||||||
# UID RECEIVED in SMS
|
# UID RECEIVED in SMS
|
||||||
VIRDEST=$MEMBERUID
|
VIRDEST=$MEMBERUID
|
||||||
MEMRIB=$(sms_uid2key "$MEMBERUID" "$PHONE" "$PIN")
|
MEMRIB=$(sms_uid2key "$MEMBERUID" "$PHONE" "$PIN")
|
||||||
if [[ $MEMRIB == "" ]]; then exit; fi
|
if [[ $MEMRIB == "" ]]; then exit; fi
|
||||||
MEMBER="$MEMBERUID"
|
MEMBER="$MEMBERUID"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -48,13 +48,11 @@ sms_SEND "$PHONE" "* Clef Publique (RIB) ="
|
||||||
sleep 2
|
sleep 2
|
||||||
sms_SEND "$PHONE" "$PUBKEY"
|
sms_SEND "$PHONE" "$PUBKEY"
|
||||||
sleep 2
|
sleep 2
|
||||||
[[ $MEMRIB != "" ]] && sms_SEND "$PHONE" "Compte relié? $MEMBER $MAIL
|
sms_SEND "$PHONE" "Compte relié? $MEMBER $MAIL
|
||||||
$MEMRIB"
|
$MEMRIB"
|
||||||
|
|
||||||
# Add contact to database
|
|
||||||
add_contact $PHONE $MEMBERUID && log "${c_green}Contact has been added to database$c_" || log "${c_red}Contact can't be added to database$c_"
|
|
||||||
|
|
||||||
log "${c_yellow}END sms_NEW.sh$c_"
|
|
||||||
|
log "END sms_NEW.sh"
|
||||||
log "~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
|
log "~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
|
||||||
exit
|
exit
|
||||||
|
|
||||||
|
|
|
@ -27,9 +27,8 @@ log "__SUB:sms_PAY.sh: $(declare -p accounting)"
|
||||||
testmin=${accounting[0]}
|
testmin=${accounting[0]}
|
||||||
VIR=${accounting[1]}
|
VIR=${accounting[1]}
|
||||||
PERCENT=${accounting[2]}
|
PERCENT=${accounting[2]}
|
||||||
CHARGE=${accounting[3]}
|
|
||||||
if [[ $testmin -eq 0 ]]; then
|
if [[ $testmin -eq 0 ]]; then
|
||||||
sms_ERROR "$phone" "Solde de votre Porte-monnaie G1sms insuffisant. Minimum: $CHARGE G1! Rechargez avec https://Cesium.app"
|
sms_ERROR "$phone" "Solde de votre Porte-monnaie G1sms insuffisant. Minimum: $((VIR+PERCENT+LIMIT)) G1! Rechargez avec https://Cesium.app"
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -50,8 +49,9 @@ else
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Payement
|
# Payement
|
||||||
PAY=$(./shell/timeout.sh -t 20 ./silkaj/silkaj transaction --auth-scrypt -salt="$phone" -password="$pin" --amount="$VIR" --output="$PUBKEYDEST" --comment="[G1sms+] PAY" -y)
|
PAY=$(./shell/timeout.sh -t 20 ./silkaj/silkaj transaction --auth-scrypt -salt="$phone" -password="$pin" --amount="$VIR" --output="$PUBKEYDEST" --comment="[G1sms+] PAY $AMOUNT $UNIT" -y)
|
||||||
if [[ "$(echo $PAY | cut -d '|' -f 1)" == "KO" || "$PAY" == "" ]]; then
|
if [[ "$(echo $PAY | cut -d '|' -f 1)" == "KO" || "$PAY" == "" ]]; then
|
||||||
|
new=$(./shell/checknodes.sh "BAN")
|
||||||
sms_ERROR "$phone" "Problème de payement avec silkaj (changement de serveur $new): $PAY";
|
sms_ERROR "$phone" "Problème de payement avec silkaj (changement de serveur $new): $PAY";
|
||||||
log "__SUB:sms_PAY.sh: Problème de payement avec silkaj $new : $PAY"
|
log "__SUB:sms_PAY.sh: Problème de payement avec silkaj $new : $PAY"
|
||||||
exit
|
exit
|
||||||
|
@ -64,7 +64,7 @@ fi
|
||||||
sleep 2
|
sleep 2
|
||||||
|
|
||||||
# + G1SMS Commission
|
# + G1SMS Commission
|
||||||
COM=$(./shell/timeout.sh -t 20 ./silkaj/silkaj transaction --auth-scrypt -salt="$phone" -password="$pin" --amount="$PERCENT" --output="$NODE_G1PUBKEY" --comment="[G1sms+] Commission" -y)
|
COM=$(./shell/timeout.sh -t 20 ./silkaj/silkaj transaction --auth-scrypt -salt="$phone" -password="$pin" --amount="$PERCENT" --output="$MASTERPUB" --comment="[G1sms+] Commission" -y)
|
||||||
if [[ "$(echo $COM | cut -d '|' -f 1)" == "KO" || "$PAY" == "" ]]; then
|
if [[ "$(echo $COM | cut -d '|' -f 1)" == "KO" || "$PAY" == "" ]]; then
|
||||||
new=$(./shell/checknodes.sh "BAN")
|
new=$(./shell/checknodes.sh "BAN")
|
||||||
sms_ERROR "$phone" "Problème de payement avec silkaj (changement de serveur $new): $COM";
|
sms_ERROR "$phone" "Problème de payement avec silkaj (changement de serveur $new): $COM";
|
||||||
|
@ -73,7 +73,7 @@ if [[ "$(echo $COM | cut -d '|' -f 1)" == "KO" || "$PAY" == "" ]]; then
|
||||||
else
|
else
|
||||||
# OK: Sync g1cents
|
# OK: Sync g1cents
|
||||||
cents=$(echo $(bc -l <<< "scale=0; $PERCENT * 100") | cut -d '.' -f 1)
|
cents=$(echo $(bc -l <<< "scale=0; $PERCENT * 100") | cut -d '.' -f 1)
|
||||||
move_g1cents "$phone" "$NODE_G1PUBKEY" "$cents"
|
move_g1cents "$phone" "$MASTERPUB" "$cents"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# LOG ACCOUNT HISTORY EVENTS
|
# LOG ACCOUNT HISTORY EVENTS
|
||||||
|
|
|
@ -79,22 +79,20 @@ else
|
||||||
log "__SUB:sms_REC.sh: SEARCH $VIRDEST related wallet!!! $DESTRIB "
|
log "__SUB:sms_REC.sh: SEARCH $VIRDEST related wallet!!! $DESTRIB "
|
||||||
DESTMEM="$VIRDEST"
|
DESTMEM="$VIRDEST"
|
||||||
# SEARCH IN WALLETS
|
# SEARCH IN WALLETS
|
||||||
LOCAL=$(grep -Rwl "$DESTMEM" ./wallets/*/*.uidname | tail -n 1 | cut -f 3 -d '/')
|
LOCAL=$(grep -Rwl "$DESTMEM" ./wallets/*/*.uidna | tail -n 1 | cut -f 3 -d '/')
|
||||||
if [[ "$LOCAL" == "" ]]; then LOCAL=$(grep -Rwl "$DESTMEM" ./wallets/*/*.uidna | tail -n 1 | cut -f 3 -d '/'); fi
|
|
||||||
if [[ "$LOCAL" != "" ]]; then
|
if [[ "$LOCAL" != "" ]]; then
|
||||||
# LOCAL G1sms account
|
# LOCAL G1sms account
|
||||||
DESTRIB=$(cat ./wallets/$LOCAL/$LOCAL.pub)
|
DESTRIB=$(cat ./wallets/$LOCAL/$LOCAL.pub)
|
||||||
DESTPHONE=$LOCAL
|
DESTPHONE=$LOCAL
|
||||||
log "__SUB:sms_REC.sh: FOUND LOCAL ($MASTERPHONE) G1sms+ wallet: $DESTRIB ($LOCAL)"
|
log "__SUB:sms_REC.sh: FOUND LOCAL ($MASTERPHONE) G1sms+ wallet: $DESTRIB ($LOCAL)"
|
||||||
else
|
else
|
||||||
# SEARCH IN WALLETS SWARM (MEMBER THEN UIDNA)
|
# SEARCH IN WALLETS SWARM
|
||||||
INSWARM=$(grep -Rwl "$DESTMEM" ./wallets_swarm/*/*.uidname | tail -n 1 | cut -f 3 -d '/')
|
SWARMNB=$(grep -Rwl "$DESTMEM" ./wallets_swarm/*/*.uidna | tail -n 1 | cut -f 3 -d '/')
|
||||||
if [[ "$INSWARM" == "" ]]; then INSWARM=$(grep -Rwl "$DESTMEM" ./wallets_swarm/*/*.uidna | tail -n 1 | cut -f 3 -d '/'); fi
|
if [[ "$LOCAL" != "" ]]; then
|
||||||
if [[ "$INSWARM" != "" ]]; then
|
REMOTENODE=$(cat ./wallets_swarm/$SWARMNB/MASTERPHONE.sms)
|
||||||
REMOTENODE=$(cat ./wallets_swarm/$INSWARM/MASTERPHONE.sms)
|
DESTRIB=$(cat ./wallets_swarm/$SWARMNB/$SWARMNB.pub)
|
||||||
DESTRIB=$(cat ./wallets_swarm/$INSWARM/$INSWARM.pub)
|
DESTPHONE=$SWARMNB
|
||||||
DESTPHONE=$INSWARM
|
log "__SUB:sms_REC.sh: FOUND SWARM ($REMOTENODE) G1sms+ wallet: $DESTRIB ($SWARMNB)"
|
||||||
log "__SUB:sms_REC.sh: FOUND SWARM ($REMOTENODE) G1sms+ wallet: $DESTRIB ($INSWARM)"
|
|
||||||
else
|
else
|
||||||
# SEARCH WITH SILKAJ
|
# SEARCH WITH SILKAJ
|
||||||
DESTRIB=$(./silkaj/silkaj id "$DESTMEM" | grep -w "$DESTMEM" | awk '{print $2}')
|
DESTRIB=$(./silkaj/silkaj id "$DESTMEM" | grep -w "$DESTMEM" | awk '{print $2}')
|
||||||
|
@ -157,7 +155,7 @@ $DESTRIB"
|
||||||
log_history "$PHONE" "REC, $VIR, $DESTRIB, $DESTMEM, $PERIOD, $TIME"
|
log_history "$PHONE" "REC, $VIR, $DESTRIB, $DESTMEM, $PERIOD, $TIME"
|
||||||
# Send DESTPHONE sms
|
# Send DESTPHONE sms
|
||||||
if [[ "$DESTPHONE" != "" ]]; then
|
if [[ "$DESTPHONE" != "" ]]; then
|
||||||
sms_SEND "$DESTPHONE" "[G1sms+] Bonjour $DESTMEM. Vous recev(r)ez un payement de $VIR G1 (pendant $TIME $PERIOD) de la part du portefeuille: $MEMBER $UIDNA."
|
sms_SEND "$DESTPHONE" "[G1sms+] Bonjour $DESTMEM. Vous recev(r)ez un payement de $VIR G1 (pendant $TIME $PERIOD) de la part du portefeuille: $MEMBER."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
else
|
else
|
||||||
|
|
|
@ -33,7 +33,7 @@ testmin=${accounting[0]}
|
||||||
VIR=${accounting[1]}
|
VIR=${accounting[1]}
|
||||||
PERCENT=${accounting[2]}
|
PERCENT=${accounting[2]}
|
||||||
if [[ $testmin -eq 0 ]]; then
|
if [[ $testmin -eq 0 ]]; then
|
||||||
sms_ERROR "$PHONE" "Solde de votre Porte-monnaie G1sms insuffisant. Minimum $VIR + $LIMIT G1! Rechargez par Cesium."
|
sms_ERROR "$PHONE" "Solde de votre Porte-monnaie G1sms insuffisant. Minimum $charge G1! Rechargez par Cesium."
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -48,17 +48,15 @@ else
|
||||||
log "__SUB:sms_VIR.sh: SEARCH $VIRDEST related wallet!!! $DESTRIB "
|
log "__SUB:sms_VIR.sh: SEARCH $VIRDEST related wallet!!! $DESTRIB "
|
||||||
DESTMEM="$VIRDEST"
|
DESTMEM="$VIRDEST"
|
||||||
# SEARCH IN WALLETS
|
# SEARCH IN WALLETS
|
||||||
LOCAL=$(grep -Rwl "$DESTMEM" ./wallets/*/*.uidname | tail -n 1 | cut -f 3 -d '/')
|
LOCAL=$(grep -Rwl "$DESTMEM" ./wallets/*/*.uidna | tail -n 1 | cut -f 3 -d '/')
|
||||||
if [[ "$LOCAL" == "" ]]; then LOCAL=$(grep -Rwl "$DESTMEM" ./wallets/*/*.uidna | tail -n 1 | cut -f 3 -d '/'); fi
|
|
||||||
if [[ "$LOCAL" != "" ]]; then
|
if [[ "$LOCAL" != "" ]]; then
|
||||||
# LOCAL G1sms account
|
# LOCAL G1sms account
|
||||||
DESTRIB=$(cat ./wallets/$LOCAL/$LOCAL.pub)
|
DESTRIB=$(cat ./wallets/$LOCAL/$LOCAL.pub)
|
||||||
DESTPHONE=$LOCAL
|
DESTPHONE=$LOCAL
|
||||||
log "__SUB:sms_VIR.sh: FOUND LOCAL ($MASTERPHONE) G1sms+ wallet: $DESTRIB ($LOCAL)"
|
log "__SUB:sms_VIR.sh: FOUND LOCAL ($MASTERPHONE) G1sms+ wallet: $DESTRIB ($LOCAL)"
|
||||||
else
|
else
|
||||||
# SEARCH IN WALLETS SWARM (MEMBER THEN UIDNA)
|
# SEARCH IN WALLETS SWARM
|
||||||
INSWARM=$(grep -Rwl "$DESTMEM" ./wallets_swarm/*/*.uidname | tail -n 1 | cut -f 3 -d '/')
|
INSWARM=$(grep -Rwl "$DESTMEM" ./wallets_swarm/*/*.uidna | tail -n 1 | cut -f 3 -d '/')
|
||||||
if [[ "$INSWARM" == "" ]]; then INSWARM=$(grep -Rwl "$DESTMEM" ./wallets_swarm/*/*.uidna | tail -n 1 | cut -f 3 -d '/'); fi
|
|
||||||
if [[ "$INSWARM" != "" ]]; then
|
if [[ "$INSWARM" != "" ]]; then
|
||||||
REMOTENODE=$(cat ./wallets_swarm/$INSWARM/MASTERPHONE.sms)
|
REMOTENODE=$(cat ./wallets_swarm/$INSWARM/MASTERPHONE.sms)
|
||||||
DESTRIB=$(cat ./wallets_swarm/$INSWARM/$INSWARM.pub)
|
DESTRIB=$(cat ./wallets_swarm/$INSWARM/$INSWARM.pub)
|
||||||
|
@ -73,7 +71,7 @@ else
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ "$DESTRIB" != "" ]]; then
|
if [[ "$DESTRIB" != "" ]]; then
|
||||||
PAY=$(./shell/timeout.sh -t 30 ./silkaj/silkaj transaction --auth-scrypt -salt="$PHONE" -password="$PIN" --amount="$VIR" --output="$DESTRIB" --comment="[G1sms+] VIR $VIR G1" -y)
|
PAY=$(./shell/timeout.sh -t 20 ./silkaj/silkaj transaction --auth-scrypt -salt="$PHONE" -password="$PIN" --amount="$VIR" --output="$DESTRIB" --comment="[G1sms+] VIR $VIR G1" -y)
|
||||||
if [[ "$(echo $PAY | cut -d '|' -f 1)" != "KO" && "$PAY" != "" ]]; then
|
if [[ "$(echo $PAY | cut -d '|' -f 1)" != "KO" && "$PAY" != "" ]]; then
|
||||||
log "__SUB:sms_VIR.sh: VIREMENT VERS $DESTMEM OK"
|
log "__SUB:sms_VIR.sh: VIREMENT VERS $DESTMEM OK"
|
||||||
mess="[G1sms+] $MEMBER
|
mess="[G1sms+] $MEMBER
|
||||||
|
@ -85,7 +83,7 @@ $PAY"
|
||||||
log_history "$PHONE" "VIR, $VIR, $DESTRIB, $DESTMEM"
|
log_history "$PHONE" "VIR, $VIR, $DESTRIB, $DESTMEM"
|
||||||
# Send DESTPHONE sms
|
# Send DESTPHONE sms
|
||||||
if [[ "$DESTPHONE" != "" ]]; then
|
if [[ "$DESTPHONE" != "" ]]; then
|
||||||
sms_SEND "$DESTPHONE" "Bonjour $DESTMEM. Vous venez de recevoir un virement de $AMOUNT $UNIT ($VIR G1) de la part de $member portefeuille $UIDNA"
|
sms_SEND "$DESTPHONE" "Bonjour $DESTMEM. Vous venez de recevoir un virement de $AMOUNT $UNIT ($VIR G1) de la part de $member portefeuille $UIDNA ($phone)"
|
||||||
fi
|
fi
|
||||||
cents=$(echo $(bc -l <<< "scale=0; $VIR * 100") | cut -d '.' -f 1)
|
cents=$(echo $(bc -l <<< "scale=0; $VIR * 100") | cut -d '.' -f 1)
|
||||||
move_g1cents "$PHONE" "$DESTRIB" "$cents"
|
move_g1cents "$PHONE" "$DESTRIB" "$cents"
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
# QmUQcSjQx2bg4cSe2rUZyQi6F8QtJFJb74fWL7D784UWf9 2 TAG_n
|
# QmUQcSjQx2bg4cSe2rUZyQi6F8QtJFJb74fWL7D784UWf9 2 TAG_n
|
||||||
# QmdbdBWv4SygqaaeWHAvABiQAa3faf4ncfSyzRnx8BDdCc 20 TAG_nanodate
|
# QmdbdBWv4SygqaaeWHAvABiQAa3faf4ncfSyzRnx8BDdCc 20 TAG_nanodate
|
||||||
# QmbN6gNM2vjLj7yaJ6xJcySDxmuSK2eB9ZDv5dpj2bo5pM 47 TAG_nodeid
|
# QmbN6gNM2vjLj7yaJ6xJcySDxmuSK2eB9ZDv5dpj2bo5pM 47 TAG_nodeid
|
||||||
# QmXaMzRqhEs4cQMRN18FWaCeqGmrDBfV8hTkbfQuBCXnnA 1243 TAG_publishkey.swarm.crypt
|
# QmXaMzRqhEs4cQMRN18FWaCeqGmrDBfV8hTkbfQuBCXnnA 1243 TAG_publishkey.MASTER.crypt
|
||||||
# QmWHsRZCTSjSxnp1Qm8WcmHNNQTJwDS2ukLE7NTccc3Kp9 1304 TAG_publishkey.B.gpg
|
# QmWHsRZCTSjSxnp1Qm8WcmHNNQTJwDS2ukLE7NTccc3Kp9 1304 TAG_publishkey.B.gpg
|
||||||
# TAG_passenger, TAG_file is used to attach G1Tag to file.
|
# TAG_passenger, TAG_file is used to attach G1Tag to file.
|
||||||
# ADD A PASSENGER FILE (Web2.0ID) INTO a G1Tag + Add INIT credit/debit values to live in SWARM.
|
# ADD A PASSENGER FILE (Web2.0ID) INTO a G1Tag + Add INIT credit/debit values to live in SWARM.
|
||||||
|
@ -74,7 +74,7 @@ mkdir -p ./TAG/${JSOURCERR}; rm -f ./TAG/${JSOURCERR}/*
|
||||||
echo "__SUB:tag_LOAD_passenger.sh: LOG. Hey You get a G1Tag!! GET IT now: ipfs get --output=./TAG/${JSOURCERR}/ /ipns/$JSOURCE"
|
echo "__SUB:tag_LOAD_passenger.sh: LOG. Hey You get a G1Tag!! GET IT now: ipfs get --output=./TAG/${JSOURCERR}/ /ipns/$JSOURCE"
|
||||||
chown -R $YOU ./TAG/${JSOURCERR}/
|
chown -R $YOU ./TAG/${JSOURCERR}/
|
||||||
su $YOU -c "ipfs get --output=./TAG/${JSOURCERR}/ /ipns/$JSOURCE" 2>&1
|
su $YOU -c "ipfs get --output=./TAG/${JSOURCERR}/ /ipns/$JSOURCE" 2>&1
|
||||||
JSOURCEPUBLISHKEY="./TAG/${JSOURCERR}/TAG_publishkey.swarm.crypt"
|
JSOURCEPUBLISHKEY="./TAG/${JSOURCERR}/TAG_publishkey.MASTER.crypt"
|
||||||
JSOURCEVALUE=$(cat ./TAG/${JSOURCERR}/TAG_amount)
|
JSOURCEVALUE=$(cat ./TAG/${JSOURCERR}/TAG_amount)
|
||||||
TAGNODEID=$(cat ./TAG/${JSOURCERR}/TAG_nodeid)
|
TAGNODEID=$(cat ./TAG/${JSOURCERR}/TAG_nodeid)
|
||||||
TAGPASSENGER="./TAG/${JSOURCERR}/TAG_passenger" # contains HASH for PASSENGER FILE (CRYPT & PUBLISH)
|
TAGPASSENGER="./TAG/${JSOURCERR}/TAG_passenger" # contains HASH for PASSENGER FILE (CRYPT & PUBLISH)
|
||||||
|
@ -125,8 +125,8 @@ IFILE=$(su $YOU -c "ipfs add \"${MUSICFILE}\" | tail -n 1")
|
||||||
if [[ ! $IFILE ]]; then exit; fi
|
if [[ ! $IFILE ]]; then exit; fi
|
||||||
echo "$IFILE" > $TAGPASSENGER
|
echo "$IFILE" > $TAGPASSENGER
|
||||||
# ONLY SWARM KEY CAN DECRYPT IPFS LINK TO FILE (TODO: Glue better)
|
# ONLY SWARM KEY CAN DECRYPT IPFS LINK TO FILE (TODO: Glue better)
|
||||||
NODE_G1PUBKEY=$(cat "./g1sms.pub.key")
|
MASTERPUB=$(cat "./g1sms.pub.key")
|
||||||
./shell/natools.py encrypt -p "$NODE_G1PUBKEY" -i "$TAGPASSENGER" -o "$TAGPASSENGERCRYPT"
|
./shell/natools.py encrypt -p "$MASTERPUB" -i "$TAGPASSENGER" -o "$TAGPASSENGERCRYPT"
|
||||||
echo "LOADED" > $TAGPASSENGER
|
echo "LOADED" > $TAGPASSENGER
|
||||||
|
|
||||||
echo "$DEB" > $TAGPASSENGERDEBIT
|
echo "$DEB" > $TAGPASSENGERDEBIT
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
################################################################################
|
################################################################################
|
||||||
# Author: Fred (support@qo-op.com)
|
# Author: Fred (support@qo-op.com)
|
||||||
# Version: 0.2020
|
# Version: 0.1
|
||||||
# License: AGPL-3.0 (https://choosealicense.com/licenses/agpl-3.0/)
|
# License: AGPL-3.0 (https://choosealicense.com/licenses/agpl-3.0/)
|
||||||
###########################################################################################
|
###########################################################################################
|
||||||
# tag_OP.sh OPERATION ON G1TAG...
|
# tag_OP.sh OPERATION ON G1TAG...
|
||||||
|
@ -15,7 +15,7 @@
|
||||||
# QmUQcSjQx2bg4cSe2rUZyQi6F8QtJFJb74fWL7D784UWf9 2 TAG_n
|
# QmUQcSjQx2bg4cSe2rUZyQi6F8QtJFJb74fWL7D784UWf9 2 TAG_n
|
||||||
# QmdbdBWv4SygqaaeWHAvABiQAa3faf4ncfSyzRnx8BDdCc 20 TAG_nanodate
|
# QmdbdBWv4SygqaaeWHAvABiQAa3faf4ncfSyzRnx8BDdCc 20 TAG_nanodate
|
||||||
# QmbN6gNM2vjLj7yaJ6xJcySDxmuSK2eB9ZDv5dpj2bo5pM 47 TAG_nodeid
|
# QmbN6gNM2vjLj7yaJ6xJcySDxmuSK2eB9ZDv5dpj2bo5pM 47 TAG_nodeid
|
||||||
# QmXaMzRqhEs4cQMRN18FWaCeqGmrDBfV8hTkbfQuBCXnnA 1243 TAG_publishkey.swarm.crypt
|
# QmXaMzRqhEs4cQMRN18FWaCeqGmrDBfV8hTkbfQuBCXnnA 1243 TAG_publishkey.MASTER.crypt
|
||||||
# QmWHsRZCTSjSxnp1Qm8WcmHNNQTJwDS2ukLE7NTccc3Kp9 1304 TAG_publishkey.B.gpg
|
# QmWHsRZCTSjSxnp1Qm8WcmHNNQTJwDS2ukLE7NTccc3Kp9 1304 TAG_publishkey.B.gpg
|
||||||
# ...
|
# ...
|
||||||
# TAG_passenger, TAG_file is used to attach G1Tag to file.
|
# TAG_passenger, TAG_file is used to attach G1Tag to file.
|
||||||
|
@ -52,7 +52,7 @@ echo "__SUB:tag_OP.sh: LOG. SOURCE G1Tag OK!! GREAT... Retrieving it all: ipfs g
|
||||||
mkdir -p ./TAG/${JSOURCERR}; rm -f ./TAG/${JSOURCERR}/*
|
mkdir -p ./TAG/${JSOURCERR}; rm -f ./TAG/${JSOURCERR}/*
|
||||||
chown -R $YOU ./TAG/${JSOURCERR}/
|
chown -R $YOU ./TAG/${JSOURCERR}/
|
||||||
su $YOU -c "ipfs get --output=./TAG/${JSOURCERR}/ /ipns/$JSOURCE"
|
su $YOU -c "ipfs get --output=./TAG/${JSOURCERR}/ /ipns/$JSOURCE"
|
||||||
JSOURCEPUBLISHKEY="./TAG/${JSOURCERR}/TAG_publishkey.swarm.crypt"
|
JSOURCEPUBLISHKEY="./TAG/${JSOURCERR}/TAG_publishkey.MASTER.crypt"
|
||||||
JSOURCEVALUE=$(cat ./TAG/${JSOURCERR}/TAG_amount);
|
JSOURCEVALUE=$(cat ./TAG/${JSOURCERR}/TAG_amount);
|
||||||
|
|
||||||
#############################################
|
#############################################
|
||||||
|
@ -69,9 +69,7 @@ if [[ $FINALSOURCE -lt 0 ]]; then echo "__SUB:tag_OP.sh: KO. La valeur de ce G1T
|
||||||
if [[ -f $KEYFILE && ! -f "/home/$YOU/.ipfs/keystore/$JSOURCERR" ]]; then
|
if [[ -f $KEYFILE && ! -f "/home/$YOU/.ipfs/keystore/$JSOURCERR" ]]; then
|
||||||
./shell/natools.py decrypt -k "$KEYFILE" -i "$JSOURCEPUBLISHKEY" -o "/home/$YOU/.ipfs/keystore/$JSOURCERR"
|
./shell/natools.py decrypt -k "$KEYFILE" -i "$JSOURCEPUBLISHKEY" -o "/home/$YOU/.ipfs/keystore/$JSOURCERR"
|
||||||
else
|
else
|
||||||
if [[ ! -f $KEYFILE ]]; then
|
echo "__SUB:tag_OP.sh: KO. La clef $KEYFILE fournie pour ce G1Tag $JSOURCERR est inexistante. Contact: https://g1sms.fr"
|
||||||
echo "__SUB:tag_OP.sh: KO. La clef de dévérouillage pour $JSOURCERR est inexistante. Contact: https://g1sms.fr"
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#############################################
|
#############################################
|
||||||
|
@ -82,7 +80,7 @@ mkdir -p ./TAG/${JDESTRR}; rm -f ./TAG/${JDESTRR}/*
|
||||||
echo "__SUB:tag_OP.sh: LOG. Hey You get a G1Tag!! GREAT... ipfs get --output=./TAG/${JDESTRR}/ /ipns/$JDEST"
|
echo "__SUB:tag_OP.sh: LOG. Hey You get a G1Tag!! GREAT... ipfs get --output=./TAG/${JDESTRR}/ /ipns/$JDEST"
|
||||||
chown -R $YOU ./TAG/${JDESTRR}/
|
chown -R $YOU ./TAG/${JDESTRR}/
|
||||||
su $YOU -c "ipfs get --output=./TAG/${JDESTRR}/ /ipns/$JDEST"
|
su $YOU -c "ipfs get --output=./TAG/${JDESTRR}/ /ipns/$JDEST"
|
||||||
JDESTPUBLISHKEY="./TAG/${JDESTRR}/TAG_publishkey.swarm.crypt"
|
JDESTPUBLISHKEY="./TAG/${JDESTRR}/TAG_publishkey.MASTER.crypt"
|
||||||
JDESTVALUE=$(cat ./TAG/${JDESTRR}/TAG_amount);
|
JDESTVALUE=$(cat ./TAG/${JDESTRR}/TAG_amount);
|
||||||
FINALDEST=$(echo "${JDESTVALUE} + ${VALUE}" | bc -l)
|
FINALDEST=$(echo "${JDESTVALUE} + ${VALUE}" | bc -l)
|
||||||
# EXTRACT $JSOURCERR PUBLISH KEY to "/home/$YOU/.ipfs/keystore/JSOURCE"
|
# EXTRACT $JSOURCERR PUBLISH KEY to "/home/$YOU/.ipfs/keystore/JSOURCE"
|
||||||
|
@ -90,9 +88,7 @@ FINALDEST=$(echo "${JDESTVALUE} + ${VALUE}" | bc -l)
|
||||||
if [[ -f $KEYFILE && ! -f "/home/$YOU/.ipfs/keystore/$JDESTRR" ]]; then
|
if [[ -f $KEYFILE && ! -f "/home/$YOU/.ipfs/keystore/$JDESTRR" ]]; then
|
||||||
./shell/natools.py decrypt -k "$KEYFILE" -i "$JDESTPUBLISHKEY" -o "/home/$YOU/.ipfs/keystore/$JDESTRR"
|
./shell/natools.py decrypt -k "$KEYFILE" -i "$JDESTPUBLISHKEY" -o "/home/$YOU/.ipfs/keystore/$JDESTRR"
|
||||||
else
|
else
|
||||||
if [[ ! -f $KEYFILE ]]; then
|
echo "__SUB:tag_OP.sh: KO. La clef $KEYFILE fournie pour ce G1Tag $JDESTRR est inexistante. Be part of the G1sms+SWARM. https://g1sms.fr"
|
||||||
echo "__SUB:tag_OP.sh: KO. La clef de dévérouillage pour $JDESTRR est inexistante. Contact: https://g1sms.fr"
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
######################################################################################################
|
######################################################################################################
|
||||||
|
@ -160,9 +156,9 @@ fi
|
||||||
echo "__SUB:tag_OP.sh: DONE. G1Tag balance updated:
|
echo "__SUB:tag_OP.sh: DONE. G1Tag balance updated:
|
||||||
$JSOURCERR (/ipns/$JSOURCE) : $JSOURCEVALUE => $FINALSOURCE
|
$JSOURCERR (/ipns/$JSOURCE) : $JSOURCEVALUE => $FINALSOURCE
|
||||||
$JDESTRR (/ipns/$JSDEST) : $JDESTVALUE) => $FINALDEST"
|
$JDESTRR (/ipns/$JSDEST) : $JDESTVALUE) => $FINALDEST"
|
||||||
|
return 1
|
||||||
else
|
else
|
||||||
echo "__SUB:tag_OP.sh: NO OPERATION DONE"
|
echo "__SUB:tag_OP.sh: NO OPERATION DONE"
|
||||||
|
return 0
|
||||||
fi
|
fi
|
||||||
######################################################################################################
|
######################################################################################################
|
||||||
|
|