ipfs-pinlist-cdn/Makefile

32 lines
723 B
Makefile
Raw Permalink 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
2017-01-09 09:53:15 +00:00
.PHONY: deploy clean
2017-01-09 07:02:39 +00:00
clean:
2017-01-09 09:53:15 +00:00
rm -f pinlist.txt pinlist.new
2017-01-09 07:02:39 +00:00
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 10:11:04 +00:00
cat ./README.md > $(PINLIST_DIR)/README.md
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