grep -rl '~/.zen' ./ | xargs sed -i 's/~/.zen//home/$YOU/.zen/g'

This commit is contained in:
qo-op 2020-05-11 07:04:18 +02:00
parent a07334d544
commit 4c202cafe1
20 changed files with 163 additions and 160 deletions

View File

@ -14,12 +14,12 @@ IPFSNODEID=$(su $YOU -c "ipfs id -f='<id>\n'")
NANODATE=$(date -u +%s%N) #1569692075385428020 NANODATE=$(date -u +%s%N) #1569692075385428020
# PROTECT from null HASH # PROTECT from null HASH
for tag in ~/.zen/ipfs/.$IPFSNODEID/TAG/*; do for tag in /home/$YOU/.zen/ipfs/.$IPFSNODEID/TAG/*; do
function rmtag () { function rmtag () {
echo "__SUB:cron_G1TAG_REFRESH.sh: rm -Rf ~/.zen/ipfs/.$IPFSNODEID/TAG/${tagj}" echo "__SUB:cron_G1TAG_REFRESH.sh: rm -Rf /home/$YOU/.zen/ipfs/.$IPFSNODEID/TAG/${tagj}"
rm -Rf ./TAG/${tagj} rm -Rf ./TAG/${tagj}
rm -f ~/.zen/ipfs/.$IPFSNODEID/TAG/${tagj} rm -f /home/$YOU/.zen/ipfs/.$IPFSNODEID/TAG/${tagj}
rm -f ~/.zen/ipfs_swarm/.$IPFSNODEID/TAG/${tagj} rm -f /home/$YOU/.zen/ipfs_swarm/.$IPFSNODEID/TAG/${tagj}
rm -f ~/.ipfs/keystore/${tagj} rm -f ~/.ipfs/keystore/${tagj}
} }

View File

@ -16,7 +16,7 @@ echo "" > /tmp/VIR
TODAY=$(date '+%Y%m%d') TODAY=$(date '+%Y%m%d')
log "__SUB:cron_VIR.reccurent.sh: Searching payements to do for $TODAY" log "__SUB:cron_VIR.reccurent.sh: Searching payements to do for $TODAY"
for file in ~/.zen/g1sms_wallets/*/VIREMENTS.gpg ; do for file in /home/$YOU/.zen/g1sms_wallets/*/VIREMENTS.gpg ; do
if [[ -f $file ]]; then if [[ -f $file ]]; then
log "__SUB:cron_VIR.reccurent.sh: FOUND $file decrypting with Node key" log "__SUB:cron_VIR.reccurent.sh: FOUND $file decrypting with Node key"
echo "${IPFSPrivKey}" | gpg -d -q --output "/tmp/VIREMENTS" --yes --pinentry-mode loopback --passphrase-fd 0 "$file" echo "${IPFSPrivKey}" | gpg -d -q --output "/tmp/VIREMENTS" --yes --pinentry-mode loopback --passphrase-fd 0 "$file"
@ -56,10 +56,10 @@ while read line
done < /tmp/VIR$TODAY done < /tmp/VIR$TODAY
# CHECK FOR LAST VIREMENTS AND CLEAN IT? # CHECK FOR LAST VIREMENTS AND CLEAN IT?
for virfile in "~/.zen/g1sms_wallets/*/VIREMENTS.gpg"; do for virfile in "/home/$YOU/.zen/g1sms_wallets/*/VIREMENTS.gpg"; do
phone=$(echo $virfile | cut -d '/' -f 3) phone=$(echo $virfile | cut -d '/' -f 3)
if [[ "$phone" == "*" ]]; then exit; fi if [[ "$phone" == "*" ]]; then exit; fi
echo "${IPFSPrivKey}" | gpg -d -q --output "/tmp/$phone.VIREMENTS" --yes --pinentry-mode loopback --passphrase-fd 0 "~/.zen/g1sms_wallets/$phone/VIREMENTS.gpg" echo "${IPFSPrivKey}" | gpg -d -q --output "/tmp/$phone.VIREMENTS" --yes --pinentry-mode loopback --passphrase-fd 0 "/home/$YOU/.zen/g1sms_wallets/$phone/VIREMENTS.gpg"
nv=0; tot=0; nv=0; tot=0;
while read ligne while read ligne
do virs=(${ligne}); do virs=(${ligne});
@ -74,8 +74,8 @@ for virfile in "~/.zen/g1sms_wallets/*/VIREMENTS.gpg"; do
if [[ $nv -eq 0 ]]; then if [[ $nv -eq 0 ]]; then
log "__SUB:cron_VIR.reccurent.sh: Plus AUCUN payement récurrent !!" log "__SUB:cron_VIR.reccurent.sh: Plus AUCUN payement récurrent !!"
sms_SEND "$phone" "Plus AUCUN payement récurrent" sms_SEND "$phone" "Plus AUCUN payement récurrent"
rm -f "~/.zen/g1sms_wallets/$phone/VIREMENTS.gpg" rm -f "/home/$YOU/.zen/g1sms_wallets/$phone/VIREMENTS.gpg"
rm -f "~/.zen/g1sms_wallets/$phone/VIREMENTS" rm -f "/home/$YOU/.zen/g1sms_wallets/$phone/VIREMENTS"
I=$(ipfs_node_wallets_add) I=$(ipfs_node_wallets_add)
else else
log "__SUB:cron_VIR.reccurent.sh: Encore $nv payements récurrents à réaliser pour $tot G1" log "__SUB:cron_VIR.reccurent.sh: Encore $nv payements récurrents à réaliser pour $tot G1"

View File

