summaryrefslogtreecommitdiff
path: root/other/tor/Makefile
blob: b79a7f09f9d390910af58ce51c68f23d46b39beb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
TODAY=`TZ=UTC date +'%Y-%m-%d_%H:%M:%S'`
WGET=wget --cache=off --bind-address=127.0.0.1
OUTDIR=tor-directory
#SOURCE=http://moria.mit.edu:9031/
#SOURCE=http://tor.noreply.org:9030/
#SOURCE=http://tor.noreply.org:80/tor/
# wget -q -O - --bind-address=127.0.0.1 http://tor.noreply.org/tor/dir-all-weaselhack
SOURCE=http://tor.noreply.org/tor/dir-all-weaselhack
TMPFILE=download.tmp
LAST_NAME=dir.last

all:
	rm -f $(TMPFILE)
	$(WGET) -q -O $(TMPFILE) $(SOURCE)
	NAME=directory-$(TODAY); \
		if [ -e $(LAST_NAME) ] && diff -q $(TMPFILE) $(OUTDIR)/`cat $(LAST_NAME)` >/dev/null ; then \
			ln $(OUTDIR)/`cat $(LAST_NAME)` $(OUTDIR)/$$NAME;  \
		else \
			mv $(TMPFILE) $(OUTDIR)/$$NAME; \
			echo "$$NAME" > $(LAST_NAME); \
		fi; \
		bin/rrd-update $$NAME
	rm -rf result.new
	mkdir result.new
	nice -n 10 bin/rrd-graph
	mv result result.old
	mv result.new result
	rm -rf result.old