MODIFY CHAIN only if something was changed

This commit is contained in:
qo-op 2021-02-02 22:42:17 +01:00
parent 99fc61e184
commit f715e0e9e2
1 changed files with 6 additions and 2 deletions

View File

@ -103,9 +103,13 @@ cat ~/.zen/ipfs*/xbian/${PREFIX}* | sort | uniq > ~/.zen/ipfs/.${IPFSNODEID}/${P
########################################################################
echo "PUBLISHING ~/.zen/ipfs SELF /ipns/$IPFSNODEID"
echo "$(date -u +%s%N | cut -b1-13)" > ~/.zen/ipfs/.${IPFSNODEID}/_timestamp
MIPFS=$(ipfs add -rHq ~/.zen/ipfs | tail -n 1)
echo $MIPFS > ~/.zen/ipfs/.${IPFSNODEID}/_chain
OLDCHAIN=$(cat ~/.zen/ipfs/.${IPFSNODEID}/_chain)
if [[ "$OLDCHAIN" != "$MIPFS" ]] # MODIFY CHAIN only if something was changed
then
echo "$(date -u +%s%N | cut -b1-13)" > ~/.zen/ipfs/.${IPFSNODEID}/_timestamp
echo $MIPFS > ~/.zen/ipfs/.${IPFSNODEID}/_chain
fi
NODEIPNS=$(ipfs name publish --quieter /ipfs/$MIPFS)
exit 0