@ -10,18 +10,21 @@ MY_PATH="`dirname \"$0\"`" # relative
MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized
YOU=$(ps auxf --sort=+utime | grep -w ipfs | grep -v -E 'color=auto|grep' | tail -n 1 | cut -d " " -f 1); YOU=$(ps auxf --sort=+utime | grep -w ipfs | grep -v -E 'color=auto|grep' | tail -n 1 | cut -d " " -f 1);
IPFSNODEID=$(ipfs id -f='<id>\n') [[ $USER == $YOU ]] && IPFSNODEID=$(ipfs id -f='<id>\n') \
|| IPFSNODEID=$(su $YOU -c "ipfs id -f='<id>\n'") # CASE root
NANODATE=$(date -u +%s%N) #1569692075385428020 NANODATE=$(date -u +%s%N) #1569692075385428020
## IS IT A SMS NODE (gammu-smsd is installed)?? ## IS IT A SMS NODE (gammu-smsd is installed)??
if [[ $(which gammu-smsd) ]]; then if [[ $(which gammu-smsd) ]]; then
[[ ! $MASTERPHONE ]] && echo "MISSING MASTERPHONE run from init.sh" && exit 1 [[ ! $MASTERPHONE ]] && echo "MISSING MASTERPHONE run from init.sh" && exit 1
echo $MASTERPHONE > ~/.zen/ipfs/.$IPFSNODEID/G1SSB/_sms echo $MASTERPHONE > /home/$YOU/.zen/ipfs/.$IPFSNODEID/G1SSB/_sms
else else
if [ -f ~/.zen/ipfs/.$IPFSNODEID/G1SSB/_sms ]; then rm -f ~/.zen/ipfs/.$IPFSNODEID/G1SSB/_sms; fi if [ -f /home/$YOU/.zen/ipfs/.$IPFSNODEID/G1SSB/_sms ]; then rm -f /home/$YOU/.zen/ipfs/.$IPFSNODEID/G1SSB/_sms; fi
fi fi
NODE_G1PUBKEY=$(cat ~/.ssb/secret.dunikey | grep 'pub:' | cut -d ' ' -f 2) NODE_G1PUBKEY=$(cat /home/$YOU/.ssb/secret.dunikey | grep 'pub:' | cut -d ' ' -f 2)
[[ $NODE_G1PUBKEY == "" ]] && echo "ERROR NODE_G1PUBKEY empty !! Please INIT SSB LAYER..." && exit 1 [[ $NODE_G1PUBKEY == "" ]] && echo "ERROR NODE_G1PUBKEY empty !! Please INIT SSB LAYER..." && exit 1
@ -52,7 +55,7 @@ Formed with 24 first char IPFS .Identity.PrivKey
Used as gpg symetric key (soon deprecated?) Used as gpg symetric key (soon deprecated?)
' '
################################################################## ##################################################################
IPFSPrivKey=$(cat ~/.ipfs/config | jq -r '.Identity.PrivKey') #" IPFSPrivKey=$(cat /home/$YOU/.ipfs/config | jq -r '.Identity.PrivKey') #"
export IPFSPrivKey="${IPFSPrivKey:0:24}" # export IPFSPrivKey="${IPFSPrivKey:0:24}" #
if [ ! $IPFSPrivKey ]; then echo "FATAL ERROR:: IPFS Node.Identity.PrivKey IPFSPrivKey EMPTY"; exit; fi if [ ! $IPFSPrivKey ]; then echo "FATAL ERROR:: IPFS Node.Identity.PrivKey IPFSPrivKey EMPTY"; exit; fi
@ -63,18 +66,18 @@ if [ ! $IPFSPrivKey ]; then echo "FATAL ERROR:: IPFS Node.Identity.PrivKey IPFSP
# #
# ONE TIME GIVE NODE_UIDNA # ONE TIME GIVE NODE_UIDNA
if [[ ! -f ~/.zen/ipfs/.$IPFSNODEID/G1SSB/_uidna ]]; then if [[ ! -f /home/$YOU/.zen/ipfs/.$IPFSNODEID/G1SSB/_uidna ]]; then
# CREATE NODE G1 KEYS AND FILES # CREATE NODE G1 KEYS AND FILES
mkdir -p ~/.zen/ipfs/.$IPFSNODEID/TASK mkdir -p /home/$YOU/.zen/ipfs/.$IPFSNODEID/TASK
#################################################################### ####################################################################
# GIVE NAME TO NODE G1 WALLET: "6789diceware" # GIVE NAME TO NODE G1 WALLET: "6789diceware"
# And write ~/.zen/g1sms_wallets/.Qm***/G1SSB/(_files) # And write /home/$YOU/.zen/g1sms_wallets/.Qm***/G1SSB/(_files)
#################################################################### ####################################################################
PRE=${ADMINPHONE:8:4} PRE=${ADMINPHONE:8:4}
ZUID=$(~/.zen/astroport/zen/tools/diceware.sh 1 | xargs) ZUID=$(/home/$YOU/.zen/astroport/zen/tools/diceware.sh 1 | xargs)
# Check if already existing among all swarm wallets G1SSB or G1SMS # Check if already existing among all swarm wallets G1SSB or G1SMS
while [[ $(grep -Rwl "$PRE$ZUID" ~/.zen/ipfs_swarm/.*/*/_uidna 2>/dev/null) ]]; do ZUID=$(~/.zen/astroport/zen/tools/diceware.sh 1 | xargs); done while [[ $(grep -Rwl "$PRE$ZUID" /home/$YOU/.zen/ipfs_swarm/.*/*/_uidna 2>/dev/null) ]]; do ZUID=$(/home/$YOU/.zen/astroport/zen/tools/diceware.sh 1 | xargs); done
NODE_UIDNA="$PRE$ZUID" NODE_UIDNA="$PRE$ZUID"
echo " echo "
@ -86,22 +89,22 @@ echo "
$NODE_UIDNA $NODE_UIDNA
" "
if [[ -f ~/.zen/secret.astroport.key ]]; then if [[ -f /home/$YOU/.zen/secret.astroport.key ]]; then
#[[ ! $(cat ~/.zen/secret.astroport.key | grep -F 'NODE_UIDNA' )]] #[[ ! $(cat /home/$YOU/.zen/secret.astroport.key | grep -F 'NODE_UIDNA' )]]
echo "IPFSNODEID=$IPFSNODEID" >> ~/.zen/secret.astroport.key echo "IPFSNODEID=$IPFSNODEID" >> /home/$YOU/.zen/secret.astroport.key
echo "NODE_UIDNA=$NODE_UIDNA" >> ~/.zen/secret.astroport.key echo "NODE_UIDNA=$NODE_UIDNA" >> /home/$YOU/.zen/secret.astroport.key
else else
echo "ERROR NO ~/.zen/secret.astroport.key !!" && exit 1 echo "ERROR NO /home/$YOU/.zen/secret.astroport.key !!" && exit 1
fi fi
chmod 400 ~/.zen/secret.astroport.key chmod 400 /home/$YOU/.zen/secret.astroport.key
source ~/.zen/secret.astroport.key source /home/$YOU/.zen/secret.astroport.key
# WRITE NODE_UIDNA # WRITE NODE_UIDNA
echo "$NODE_UIDNA" > ~/.zen/ipfs/.$IPFSNODEID/G1SSB/_uidna ####### _uidna echo "$NODE_UIDNA" > /home/$YOU/.zen/ipfs/.$IPFSNODEID/G1SSB/_uidna ####### _uidna
echo $IPFSNODEID > ~/.zen/ipfs/.$IPFSNODEID/G1SSB/_ipfs.id ####### _ipfs.id echo $IPFSNODEID > /home/$YOU/.zen/ipfs/.$IPFSNODEID/G1SSB/_ipfs.id ####### _ipfs.id
echo $NANODATE > ~/.zen/ipfs/.$IPFSNODEID/G1SSB/_nanodate ####### _nanodate echo $NANODATE > /home/$YOU/.zen/ipfs/.$IPFSNODEID/G1SSB/_nanodate ####### _nanodate
############ If sudo without password activated (Raspbian) ############ If sudo without password activated (Raspbian)
# SYSTEM MODIFY hosts & hostname ########################### # SYSTEM MODIFY hosts & hostname ###########################
@ -111,13 +114,13 @@ $NODE_UIDNA
############################################################ ############################################################
# TODO rewrite AUTO BACKUP / RESTORE # TODO rewrite AUTO BACKUP / RESTORE
# tools/natools.py encrypt -p $NODE_G1PUBKEY -i "./authfile" -o "~/.zen/ipfs/.$IPFSNODEID/G1SSB/_authfile.swarm.crypt" # tools/natools.py encrypt -p $NODE_G1PUBKEY -i "./authfile" -o "/home/$YOU/.zen/ipfs/.$IPFSNODEID/G1SSB/_authfile.swarm.crypt"
# SILKAJ INIT G1 NODE WALLET TODO ACTIVATE # SILKAJ INIT G1 NODE WALLET TODO ACTIVATE
#duniter_server=$(./tools/duniter_getnode.sh) #duniter_server=$(./tools/duniter_getnode.sh)
#TX_IN=$(silkaj -p "$duniter_server" -af --file ~/.ssb/secret.dunikey tx --output $SWARM_G1PUBKEY --amount 3.24 --comment "[A.Station] G1SSBIPF ($ADMINPSEUDO) $NODE_UIDNA $IPFSNODEID" -y) #TX_IN=$(silkaj -p "$duniter_server" -af --file /home/$YOU/.ssb/secret.dunikey tx --output $SWARM_G1PUBKEY --amount 3.24 --comment "[A.Station] G1SSBIPF ($ADMINPSEUDO) $NODE_UIDNA $IPFSNODEID" -y)
log "__SUB:initkeys.sh: [ADMIN] NODE G1sms+ $NODE_UIDNA : ls ~/.zen/ipfs/.$IPFSNODEID" log "__SUB:initkeys.sh: [ADMIN] NODE G1sms+ $NODE_UIDNA : ls /home/$YOU/.zen/ipfs/.$IPFSNODEID"
if [[ $G1SMS == "YES" ]]; then if [[ $G1SMS == "YES" ]]; then
echo "SENDING SMS to $ADMINPHONE" echo "SENDING SMS to $ADMINPHONE"
sudo gammu-smsd-inject -l TEXT "$ADMINPHONE" -text "[ADMIN] G1sms+ NODE $NODE_UIDNA ($IPFSNODEID)" 1>&2 sudo gammu-smsd-inject -l TEXT "$ADMINPHONE" -text "[ADMIN] G1sms+ NODE $NODE_UIDNA ($IPFSNODEID)" 1>&2
@ -127,19 +130,19 @@ $NODE_UIDNA
fi fi
# COHERENCE TEST # COHERENCE TEST
[[ -f ~/.zen/secret.astroport.key ]] && source ~/.zen/secret.astroport.key || echo "Missing ~/.zen/secret.astroport.key" || exit 1 [[ -f /home/$YOU/.zen/secret.astroport.key ]] && source /home/$YOU/.zen/secret.astroport.key || echo "Missing /home/$YOU/.zen/secret.astroport.key" || exit 1
[[ -f ~/.zen/ipfs/.$IPFSNODEID/G1SSB/_uidna ]] && NODE_UIDNA=$(cat ~/.zen/ipfs/.$IPFSNODEID/G1SSB/_uidna)|| echo "Missing _uidna" || exit 1 [[ -f /home/$YOU/.zen/ipfs/.$IPFSNODEID/G1SSB/_uidna ]] && NODE_UIDNA=$(cat /home/$YOU/.zen/ipfs/.$IPFSNODEID/G1SSB/_uidna)|| echo "Missing _uidna" || exit 1
## INIT NODE G1 PUB & PRIV KEY ## INIT NODE G1 PUB & PRIV KEY
NODE_G1PUBKEY=$ZENG1 NODE_G1PUBKEY=$ZENG1
[[ ! $NODE_G1PUBKEY ]] && echo "Missing NODE_G1PUBKEY" && exit 1 [[ ! $NODE_G1PUBKEY ]] && echo "Missing NODE_G1PUBKEY" && exit 1
NODE_PUBSECFILE="~/.ssb/secret.dunikey" NODE_PUBSECFILE="/home/$YOU/.ssb/secret.dunikey"
[[ ! $NODE_PUBSECFILE ]] && echo "Missing NODE_PUBSECFILE" && exit 1 [[ ! $NODE_PUBSECFILE ]] && echo "Missing NODE_PUBSECFILE" && exit 1
########################################################## ##########################################################
# MEMORIZE NODE NANODATE EXECUTION TIME (for ntpdate regular sync) # MEMORIZE NODE NANODATE EXECUTION TIME (for ntpdate regular sync)
if [[ -f ~/.zen/ipfs/.$IPFSNODEID/G1SSB/_nanodate ]]; then if [[ -f /home/$YOU/.zen/ipfs/.$IPFSNODEID/G1SSB/_nanodate ]]; then
last=$(cat ~/.zen/ipfs/.$IPFSNODEID/G1SSB/_nanodate) last=$(cat /home/$YOU/.zen/ipfs/.$IPFSNODEID/G1SSB/_nanodate)
timediff=$( echo "${NANODATE} - ${last}" | bc -l ) timediff=$( echo "${NANODATE} - ${last}" | bc -l )
# NODE TIME SYNC 600 milliards de nanosecondes = 600 s = 10 mn # NODE TIME SYNC 600 milliards de nanosecondes = 600 s = 10 mn
if [[ $timediff -gt 600000000000 ]]; then if [[ $timediff -gt 600000000000 ]]; then
@ -148,7 +151,7 @@ if [[ -f ~/.zen/ipfs/.$IPFSNODEID/G1SSB/_nanodate ]]; 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 > ~/.zen/ipfs/.$IPFSNODEID/G1SSB/_nanodate echo $NANODATE > /home/$YOU/.zen/ipfs/.$IPFSNODEID/G1SSB/_nanodate
fi fi
################################################################ ################################################################
@ -158,9 +161,9 @@ fi
if [[ -e "/dev/usb/lp0" ]]; then if [[ -e "/dev/usb/lp0" ]]; then
log "G1CORE: IMPRESSION G1Tag ACTIF .............." log "G1CORE: IMPRESSION G1Tag ACTIF .............."
export PRINT=true export PRINT=true
echo "$ADRESSE" > ~/.zen/ipfs/.$IPFSNODEID/G1SSB/_where echo "$ADRESSE" > /home/$YOU/.zen/ipfs/.$IPFSNODEID/G1SSB/_where
else else
rm -f ~/.zen/ipfs/.$IPFSNODEID/G1SSB/_where rm -f /home/$YOU/.zen/ipfs/.$IPFSNODEID/G1SSB/_where
fi fi
echo ' echo '
@ -170,6 +173,6 @@ echo '
___/ /| |/ |/ / ___ |/ _, _/ / / / / / /_/ / ___/ /| |/ |/ / ___ |/ _, _/ / / / / / /_/ /
/____/ |__/|__/_/ |_/_/ |_/_/ /_/ /_/\__,_/ /____/ |__/|__/_/ |_/_/ |_/_/ /_/ /_/\__,_/
loaded loaded
~/.zen/secret.astroport.key /home/$YOU/.zen/secret.astroport.key
' '
ls -a ~/.zen/ipfs/.$IPFSNODEID/G1SSB/ ls -a /home/$YOU/.zen/ipfs/.$IPFSNODEID/G1SSB/

View File

@ -4,7 +4,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/)
################################################################################ ################################################################################
# TODO: Before June 2020: Get "~/.zen/g1billets/$bpath/note.authfile.IPFSPrivKey.gpg" for automatic Payback # TODO: Before June 2020: Get "/home/$YOU/.zen/g1billets/$bpath/note.authfile.IPFSPrivKey.gpg" for automatic Payback
# Search for old G1Billets for final CHK : Forget & Transfer G1 ? # Search for old G1Billets for final CHK : Forget & Transfer G1 ?
source ./init.sh source ./init.sh
source ./functions.sh source ./functions.sh

View File

