]> pd.if.org Git - newsd/blob - Makefile
2d12af3bdd637e7877ad554c15d8209e95559176
[newsd] / Makefile
1 PSQL=psql -q -1 --set ON_ERROR_STOP=1 -d news
2
3 default:        test
4
5 all: postgres
6
7 configdl:       active newsgroups control.ctl
8
9 reset: stop preserve start
10
11 load: stop newsdb schema activesync start
12
13 active newsgroups:
14         wget -N ftp://ftp.isc.org/pub/usenet/CONFIG/$@.bz2
15         bzip2 -dfk $@.bz2
16
17 control.ctl:
18         wget -N ftp://ftp.isc.org/pub/usenet/CONFIG/$@
19
20 newsdb:
21         -dropdb news
22         createdb -O news -T template0 -E SQL_ASCII news
23         psql -d news -c 'alter database news set search_path to nntp,public'
24         psql -d news -c 'alter database news set client_min_messages to warning'
25
26 preserve:
27         sudo su -c 'psql -1 --set ON_ERROR_STOP=1 -U news -d news -f preserve.sql' news
28
29 activesync:     loadactive loadnewsgroups
30
31 loadactive:     active
32         cat active | DBI_DSN='dbi:Pg:dbname=news' perl convactive
33         touch $@
34
35 loadnewsgroups: newsgroups
36         cat newsgroups |DBI_DSN='dbi:Pg:dbname=news' perl convnewsgroups
37         touch $@
38
39 testserver:
40         rm -f news.log
41         PERL5LIB=./Net-Server-NNTP/lib ./newsd conf_file=test.conf
42
43 test:
44         prove t/*.t
45
46 schema:
47         (echo 'set role news;'; cat schema.sql) | $(PSQL) 
48
49 startsingle:
50         sudo ./newsd log_level=3 server_type=Single
51
52 start:
53         sudo ./newsd log_level=2
54
55 stop:
56         -sudo sh -c "kill `cat /var/run/news/newsd.pid`"
57
58 restart: stop start
59
60 .PHONY: active newsgroups control.ctl configdl