diff --git a/zen/ipfs_SWARM_refresh.sh b/zen/ipfs_SWARM_refresh.sh index 09f2e50..9b2e537 100755 --- a/zen/ipfs_SWARM_refresh.sh +++ b/zen/ipfs_SWARM_refresh.sh @@ -35,21 +35,26 @@ _|_| | __) __)\/\//--\| \| | | \|_| | \|___)| | ' echo "I am $ipfsnodeid" +cd ~/ + # PUBLISH NODE ipfs shared data to swarm +[[ ! -d ~/.zen/ipfs ]] && echo "ERROR please create ~/.zen/ipfs/" && exit 1 IWALLETS=$(ipfs add -rHq ~/.zen/ipfs | tail -n 1) NODEIPNS=$(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 +ipfs get --output=./.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 + rm -Rf ./.zen/ipfs_swarm/.$id + $MY_PATH/tools/timeout.sh -t 30 ipfs get --output=./.zen/ipfs_swarm/ /ipns/$id done