@ -21,10 +21,10 @@ case "$CMD" in
# Get it from first MESSAGE message word... # Get it from first MESSAGE message word...
towoo=$(echo $MESSAGE | cut -d ' ' -f 1) towoo=$(echo $MESSAGE | cut -d ' ' -f 1)
SEARCH=$(grep -Rwl "$towoo" ~/.zen/ipfs_swarm/*/_uidna* | tail -n 1 | cut -f 6 -d '/') SEARCH=$(grep -Rwl "$towoo" /home/$YOU/.zen/ipfs_swarm/*/_uidna* | tail -n 1 | cut -f 6 -d '/')
if [[ "$SEARCH" != "" ]]; then if [[ "$SEARCH" != "" ]]; then
REMOTENODE=$(cat ~/.zen/ipfs_swarm/$SEARCH/MASTERPHONE.sms) REMOTENODE=$(cat /home/$YOU/.zen/ipfs_swarm/$SEARCH/MASTERPHONE.sms)
DESTRIB=$(cat ~/.zen/ipfs_swarm/$SEARCH/_pub) DESTRIB=$(cat /home/$YOU/.zen/ipfs_swarm/$SEARCH/_pub)
DESTPHONE=$SEARCH DESTPHONE=$SEARCH
log "__SUB:sms_ADMIN.sh: FOUND $towoo on NODE ($REMOTENODE) G1sms+ wallet: $DESTRIB : $DESTPHONE)" log "__SUB:sms_ADMIN.sh: FOUND $towoo on NODE ($REMOTENODE) G1sms+ wallet: $DESTRIB : $DESTPHONE)"
@ -37,7 +37,7 @@ case "$CMD" in
MEM) MEM)
log "__SUB:sms_ADMIN.sh: Send $MESSAGE message to All NODE members" log "__SUB:sms_ADMIN.sh: Send $MESSAGE message to All NODE members"
for f in ~/.zen/g1sms_wallets/*/_uidname; do for f in /home/$YOU/.zen/g1sms_wallets/*/_uidname; do
uid=$(cat $f); uid=$(cat $f);
num=$(echo $f | cut -d '/' -f 6); num=$(echo $f | cut -d '/' -f 6);
if [[ "$num" == "$ADMINPHONE" || "$num" == "$MASTERPHONE" ]]; then continue; fi if [[ "$num" == "$ADMINPHONE" || "$num" == "$MASTERPHONE" ]]; then continue; fi
@ -45,19 +45,19 @@ case "$CMD" in
sms_SEND "$num" "$uid, $MESSAGE" sms_SEND "$num" "$uid, $MESSAGE"
sleep 5 sleep 5
done done
sms_SEND "$ADMINPHONE" "ADMIN! Message envoyé aux $(cat ~/.zen/g1sms_wallets/*/*.uidname | wc -l) membres de ce NODE" sms_SEND "$ADMINPHONE" "ADMIN! Message envoyé aux $(cat /home/$YOU/.zen/g1sms_wallets/*/*.uidname | wc -l) membres de ce NODE"
;; ;;
ALL) ALL)
log "__SUB:sms_ADMIN.sh: Send $MESSAGE message to All NODE G1sms wallets" log "__SUB:sms_ADMIN.sh: Send $MESSAGE message to All NODE G1sms wallets"
for f in ~/.zen/g1sms_wallets/*; do for f in /home/$YOU/.zen/g1sms_wallets/*; do
num=$(echo $f | cut -d '/' -f 6); num=$(echo $f | cut -d '/' -f 6);
if [[ "$num" == "$ADMINPHONE" || "$num" == "$MASTERPHONE" ]]; then continue; fi if [[ "$num" == "$ADMINPHONE" || "$num" == "$MASTERPHONE" ]]; then continue; fi
log "__SUB:sms_ADMIN.sh: Send SMS to $num" log "__SUB:sms_ADMIN.sh: Send SMS to $num"
sms_SEND "$num" "$MESSAGE" sms_SEND "$num" "$MESSAGE"
sleep 5 sleep 5
done done
sms_SEND "$ADMINPHONE" "ADMIN! Message envoyé aux $(ls ~/.zen/g1sms_wallets/ | cut -d '/' -f3 | wc -l) possesseur de G1sms Wallets de ce NODE" sms_SEND "$ADMINPHONE" "ADMIN! Message envoyé aux $(ls /home/$YOU/.zen/g1sms_wallets/ | cut -d '/' -f3 | wc -l) possesseur de G1sms Wallets de ce NODE"
;; ;;
*) *)

View File

@ -7,7 +7,7 @@
MY_PATH="`dirname \"$0\"`" # relative MY_PATH="`dirname \"$0\"`" # relative
MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized
cd ~/.zen/astroport/g1sms/ cd /home/$YOU/.zen/astroport/g1sms/
source ./init.sh source ./init.sh
source ./functions.sh source ./functions.sh

View File

@ -66,7 +66,7 @@ log "__SUB:sms_BILLET.sh: TEST : $VIR < $MIN ? $testmin"
if [[ "$testmin" -eq "1" ]] if [[ "$testmin" -eq "1" ]]
then then
# Clean MEMBER directory # Clean MEMBER directory
rm -f ~/.zen/g1billets/MEMBERS/$MEMBER/*.jpg rm -f /home/$YOU/.zen/g1billets/MEMBERS/$MEMBER/*.jpg
boucle=0; boucle=0;
while [ $boucle -lt $NBbillets ] while [ $boucle -lt $NBbillets ]
do do
@ -75,7 +75,7 @@ then
bpath=$(echo $NUMBER | sed 's/ /_/g') bpath=$(echo $NUMBER | sed 's/ /_/g')
# Cas d'un billet existant # Cas d'un billet existant
while [ -d "~/.zen/g1billets/$bpath" ] while [ -d "/home/$YOU/.zen/g1billets/$bpath" ]
do do
NUMBER=$(./diceware.sh 2 | xargs) NUMBER=$(./diceware.sh 2 | xargs)
bpath=$(echo $NUMBER | sed 's/ /_/g') bpath=$(echo $NUMBER | sed 's/ /_/g')
@ -91,28 +91,28 @@ then
BILLETPUBKEY=$(python3 ./tools/key_create_dunikey.py "$NUMBER" "$SECRET") BILLETPUBKEY=$(python3 ./tools/key_create_dunikey.py "$NUMBER" "$SECRET")
# COPY authfile for Usage in 6 month... # COPY authfile for Usage in 6 month...
log "__SUB:sms_BILLET.sh: authfile KEY : ~/.zen/g1billets/$bpath/note.dunikey.IPFSPrivKey.gpg" log "__SUB:sms_BILLET.sh: authfile KEY : /home/$YOU/.zen/g1billets/$bpath/note.dunikey.IPFSPrivKey.gpg"
mkdir -p "~/.zen/g1billets/$bpath" mkdir -p "/home/$YOU/.zen/g1billets/$bpath"
echo "${IPFSPrivKey}" | gpg -q --output "~/.zen/g1billets/$bpath/note.dunikey.IPFSPrivKey.gpg" --yes --pinentry-mode loopback --symmetric --passphrase-fd 0 "/tmp/secret.dunikey" echo "${IPFSPrivKey}" | gpg -q --output "/home/$YOU/.zen/g1billets/$bpath/note.dunikey.IPFSPrivKey.gpg" --yes --pinentry-mode loopback --symmetric --passphrase-fd 0 "/tmp/secret.dunikey"
./natools.py encrypt -p $NODE_G1PUBKEY -i "/tmp/secret.dunikey" -o "~/.zen/g1billets/$bpath/note.dunikey.$NODE_UIDNA.crypt" ./natools.py encrypt -p $NODE_G1PUBKEY -i "/tmp/secret.dunikey" -o "/home/$YOU/.zen/g1billets/$bpath/note.dunikey.$NODE_UIDNA.crypt"
rm -f /tmp/secret.dunikey rm -f /tmp/secret.dunikey
log_history $PHONE "G1BILLET, $TRANSAC, $BILLETPUBKEY" log_history $PHONE "G1BILLET, $TRANSAC, $BILLETPUBKEY"
sleep 3 sleep 3
# Fill BILLET with TRANSAC amount # Fill BILLET with TRANSAC amount
duniter_server=$(./tools/duniter_getnode.sh) duniter_server=$(./tools/duniter_getnode.sh)
PAY=$(silkaj -p "$duniter_server" -af --file ~/.zen/g1sms_wallets/$PHONE/secret.dunikey tx --output "$BILLETPUBKEY" --amount "$TRANSAC" --comment "[G1sms+] G1Billet $NUMBER" -y) PAY=$(silkaj -p "$duniter_server" -af --file /home/$YOU/.zen/g1sms_wallets/$PHONE/secret.dunikey tx --output "$BILLETPUBKEY" --amount "$TRANSAC" --comment "[G1sms+] G1Billet $NUMBER" -y)
if [[ "$(echo $PAY | grep 'successful')" != "" && "$PAY" != "" ]]; then if [[ "$(echo $PAY | grep 'successful')" != "" && "$PAY" != "" ]]; then
# NOTES ARE FILES STORED IN DICEWARE COMPOSED SUBDIR # NOTES ARE FILES STORED IN DICEWARE COMPOSED SUBDIR
echo "$(date +%Y%m%d)" > "~/.zen/g1billets/$bpath/note.creationdate" echo "$(date +%Y%m%d)" > "/home/$YOU/.zen/g1billets/$bpath/note.creationdate"
echo "$MEMBER" > "~/.zen/g1billets/$bpath/note.creator" echo "$MEMBER" > "/home/$YOU/.zen/g1billets/$bpath/note.creator"
echo "$MEMRIB" > "~/.zen/g1billets/$bpath/note.memrib" echo "$MEMRIB" > "/home/$YOU/.zen/g1billets/$bpath/note.memrib"
echo "$NUMBER" > "~/.zen/g1billets/$bpath/note.number" echo "$NUMBER" > "/home/$YOU/.zen/g1billets/$bpath/note.number"
echo "$PHONE" > "~/.zen/g1billets/$bpath/note.phone" echo "$PHONE" > "/home/$YOU/.zen/g1billets/$bpath/note.phone"
echo "$SECRET" > "~/.zen/g1billets/$bpath/note.secret" echo "$SECRET" > "/home/$YOU/.zen/g1billets/$bpath/note.secret"
echo "$VALbillet" > "~/.zen/g1billets/$bpath/note.love" echo "$VALbillet" > "/home/$YOU/.zen/g1billets/$bpath/note.love"
echo "$TRANSAC" > "~/.zen/g1billets/$bpath/note.g1" echo "$TRANSAC" > "/home/$YOU/.zen/g1billets/$bpath/note.g1"
echo "$BILLETPUBKEY" > "~/.zen/g1billets/$bpath/note.pubkey" echo "$BILLETPUBKEY" > "/home/$YOU/.zen/g1billets/$bpath/note.pubkey"
log "Remplissage: $TRANSAC G1... $BILLETPUBKEY = $PAY" log "Remplissage: $TRANSAC G1... $BILLETPUBKEY = $PAY"
# CREATION FICHIER IMAGE BILLET # CREATION FICHIER IMAGE BILLET
@ -125,8 +125,8 @@ then
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 # Copy & Send produced files
zip /tmp/$PHONE_Bills_$bpath.zip ~/.zen/g1billets/MEMBERS/$MEMBER/*.* zip /tmp/$PHONE_Bills_$bpath.zip /home/$YOU/.zen/g1billets/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 ~/.zen/g1billets/MEMBERS/$MEMBER/ && log "__SUB:sms_BILLET.sh: ALERT sent....." 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 /home/$YOU/.zen/g1billets/MEMBERS/$MEMBER/ && log "__SUB:sms_BILLET.sh: ALERT sent....."
log "__SUB:sms_BILLET.sh: ERROR SILKAJ $(cat ./silkaj/src/constants.py)" log "__SUB:sms_BILLET.sh: ERROR SILKAJ $(cat ./silkaj/src/constants.py)"
exit exit
@ -135,12 +135,12 @@ then
# + G1SMS Commission # + G1SMS Commission
sleep 2 sleep 2
COM=$(silkaj -p "$duniter_server" -af --file ~/.zen/g1sms_wallets/$PHONE/secret.dunikey tx --output "$NODE_G1PUBKEY" --amount "$BILLCOM" --comment "[G1sms+] Achat G1Billets" -y) COM=$(silkaj -p "$duniter_server" -af --file /home/$YOU/.zen/g1sms_wallets/$PHONE/secret.dunikey tx --output "$NODE_G1PUBKEY" --amount "$BILLCOM" --comment "[G1sms+] Achat G1Billets" -y)
# POUR IMPRIMER LES BILLETS! Brancher votre imprimante, configurer cups, activer code lp ;) # POUR IMPRIMER LES BILLETS! Brancher votre imprimante, configurer cups, activer code lp ;)
num=$(date +%Y%m%d) num=$(date +%Y%m%d)
log "__SUB:sms_BILLET.sh: PRINT $num $MEMBER" log "__SUB:sms_BILLET.sh: PRINT $num $MEMBER"
montage ~/.zen/g1billets/MEMBERS/$MEMBER/*.jpg -tile 2x3 -geometry 964x459 /tmp/$PHONE_Bills_$bpath.pdf && rm -f ~/.zen/g1billets/MEMBERS/$MEMBER/*.jpg && log "__SUB:sms_BILLET.sh: PDF made /tmp/$PHONE_Bills_$bpath.pdf" montage /home/$YOU/.zen/g1billets/MEMBERS/$MEMBER/*.jpg -tile 2x3 -geometry 964x459 /tmp/$PHONE_Bills_$bpath.pdf && rm -f /home/$YOU/.zen/g1billets/MEMBERS/$MEMBER/*.jpg && log "__SUB:sms_BILLET.sh: PDF made /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 - cd /tmp && zip $PHONE_Bills_$bpath.zip $PHONE_Bills_$bpath.pdf && log "__SUB:sms_BILLET.sh: Zip DONE :: /tmp$PHONE_Bills_$bpath.zip !!" && cd -
# rm -f /tmp/$PHONE_Bills_$bpath.pdf # rm -f /tmp/$PHONE_Bills_$bpath.pdf

View File

@ -18,13 +18,13 @@ SEC="$4 $5 $6 $7"
# Construct billet path # Construct billet path
bpath=$(echo "$CODE" | sed 's/ /_/g') bpath=$(echo "$CODE" | sed 's/ /_/g')
if [ -d "~/.zen/g1billets/$bpath" ] if [ -d "/home/$YOU/.zen/g1billets/$bpath" ]
then then
SECRET=$(cat "~/.zen/g1billets/$bpath/note.secret") SECRET=$(cat "/home/$YOU/.zen/g1billets/$bpath/note.secret")
SALT=$(cat "~/.zen/g1billets/$bpath/note.salt") SALT=$(cat "/home/$YOU/.zen/g1billets/$bpath/note.salt")
VALbillet=$(cat "~/.zen/g1billets/$bpath/note.value") VALbillet=$(cat "/home/$YOU/.zen/g1billets/$bpath/note.value")
UNIT=$(cat "~/.zen/g1billets/$bpath/note.unit") UNIT=$(cat "/home/$YOU/.zen/g1billets/$bpath/note.unit")
BILLETPUBKEY=$(cat "~/.zen/g1billets/$bpath/note.pubkey") BILLETPUBKEY=$(cat "/home/$YOU/.zen/g1billets/$bpath/note.pubkey")
# Check account amount # Check account amount
declare -a accounting declare -a accounting
@ -53,13 +53,13 @@ https://www.g1sms.fr/contact"
sms_INIT_ACCOUNT "$PHONE" sms_INIT_ACCOUNT "$PHONE"
fi fi
echo "${IPFSPrivKey}" | gpg -d -q --output "/tmp/note.dunikey" --yes --pinentry-mode loopback --passphrase-fd 0 "~/.zen/g1billets/$bpath/note.dunikey.IPFSPrivKey.gpg" echo "${IPFSPrivKey}" | gpg -d -q --output "/tmp/note.dunikey" --yes --pinentry-mode loopback --passphrase-fd 0 "/home/$YOU/.zen/g1billets/$bpath/note.dunikey.IPFSPrivKey.gpg"
duniter_server=$(./tools/duniter_getnode.sh) duniter_server=$(./tools/duniter_getnode.sh)
PAY=$(silkaj -p "$duniter_server" -af --file /tmp/note.dunikey tx --output "$PUBKEY" --amount "$AMOUNTG1" --comment "[G1sms+] $NODE_G1PUBKEY:RAZ:$CODE" -y) PAY=$(silkaj -p "$duniter_server" -af --file /tmp/note.dunikey tx --output "$PUBKEY" --amount "$AMOUNTG1" --comment "[G1sms+] $NODE_G1PUBKEY:RAZ:$CODE" -y)
if [[ "$(echo $PAY | grep 'successful')" != "" && "$PAY" != "" ]]; then if [[ "$(echo $PAY | grep 'successful')" != "" && "$PAY" != "" ]]; then
# DESTROY BILLET # DESTROY BILLET
rm -Rf ~/.zen/g1billets/$bpath rm -Rf /home/$YOU/.zen/g1billets/$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 -Rf /tmp/billets_valides/$bpath

View File

@ -49,9 +49,9 @@ 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 Avatar on G1 Logo SouthEast
if [[ $(file "~/.zen/g1sms_wallets/$PHONE/_avatar.png" | grep 'PNG') ]]; then if [[ $(file "/home/$YOU/.zen/g1sms_wallets/$PHONE/_avatar.png" | grep 'PNG') ]]; then
composite -compose Over -gravity East -geometry +15+0 -dissolve 33% "~/.zen/g1sms_wallets/$PHONE/_avatar.png" "./Oeuro.jpg" "/tmp/$NUMERO.jpg" composite -compose Over -gravity East -geometry +15+0 -dissolve 33% "/home/$YOU/.zen/g1sms_wallets/$PHONE/_avatar.png" "./Oeuro.jpg" "/tmp/$NUMERO.jpg"
composite -compose Over -gravity West -geometry +15+0 -dissolve 33% "~/.zen/g1sms_wallets/$PHONE/_avatar.png" "/tmp/$NUMERO.jpg" "/tmp/$NUMERO.jpg" composite -compose Over -gravity West -geometry +15+0 -dissolve 33% "/home/$YOU/.zen/g1sms_wallets/$PHONE/_avatar.png" "/tmp/$NUMERO.jpg" "/tmp/$NUMERO.jpg"
else else
composite -compose Over -gravity East -geometry +15+0 -dissolve 33% "./G1Anar.png" "./Oeuro.jpg" "/tmp/$NUMERO.jpg" composite -compose Over -gravity East -geometry +15+0 -dissolve 33% "./G1Anar.png" "./Oeuro.jpg" "/tmp/$NUMERO.jpg"
composite -compose Over -gravity West -geometry +15+0 -dissolve 33% "./G1Anar.png" "/tmp/$NUMERO.jpg" "/tmp/$NUMERO.jpg" composite -compose Over -gravity West -geometry +15+0 -dissolve 33% "./G1Anar.png" "/tmp/$NUMERO.jpg" "/tmp/$NUMERO.jpg"
@ -122,8 +122,8 @@ if [[ "$TRANSAC" == "TEST" ]]; then
exit exit
else else
# Move billet to MEMBER folder 6 month later # Move billet to MEMBER folder 6 month later
mkdir -p "~/.zen/g1billets/MEMBERS/$MEMBER/" mkdir -p "/home/$YOU/.zen/g1billets/MEMBERS/$MEMBER/"
mv "/tmp/BILL.$year.$valid.$NUMERO.$MONTANT.$UNIT.jpg" "~/.zen/g1billets/MEMBERS/$MEMBER/" mv "/tmp/BILL.$year.$valid.$NUMERO.$MONTANT.$UNIT.jpg" "/home/$YOU/.zen/g1billets/MEMBERS/$MEMBER/"
# Clean TEMP files # Clean TEMP files
rm "/tmp/$NUMERO_NOTERIB.png" rm "/tmp/$NUMERO_NOTERIB.png"
rm "/tmp/$NUMERO.jpg" rm "/tmp/$NUMERO.jpg"

View File

@ -25,7 +25,7 @@ AMOUNT=${accounting[1]}
UNIT=${accounting[2]} UNIT=${accounting[2]}
# SEARCH FOR VIREMENT # SEARCH FOR VIREMENT
if [[ -f ~/.zen/g1sms_wallets/$PHONE/VIREMENTS.gpg ]]; then if [[ -f /home/$YOU/.zen/g1sms_wallets/$PHONE/VIREMENTS.gpg ]]; then
echo "FOUND $file decrypting with Node key" echo "FOUND $file decrypting with Node key"
echo "${IPFSPrivKey}" | gpg -d -q --output "/tmp/VIREMENTS.$PHONE" --yes --pinentry-mode loopback --passphrase-fd 0 "$file" echo "${IPFSPrivKey}" | gpg -d -q --output "/tmp/VIREMENTS.$PHONE" --yes --pinentry-mode loopback --passphrase-fd 0 "$file"
declare -a LIST declare -a LIST

View File

@ -12,10 +12,10 @@ PHONE="$1"
MEMBERUID="$2" MEMBERUID="$2"
TODAY=$(date '+%Y%m%d') TODAY=$(date '+%Y%m%d')
if [[ -f "~/.zen/g1sms_wallets/$PHONE/VIREMENTS" ]]; then if [[ -f "/home/$YOU/.zen/g1sms_wallets/$PHONE/VIREMENTS" ]]; then
# CHECK IF ALL DONE. # CHECK IF ALL DONE.
log "__SUB:sms_DESTROY.sh: FOUND "~/.zen/g1sms_wallets/$PHONE/VIREMENTS" decrypting with Node key" log "__SUB:sms_DESTROY.sh: FOUND "/home/$YOU/.zen/g1sms_wallets/$PHONE/VIREMENTS" decrypting with Node key"
echo "${IPFSPrivKey}" | gpg -d -q --output "/tmp/VIREMENTS.$PHONE" --yes --pinentry-mode loopback --passphrase-fd 0 "~/.zen/g1sms_wallets/$PHONE/VIREMENTS.gpg" echo "${IPFSPrivKey}" | gpg -d -q --output "/tmp/VIREMENTS.$PHONE" --yes --pinentry-mode loopback --passphrase-fd 0 "/home/$YOU/.zen/g1sms_wallets/$PHONE/VIREMENTS.gpg"
for next in $(cat /tmp/VIREMENTS.$PHONE | cut -d ' ' -f 1); do for next in $(cat /tmp/VIREMENTS.$PHONE | cut -d ' ' -f 1); do
if [[ $next -ge $TODAY ]]; then if [[ $next -ge $TODAY ]]; then
log "__SUB:sms_DESTROY.sh: VIREMENT $next >= $TODAY" log "__SUB:sms_DESTROY.sh: VIREMENT $next >= $TODAY"
@ -37,9 +37,9 @@ if [[ "$MEMBERUID" == "DON" || "$MEMBERUID" == "" || "$MEMBERUID" == "$MEMBER" ]
AMOUNTG1=$(silkaj_balance $PUBKEY) AMOUNTG1=$(silkaj_balance $PUBKEY)
GETLIMIT=$(bc <<< "$AMOUNTG1 - $LIMIT") GETLIMIT=$(bc <<< "$AMOUNTG1 - $LIMIT")
duniter_server=$(./tools/duniter_getnode.sh) duniter_server=$(./tools/duniter_getnode.sh)
PAY=$(silkaj -p "$duniter_server" -af --file ~/.zen/g1sms_wallets/$PHONE/secret.dunikey tx --output "$MEMRIB" --amount "$GETLIMIT" --comment "[G1sms+] Wallet DESTROY $MEMBER $MEMBERUID" -y) PAY=$(silkaj -p "$duniter_server" -af --file /home/$YOU/.zen/g1sms_wallets/$PHONE/secret.dunikey tx --output "$MEMRIB" --amount "$GETLIMIT" --comment "[G1sms+] Wallet DESTROY $MEMBER $MEMBERUID" -y)
sleep 5 sleep 5
back=$(silkaj -p "$duniter_server" -af --file ~/.zen/g1sms_wallets/$PHONE/secret.dunikey tx --output "$NODE_G1PUBKEY" --amount "$LIMIT" --comment "[G1sms+] Wallet DESTROY Send $LIMIT To NODE" -y) back=$(silkaj -p "$duniter_server" -af --file /home/$YOU/.zen/g1sms_wallets/$PHONE/secret.dunikey tx --output "$NODE_G1PUBKEY" --amount "$LIMIT" --comment "[G1sms+] Wallet DESTROY Send $LIMIT To NODE" -y)
# TODO DEBUG :: echo $PAY # TODO DEBUG :: echo $PAY
if [[ "$(echo $PAY | grep 'successful')" != "" && "$PAY" != "" && "$(echo $back | grep 'successful')" != "" ]]; then if [[ "$(echo $PAY | grep 'successful')" != "" && "$PAY" != "" && "$(echo $back | grep 'successful')" != "" ]]; then
@ -56,8 +56,8 @@ $ADMINPSEUDO @ $NODEUIDNA
$back" $back"
sms_SEND "$PHONE" "$mess" sms_SEND "$PHONE" "$mess"
rm -Rf ~/.zen/g1sms_wallets/$PHONE; rm -Rf /home/$YOU/.zen/g1sms_wallets/$PHONE;
rm -Rf ~/.zen/ipfs/$(echo -n $PHONE | sha256sum | cut -d ' ' -f 1)@$(echo -n $MASTERPHONE | sha256sum | cut -d ' ' -f 1) rm -Rf /home/$YOU/.zen/ipfs/$(echo -n $PHONE | sha256sum | cut -d ' ' -f 1)@$(echo -n $MASTERPHONE | sha256sum | cut -d ' ' -f 1)
log "__SUB:sms_DESTROY.sh: WALLET DESTROYED : $PHONE / $UIDNA / $MEMBER : ${c_green}OK$c_" log "__SUB:sms_DESTROY.sh: WALLET DESTROYED : $PHONE / $UIDNA / $MEMBER : ${c_green}OK$c_"
fi fi
else else

View File

@ -16,7 +16,7 @@ log "__SUB:sms_EMAIL.sh.sh: START ($1=phone, $2=mail)"
phone="$1" phone="$1"
mail="$2" mail="$2"
MAILFILE="~/.zen/g1sms_wallets/$phone/_email" # Contains the member EMAIL (Send BILLET) MAILFILE="/home/$YOU/.zen/g1sms_wallets/$phone/_email" # Contains the member EMAIL (Send BILLET)
# Initialise PHONE, PIN, PUBKEY, UNIT ... # Initialise PHONE, PIN, PUBKEY, UNIT ...
sms_INIT_ACCOUNT "$phone" "NOSMS" sms_INIT_ACCOUNT "$phone" "NOSMS"

View File

@ -14,7 +14,7 @@
# #
# 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 ~/.zen/g1sms_wallets/IDs # PHONE any /home/$YOU/.zen/g1sms_wallets/IDs
# TODO: for multi-channel -> Use HASHLINK + UIDNA + NODE_UIDNA + AMOUNT ... # TODO: for multi-channel -> Use HASHLINK + UIDNA + NODE_UIDNA + AMOUNT ...
########################################################################################### ###########################################################################################
source ./init.sh source ./init.sh
@ -73,8 +73,8 @@ fi
##### IS G1DAB NODE? ##### IS G1DAB NODE?
if [[ ! $PASSENGER && ! $G1DAB ]]; then if [[ ! $PASSENGER && ! $G1DAB ]]; then
if [[ -f ~/.zen/g1sms_wallets/$PHONE/ipfsid.G1TAGNODE ]]; then if [[ -f /home/$YOU/.zen/g1sms_wallets/$PHONE/ipfsid.G1TAGNODE ]]; then
DABnode=$(cat ~/.zen/g1sms_wallets/$PHONE/ipfsid.G1TAGNODE) DABnode=$(cat /home/$YOU/.zen/g1sms_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 sur $DABnode non détectée!! Choisissez un autre G1Dab..."
log "__SUB:sms_G1TAG.sh: IMPRIMANTE G1Tag non détectée!!" log "__SUB:sms_G1TAG.sh: IMPRIMANTE G1Tag non détectée!!"
@ -84,7 +84,7 @@ if [[ ! $PASSENGER && ! $G1DAB ]]; then
fi fi
# TODO: SEARCH PROXIMITY DAB LOCATION (GeoPoint + GPS)... # TODO: SEARCH PROXIMITY DAB LOCATION (GeoPoint + GPS)...
# for node in ~/.zen/g1sms_wallets_swarm/.*/*.where; do # for node in /home/$YOU/.zen/g1sms_wallets_swarm/.*/*.where; do
# done # done
########################################################### ###########################################################
# silkaj NODE CHANGE !!! # silkaj NODE CHANGE !!!
@ -95,7 +95,7 @@ fi
# PAY VIR + PERCENT G1 # PAY VIR + PERCENT G1
ML=$(bc -l <<< "scale=2; $VIR + $PERCENT") ML=$(bc -l <<< "scale=2; $VIR + $PERCENT")
duniter_server=$(./tools/duniter_getnode.sh) duniter_server=$(./tools/duniter_getnode.sh)
PAY=$(silkaj -p "$duniter_server" -af --file ~/.zen/g1sms_wallets/$PHONE/secret.dunikey tx --output "$NODE_G1PUBKEY" --amount "$ML" --comment "[G1sms+] ACHAT $3 G1Tag(s) - $2 $UNIT" -y) PAY=$(silkaj -p "$duniter_server" -af --file /home/$YOU/.zen/g1sms_wallets/$PHONE/secret.dunikey tx --output "$NODE_G1PUBKEY" --amount "$ML" --comment "[G1sms+] ACHAT $3 G1Tag(s) - $2 $UNIT" -y)
if [[ "$(echo $PAY | grep 'successful')" == "" || "$PAY" == "" ]]; then if [[ "$(echo $PAY | grep 'successful')" == "" || "$PAY" == "" ]]; then
sms_ERROR "$PHONE" "$PAY"; sms_ERROR "$PHONE" "$PAY";
exit exit
@ -111,9 +111,9 @@ while [[ $c -lt $NUMBER ]]; do
RR=$(echo ${AA} | sed s/\ //g ); # Nom concaténé RR=$(echo ${AA} | sed s/\ //g ); # Nom concaténé
PR=$(echo ${AA} | cut -d ' ' -f 1 ); # Prénom du G1Tag PR=$(echo ${AA} | cut -d ' ' -f 1 ); # Prénom du G1Tag
# Create Unique G1tag in all SWARM! TODO hash256 # Create Unique G1tag in all SWARM! TODO hash256
# ~/.zen/ipfs/$(echo -n $PHONE | sha256sum | cut -d ' ' -f 1)@$(echo -n $MASTERPHONE | sha256sum | cut -d ' ' -f 1) # /home/$YOU/.zen/ipfs/$(echo -n $PHONE | sha256sum | cut -d ' ' -f 1)@$(echo -n $MASTERPHONE | sha256sum | cut -d ' ' -f 1)
SHAA=$(echo -n $AA | sha256sum | cut -d ' ' -f 1) SHAA=$(echo -n $AA | sha256sum | cut -d ' ' -f 1)
while [[ $(ls ~/.zen/ipfs_swarm/${SHAA}@*/_uidna) ]]; do while [[ $(ls /home/$YOU/.zen/ipfs_swarm/${SHAA}@*/_uidna) ]]; do
AA=$(./diceware.sh 6 | xargs); RR=$(echo ${AA} | sed s/\ //g ); PR=$(echo ${AA} | cut -d ' ' -f 1 ); AA=$(./diceware.sh 6 | xargs); RR=$(echo ${AA} | sed s/\ //g ); PR=$(echo ${AA} | cut -d ' ' -f 1 );
SHAA=$(echo -n $AA | sha256sum | cut -d ' ' -f 1) SHAA=$(echo -n $AA | sha256sum | cut -d ' ' -f 1)
done done
@ -129,7 +129,7 @@ TAGID="./TAG/${RR}/TAG_id" #Nom du TAG
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 "~/.zen/ipfs/.$IPFSNODEID/TAG/${J}" TAGPASSENGER="./TAG/${RR}/TAG_passenger" # Reference to G1Tag owner/counter put in "/home/$YOU/.zen/ipfs/.$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 TAGPUBLISH_B_GPG="./TAG/${RR}/TAG_publishkey.B.gpg" # ipns publish key B PGP cyphered
TAGPUBLISH_PHONE_CRYPT="./TAG/${RR}/TAG_publishkey.phone.crypt" # natools.py crypt with creator G1sms Wallet PUBKEY TAGPUBLISH_PHONE_CRYPT="./TAG/${RR}/TAG_publishkey.phone.crypt" # natools.py crypt with creator G1sms Wallet PUBKEY
@ -197,14 +197,14 @@ TAGCHAIN="./TAG/${RR}/TAG_chain" # contains IPFS current ipfs hash
J=$(su $YOU -c "ipfs name publish -k ${RR} --quieter /ipfs/${I}") J=$(su $YOU -c "ipfs name publish -k ${RR} --quieter /ipfs/${I}")
echo "${J}" > "$TAGIPNS" echo "${J}" > "$TAGIPNS"
# KEEP G1Tag J MEMORY in NODE ~/.zen/ipfs/.$IPFSNODEID/TAG/ (TODO: OPTIMIZE SWARM SYNC and REPUBLISH) # KEEP G1Tag J MEMORY in NODE /home/$YOU/.zen/ipfs/.$IPFSNODEID/TAG/ (TODO: OPTIMIZE SWARM SYNC and REPUBLISH)
mkdir -p "~/.zen/ipfs/.$IPFSNODEID/TAG/" mkdir -p "/home/$YOU/.zen/ipfs/.$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 !!! # TODO USE SHA256 ID !!!
echo "$PHONE" > "~/.zen/ipfs/.$IPFSNODEID/TAG/${J}" echo "$PHONE" > "/home/$YOU/.zen/ipfs/.$IPFSNODEID/TAG/${J}"
if [[ $PASSENGER ]]; then if [[ $PASSENGER ]]; then
HPASSENGER=$(echo -n $PASSENGER | sha256sum | cut -d ' ' -f 1) HPASSENGER=$(echo -n $PASSENGER | sha256sum | cut -d ' ' -f 1)
echo "$HPASSENGER" > "~/.zen/ipfs/.$IPFSNODEID/TAG/${J}"; echo "$HPASSENGER" > "/home/$YOU/.zen/ipfs/.$IPFSNODEID/TAG/${J}";
fi fi
########################################################### ###########################################################
@ -224,8 +224,8 @@ TAGCHAIN="./TAG/${RR}/TAG_chain" # contains IPFS current ipfs hash
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 "~/.zen/g1sms_wallets/$PHONE/$PHONE.avatar.png" | grep 'PNG') ]]; then # if [[ $(file "/home/$YOU/.zen/g1sms_wallets/$PHONE/$PHONE.avatar.png" | grep 'PNG') ]]; then
# composite -compose Over -resize 150% -gravity Center "~/.zen/g1sms_wallets/$PHONE/$PHONE.avatar.png" "./TAG/${RR}/${RR}.png" "./TAG/${RR}/${RR}.png" # composite -compose Over -resize 150% -gravity Center "/home/$YOU/.zen/g1sms_wallets/$PHONE/$PHONE.avatar.png" "./TAG/${RR}/${RR}.png" "./TAG/${RR}/${RR}.png"
# else # else
# composite -compose Over -resize 100% -gravity Center "./G1Anar.png" "./TAG/${RR}/${RR}.png" "./TAG/${RR}/${RR}.png" # composite -compose Over -resize 100% -gravity Center "./G1Anar.png" "./TAG/${RR}/${RR}.png" "./TAG/${RR}/${RR}.png"
# fi # fi
@ -241,23 +241,23 @@ TAGCHAIN="./TAG/${RR}/TAG_chain" # contains IPFS current ipfs hash
# 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 "~/.zen/g1sms_wallets/$PHONE/ipfsid.G1TAGNODE" ]]; then if [[ -f "/home/$YOU/.zen/g1sms_wallets/$PHONE/ipfsid.G1TAGNODE" ]]; then
destnode=$(cat "~/.zen/g1sms_wallets/$PHONE/ipfsid.G1TAGNODE") destnode=$(cat "/home/$YOU/.zen/g1sms_wallets/$PHONE/ipfsid.G1TAGNODE")
if [[ "$destnode" == "" || "$destnode" == "$IPFSNODEID" ]]; then if [[ "$destnode" == "" || "$destnode" == "$IPFSNODEID" ]]; then
log "__SUB:sms_G1TAG.sh: Local PRINT ${RR} # ipfs ls /ipns/${J}" log "__SUB:sms_G1TAG.sh: Local PRINT ${RR} # ipfs ls /ipns/${J}"
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 NODE_G1PUBKEY ?
log "__SUB:sms_G1TAG.sh: Remote PRINT :: ~/.zen/g1sms_wallets/.$destnode/PRINT/${RR}.bin " log "__SUB:sms_G1TAG.sh: Remote PRINT :: /home/$YOU/.zen/g1sms_wallets/.$destnode/PRINT/${RR}.bin "
mkdir -p "~/.zen/g1sms_wallets/.$destnode/PRINT/" mkdir -p "/home/$YOU/.zen/g1sms_wallets/.$destnode/PRINT/"
# TODO: USE $DEST_G1PUBKEY is better # TODO: USE $DEST_G1PUBKEY is better
./natools.py encrypt -p $NODE_G1PUBKEY -i "./TAG/${RR}/${RR}.png" -o "~/.zen/g1sms_wallets/.$destnode/PRINT/${RR}.bin" ./natools.py encrypt -p $NODE_G1PUBKEY -i "./TAG/${RR}/${RR}.png" -o "/home/$YOU/.zen/g1sms_wallets/.$destnode/PRINT/${RR}.bin"
fi fi
else else
# #
log "__SUB:sms_G1TAG.sh: Becoming default PRINTER :: $IPFSNODEID" log "__SUB:sms_G1TAG.sh: Becoming default PRINTER :: $IPFSNODEID"
echo "$IPFSNODEID" > "~/.zen/g1sms_wallets/$PHONE/ipfsid.G1TAGNODE" echo "$IPFSNODEID" > "/home/$YOU/.zen/g1sms_wallets/$PHONE/ipfsid.G1TAGNODE"
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
destnode="$IPFSNODEID" destnode="$IPFSNODEID"
@ -269,14 +269,14 @@ done
# PRINT $PHONE WALLET PUBKEY # PRINT $PHONE WALLET PUBKEY
#################################################### ####################################################
if [[ "$destnode" == "" || "$destnode" == "$IPFSNODEID" ]]; then if [[ "$destnode" == "" || "$destnode" == "$IPFSNODEID" ]]; then
qrencode -s 5 -o "/tmp/G1PubQR.$PHONE.png" "$(cat ~/.zen/g1sms_wallets/$PHONE/$PHONE.pub)" qrencode -s 5 -o "/tmp/G1PubQR.$PHONE.png" "$(cat /home/$YOU/.zen/g1sms_wallets/$PHONE/$PHONE.pub)"
composite -compose Over -gravity West "/tmp/G1PubQR.$PHONE.png" "./g1tag.png" "/tmp/G1PubQR.$PHONE.png" composite -compose Over -gravity West "/tmp/G1PubQR.$PHONE.png" "./g1tag.png" "/tmp/G1PubQR.$PHONE.png"
if [[ $(file "~/.zen/g1sms_wallets/$PHONE/$PHONE.avatar.png" | grep 'PNG') ]]; then if [[ $(file "/home/$YOU/.zen/g1sms_wallets/$PHONE/$PHONE.avatar.png" | grep 'PNG') ]]; then
composite -compose Over -gravity Center "~/.zen/g1sms_wallets/$PHONE/$PHONE.avatar.png" "/tmp/G1PubQR.$PHONE.png" "/tmp/G1PubQR.$PHONE.png" composite -compose Over -gravity Center "/home/$YOU/.zen/g1sms_wallets/$PHONE/$PHONE.avatar.png" "/tmp/G1PubQR.$PHONE.png" "/tmp/G1PubQR.$PHONE.png"
fi fi
if [[ -f ~/.zen/g1sms_wallets/$PHONE/$PHONE.uidrib ]]; then if [[ -f /home/$YOU/.zen/g1sms_wallets/$PHONE/$PHONE.uidrib ]]; then
qrencode -s 6 -o "/tmp/G1MemQR.$PHONE.png" "$(cat ~/.zen/g1sms_wallets/$PHONE/$PHONE.uidrib)"; qrencode -s 6 -o "/tmp/G1MemQR.$PHONE.png" "$(cat /home/$YOU/.zen/g1sms_wallets/$PHONE/$PHONE.uidrib)";
composite -compose Over -gravity SouthEast "/tmp/G1MemQR.$PHONE.png" "/tmp/G1PubQR.$PHONE.png" "/tmp/G1PubQR.$PHONE.png" && rm /tmp/G1MemQR.$PHONE.png composite -compose Over -gravity SouthEast "/tmp/G1MemQR.$PHONE.png" "/tmp/G1PubQR.$PHONE.png" "/tmp/G1PubQR.$PHONE.png" && rm /tmp/G1MemQR.$PHONE.png
fi fi

