summaryrefslogtreecommitdiff
path: root/irssi-MASTER/Makefile
blob: e81a0a421c8596733553ba812afa3892a9520953 (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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
MASTERNICK = weasel
CERT="$(HOME)/.irssi/oftc-weasel.pem"
PKEY="$(HOME)/.irssi/oftc-weasel.key"
CAFILE="$(HOME)/.irssi/oftc.crt"
HOST="asteria.debian.or.at"

WAIT=1000

config: config.tmp
	mv -f "$<" "$@"
	chmod -w "$@"

.INTERMEDIATE: config.tmp
config.tmp: config.in servers.tmp chatnets.tmp
	cat $? > "$@"

.INTERMEDIATE: servers.tmp
servers.tmp: ~/.oftc-hosts ~/.oftc-port ~/.oftc-testnet-port Makefile
	echo "servers = (" > "$@"
	while read name ip; do \
		echo "# $$name" >> "$@" && \
		printf '{ \
			address = "%s"; \
			chatnet = "OFTC-%s"; \
			port = "%d"; \
			use_ssl = "yes"; \
			ssl_cert = $(CERT); \
			ssl_pkey = $(PKEY); \
			ssl_verify = "yes"; \
			ssl_cafile = $(CAFILE); \
			own_host = $(HOST); \
			autoconnect = "no"; \
			},\n' \
		    \
			$$ip \
			$$name \
			"`cat ~/.oftc-port`" \
		    \
		    >> "$@" && \
		\
		\
		printf '{ \
			address = "%s"; \
			chatnet = "TESTNET-%s"; \
			port = "%d"; \
			use_ssl = "yes"; \
			ssl_cert = $(CERT); \
			ssl_pkey = $(PKEY); \
			ssl_verify = "yes"; \
			ssl_cafile = $(CAFILE); \
			own_host = $(HOST); \
			autoconnect = "no"; \
			},\n' \
		    \
			$$ip \
			$$name \
			"`cat ~/.oftc-testnet-port`" \
		    \
		    >> "$@" ; \
		\
	done < ~/.oftc-hosts && echo built.
	echo ")" >> "$@"

.INTERMEDIATE: chatnets.tmp
chatnets.tmp: ~/.oftc-hosts ~/.oftc-port ~/.oftc-testnet-port Makefile
	echo "chatnets = {" > "$@"
	while read name ip; do \
		echo "# $$name" >> "$@" && \
		printf '"OFTC-%s" = { \
				type = "IRC"; \
				autosendcmd = "links; wait -OFTC-%s $(WAIT)"; \
				cmdmax = "512"; \
				cmdspeed = "10"; \
				max_kicks = "1"; \
				max_msgs = "100"; \
				max_modes = "4"; \
				nick = "$(MASTERNICK)-%s"; \
			};\n' \
		    \
			$$name \
			$$name \
			$$name \
		    \
		    >> "$@" && \
		\
		printf '"TESTNET-%s" = { \
				type = "IRC"; \
				autosendcmd = "links; wait -TESTNET-%s $(WAIT)"; \
				cmdmax = "512"; \
				cmdspeed = "10"; \
				max_kicks = "1"; \
				max_msgs = "100"; \
				max_modes = "4"; \
				nick = "$(MASTERNICK)-%s"; \
			};\n' \
		    \
			$$name \
			$$name \
			$$name \
		    \
		    >> "$@" ; \
		\
	done < ~/.oftc-hosts && echo built.
	echo "}" >> "$@"