diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..cb98b6d --- /dev/null +++ b/.gitignore @@ -0,0 +1,6 @@ +g1sms.bfproject +g1sms.priv.key +shell/init.sh +*~ +wallets/ + diff --git a/config.sh b/config.sh index ebb5066..3d3e7d1 100755 --- a/config.sh +++ b/config.sh @@ -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 diff --git a/install.sh b/install.sh index 497f057..cfc1aa8 100755 --- a/install.sh +++ b/install.sh @@ -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 diff --git a/shell/init.sh.template b/shell/init.sh.template index 67098af..96b5137 100755 --- a/shell/init.sh.template +++ b/shell/init.sh.template @@ -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 diff --git a/sms_received.sh b/sms_received.sh index c9b4032..7ad4f64 100755 --- a/sms_received.sh +++ b/sms_received.sh @@ -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"&