View File

@ -38,10 +38,10 @@ PHONEDEST="$COUNTRY${PHONEDEST:1:10}"
HPHONE=$(echo -n $PHONEDEST | sha256sum | cut -d ' ' -f 1) HPHONE=$(echo -n $PHONEDEST | sha256sum | cut -d ' ' -f 1)
# CHECK if PHONEDEST have an account in IPFS G1sms+ SWARM # CHECK if PHONEDEST have an account in IPFS G1sms+ SWARM
if [[ -f ~/.zen/ipfs_swarm/G1SMS/$HPHONE@*/_pub ]] if [[ -f /home/$YOU/.zen/ipfs_swarm/G1SMS/$HPHONE@*/_pub ]]
then then
PUBKEYDEST=$(cat ~/.zen/ipfs_swarm/G1SMS/$HPHONE@*/_pub) PUBKEYDEST=$(cat /home/$YOU/.zen/ipfs_swarm/G1SMS/$HPHONE@*/_pub)
UNITDEST=$(cat ~/.zen/ipfs_swarm/G1SMS/$HPHONE@*/_unit) UNITDEST=$(cat /home/$YOU/.zen/ipfs_swarm/G1SMS/$HPHONE@*/_unit)
else else
# NO, then create NEW Wallet # NO, then create NEW Wallet
sms_INIT_ACCOUNT "$PHONEDEST" sms_INIT_ACCOUNT "$PHONEDEST"
@ -52,7 +52,7 @@ fi
duniter_server=$(./tools/duniter_getnode.sh) duniter_server=$(./tools/duniter_getnode.sh)
# Payement # Payement
PAY=$(silkaj -p "$duniter_server" -af --file ~/.zen/g1sms_wallets/$PHONE/secret.dunikey tx --output "$PUBKEYDEST" --amount "$VIR" --comment "[G1sms+] PAY" -y) PAY=$(silkaj -p "$duniter_server" -af --file /home/$YOU/.zen/g1sms_wallets/$PHONE/secret.dunikey tx --output "$PUBKEYDEST" --amount "$VIR" --comment "[G1sms+] PAY" -y)
if [[ "$(echo $PAY | grep 'successful')" == "" || "$PAY" == "" ]]; then if [[ "$(echo $PAY | grep 'successful')" == "" || "$PAY" == "" ]]; then
sms_ERROR "$phone" "Problème de payement $PAY"; sms_ERROR "$phone" "Problème de payement $PAY";
log "__SUB:sms_PAY.sh: Problème $PAY" log "__SUB:sms_PAY.sh: Problème $PAY"
@ -62,7 +62,7 @@ fi
sleep 2 sleep 2
# + G1SMS Commission # + G1SMS Commission
COM=$(silkaj -p "$duniter_server" -af --file ~/.zen/g1sms_wallets/$PHONE/secret.dunikey tx --output "$NODE_G1PUBKEY" --amount "$PERCENT" --comment "[G1sms+] Commission" -y) COM=$(silkaj -p "$duniter_server" -af --file /home/$YOU/.zen/g1sms_wallets/$PHONE/secret.dunikey tx --output "$NODE_G1PUBKEY" --amount "$PERCENT" --comment "[G1sms+] Commission" -y)
if [[ "$(echo $COM | grep 'successful')" == "" || "$PAY" == "" ]]; then if [[ "$(echo $COM | grep 'successful')" == "" || "$PAY" == "" ]]; then
sms_ERROR "$phone" "Problème de payement $COM"; sms_ERROR "$phone" "Problème de payement $COM";
log "__SUB:sms_PAY.sh: Problème $COM" log "__SUB:sms_PAY.sh: Problème $COM"

