#!/bin/bash ######################################################################## # Author: Fred (support@qo-op.com) # Version: 2020.03.24 # License: AGPL-3.0 (https://choosealicense.com/licenses/agpl-3.0/) ######################################################################## MY_PATH="`dirname \"$0\"`" # relative MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized ME="${0##*/}" echo ' ######################################################################## # \\/// # qo-op ############# '$MY_PATH/$ME' ######################################################################## # ex: ./'$ME' # SYNC IPFS SWARM PEERS SHARED DATA .Qm**** ########################################################################' ######################################################################## # ENVIRONEMENT DETECTION + IPFS ~/.zen/ipfs/.$ipfsnodeid/G1SSB/_info ######################################################################## ipfsnodeid=$(ipfs id -f='\n') [[ $ipfsnodeid == "" ]] && echo "ERROR missing IPFS Node id !! IPFS is not installed !?" && exit 1 ######################################################################## [[ ! -f ~/.ssb/secret.dunikey ]] && $MY_PATH/tools/secret2dunikey.sh g1pub=$(cat ~/.ssb/secret.dunikey | grep 'pub:' | cut -d ' ' -f 2) ######################################################################## mkdir -p "~/.zen/ipfs_swarm" echo ' ___ _ _ __ __ _ _ _ _ _ _ __ | |_)|_(_ (_\ //\ |_)|\/| |_)|_|_|_)|_(_ |_| _|_| | __) __)\/\//--\| \| | | \|_| | \|___)| | ' # REFRESH SELF NODE PUBLISHING ipfs add -rHq ~/.zen/ipfs ipfs name publish --quieter /ipfs/$IWALLETS # GET IPNS published wallets from ALL SWARM NODES ## TODO: IF NODES are MISSING, check ./wallets_swarm/.QmNODES... ipfs get --output=$HOME/.zen/ipfs_swarm/ /ipns/$ipfsnodeid count=1 # Search for All peers Nodes. ## TODO: To be changed when Swarm is too big or not expendanding #for id in ./ipfs_swarm/.Qm*/; # Alternative search for id in $(ipfs swarm peers | awk -F '/' '{print $7}'); do count=$((count+1)) id=$(echo $id | cut -d '.' -f 3 | cut -d '/' -f 1) echo "Refreshing ~/.zen/ipfs_swarm/.$id" rm -Rf $HOME/.zen/ipfs_swarm/.$id $MY_PATH/tools/timeout.sh -t 30 ipfs get --output=$HOME/.zen/ipfs_swarm/ /ipns/$id done