diff --git a/.install/1-install_requirements.sh b/.install/1-install_requirements.sh index 3cc5068..88cfb8f 100755 --- a/.install/1-install_requirements.sh +++ b/.install/1-install_requirements.sh @@ -6,11 +6,11 @@ isARM=$(uname -a | grep arm) # Basics sudo apt update -sudo apt install curl jq zip unzip htop tree ntpdate gnupg ssmtp mpack imagemagick qrencode bc libttspico-utils libttspico0 libttspico-data -y +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 libsodium=$(sudo apt search libsodium | grep -v "header" | grep -v "debug symbols" | grep "Network communication" -B1 | head -n1 | awk -F '/' '{ print $1 }') -sudo apt install python3-pip $libsodium -y +sudo apt install python-pip python3-pip $libsodium -y pip3 install duniterpy pip3 install silkaj --user diff --git a/.install/3-install_copylaradio.sh b/.install/3-install_copylaradio.sh index d12e12e..9565d28 100755 --- a/.install/3-install_copylaradio.sh +++ b/.install/3-install_copylaradio.sh @@ -11,7 +11,7 @@ isARM=$(uname -a | grep arm) ######## 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 +sudo apt install libid3-tools mpd mpc lame omxplayer -y ## CONFIG MPD @@ -57,8 +57,8 @@ sudo systemctl restart nginx # 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 +sudo ln -s /home/$USER/_CopyLaRadio/www/rompr /var/www/rompr +sudo chmod 777 /home/$USER/_CopyLaRadio/www/rompr/albumart +sudo chmod 777 /home/$USER/_CopyLaRadio/www/rompr/prefs exit 0 diff --git a/_chain b/_chain index 85768c8..33d4fcc 100755 --- a/_chain +++ b/_chain @@ -1 +1 @@ -QmYS8rkJee27cXLy6fbZAoweBFHNUkfTZ4V3YrWfNtWFwA +Qmad8nh1sLJJS8UtyXQJ2GzYrv768dDsBfwhtFyBjXh8Z3 diff --git a/_comments b/_comments index fad95b3..9cc3739 100755 --- a/_comments +++ b/_comments @@ -166,3 +166,9 @@ OK 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: diff --git a/_nanodate b/_nanodate index b7d14df..d0acc79 100755 --- a/_nanodate +++ b/_nanodate @@ -1 +1 @@ -1576059397859243783 +1576284752579254475 diff --git a/_publishkey.gpg b/_publishkey.gpg index 817c0b5..8927cc3 100755 Binary files a/_publishkey.gpg and b/_publishkey.gpg differ diff --git a/rc.local.sh b/rc.local.sh index 92e5d00..697c30e 100755 --- a/rc.local.sh +++ b/rc.local.sh @@ -1,17 +1,28 @@ -#!/bin/sh -# +#!/bin/bash +###################################################################### +# 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 ###################################################################### -# INJECT it self +# INJECT it self into /etc/rc.local +###################################################################### +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) if [[ ! $inserted ]]; then - sed -i s/exit\ 0//g /etc/rc.local - echo "include /home/pi/G1sms+/rc.local.sh" >> /etc/rc.local - echo "exit 0" >> /etc/rc.local + sudo sed -i s/exit\ 0//g /etc/rc.local + sudo echo "include $MY_PATH/rc.local.sh" >> /etc/rc.local + sudo echo "exit 0" >> /etc/rc.local fi -###################################################################### +###################################################################### +#### WRITE SYSTEM STARTUP COMMANDS HERE........ +###################################################################### # mpd Runs like pi and some rights are bad!! chown -R pi /var/run/mpd chown -R pi /run/mpd @@ -28,33 +39,33 @@ chmod 664 /tmp/youtube-dl.log chown pi:www-data /tmp/youtube-dl.log # LAUNCH BUTTONS WATCH -su pi -c "/home/pi/G1sms+/_CopyLaRadio/watch.sh &" +su pi -c "$MY_PATH/_CopyLaRadio/watch.sh &" # LAUNCH COPY SCRIPT -su pi -c "/home/pi/G1sms+/_CopyLaRadio/copy.sh &" +su pi -c "$MY_PATH/_CopyLaRadio/copy.sh &" # Print the IP address _IP=$(hostname -I | cut -d " " -f 1) || true if [ "$_IP" ]; then printf "IP address is %s\n" "$_IP" - /home/pi/G1sms+/shell/parle.sh "Adresse IP: $_IP" + $MY_PATH/shell/parle.sh "Adresse IP: $_IP" youtube-dl -U - /home/pi/G1sms+/shell/parle.sh "Mise à jour de Youtube DL. Terminé!" + $MY_PATH/shell/parle.sh "Mise à jour de Youtube DL. Terminé!" #IPFS YOU=$(ps aux --sort=+utime | grep ipfs | tail -n 1 | cut -d " " -f 1) if [[ "$YOU" != "" && "$YOU" != "root" ]]; then - /home/pi/G1sms+/shell/parle.sh "IPFS OK. Système de fichier interplanétaire activé." + $MY_PATH/shell/parle.sh "IPFS OK. Système de fichier interplanétaire activé." fi else - /home/pi/G1sms+/shell/parle.sh "Connexion Internet Impossible!" + $MY_PATH/shell/parle.sh "Connexion Internet Impossible!" fi # LANCEMENT G1Tag READ if [[ -e "/dev/ttyACM0" ]]; then - cd /home/pi/G1sms+ && ./shell/tag_READ.sh & - /home/pi/G1sms+/shell/parle.sh "Lecteur G1 tag" + cd $MY_PATH && ./shell/tag_READ.sh & + $MY_PATH/shell/parle.sh "Lecteur G1 tag" fi -if [[ -d "/home/pi/G1sms+/www/rompr" ]]; then - /home/pi/G1sms+/shell/parle.sh "Jukebox interplanétaire accessible" +if [[ -d "$MY_PATH/www/rompr" ]]; then + $MY_PATH/shell/parle.sh "Jukebox interplanétaire accessible" fi diff --git a/shell/cron_CODE.backup.sh b/shell/cron_CODE.backup.sh index 713f044..43f707a 100755 --- a/shell/cron_CODE.backup.sh +++ b/shell/cron_CODE.backup.sh @@ -9,6 +9,9 @@ source ./shell/init.sh source ./shell/functions.sh now=$(date +%Y-%m-%d) +MY_PATH="`dirname \"$0\"`" # relative +MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized + echo "COMMENTAIRES?" read COMMENT @@ -49,12 +52,10 @@ echo $(date +%s%N) > "./$dir/_nanodate" echo "$now: $COMMENT" >> "./$dir/_comments" -# TAR ALL ARCHIVE FILES -tar -cvzf G1sms+_backup_$now.tar.gz --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 G1sms+ FILES (WITH EXCLUSIONS!!) +tar -cvzf ~/G1sms+_backup_$now.tar.gz --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 -mkdir -p /tmp/CODE/ -mv G1sms+_backup_$now.tar.gz /tmp/CODE/G1sms+.latest.tgz -cp ./$dir/install*.sh /tmp/CODE/ +mkdir -p /tmp/CODE/ && tar xzf ~/G1sms+_backup_$now.tar.gz -C /tmp/CODE/ && rm -f ~/G1sms+_backup_$now.tar.gz # PUBLISH IT hash=$(su $YOU -c "ipfs add -rq /tmp/CODE/ -w | tail -n 1") @@ -67,5 +68,3 @@ rm -Rf /tmp/CODE echo "_CHAIN: NEW /ipfs/$hash // $hop PUBLISHED with \"SWARM_CODE_MASTER\" key ipfs get --output=./ /ipns/$publish" - - diff --git a/shell/functions.sh b/shell/functions.sh index 029b79f..484bf4c 100755 --- a/shell/functions.sh +++ b/shell/functions.sh @@ -358,7 +358,7 @@ log "__SUB:sms_INIT_ACCOUNT: ($1=phone, $2=NOSMS)" # ACTIVATE G1SMS WALLET ####################### # log "$MASTERKEYFILE $PUBKEY THIRD_PARTY_MANAGER:$MASTERPUB" - TX_IN=$(./silkaj/silkaj transaction --auth-file -file="$MASTERKEYFILE" --amount=3.15 --output=$PUBKEY --comment="[G1sms+] $UIDNA$TAIL 3RD:$MASTERPUB " -y) + TX_IN=$(./silkaj/silkaj transaction --auth-file -file="$MASTERKEYFILE" --amount=3.24 --output=$PUBKEY --comment="[G1sms+] $UIDNA$TAIL 3RD:$MASTERPUB " -y) log "__SUB:sms_INIT_ACCOUNT: G1 Wallet TX IN: $TX_IN" sleep 2 TX_OUT=$(./silkaj/silkaj transaction --auth-scrypt -salt="$PHONE" -password="$PIN" --amount=0.1 --output=$MASTERPUB --comment="[G1sms+] $UIDNA$TAIL 3RD:$MASTERPUB:ACK" -y) diff --git a/shell/g1tag-v0.png b/shell/g1tag-v0.png new file mode 100644 index 0000000..194c743 Binary files /dev/null and b/shell/g1tag-v0.png differ diff --git a/shell/g1tag.png b/shell/g1tag.png index 194c743..f6b61e9 100644 Binary files a/shell/g1tag.png and b/shell/g1tag.png differ diff --git a/shell/init_keys.sh b/shell/init_keys.sh index 296e17d..515692f 100755 --- a/shell/init_keys.sh +++ b/shell/init_keys.sh @@ -14,6 +14,7 @@ CHEMIN="/home/$YOU/G1sms+" # G1sms+ Node KEYS (G1wallet, gpg, IPNS) ################################################################## 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 ################################################################## # G1sms+ Swarm KEYS @@ -59,11 +60,25 @@ fi # Create G1sms Wallet with that NODE G1 wallet as member reference if [[ ! -f "./wallets/.$IPFSNODEID/$IPFSNODEID.pub" ]]; then mkdir -p ./wallets/.$IPFSNODEID/TASK + # TODO @poka ?? Place in install sequence: Create Node G1 Wallet (login=ipfsID pass=ipfsPrivKey) NODEG1WALLET=$(./silkaj/silkaj generate_auth_file --auth-scrypt -salt="$IPFSNODEID" -password="$GPGPASS") if [[ ! $NODEG1WALLET ]]; then echo "PROBLEME CREATION DU WALLET G1 DE $IPFSNODEID"; exit; fi + + # Backup authfile GPG with IPFS NODE PRIVATE KEY echo "${GPGPASS}" | gpg -q --output "./wallets/.$IPFSNODEID/$IPFSNODEID.authfile.GPGPASS.gpg" --yes --pinentry-mode loopback --symmetric --passphrase-fd 0 "./authfile" + # Backup authfile CYPHER with NODE G1 WALLET PUB KEY ./shell/natools.py encrypt -p $NODEG1WALLET -i "./authfile" -o "./wallets/.$IPFSNODEID/$IPFSNODEID.authfile.crypt" - rm -f ./authfile + + # TODO ADD ACCESS TO OTHER SWARM NODES CYPHERING WITH ALL ACTUAL NODES G1WALLET PUB KEYS + # USEFUL TO OPERATE G1TAG WITHOUT SHARING MASTERKEYFILE... + # for nodepubfile in ./wallets_swarm/.Qm*/*.pub; do + # nodeG1pub=$(cat $nodepubfile) + # nodeID=$(echo $all | cut -d '/' -f 3) + # ./shell/natools.py encrypt -p $nodeG1pub -i "./authfile" -o "./wallets/.$IPFSNODEID/$nodeID.authfile.crypt" + # done + + # Keep Node G1 wallet authfile in G1sms+ root + mv -f ./authfile ../ echo $NODEG1WALLET > "./wallets/.$IPFSNODEID/$IPFSNODEID.pub" echo $IPFSNODEID > "./wallets/.$IPFSNODEID/$IPFSNODEID.ipfsid" @@ -82,9 +97,11 @@ if [[ ! -f "./wallets/.$IPFSNODEID/$IPFSNODEID.pub" ]]; then 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 + # WRITE NODE uidna NAME TO /etc/hosts & .Qm*/Qm*.uidna file + echo "127.0.0.101 $UIDNA$TAIL" >> "/etc/hosts" echo "$UIDNA$TAIL" > "./wallets/.$IPFSNODEID/$IPFSNODEID.uidna" - # CREATE NODE WALLET LIKE A PHONE (Stored in wallets/.$IPFSNODEID) + # TODO: MAYBE REMOVE THAT CREATE NODE WALLET LIKE A PHONE (Stored in wallets/.$IPFSNODEID) BUT CREATE & ATTACH G1TAG INSTEAD 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" @@ -93,7 +110,7 @@ if [[ ! -f "./wallets/.$IPFSNODEID/$IPFSNODEID.pub" ]]; then 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_IN=$(./silkaj/silkaj transaction --auth-file -file="$MASTERKEYFILE" --amount=3.24 --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 diff --git a/shell/sms_G1TAG.sh b/shell/sms_G1TAG.sh index bfb5345..2951d25 100755 --- a/shell/sms_G1TAG.sh +++ b/shell/sms_G1TAG.sh @@ -116,7 +116,7 @@ c=0 while [[ $c -lt $NUMBER ]]; do ((c++)) # Create Unique SWARM G1tag! - AA=$(./shell/diceware.sh 6 | xargs); RR=$(echo ${AA} | sed s/\ //g ); + AA=$(./shell/diceware.sh 6 | xargs); RR=$(echo ${AA} | sed s/\ //g ); PR=$(echo ${AA} | cut -d ' ' -f 1 ); while [ -d "./wallets_swarm/TAG/${RR}" ]; do AA=$(./shell/diceware.sh 6 | xargs); RR=$(echo ${AA} | sed s/\ //g ); @@ -221,11 +221,10 @@ TAGCHAIN="./TAG/${RR}/TAG_chain" # contains IPFS current ipfs hash fi # WRITE G1Tag G1 amount - convert -pointsize 150 -fill black -gravity Center -draw 'text 240,-140 "'"$2"'"' "./TAG/${RR}/${RR}.png" "./TAG/${RR}/${RR}.png" - convert -pointsize 50 -fill black -gravity NorthEast -draw 'text -100,0 "'"G1"'"' "./TAG/${RR}/${RR}.png" "./TAG/${RR}/${RR}.png" - + convert -pointsize 150 -fill black -gravity Center -draw 'text 300,-140 "'"$2"'"' "./TAG/${RR}/${RR}.png" "./TAG/${RR}/${RR}.png" + convert -pointsize 50 -fill black -gravity North -draw 'text 20,0 "'"${PR}"'"' "./TAG/${RR}/${RR}.png" "./TAG/${RR}/${RR}.png" # WRITE G1Tag RR - convert -pointsize 40 -fill black -gravity SouthWest -draw 'text 0,0 "'"${RR}"'"' "./TAG/${RR}/${RR}.png" "./TAG/${RR}/${RR}.png" + convert -pointsize 40 -fill black -gravity SouthWest -draw 'text 3,0 "'"${RR}"'"' "./TAG/${RR}/${RR}.png" "./TAG/${RR}/${RR}.png" # ROTATION (FIXE AVATAR & CHIFFRE)? # convert "./TAG/${RR}/${RR}.png" -rotate -180 "./TAG/${RR}/${RR}.png" @@ -260,9 +259,9 @@ if [[ "$destnode" == "" || "$destnode" == "$IPFSNODEID" ]]; then if [[ $(file "./wallets/$PHONE/$PHONE.avatar.png" | grep 'PNG') ]]; then composite -compose Over -resize 150% -gravity Center "./wallets/$PHONE/$PHONE.avatar.png" "/tmp/G1PubQR.$PHONE.png" "/tmp/G1PubQR.$PHONE.png" fi - convert -pointsize 60 -fill black -gravity Center -draw 'text 320,-160 "'"$MEMBER"'"' "/tmp/G1PubQR.$PHONE.png" "/tmp/G1PubQR.$PHONE.png" - convert -pointsize 70 -fill black -gravity Center -draw 'text 345, 0 "'"$UIDNA"'"' "/tmp/G1PubQR.$PHONE.png" "/tmp/G1PubQR.$PHONE.png" - convert -pointsize 60 -fill black -gravity Center -draw 'text 330,160 "'"$PHONE"'"' "/tmp/G1PubQR.$PHONE.png" "/tmp/G1PubQR.$PHONE.png" + convert -pointsize 60 -fill black -gravity Center -draw 'text 340,-160 "'"$MEMBER"'"' "/tmp/G1PubQR.$PHONE.png" "/tmp/G1PubQR.$PHONE.png" + convert -pointsize 70 -fill black -gravity Center -draw 'text 345,-5 "'"$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_print "/tmp/G1PubQR.$PHONE.bin" /dev/usb/lp0 rm -f /tmp/G1PubQR.* diff --git a/shell/tag_OP.sh b/shell/tag_OP.sh index 7d30dd4..4a47744 100755 --- a/shell/tag_OP.sh +++ b/shell/tag_OP.sh @@ -69,7 +69,9 @@ 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 ./shell/natools.py decrypt -k "$KEYFILE" -i "$JSOURCEPUBLISHKEY" -o "/home/$YOU/.ipfs/keystore/$JSOURCERR" else - echo "__SUB:tag_OP.sh: KO. La clef $KEYFILE fournie pour ce G1Tag $JSOURCERR est inexistante. Contact: https://g1sms.fr" + if [[ ! -f $KEYFILE ]] then + echo "__SUB:tag_OP.sh: KO. La clef de dévérouillage pour $JSOURCERR est inexistante. Contact: https://g1sms.fr" + fi fi ############################################# @@ -88,7 +90,9 @@ FINALDEST=$(echo "${JDESTVALUE} + ${VALUE}" | bc -l) if [[ -f $KEYFILE && ! -f "/home/$YOU/.ipfs/keystore/$JDESTRR" ]]; then ./shell/natools.py decrypt -k "$KEYFILE" -i "$JDESTPUBLISHKEY" -o "/home/$YOU/.ipfs/keystore/$JDESTRR" else - 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" + if [[ ! -f $KEYFILE ]] then + echo "__SUB:tag_OP.sh: KO. La clef de dévérouillage pour $JDESTRR est inexistante. Contact: https://g1sms.fr" + fi fi ###################################################################################################### diff --git a/shell/tag_READ_X.sh b/shell/tag_READ_X.sh index e514a7b..5e101c5 100755 --- a/shell/tag_READ_X.sh +++ b/shell/tag_READ_X.sh @@ -13,9 +13,20 @@ echo "__SUB:tag_READ_X.sh: QRCODE READER : START" source ./shell/init.sh source ./shell/functions.sh +MY_PATH="`dirname \"$0\"`" # relative +MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized +function log () { + echo "$line +$1" >> /tmp/tag_READ_X.log +} + +MASTERKEYFILE="${MY_PATH}/../g1sms.priv.key" +if [ ! -f $MASTERKEYFILE ]; then echo "ERREUR CLEF DECHIFFRAGE!"; exit; fi +# TODO G1TAG: USE CREATOR NODE KEY FILE INSTEAD OF MASTERKEYFILE SWARM KEY + # DOUCHETTE ES TU LA? if [ ! $G1TX ]; then echo "Branchez votre lecteur de QR code!"; exit; fi -./shell/tools/4LETTER.scroll.py "G1TX SCAN QRCODE G1 + G1TAG PRET" +./shell/tools/4LETTER.scroll.py "G1TX START" ./shell/timeout.sh -t 2 ./shell/tools/4LETTER.spinner.py # TABLEAU MEMOIRE DE SCAN @@ -34,12 +45,13 @@ cat /dev/ttyACM0 | while read line; do R=$(echo $qrvalue | cut -d '#' -f 1) J=$(echo $qrvalue | cut -d '#' -f 2) log "__SUB:tag_READ_X.sh: Lecture G1Tag $R $J" - # + # IPFS READ ID=$(su $YOU -c "ipfs cat /ipns/$J/TAG_id"); if [[ "$ID" == "" ]]; then - ./shell/tools/4LETTER.scroll.py "MAUVAIS G1TAG DETRUIRE OU RAPPORTER A SON CREATEUR" + ./shell/tools/4LETTER.scroll.py ">> BAD G1TAG <<" continue fi + # Get First R Tag name word and remove space for RR FID=$(echo $ID | awk '{print toupper($1)}') RR=$(echo $ID | sed s/\ //g) @@ -49,11 +61,11 @@ cat /dev/ttyACM0 | while read line; do if [[ "$CURRENCY" == "zen" ]]; then CUR="zène"; else CUR=$CURRENCY; fi # Correction du défaut de prononciation. PASSENGER=$(su $YOU -c "ipfs cat /ipns/$J/TAG_passenger"); if [[ "$PASSENGER" != "" ]]; then - ./shell/tools/4LETTER.scroll.py "G1TAG PASSENGER $RVALUE" + ./shell/tools/4LETTER.scroll.py "G1TAG PASSENGER $RVALUE ZEN" else G1VAL=$(bc -l <<< "scale=2; $RVALUE / 100" | cut -d '.' -f 1) log "__SUB:tag_READ_X.sh: G1Tag $FID. Valeur $RVALUE $CURRENCY = $G1VAL G1" - ./shell/tools/4LETTER.scroll.py "ZEN $RVALUE" + ./shell/tools/4LETTER.scroll.py "$RVALUE ZEN *** $RVALUE ZEN" fi cmd="RJ" CASHBACK="" @@ -67,13 +79,13 @@ cat /dev/ttyACM0 | while read line; do # ID=$(su $YOU -c "ipfs cat /ipns/$J/TAG_id"); if [[ "$ID" == "" ]]; then - ./shell/tools/4LETTER.scroll.py "MAUVAIS G1TAG STOP" + ./shell/tools/4LETTER.scroll.py ">> BAD G1TAG <<" continue fi FID=$(echo $ID | awk '{print toupper($1)}') RR=$(echo $ID | sed s/\ //g) - ./shell/tools/4LETTER.scroll.py "G1TAG $FID WRITE" + ./shell/tools/4LETTER.scroll.py "G1TAG $FID >>TX>> " BVALUE=$(su $YOU -c "ipfs cat /ipns/$J/TAG_amount") CURRENCY=$(su $YOU -c "ipfs cat /ipns/$J/TAG_currency" | awk '{print tolower($1)}') if [[ "$CURRENCY" == "zen" ]]; then CUR="zène"; else CUR=$CURRENCY; fi # Correction du défaut de prononciation. @@ -84,22 +96,22 @@ cat /dev/ttyACM0 | while read line; do else rm /tmp/TAG_publishkey.B.gpg su $YOU -c "ipfs get -o /tmp/ /ipns/$J/TAG_publishkey.B.gpg" - # CHECK IF OK + ./shell/tools/4LETTER.scroll.py "** GPG **" gpg -d --output /tmp/ipns.key --pinentry-mode=loopback --passphrase $BB /tmp/TAG_publishkey.B.gpg + # CHECK IF OK if [[ ! -f /tmp/ipns.key ]]; then - ./shell/tools/4LETTER.scroll.py "ERREUR DECHIFFRAGE GPG" + ./shell/tools/4LETTER.scroll.py ">> BAD GPG KEY <<" continue fi mv /tmp/ipns.key /home/$YOU/.ipfs/keystore/$RR log "__SUB:tag_READ_X.sh: Récupération de la clef de publication $RR" - ./shell/tools/4LETTER.scroll.py "DECHIFFRAGE CLEF" fi if [[ "$PASSENGER" != "" ]]; then log "__SUB:tag_READ_X.sh: !!!! $FID REC Tag = $BVALUE $CURRENCY" ./shell/tools/4LETTER.scroll.py "G1TAG PASSENGER $BVALUE ZEN" else log "__SUB:tag_READ_X.sh: Ce G1 Tag $FID contient $BVALUE $CURRENCY" - ./shell/tools/4LETTER.scroll.py "ZEN $BVALUE" + ./shell/tools/4LETTER.scroll.py "$BVALUE ZEN *** $BVALUE ZEN MAX" fi cmd="BJ" val+=("$BVALUE") @@ -107,7 +119,7 @@ cat /dev/ttyACM0 | while read line; do *) if [[ $lon -eq 44 ]]; then - ./shell/tools/4LETTER.scroll.py "PORTEFEUILLE G1" & + ./shell/tools/4LETTER.scroll.py "PORTEFEUILLE G1 >>>>>>>>" & J=$qrvalue if [[ "$J" != "${obj[0]}" ]]; then VALUE=$(./shell/timeout.sh -t 25 ./silkaj/silkaj amount $J) @@ -115,7 +127,7 @@ cat /dev/ttyACM0 | while read line; do if [[ "$(echo $VALUE | cut -d ':' -f 1)" != "Error" && "$VALUE" != "" ]]; then log "__SUB:tag_READ_X.sh: Ce compte monnaie libre contient $VALUE G1" NOPOINT=$(echo $VALUE | cut -d '.' -f 1) - ./shell/tools/4LETTER.scroll.py "CONTIENT $NOPOINT G1 *** $NOPOINT G1 " + ./shell/tools/4LETTER.scroll.py " $NOPOINT G1 *** $NOPOINT G1 " CASHBACK="$J" cmd="G1" val+=("$VALUE") @@ -134,7 +146,7 @@ cat /dev/ttyACM0 | while read line; do fi fi else - ./shell/tools/4LETTER.scroll.py "OUI CONTIENT ${val[0]} G1 !!" + ./shell/tools/4LETTER.scroll.py "G1 ${val[0]} / G1 ${val[0]}" fi else ./shell/tools/4LETTER.scroll.py "ERREUR QRCODE INCONNU" @@ -196,7 +208,7 @@ cat /dev/ttyACM0 | while read line; do J=$(su $YOU -c "ipfs name publish -k ${RR} --quieter /ipfs/${I}") log "__SUB:tag_READ_X.sh: Destruction de ce G1 Tag publish -k ${RR} --quieter /ipfs/${I} :: ipfs ls /ipns/$J" - ./shell/tools/4LETTER.scroll.py "${FID} G1TAG VIDE MERCI DE LE DETRUIRE" + ./shell/tools/4LETTER.scroll.py "${FID} G1TAG VIDE !! DETRUCTION !!" # CLEAN IPFS keystore: remove NOT created NODE keys SOURCENODEID=$(cat "./TAG/${RR}/TAG_nodeid") @@ -206,7 +218,7 @@ cat /dev/ttyACM0 | while read line; do fi else # AJOUT MEMOIRE SCAN - ./shell/tools/4LETTER.scroll.py "ENSUITE" + ./shell/timeout.sh -t 1 ./shell/tools/4LETTER.spinner.py act+=("$cmd") obj+=("$J") fi @@ -244,7 +256,7 @@ cat /dev/ttyACM0 | while read line; do ./shell/tools/4LETTER.scroll.py "DEJA TAG PASSENGER"; else log "__SUB:tag_READ_X.sh: Transformation du G1 Tag en Rec Tag. ${val[0]} = ${val[1]}" - ./shell/tools/4LETTER.scroll.py "TRASNFORMATION G1TAG ${val[0]} $CUR EN PASSENGER ${FID}"; + ./shell/tools/4LETTER.scroll.py "TRASNFORMATION G1TAG ${val[0]} ZEN EN PASSENGER ${FID}"; log "__SUB:tag_READ_X.sh: $(./shell/tag_OP.sh ${obj[0]} ${obj[0]} 0 $MASTERKEYFILE)" fi CASHBACK="" @@ -256,6 +268,6 @@ cat /dev/ttyACM0 | while read line; do ./shell/timeout.sh -t 2 ./shell/tools/4LETTER.spinner.py fi - ./shell/tools/4LETTER.scroll.py "FLASHER QRCODE" + ./shell/tools/4LETTER.blink.py done diff --git a/shell/tools/4LETTER.blink.py b/shell/tools/4LETTER.blink.py new file mode 100755 index 0000000..5f77418 --- /dev/null +++ b/shell/tools/4LETTER.blink.py @@ -0,0 +1,15 @@ +#!/usr/bin/env python + +import time +import fourletterphat + +fourletterphat.clear() + +fourletterphat.print_str("SCAN") +fourletterphat.set_blink(fourletterphat.HT16K33_BLINK_HALFHZ) +fourletterphat.show() +time.sleep(1) +fourletterphat.set_blink(fourletterphat.HT16K33_BLINK_OFF) +fourletterphat.print_str("CODE") +fourletterphat.show() +time.sleep(0.5)