View File

@ -3,7 +3,7 @@
# Author: Fred (support@qo-op.com) # Author: Fred (support@qo-op.com)
# Version: 1.0 # Version: 1.0
# License: AGPL-3.0 (https://choosealicense.com/licenses/agpl-3.0/) # License: AGPL-3.0 (https://choosealicense.com/licenses/agpl-3.0/)
# RECORD RECURRENT PAYEMENTS WITH "Cesium+ ID" Pubkey TODO cron ~/.zen/g1sms_wallets/$PHONE/VIREMENTS, Fusion avec sms_VIR.sh # RECORD RECURRENT PAYEMENTS WITH "Cesium+ ID" Pubkey TODO cron /home/$YOU/.zen/g1sms_wallets/$PHONE/VIREMENTS, Fusion avec sms_VIR.sh
################################################################################ ################################################################################
source ./init.sh source ./init.sh
source ./functions.sh source ./functions.sh
@ -79,22 +79,22 @@ 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" ~/.zen/g1sms_wallets/*/_uidname | tail -n 1 | cut -f 6 -d '/') LOCAL=$(grep -Rwl "$DESTMEM" /home/$YOU/.zen/g1sms_wallets/*/_uidname | tail -n 1 | cut -f 6 -d '/')
if [[ "$LOCAL" == "" ]]; then LOCAL=$(grep -Rwl "$DESTMEM" ~/.zen/g1sms_wallets/*/_uidna | tail -n 1 | cut -f 6 -d '/'); fi if [[ "$LOCAL" == "" ]]; then LOCAL=$(grep -Rwl "$DESTMEM" /home/$YOU/.zen/g1sms_wallets/*/_uidna | tail -n 1 | cut -f 6 -d '/'); fi
if [[ "$LOCAL" != "" ]]; then if [[ "$LOCAL" != "" ]]; then
# LOCAL G1sms account # LOCAL G1sms account
DESTRIB=$(cat ~/.zen/g1sms_wallets/$LOCAL/_pub) DESTRIB=$(cat /home/$YOU/.zen/g1sms_wallets/$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
##################### REWRITE TODO ##################### REWRITE TODO
# SEARCH IN WALLETS SWARM (MEMBER THEN UIDNA) # SEARCH IN WALLETS SWARM (MEMBER THEN UIDNA)
# INSWARM=$(grep -Rwl "$DESTMEM" ~/.zen/g1sms_wallets_swarm/*/*.uidname | tail -n 1 | cut -f 3 -d '/') # INSWARM=$(grep -Rwl "$DESTMEM" /home/$YOU/.zen/g1sms_wallets_swarm/*/*.uidname | tail -n 1 | cut -f 3 -d '/')
# if [[ "$INSWARM" == "" ]]; then INSWARM=$(grep -Rwl "$DESTMEM" ~/.zen/g1sms_wallets_swarm/*/*.uidna | tail -n 1 | cut -f 3 -d '/'); fi # if [[ "$INSWARM" == "" ]]; then INSWARM=$(grep -Rwl "$DESTMEM" /home/$YOU/.zen/g1sms_wallets_swarm/*/*.uidna | tail -n 1 | cut -f 3 -d '/'); fi
# if [[ "$INSWARM" != "" ]]; then # if [[ "$INSWARM" != "" ]]; then
# REMOTENODE=$(cat ~/.zen/g1sms_wallets_swarm/$INSWARM/MASTERPHONE.sms) # REMOTENODE=$(cat /home/$YOU/.zen/g1sms_wallets_swarm/$INSWARM/MASTERPHONE.sms)
# DESTRIB=$(cat ~/.zen/g1sms_wallets_swarm/$INSWARM/$INSWARM.pub) # DESTRIB=$(cat /home/$YOU/.zen/g1sms_wallets_swarm/$INSWARM/$INSWARM.pub)
# DESTPHONE=$INSWARM # DESTPHONE=$INSWARM
# log "__SUB:sms_VIR.sh: FOUND SWARM ($REMOTENODE) G1sms+ wallet: $DESTRIB ($INSWARM)" # log "__SUB:sms_VIR.sh: FOUND SWARM ($REMOTENODE) G1sms+ wallet: $DESTRIB ($INSWARM)"
# else # else
@ -110,18 +110,18 @@ fi
if [[ "$DESTRIB" != "" ]]; then if [[ "$DESTRIB" != "" ]]; then
duniter_server=$(./tools/duniter_getnode.sh) duniter_server=$(./tools/duniter_getnode.sh)
log "__SUB:sms_REC.sh: TRAITEMENT DU VIREMENT DE $AMOUNT $UNIT = 1ER VIREMENT de $VIR G1 vers $VIRDEST ($DESTRIB) $TIME FOIS. OK..." log "__SUB:sms_REC.sh: TRAITEMENT DU VIREMENT DE $AMOUNT $UNIT = 1ER VIREMENT de $VIR G1 vers $VIRDEST ($DESTRIB) $TIME FOIS. OK..."
PAY=$(silkaj -p "$duniter_server" -af --file ~/.zen/g1sms_wallets/$PHONE/secret.dunikey tx --output "$DESTRIB" --amount "$VIR" --comment "[G1sms+] REC 1/$TIME ($PERIOD)" -y) PAY=$(silkaj -p "$duniter_server" -af --file /home/$YOU/.zen/g1sms_wallets/$PHONE/secret.dunikey tx --output "$DESTRIB" --amount "$VIR" --comment "[G1sms+] REC 1/$TIME ($PERIOD)" -y)
if [[ "$(echo $PAY | grep 'successful')" == "" || "$PAY" == "" ]]; then if [[ "$(echo $PAY | grep 'successful')" == "" || "$PAY" == "" ]]; then
sms_ERROR "$PHONE" "Problème de payement $PAY"; sms_ERROR "$PHONE" "Problème de payement $PAY";
log "__SUB:sms_REC.sh: END ~~~~~~~~~~~~~~~~~~~~~~~~~~~~" log "__SUB:sms_REC.sh: END ~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
exit 1 exit 1
fi fi
log "__SUB:sms_REC.sh: UPDATE ~/.zen/g1sms_wallets/$PHONE/VIREMENTS with FUTURE PAYEMENTS? $PAY" log "__SUB:sms_REC.sh: UPDATE /home/$YOU/.zen/g1sms_wallets/$PHONE/VIREMENTS with FUTURE PAYEMENTS? $PAY"
########### MAKE ~/.zen/g1sms_wallets/$PHONE/VIREMENTS for NEXT ONES ########### MAKE /home/$YOU/.zen/g1sms_wallets/$PHONE/VIREMENTS for NEXT ONES
if [[ -f "~/.zen/g1sms_wallets/$PHONE/VIREMENTS.gpg" ]]; then if [[ -f "/home/$YOU/.zen/g1sms_wallets/$PHONE/VIREMENTS.gpg" ]]; then
# DECYPHER FILE FOR CHANGE # DECYPHER FILE FOR CHANGE
echo "${IPFSPrivKey}" | gpg -d -q --output "~/.zen/g1sms_wallets/$PHONE/VIREMENTS" --yes --pinentry-mode loopback --passphrase-fd 0 "~/.zen/g1sms_wallets/$PHONE/VIREMENTS.gpg" echo "${IPFSPrivKey}" | gpg -d -q --output "/home/$YOU/.zen/g1sms_wallets/$PHONE/VIREMENTS" --yes --pinentry-mode loopback --passphrase-fd 0 "/home/$YOU/.zen/g1sms_wallets/$PHONE/VIREMENTS.gpg"
fi fi
# WRITE NEW LINES INTO AN ARRAY FILE: VIREMENTS # WRITE NEW LINES INTO AN ARRAY FILE: VIREMENTS
boucle=$((TIME - 1)) boucle=$((TIME - 1))
@ -131,14 +131,14 @@ if [[ "$DESTRIB" != "" ]]; then
$((num ++)) $((num ++))
NEXT=$(date --date="$num $NEXTDATE" '+%Y%m%d') NEXT=$(date --date="$num $NEXTDATE" '+%Y%m%d')
# ADD NEW LINE IN VIREMENTS # ADD NEW LINE IN VIREMENTS
echo "$NEXT $MEMBER $PHONE $VIR $DESTRIB $DESTMEM $MEMBER#$TIME#$AMOUNT#$DESTMEM $boucle " >> ~/.zen/g1sms_wallets/$PHONE/VIREMENTS echo "$NEXT $MEMBER $PHONE $VIR $DESTRIB $DESTMEM $MEMBER#$TIME#$AMOUNT#$DESTMEM $boucle " >> /home/$YOU/.zen/g1sms_wallets/$PHONE/VIREMENTS
done done
# CYPHER FILE # CYPHER FILE
echo "${IPFSPrivKey}" | gpg -q --output "~/.zen/g1sms_wallets/$PHONE/VIREMENTS.gpg" --yes --pinentry-mode loopback --symmetric --passphrase-fd 0 "~/.zen/g1sms_wallets/$PHONE/VIREMENTS" echo "${IPFSPrivKey}" | gpg -q --output "/home/$YOU/.zen/g1sms_wallets/$PHONE/VIREMENTS.gpg" --yes --pinentry-mode loopback --symmetric --passphrase-fd 0 "/home/$YOU/.zen/g1sms_wallets/$PHONE/VIREMENTS"
# EMPTY CLEAR FILE # EMPTY CLEAR FILE
log "__SUB:sms_REC.sh: $(cat ~/.zen/g1sms_wallets/$PHONE/VIREMENTS)" log "__SUB:sms_REC.sh: $(cat /home/$YOU/.zen/g1sms_wallets/$PHONE/VIREMENTS)"
echo "" > ~/.zen/g1sms_wallets/$PHONE/VIREMENTS echo "" > /home/$YOU/.zen/g1sms_wallets/$PHONE/VIREMENTS
########### ###########
log "__SUB:sms_REC.sh: .....................................OK!!!" log "__SUB:sms_REC.sh: .....................................OK!!!"

View File

@ -10,7 +10,7 @@ log "X sms_SETUNIT.sh ($1=phone, $2=unit)"
phone="$1" phone="$1"
unit="$2" unit="$2"
UNITFILE="~/.zen/g1sms_wallets/$phone/_unit" UNITFILE="/home/$YOU/.zen/g1sms_wallets/$phone/_unit"
# Initialise PHONE, PIN, PUBKEY, UNIT, HIST # Initialise PHONE, PIN, PUBKEY, UNIT, HIST
sms_INIT_ACCOUNT "$phone" "NOSMS" sms_INIT_ACCOUNT "$phone" "NOSMS"

View File

@ -48,22 +48,22 @@ 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" ~/.zen/g1sms_wallets/*/_uidname | tail -n 1 | cut -f 6 -d '/') LOCAL=$(grep -Rwl "$DESTMEM" /home/$YOU/.zen/g1sms_wallets/*/_uidname | tail -n 1 | cut -f 6 -d '/')
if [[ "$LOCAL" == "" ]]; then LOCAL=$(grep -Rwl "$DESTMEM" ~/.zen/g1sms_wallets/*/_uidna | tail -n 1 | cut -f 6 -d '/'); fi if [[ "$LOCAL" == "" ]]; then LOCAL=$(grep -Rwl "$DESTMEM" /home/$YOU/.zen/g1sms_wallets/*/_uidna | tail -n 1 | cut -f 6 -d '/'); fi
if [[ "$LOCAL" != "" ]]; then if [[ "$LOCAL" != "" ]]; then
# LOCAL G1sms account # LOCAL G1sms account
DESTRIB=$(cat ~/.zen/g1sms_wallets/$LOCAL/_pub) DESTRIB=$(cat /home/$YOU/.zen/g1sms_wallets/$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
##################### REWRITE TODO ##################### REWRITE TODO
# SEARCH IN WALLETS SWARM (MEMBER THEN UIDNA) # SEARCH IN WALLETS SWARM (MEMBER THEN UIDNA)
# INSWARM=$(grep -Rwl "$DESTMEM" ~/.zen/g1sms_wallets_swarm/*/*.uidname | tail -n 1 | cut -f 3 -d '/') # INSWARM=$(grep -Rwl "$DESTMEM" /home/$YOU/.zen/g1sms_wallets_swarm/*/*.uidname | tail -n 1 | cut -f 3 -d '/')
# if [[ "$INSWARM" == "" ]]; then INSWARM=$(grep -Rwl "$DESTMEM" ~/.zen/g1sms_wallets_swarm/*/*.uidna | tail -n 1 | cut -f 3 -d '/'); fi # if [[ "$INSWARM" == "" ]]; then INSWARM=$(grep -Rwl "$DESTMEM" /home/$YOU/.zen/g1sms_wallets_swarm/*/*.uidna | tail -n 1 | cut -f 3 -d '/'); fi
# if [[ "$INSWARM" != "" ]]; then # if [[ "$INSWARM" != "" ]]; then
# REMOTENODE=$(cat ~/.zen/g1sms_wallets_swarm/$INSWARM/MASTERPHONE.sms) # REMOTENODE=$(cat /home/$YOU/.zen/g1sms_wallets_swarm/$INSWARM/MASTERPHONE.sms)
# DESTRIB=$(cat ~/.zen/g1sms_wallets_swarm/$INSWARM/$INSWARM.pub) # DESTRIB=$(cat /home/$YOU/.zen/g1sms_wallets_swarm/$INSWARM/$INSWARM.pub)
# DESTPHONE=$INSWARM # DESTPHONE=$INSWARM
# log "__SUB:sms_VIR.sh: FOUND SWARM ($REMOTENODE) G1sms+ wallet: $DESTRIB ($INSWARM)" # log "__SUB:sms_VIR.sh: FOUND SWARM ($REMOTENODE) G1sms+ wallet: $DESTRIB ($INSWARM)"
# else # else
@ -78,7 +78,7 @@ fi
if [[ "$DESTRIB" != "" ]]; then if [[ "$DESTRIB" != "" ]]; then
duniter_server=$(./tools/duniter_getnode.sh) duniter_server=$(./tools/duniter_getnode.sh)
PAY=$(silkaj -p "$duniter_server" -af --file ~/.zen/g1sms_wallets/$PHONE/secret.dunikey tx --output "$DESTRIB" --amount "$VIR" --comment "[G1sms+] VIR $VIR G1" -y) PAY=$(silkaj -p "$duniter_server" -af --file /home/$YOU/.zen/g1sms_wallets/$PHONE/secret.dunikey tx --output "$DESTRIB" --amount "$VIR" --comment "[G1sms+] VIR $VIR G1" -y)
if [[ "$(echo $PAY | grep 'successful')" != "" && "$PAY" != "" ]]; then if [[ "$(echo $PAY | grep 'successful')" != "" && "$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

View File

@ -4,7 +4,7 @@
# Version: 1.0 # Version: 1.0
# License: AGPL-3.0 (https://choosealicense.com/licenses/agpl-3.0/) # License: AGPL-3.0 (https://choosealicense.com/licenses/agpl-3.0/)
################################################################################ ################################################################################
# is there ADMINPSEUDO-UIDNATAIL in ~/.zen/g1sms_wallets_swarm/.*/*.uidna ?" # is there ADMINPSEUDO-UIDNATAIL in /home/$YOU/.zen/g1sms_wallets_swarm/.*/*.uidna ?"
source ./init.sh source ./init.sh
source ./functions.sh source ./functions.sh
log "__SUB:sms_WHERE.sh: START ($1=PHONE $2=askeduidna)" log "__SUB:sms_WHERE.sh: START ($1=PHONE $2=askeduidna)"
@ -21,19 +21,19 @@ Envoyez N pour créer votre portefeuille G1sms"
fi fi
if [[ "$askeduidna" == "" ]]; then #SELF if [[ "$askeduidna" == "" ]]; then #SELF
if [[ -f "~/.zen/ipfs/.$IPFSNODEID/G1SSB/_uidna" ]]; then if [[ -f "/home/$YOU/.zen/ipfs/.$IPFSNODEID/G1SSB/_uidna" ]]; then
nodeuidnafile="~/.zen/ipfs/.$IPFSNODEID/G1SSB/_uidna" nodeuidnafile="/home/$YOU/.zen/ipfs/.$IPFSNODEID/G1SSB/_uidna"
uidna=$(cat $nodeuidnafile) uidna=$(cat $nodeuidnafile)
fi fi
else else
nodeuidnafile=$(grep -Rwl "$askeduidna" ~/.zen/ipfs_swarm/.*/G1SSB/_uidna) nodeuidnafile=$(grep -Rwl "$askeduidna" /home/$YOU/.zen/ipfs_swarm/.*/G1SSB/_uidna)
uidna=$(cat $nodeuidnafile) uidna=$(cat $nodeuidnafile)
fi fi
if [[ -f $nodeuidnafile && "$uidna" != "" ]]; then if [[ -f $nodeuidnafile && "$uidna" != "" ]]; then
ipfsnodeid=$(echo $nodeuidnafile | cut -d '/' -f 6 | cut -d '.' -f 2 ) ipfsnodeid=$(echo $nodeuidnafile | cut -d '/' -f 6 | cut -d '.' -f 2 )
echo $uidna > ~/.zen/g1sms_wallets/$PHONE/uidna.G1TAGNODE echo $uidna > /home/$YOU/.zen/g1sms_wallets/$PHONE/uidna.G1TAGNODE
echo $ipfsnodeid > ~/.zen/g1sms_wallets/$PHONE/ipfsid.G1TAGNODE echo $ipfsnodeid > /home/$YOU/.zen/g1sms_wallets/$PHONE/ipfsid.G1TAGNODE
log "__SUB:sms_WHERE.sh: Distributeur de G1Tag $uidna : $ipfsnodeid " log "__SUB:sms_WHERE.sh: Distributeur de G1Tag $uidna : $ipfsnodeid "
log_history $PHONE "G1TagNode, $uidna, $ipfsnodeid" log_history $PHONE "G1TagNode, $uidna, $ipfsnodeid"
else else
@ -46,7 +46,7 @@ fi
mess="[G1sms+] $MEMBER mess="[G1sms+] $MEMBER
Votre distributeur G1DAB est Votre distributeur G1DAB est
$uidna ($ipfsnodeid), situé: $uidna ($ipfsnodeid), situé:
$(cat ~/.zen/ipfs_swarm/.$ipfsnodeid/G1SSB/_where)" $(cat /home/$YOU/.zen/ipfs_swarm/.$ipfsnodeid/G1SSB/_where)"
sms_SEND "$PHONE" "$mess" sms_SEND "$PHONE" "$mess"

View File

@ -29,10 +29,10 @@ CMD=$(echo "$TEXT" | awk '{print toupper($1)}')
################################################################## ##################################################################
# Check if PHONE is already registred in G1sms+ SWARM # Check if PHONE is already registred in G1sms+ SWARM
################################################################## ##################################################################
if [[ ! -f "~/.zen/g1sms_wallets/$PHONE/MASTERPHONE.sms" && "$CMD" != "ADMIN" ]] if [[ ! -f "/home/$YOU/.zen/g1sms_wallets/$PHONE/MASTERPHONE.sms" && "$CMD" != "ADMIN" ]]
then then
HPHONE=$(echo -n $PHONE | sha256sum | cut -d ' ' -f 1) HPHONE=$(echo -n $PHONE | sha256sum | cut -d ' ' -f 1)
NODEPHONE=$(cat ~/.zen/ipfs_swarm/$HPHONE@*/MASTERPHONE.sms 2>/dev/null) NODEPHONE=$(cat /home/$YOU/.zen/ipfs_swarm/$HPHONE@*/MASTERPHONE.sms 2>/dev/null)
if [[ "$NODEPHONE" != "$MASTERPHONE" && "$NODEPHONE" != "" ]]; then if [[ "$NODEPHONE" != "$MASTERPHONE" && "$NODEPHONE" != "" ]]; then
sms_SEND "$PHONE" "[G1sms+] Vous avez déjà un compte portefeuille sur $NODEPHONE (Envoyez lui RAZ si vous voulez fermer votre compte)" sms_SEND "$PHONE" "[G1sms+] Vous avez déjà un compte portefeuille sur $NODEPHONE (Envoyez lui RAZ si vous voulez fermer votre compte)"
log "ALERT!! $PHONE compte existant sur le NODE G1sms+ ($NODEPHONE)" log "ALERT!! $PHONE compte existant sur le NODE G1sms+ ($NODEPHONE)"
@ -40,7 +40,7 @@ then
fi fi
else else
# Refresh MasterPhone (usefull in case of MASTERPHONE SIM number change) # Refresh MasterPhone (usefull in case of MASTERPHONE SIM number change)
echo "$MASTERPHONE" > "~/.zen/g1sms_wallets/$PHONE/MASTERPHONE.sms" echo "$MASTERPHONE" > "/home/$YOU/.zen/g1sms_wallets/$PHONE/MASTERPHONE.sms"
fi fi
################################################################## ##################################################################

View File

@ -21,7 +21,7 @@ source ./functions.sh
############################################## ##############################################
YOU=$(ps auxf --sort=+utime | grep -w ipfs | grep -v -E 'color=auto|grep' | tail -n 1 | cut -d " " -f 1); YOU=$(ps auxf --sort=+utime | grep -w ipfs | grep -v -E 'color=auto|grep' | tail -n 1 | cut -d " " -f 1);
IPFSNODEID=$(su $YOU -c "ipfs id -f='<id>\n'") IPFSNODEID=$(su $YOU -c "ipfs id -f='<id>\n'")
NODE_UIDNA=$(cat "~/.zen/ipfs/.$IPFSNODEID/G1SSB/_uidna") NODE_UIDNA=$(cat "/home/$YOU/.zen/ipfs/.$IPFSNODEID/G1SSB/_uidna")
MY_PATH="`dirname \"$0\"`" # relative MY_PATH="`dirname \"$0\"`" # relative
MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized