From 93f723a1126a2c78e531bf4446976dd18fd36685 Mon Sep 17 00:00:00 2001 From: qo-op Date: Mon, 22 Feb 2021 02:30:10 +0100 Subject: [PATCH] better pinning --- zen/gchange_INIT.sh | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/zen/gchange_INIT.sh b/zen/gchange_INIT.sh index 6324b63..fe03085 100755 --- a/zen/gchange_INIT.sh +++ b/zen/gchange_INIT.sh @@ -103,20 +103,22 @@ IamBOOTSTRAP=$(cat ~/.zen/astrXbian/A_boostrap_nodes.txt | grep "$G1PUB") # AM I if [[ "$IamBOOTSTRAP" == "$G1PUB" ]]; then ## AUTO PIN FRIENDS ACTIVATION # /home/fred/.zen/ipfs_swarm/.12D3KooWB2PWQegymKFGdhKGQbyvnp5RQvjFPzz6KC6sxeo3juaB/PIN/QmbkFKpmfaZyFTBNGbnsLDuaQULzLTAS5DBYHjSYVDrFen/2D2LfX7GaQynDooqn1Eb21zavbgcNJucMbjrafe9qxrF -for astrofile in $(ls ~/.zen/ipfs_swarm/.*/PIN/*/* | grep -Ev ${IPFSNODEID} | cut -d '/' -f 8 | sort | uniq ); +for ipfsid in $(ls ~/.zen/ipfs_swarm/.*/PIN/*/* | grep -Ev ${IPFSNODEID} | cut -d '/' -f 8 | sort | uniq); do ~/.zen/astrXbian/zen/tools/timeout.sh -t 5 ipfs ls $ipfsid 2>/dev/null | cut -d ' ' -f 1; done + +for ipfsfile in $(ls ~/.zen/ipfs_swarm/.*/PIN/*/* | grep -Ev ${IPFSNODEID} | cut -d '/' -f 8 | sort | uniq ); do # /home/fred/.zen/ipfs_swarm/.12D3KooWB2PWQegymKFGdhKGQbyvnp5RQvjFPzz6KC6sxeo3juaB/PIN/QmbkFKpmfaZyFTBNGbnsLDuaQULzLTAS5DBYHjSYVDrFen/2D2LfX7GaQynDooqn1Eb21zavbgcNJucMbjrafe9qxrF # PINNING NEW FILE + astrofile=$(~/.zen/astrXbian/zen/tools/timeout.sh -t 5 ipfs ls $ipfsfile 2>/dev/null | cut -d ' ' -f 1) echo "PINNING ~/.zen/ipfs/.${IPFSNODEID}/PIN/${astrofile} ??" - if [[ ! -d ~/.zen/ipfs/.${IPFSNODEID}/PIN/${astrofile} ]]; + if [[ ! -d ~/.zen/ipfs/.${IPFSNODEID}/PIN/${astrofile} && "${astrofile}" != "" ]]; then echo "PIN : $astrofile" + ipfs ls ${astrofile} ipfs pin add /ipfs/$astrofile && mkdir -p ~/.zen/ipfs/.${IPFSNODEID}/PIN/${astrofile}/ echo "PUBLISHING MY PIN" - [[ -d ~/.zen/ipfs/.${IPFSNODEID}/PIN/${astrofile} ]] && echo "0" > ~/.zen/ipfs/.${IPFSNODEID}/PIN/${astrofile}/$G1PUB + [[ -d ~/.zen/ipfs/.${IPFSNODEID}/PIN/${astrofile} ]] && echo "0" > ~/.zen/ipfs/.${IPFSNODEID}/PIN/${astrofile}/$G1PUB && break fi -# EXIT AFTER ONE PIN ONLY (next PIN in cron_MINUTE time) -[[ -f ~/.zen/ipfs/.${IPFSNODEID}/PIN/${astrofile}/$G1PUB ]] && break done fi ################## AUTO PINNING