From b21288f13f02d7f7fbd8214255f71688484a86ce Mon Sep 17 00:00:00 2001 From: fred Date: Fri, 8 Apr 2022 20:16:39 +0200 Subject: [PATCH] protect from empty ~/.zen/bunkerbox/history_qo-op.json --- crowdbunker.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/crowdbunker.sh b/crowdbunker.sh index f8b73f8..c06801d 100755 --- a/crowdbunker.sh +++ b/crowdbunker.sh @@ -128,6 +128,7 @@ echo "########################################################################## if [[ "$(cat ~/.zen/bunkerbox/choice 2>/dev/null)" == "qo-op" ]]; then IPNSL="/ipns/$(ipfs key list -l | grep 'qo-op' | cut -f 1 -d ' ')" ipfs get -o ~/.zen/bunkerbox/history_qo-op.json $IPNSL/history.json # Get actual IPNS qo-op history.json + [[ ! -f ~/.zen/bunkerbox/history_qo-op.json || $(cat ~/.zen/bunkerbox/history_qo-op.json 2>/dev/null) == "" ]] && cp ${MY_PATH}/templates/data/history.json ~/.zen/bunkerbox/history_qo-op.json [[ $(cat ~/.zen/bunkerbox/history_qo-op.json | jq .Videos[].link | grep $VUID) ]] && echo "VIDEO DEJA DANS IPFS... CONTINUE" && echo && cp ~/.zen/bunkerbox/history_qo-op.json ~/.zen/bunkerbox/history.json && continue # JSON FUSION jq -s '.[0] * .[1]' ~/.zen/bunkerbox/history_qo-op.json ~/.zen/bunkerbox/history.json | jq -M '.Videos |= unique_by(.link)' > ~/.zen/bunkerbox/history.fusion.json