ipfs-pinlist-cdn/Makefile

32 lines
662 B
Makefile
Raw Normal View History

2017-01-09 07:02:39 +00:00
IPFS_ROOT := $(HOME)/Documents/sneak/my-ipfs-root
PINLIST_DIR := $(IPFS_ROOT)/pinlist
default: deploy
.PHONY: deploy
clean:
rm -f pinlist.txt
deploy: pinlist.txt
mkdir -p $(PINLIST_DIR)
2017-01-09 09:46:19 +00:00
cat ./pinlist.txt > $(PINLIST_DIR)/pinlist.txt
cat ./bin/pin.sh > $(PINLIST_DIR)/pin.sh
2017-01-09 07:02:39 +00:00
ipfs add -r $(IPFS_ROOT) | \
tail -1 | \
awk -F' ' '{print $$2}' | \
ipfs name publish
pinlist.txt: pins/*.json
2017-01-09 09:46:19 +00:00
jq -r .pins[] $^ > pinlist.new && mv pinlist.new $@.tmp
echo "# timestamp=$$(date -u +%s)" >> $@.tmp
cat $@.tmp | sort | uniq > $@
rm $@.tmp
tidy:
for X in pins/*.json ; do \
echo $$X ; \
jq -S --indent 4 . $$X > $$X.new && mv $$X.new $$X ; \
done