aboutsummaryrefslogtreecommitdiff
path: root/net/ddns-scripts/Makefile
blob: 8a657ffaa1e365cea562ad27acd63b4c5c8bcf11 (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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
#
# Copyright (C) 2008-2018 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
#

include $(TOPDIR)/rules.mk

PKG_NAME:=ddns-scripts
PKG_VERSION:=2.8.0
PKG_RELEASE:=24

PKG_LICENSE:=GPL-2.0

include $(INCLUDE_DIR)/package.mk

define Package/ddns-scripts/Default
  SECTION:=net
  CATEGORY:=Network
  SUBMENU:=IP Addresses and Names
  PKGARCH:=all
endef


define Package/ddns-scripts
  $(call Package/ddns-scripts/Default)
  TITLE:=Dynamic DNS Client scripts (with IPv6 support)
endef

define Package/ddns-scripts/description
  Dynamic DNS Client scripts (with IPv6 support)
  A highly configurable set of scripts for doing dynamic dns updates.
  - IPv6 support
  - DNS server support
  - Glue Record support (require BIND host or KNOT host)
  - DNS requests via TCP
  - Proxy server support
  - log file support
  - support to run once
  Version: $(PKG_VERSION)-$(PKG_RELEASE)
  Info   : https://openwrt.org/docs/guide-user/services/ddns/client
endef

define Package/ddns-scripts/conffiles
/etc/config/ddns
endef


define Package/ddns-scripts-services
  $(call Package/ddns-scripts/Default)
  TITLE:=Common ddns providers
  DEPENDS:=ddns-scripts
endef

define Package/ddns-scripts-services/description
  Dynamic DNS Client definitions for supported services
endef


define Package/ddns-scripts-cloudflare
  $(call Package/ddns-scripts/Default)
  TITLE:=Extension for cloudflare.com API v4
  DEPENDS:=ddns-scripts +curl
endef

define Package/ddns-scripts-cloudflare/description
  Dynamic DNS Client scripts extension for cloudflare.com API v4 (require curl)
endef


define Package/ddns-scripts-freedns
  $(call Package/ddns-scripts/Default)
  TITLE:=Extension for freedns.42.pl
  DEPENDS:=ddns-scripts +curl
endef

define Package/ddns-scripts-freedns/description
  Dynamic DNS Client scripts extension for "freedns.42.pl".
endef


define Package/ddns-scripts-godaddy
  $(call Package/ddns-scripts/Default)
  TITLE:=Extension for godaddy.com API v1
  DEPENDS:=ddns-scripts +curl
endef

define Package/ddns-scripts-godaddy/description
  Dynamic DNS Client scripts extension for "godaddy.com API v1".
endef


define Package/ddns-scripts-digitalocean
  $(call Package/ddns-scripts/Default)
  TITLE:=Extention for digitalocean.com API v2
  DEPENDS:=ddns-scripts +curl
endef

define Package/ddns-scripts-digitalocean/description
  Dynamic DNS Client scripts extension for "digitalocean.com API v2".
  The script directly updates a DNS record using the DO API.
  It requires:
  "option dns_server" to be set to the server to be used by nsupdate.
  "option domain" the dns domain to update the record for (eg. A-record: home.<example.com>)
  "option username" the dns record name to update (eg. A-record: <home>.example.com)
  "option param_opt" the id of the dns record to update (check using chrome inspector in the DO dns tab)
  "option password" the api token generated in the DO panel
endef


define Package/ddns-scripts_no-ip_com
  $(call Package/ddns-scripts/Default)
  TITLE:=Extension for no-ip.com
  DEPENDS:=ddns-scripts
endef

define Package/ddns-scripts_no-ip_com/description
  Dynamic DNS Client scripts extension for "no-ip.com".
endef


define Package/ddns-scripts_nsupdate
  $(call Package/ddns-scripts/Default)
  TITLE:=Extension for using bind nsupdate.
  DEPENDS:=ddns-scripts +bind-client
endef

define Package/ddns-scripts_nsupdate/description
  Dynamic DNS Client scripts extension for direct updates using bind nsupdate
  The script directly updates a PowerDNS (or maybe bind server) via nsupdate
  from bind-client package.
  It requires:
  "option dns_server" to be set to the server to be used by nsupdate.
  "option username" should be set to the key name and
  "option password" to the base64 encoded shared secret.
endef


define Package/ddns-scripts_route53-v1
  $(call Package/ddns-scripts/Default)
  TITLE:=Extension for route53 API v1
  DEPENDS:=ddns-scripts +curl +openssl-util
endef

define Package/ddns-scripts_route53-v1/description
  Dynamic DNS Client scripts extension for Amazon AWS "route53 API v1".
  Note: You must also install ca-certificate or ca-bundle.
  It requires:
  "option username" to be a valid AWS access key id
  "option password" to be the matching AWS secret key id
  "option domain" to contain the hosted zone ID
endef


define Package/ddns-scripts_cnkuai_cn
  $(call Package/ddns-scripts/Default)
  TITLE:=CnKuai API
  DEPENDS:=ddns-scripts +curl +giflib-utils
endef

define Package/ddns-scripts_cnkuai_cn/description
  Dynamic DNS Client scripts extension for "cnkuai.cn".
  It requires:
  "option username" to be a valid CnKuai control panel id
  "option password" to be the matching CnKuai control panel password
  "option domain" to contain the domain
endef


define Build/Configure
endef

define Build/Compile
endef


define Package/ddns-scripts/install
	$(INSTALL_DIR) $(1)/etc/hotplug.d/iface
	$(INSTALL_DATA) ./files/etc/hotplug.d/iface/ddns \
		$(1)/etc/hotplug.d/iface/95-ddns

	$(INSTALL_DIR) $(1)/etc/init.d
	$(INSTALL_BIN) ./files/etc/init.d/ddns \
		$(1)/etc/init.d/ddns

	$(INSTALL_DIR) $(1)/etc/config
	$(INSTALL_CONF) ./files/etc/config/ddns \
		$(1)/etc/config/ddns

	$(INSTALL_DIR) $(1)/usr/share/ddns
	echo "$(PKG_VERSION)-$(PKG_RELEASE)" > $(1)/usr/share/ddns/version
	$(INSTALL_DATA) ./files/usr/share/ddns/list \
		$(1)/usr/share/ddns

	$(INSTALL_DIR) $(1)/usr/lib/ddns
	$(INSTALL_DATA) ./files/usr/lib/ddns/dynamic_dns_functions.sh \
		$(1)/usr/lib/ddns
	$(INSTALL_BIN) ./files/usr/lib/ddns/dynamic_dns_lucihelper.sh \
		$(1)/usr/lib/ddns
	$(INSTALL_BIN) ./files/usr/lib/ddns/dynamic_dns_updater.sh \
		$(1)/usr/lib/ddns

	$(INSTALL_DIR) $(1)/usr/bin
	$(INSTALL_BIN) ./files/usr/bin/ddns.sh \
		$(1)/usr/bin/ddns
endef

define Package/ddns-scripts/postinst
#!/bin/sh
if [ -z "$${IPKG_INSTROOT}" ]; then
	/etc/init.d/ddns enabled
	/etc/init.d/ddns start
fi
exit 0
endef

define Package/ddns-scripts/prerm
#!/bin/sh
if [ -n "$${IPKG_INSTROOT}" ]; then
	/etc/init.d/ddns stop
	/etc/init.d/ddns disable
fi
exit 0
endef


define Package/ddns-scripts-services/install
	$(INSTALL_DIR) $(1)/usr/share/ddns/services
	$(INSTALL_DATA) ./files/usr/share/ddns/services/* \
		$(1)/usr/share/ddns/services
endef


define Package/ddns-scripts-cloudflare/install
	$(INSTALL_DIR) $(1)/usr/lib/ddns
	$(INSTALL_BIN) ./files/usr/lib/ddns/update_cloudflare_com_v4.sh \
		$(1)/usr/lib/ddns

	$(INSTALL_DIR) $(1)/usr/share/ddns/services
	$(INSTALL_DATA) ./files/usr/share/ddns/services/cloudflare.com-v4.json \
		$(1)/usr/share/ddns/services/
endef

define Package/ddns-scripts-cloudflare/prerm
#!/bin/sh
if [ -z "$${IPKG_INSTROOT}" ]; then
	/etc/init.d/ddns stop
fi
exit 0
endef


define Package/ddns-scripts-freedns/install
	$(INSTALL_DIR) $(1)/usr/lib/ddns
	$(INSTALL_BIN) ./files/usr/lib/ddns/update_freedns_42_pl.sh \
		$(1)/usr/lib/ddns

	$(INSTALL_DIR) $(1)/usr/share/ddns/services
	$(INSTALL_DATA) ./files/usr/share/ddns/services/freedns.42.pl.json \
		$(1)/usr/share/ddns/services
endef

define Package/ddns-scripts-freedns/prerm
#!/bin/sh
if [ -z "$${IPKG_INSTROOT}" ]; then
	/etc/init.d/ddns stop
fi
exit 0
endef


define Package/ddns-scripts-godaddy/install
	$(INSTALL_DIR) $(1)/usr/lib/ddns
	$(INSTALL_BIN) ./files/usr/lib/ddns/update_godaddy_com_v1.sh \
		$(1)/usr/lib/ddns

	$(INSTALL_DIR) $(1)/usr/share/ddns/services
	$(INSTALL_DATA) ./files/usr/share/ddns/services/godaddy.com-v1.json \
		$(1)/usr/share/ddns/services
endef

define Package/ddns-scripts-godaddy/prerm
#!/bin/sh
if [ -z "$${IPKG_INSTROOT}" ]; then
	/etc/init.d/ddns stop
fi
exit 0
endef


define Package/ddns-scripts-digitalocean/install
	$(INSTALL_DIR) $(1)/usr/lib/ddns
	$(INSTALL_BIN) ./files/usr/lib/ddns/update_digitalocean_com_v2.sh \
		$(1)/usr/lib/ddns

	$(INSTALL_DIR) $(1)/usr/share/ddns/services
	$(INSTALL_DATA) ./files/usr/share/ddns/services/digitalocean.com-v2.json \
		$(1)/usr/share/ddns/services
endef

define Package/ddns-scripts-digitalocean/prerm
#!/bin/sh
if [ -z "$${IPKG_INSTROOT}" ]; then
	/etc/init.d/ddns stop
fi
exit 0
endef


define Package/ddns-scripts_no-ip_com/install
	$(INSTALL_DIR) $(1)/usr/lib/ddns
	$(INSTALL_BIN) ./files/usr/lib/ddns/update_no-ip_com.sh \
		$(1)/usr/lib/ddns

	$(INSTALL_DIR) $(1)/usr/share/ddns/services
	$(INSTALL_DATA) ./files/usr/share/ddns/services/no-ip.com.json \
		$(1)/usr/share/ddns/services
endef

define Package/ddns-scripts_no-ip_com/prerm
#!/bin/sh
if [ -z "$${IPKG_INSTROOT}" ]; then
	/etc/init.d/ddns stop
fi
exit 0
endef


define Package/ddns-scripts_nsupdate/install
	$(INSTALL_DIR) $(1)/usr/lib/ddns
	$(INSTALL_BIN) ./files/usr/lib/ddns/update_nsupdate.sh \
		$(1)/usr/lib/ddns

	$(INSTALL_DIR) $(1)/usr/share/ddns/services
	$(INSTALL_DATA) ./files/usr/share/ddns/services/bind-nsupdate.json \
		$(1)/usr/share/ddns/services
endef

define Package/ddns-scripts_nsupdate/prerm
#!/bin/sh
if [ -z "$${IPKG_INSTROOT}" ]; then
	/etc/init.d/ddns stop
fi
exit 0
endef


define Package/ddns-scripts_route53-v1/install
	$(INSTALL_DIR) $(1)/usr/lib/ddns
	$(INSTALL_BIN) ./files/usr/lib/ddns/update_route53_v1.sh \
		$(1)/usr/lib/ddns

	$(INSTALL_DIR) $(1)/usr/share/ddns/services
	$(INSTALL_DATA) ./files/usr/share/ddns/services/route53-v1.json \
		$(1)/usr/share/ddns/services
endef

define Package/ddns-scripts_route53-v1/prerm
#!/bin/sh
if [ -z "$${IPKG_INSTROOT}" ]; then
	/etc/init.d/ddns stop
fi
exit 0
endef


define Package/ddns-scripts_cnkuai_cn/install
	$(INSTALL_DIR) $(1)/usr/lib/ddns
	$(INSTALL_BIN) ./files/usr/lib/ddns/update_cnkuai_cn.sh \
		$(1)/usr/lib/ddns

	$(INSTALL_DIR) $(1)/usr/share/ddns/services
	$(INSTALL_DATA) ./files/usr/share/ddns/services/cnkuai.cn.json \
		$(1)/usr/share/ddns/services
endef

define Package/ddns-scripts_cnkuai_cn/prerm
#!/bin/sh
if [ -z "$${IPKG_INSTROOT}" ]; then
	/etc/init.d/ddns stop
fi
exit 0
endef


$(eval $(call BuildPackage,ddns-scripts))
$(eval $(call BuildPackage,ddns-scripts-services))
$(eval $(call BuildPackage,ddns-scripts-cloudflare))
$(eval $(call BuildPackage,ddns-scripts-freedns))
$(eval $(call BuildPackage,ddns-scripts-godaddy))
$(eval $(call BuildPackage,ddns-scripts-digitalocean))
$(eval $(call BuildPackage,ddns-scripts_no-ip_com))
$(eval $(call BuildPackage,ddns-scripts_nsupdate))
$(eval $(call BuildPackage,ddns-scripts_route53-v1))
$(eval $(call BuildPackage,ddns-scripts_cnkuai_cn))