Default SIM card change + RAZ cmd

This commit is contained in:
qo-op 2019-11-29 16:30:34 +01:00
parent 88817448ca
commit b9ef1d62a4
5 changed files with 19 additions and 9 deletions

6
.gitignore vendored Normal file
View File

@ -0,0 +1,6 @@
g1sms.bfproject
g1sms.priv.key
shell/init.sh
*~
wallets/

View File

@ -22,14 +22,15 @@ if [[ -f ./shell/init.sh.template && ! -f ./shell/init.sh ]]; then
read ADMINPHONE
if [[ "$ADMINPHONE" == "" ]]; then echo "IMPOSSIBLE DE CONTINUER"; exit; fi
echo "Le numéro de la carte SIM, du module SMS? (ex +33611223344)"
echo "Le numéro de la carte SIM, du module SMS. AUCUNE liaison SMS? Laissez vide (défaut: +33600000000)"
read MASTERPHONE
if [[ "$MASTERPHONE" == "" ]]; then MASTERPHONE="+33600000000"; fi
echo "L'adresse où se trouve votre G1Node pour indiquer où venir chercher ses G1Tag (ex: au G1FabLab de Toulouse)"
read ADRESSE
sed -i s/pi/$YOU/g ./shell/init.sh.template
sed -i s/+33660780131/$MASTERPHONE/g ./shell/init.sh.template
sed -i s/+33600000000/$MASTERPHONE/g ./shell/init.sh.template
sed -i s/au\ G1FabLab\ de\ Toulouse/$ADRESSE/g ./shell/init.sh.template
sed -i s/+33647683646/$ADMINPHONE/g ./shell/init.sh.template
sed -i s/Fred/$ADMINPSEUDO/g ./shell/init.sh.template

View File

@ -42,9 +42,9 @@ if [ ! -d ./G1sms+ ]; then
read ADMINPHONE
if [[ "$ADMINPHONE" == "" ]]; then ADMINPHONE="+33647683646"; fi
echo "Le numéro de la carte SIM, du module SMS. AUCUNE liaison SMS? Laissez vide (défaut: +33611223344)"
echo "Le numéro de la carte SIM, du module SMS. AUCUNE liaison SMS? Laissez vide (défaut: +33600000000)"
read MASTERPHONE
if [[ "$MASTERPHONE" == "" ]]; then MASTERPHONE="+33611223344"; fi
if [[ "$MASTERPHONE" == "" ]]; then MASTERPHONE="+33600000000"; fi
# TODO ASK for GeoPoint
echo "L'adresse où se trouve votre G1Node pour indiquer où venir chercher les G1Tag imprimés (ex: au G1FabLab de Toulouse)"
@ -52,7 +52,7 @@ if [ ! -d ./G1sms+ ]; then
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/+33600000000/$MASTERPHONE/g /home/$YOU/G1sms+/shell/init.sh
sed -i s/au\ G1FabLab\ de\ Toulouse/$ADRESSE/g /home/$YOU/G1sms+/shell/init.sh
sed -i s/+33647683646/$ADMINPHONE/g /home/$YOU/G1sms+/shell/init.sh
sed -i s/Fred/$ADMINPSEUDO/g /home/$YOU/G1sms+/shell/init.sh

View File

@ -61,7 +61,7 @@ fi
export NODECOMM=10
##################################################################
# SMS SIM Card Phone Number
export MASTERPHONE="+33660780131"
export MASTERPHONE="+33600000000"
export ADRESSE="au G1FabLab de Toulouse"
export G1DAB="NO"
##################################################################
@ -73,7 +73,7 @@ fi
export DUNITER="https://g1.duniter.org"
export CESIUM="https://g1.data.le-sou.org"
# TODO Use latest Silkaj from "sudo pip3 install silkaj"
# TODO Use latest Silkaj from "sudo fredp3 install silkaj"
# export SILKAJ="/usr/local/bin/silkaj"
source $CHEMIN/shell/init_keys.sh

View File

@ -62,7 +62,7 @@ ipfs_swarm_wallets_refresh
##################################################################
# Check if PHONE is already registred in G1sms+ SWARM
##################################################################
if [[ -f "./wallets_swarm/$PHONE/MASTERPHONE.sms" && "$CMD" != "ADMIN" ]]
if [[ ! -f "./wallets/$PHONE/MASTERPHONE.sms" && "$CMD" != "ADMIN" ]]
then
NODEPHONE=$(cat "./wallets_swarm/$PHONE/MASTERPHONE.sms")
if [[ "$NODEPHONE" != "$MASTERPHONE" && "$NODEPHONE" != "" ]]; then
@ -70,13 +70,16 @@ then
log "ALERT!! $PHONE compte existant sur le NODE G1sms+ ($NODEPHONE)"
exit
fi
else
# Refresh MasterPhone (usefull in case of MASTERPHONE SIM number change)
echo "$MASTERPHONE" > "./wallets/$PHONE/MASTERPHONE.sms"
fi
##################################################################
# Handle commands CMD
##################################################################
case "$CMD" in
DESTROY)
DESTROY|RAZ)
# SEND DESTROY Member or DESTROY DON to empty you PHONE wallet and remove it
MEMBERUID=$(echo "$TEXT" | awk '{print $2}' | grep -E "([A-Za-z0-9\-\_]+$)")
./shell/sms_DESTROY.sh "$PHONE" "$MEMBERUID"&