From e0e56d17dff809154f901ef1f77599b2c6a6d604 Mon Sep 17 00:00:00 2001 From: qo-op Date: Sat, 9 May 2020 13:00:09 +0200 Subject: [PATCH] ERASE ALL FOR NEW INSTALL --- g1sms/init.sh | 2 ++ g1sms/init_keys.sh | 19 +++++++++++-------- g1sms/test.sh | 5 +---- zen/ssb_INIT.sh | 4 +++- zen/tools/make_G1SSB_secret.sh | 6 +++++- 5 files changed, 22 insertions(+), 14 deletions(-) diff --git a/g1sms/init.sh b/g1sms/init.sh index 989ec79..8a6f9a4 100755 --- a/g1sms/init.sh +++ b/g1sms/init.sh @@ -7,6 +7,8 @@ MY_PATH="`dirname \"$0\"`" # relative MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized +[[ ! $($which bc) ]] && sudo apt-get install bc -y + function log () { [[ "$DOLOG" == "YES" ]] && echo "$PHONE:$1" >> /tmp/g1sms.log; } diff --git a/g1sms/init_keys.sh b/g1sms/init_keys.sh index ba3179b..393a25f 100755 --- a/g1sms/init_keys.sh +++ b/g1sms/init_keys.sh @@ -12,7 +12,7 @@ MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized NODE_G1PUBKEY=$(cat ~/.ssb/secret.dunikey | grep 'pub:' | cut -d ' ' -f 2) [[ $NODE_G1PUBKEY == "" ]] && echo "ERROR NODE_G1PUBKEY empty !! Please check it..." && exit 1 -YOU=$(ps aux --sort=+utime | grep ipfs | 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='\n') NANODATE=$(date -u +%s%N) #1569692075385428020 @@ -38,13 +38,16 @@ if [[ ! -f ~/.zen/ipfs/.$IPFSNODEID/G1SSB/_uidna ]]; then # And write ~/.zen/g1sms_wallets/.Qm***/G1SSB/(_files) #################################################################### PRE=${MASTERPHONE:8:4} - ZUID=$(./diceware.sh 1 | xargs) + ZUID=$($MY_PATH/diceware.sh 1 | xargs) # Check if already existing among all swarm wallets G1SSB or G1SMS - while [[ $(grep -Rwl "$PRE$ZUID" ~/.zen/ipfs_swarm/.*/*/_uidna) ]]; do ZUID=$(./diceware.sh 1 | xargs); done + while [[ $(grep -Rwl "$PRE$ZUID" ~/.zen/ipfs_swarm/.*/*/_uidna) ]]; do ZUID=$($MY_PATH/diceware.sh 1 | xargs); done NODE_UIDNA="$PRE$ZUID" - NODE_PIN=$(./diceware.sh | xargs) + NODE_PIN=$($MY_PATH/diceware.sh | xargs) - [[ -f ~/.zen/secret.astroport.key ]] && echo "NODE_UIDNA=$NODE_UIDNA" >> ~/.zen/secret.astroport.key + [[ -f ~/.zen/secret.astroport.key ]] \ + && [[ ! $(cat ~/.zen/secret.astroport.key | grep -F 'NODE_UIDNA' )]] \ + && echo "NODE_UIDNA=$NODE_UIDNA" >> ~/.zen/secret.astroport.key + source ~/.zen/secret.astroport.key # WRITE NODE_UIDNA @@ -55,8 +58,8 @@ if [[ ! -f ~/.zen/ipfs/.$IPFSNODEID/G1SSB/_uidna ]]; then ############ If sudo without password activated (Raspbian) # SYSTEM MODIFY hosts & hostname ########################### # WRITE NODE uidna NAME TO /etc/hosts & .Qm*/_uidna file - [[ $USER == "pi" ]] && sudo echo "127.0.0.101 $NODE_UIDNA" >> /etc/hosts - [[ $USER == "pi" ]] && sudo echo "$NODE_UIDNA" > /etc/hostname + # sudo echo "127.0.0.101 $NODE_UIDNA" >> /etc/hosts + # sudo echo "$NODE_UIDNA" > /etc/hostname ############################################################ # TODO rewrite AUTO BACKUP / RESTORE @@ -72,7 +75,7 @@ if [[ ! -f ~/.zen/ipfs/.$IPFSNODEID/G1SSB/_uidna ]]; then fi -source ~/.zen/secret.astroport.key +[[ -f ~/.zen/secret.astroport.key ]] && source ~/.zen/secret.astroport.key || echo "Missing ~/.zen/secret.astroport.key" && exit 1 NODE_UIDNA=$(cat "~/.zen/ipfs/.$IPFSNODEID/G1SSB/_uidna") ## INIT NODE G1 PUB & PRIV KEY diff --git a/g1sms/test.sh b/g1sms/test.sh index 34da684..b51d4ec 100755 --- a/g1sms/test.sh +++ b/g1sms/test.sh @@ -14,10 +14,7 @@ source $MY_PATH/functions.sh STOP="RUN" $MY_PATH/search TODO -echo "WAAAAHHH ENCORE UNE BELLE LISTE DE TODO ;)" -echo "La partie du code sms_ est plutot fonctionnelle." -echo "Dé-commentez 'gammu-smsd-inject' dans ./shell/fonction.sh pour tester sans envoyer de SMS!" -echo + echo "Lancez dans une console tail -f /tmp/g1sms.log pour suivre le déroulement (log)" echo echo "On commence la simulation de reception d'un SMS" diff --git a/zen/ssb_INIT.sh b/zen/ssb_INIT.sh index e6c4b37..08cef00 100755 --- a/zen/ssb_INIT.sh +++ b/zen/ssb_INIT.sh @@ -59,7 +59,8 @@ sbotc publish '{"type":"ipfstryme","text":"'"$(ipfs id | jq -r .Addresses[] | ta # ADD Cesium+ informations CESIUM="https://g1.data.le-sou.org" -title=$(curl -s ${CESIUM}/user/profile/${g1pub} | jq '._source.title') +[[ -f ~/.zen/ipfs/.$ipfsnodeid/G1SSB/_uidna ]] && uidna=$(cat ~/.zen/ipfs/.$ipfsnodeid/G1SSB/_uidna) +[[ ! $uidna ]] && title=$(curl -s ${CESIUM}/user/profile/${g1pub} | jq '._source.title') || title="Station $uidna" [[ $title == null ]] && title="Station $USER@$(cat /etc/hostname)" city=$(curl -s ${CESIUM}/user/profile/${g1pub} | jq '._source.city') [[ $city != null ]] && title="$title in $city" @@ -79,6 +80,7 @@ qrencode -s 5 -o ~/.zen/ipfs/.$ipfsnodeid/G1SSB/_g1.qrcode.png "$g1pub" if [[ ! $(file "/tmp/avatar.png" | grep 'PNG') ]]; then qrcodefile=~/.zen/ipfs/.$ipfsnodeid/G1SSB/_g1.qrcode.png + rm -f /tmp/avatar.png else qrcodefile=/tmp/avatar.png fi diff --git a/zen/tools/make_G1SSB_secret.sh b/zen/tools/make_G1SSB_secret.sh index eac1c90..bd66c97 100755 --- a/zen/tools/make_G1SSB_secret.sh +++ b/zen/tools/make_G1SSB_secret.sh @@ -87,7 +87,7 @@ export PATH=$PATH:~/.local/bin if [[ ! $(which silkaj) ]]; then sudo apt update || true libzzz=$(sudo apt-cache search libsodium | awk '{print $1}' | grep libsodium2) - sudo apt install build-essential qrencode jq $libzzz -y + sudo apt install libffi-dev build-essential qrencode jq bc $libzzz -y sudo apt install python3-pip python3-setuptools python3-wheel -y sudo pip3 install base58 pip3 install silkaj --user @@ -326,6 +326,10 @@ Manual activation #Swarm0 Astroport Station: ~/.zen/astroport/zen/cron_VRFY.sh ~/.zen/astroport/zen/ssb_INIT.sh +!!!!!! ERASE ALL FOR NEW INSTALL !!!!!! +rm -Rf ~/.ssb* +rm -f .zen/secret.astroport.key + Submit issues: https://git.p2p.legal/axiom-team/astroport/issues Send ideas to support@qo-op.com "