Merge pull request #17137 from oskarirauta/banip
[feed/packages.git] / net / ddns-scripts / Makefile
1 #
2 # Copyright (C) 2008-2018 OpenWrt.org
3 #
4 # This is free software, licensed under the GNU General Public License v2.
5 #
6
7 include $(TOPDIR)/rules.mk
8
9 PKG_NAME:=ddns-scripts
10 PKG_VERSION:=2.8.2
11 PKG_RELEASE:=19
12
13 PKG_LICENSE:=GPL-2.0
14
15 include $(INCLUDE_DIR)/package.mk
16
17 define Package/ddns-scripts/Default
18 SECTION:=net
19 CATEGORY:=Network
20 SUBMENU:=IP Addresses and Names
21 PKGARCH:=all
22 endef
23
24
25 define Package/ddns-scripts
26 $(call Package/ddns-scripts/Default)
27 TITLE:=Dynamic DNS Client scripts (with IPv6 support)
28 DEPENDS:=+ddns-scripts-services
29 endef
30
31 define Package/ddns-scripts/description
32 Dynamic DNS Client scripts (with IPv6 support)
33 A highly configurable set of scripts for doing dynamic dns updates.
34 - IPv6 support
35 - DNS server support
36 - Glue Record support (require BIND host or KNOT host)
37 - DNS requests via TCP
38 - Proxy server support
39 - log file support
40 - support to run once
41 Version: $(PKG_VERSION)-$(PKG_RELEASE)
42 Info : https://openwrt.org/docs/guide-user/services/ddns/client
43 endef
44
45 define Package/ddns-scripts/conffiles
46 /etc/config/ddns
47 endef
48
49
50 define Package/ddns-scripts-services
51 $(call Package/ddns-scripts/Default)
52 TITLE:=Common ddns providers
53 endef
54
55 define Package/ddns-scripts-services/description
56 Dynamic DNS Client definitions for supported services
57 endef
58
59
60 define Package/ddns-scripts-cloudflare
61 $(call Package/ddns-scripts/Default)
62 TITLE:=Extension for cloudflare.com API v4
63 DEPENDS:=ddns-scripts +curl
64 endef
65
66 define Package/ddns-scripts-cloudflare/description
67 Dynamic DNS Client scripts extension for cloudflare.com API v4 (require curl)
68 endef
69
70
71 define Package/ddns-scripts-freedns
72 $(call Package/ddns-scripts/Default)
73 TITLE:=Extension for freedns.42.pl
74 DEPENDS:=ddns-scripts +curl
75 endef
76
77 define Package/ddns-scripts-freedns/description
78 Dynamic DNS Client scripts extension for "freedns.42.pl".
79 endef
80
81
82 define Package/ddns-scripts-godaddy
83 $(call Package/ddns-scripts/Default)
84 TITLE:=Extension for godaddy.com API v1
85 DEPENDS:=ddns-scripts +curl
86 endef
87
88 define Package/ddns-scripts-godaddy/description
89 Dynamic DNS Client scripts extension for "godaddy.com API v1".
90 endef
91
92
93 define Package/ddns-scripts-digitalocean
94 $(call Package/ddns-scripts/Default)
95 TITLE:=Extention for digitalocean.com API v2
96 DEPENDS:=ddns-scripts +curl
97 endef
98
99 define Package/ddns-scripts-digitalocean/description
100 Dynamic DNS Client scripts extension for "digitalocean.com API v2".
101 The script directly updates a DNS record using the DO API.
102 It requires:
103 "option dns_server" to be set to the server to be used by nsupdate.
104 "option domain" the dns domain to update the record for (eg. A-record: home.<example.com>)
105 "option username" the dns record name to update (eg. A-record: <home>.example.com)
106 "option param_opt" the id of the dns record to update (check using chrome inspector in the DO dns tab)
107 "option password" the api token generated in the DO panel
108 endef
109
110
111 define Package/ddns-scripts-dnspod
112 $(call Package/ddns-scripts/Default)
113 TITLE:=Extension for dnspod.cn API
114 DEPENDS:=ddns-scripts +curl
115 endef
116
117 define Package/ddns-scripts-dnspod/description
118 Dynamic DNS Client scripts extension for dnspod.cn API (require curl)
119 endef
120
121
122 define Package/ddns-scripts-noip
123 $(call Package/ddns-scripts/Default)
124 TITLE:=Extension for no-ip.com
125 DEPENDS:=ddns-scripts
126 endef
127
128 define Package/ddns-scripts-noip/description
129 Dynamic DNS Client scripts extension for "no-ip.com".
130 endef
131
132
133 define Package/ddns-scripts-nsupdate
134 $(call Package/ddns-scripts/Default)
135 TITLE:=Extension for using bind nsupdate.
136 DEPENDS:=ddns-scripts +bind-client
137 endef
138
139 define Package/ddns-scripts-nsupdate/description
140 Dynamic DNS Client scripts extension for direct updates using bind nsupdate
141 The script directly updates a PowerDNS (or maybe bind server) via nsupdate
142 from bind-client package.
143 It requires:
144 "option dns_server" to be set to the server to be used by nsupdate.
145 "option username" should be set to the key name and
146 "option password" to the base64 encoded shared secret.
147 endef
148
149
150 define Package/ddns-scripts-route53
151 $(call Package/ddns-scripts/Default)
152 TITLE:=Extension for route53 API v1
153 DEPENDS:=ddns-scripts +curl +openssl-util
154 endef
155
156 define Package/ddns-scripts-route53/description
157 Dynamic DNS Client scripts extension for Amazon AWS "route53 API v1".
158 Note: You must also install ca-certificate or ca-bundle.
159 It requires:
160 "option username" to be a valid AWS access key id
161 "option password" to be the matching AWS secret key id
162 "option domain" to contain the hosted zone ID
163 endef
164
165
166 define Package/ddns-scripts-cnkuai
167 $(call Package/ddns-scripts/Default)
168 TITLE:=CnKuai API
169 DEPENDS:=ddns-scripts +curl +giflib-utils
170 endef
171
172 define Package/ddns-scripts-cnkuai/description
173 Dynamic DNS Client scripts extension for "cnkuai.cn".
174 It requires:
175 "option username" to be a valid CnKuai control panel id
176 "option password" to be the matching CnKuai control panel password
177 "option domain" to contain the domain
178 endef
179
180
181 define Package/ddns-scripts-gandi
182 $(call Package/ddns-scripts/Default)
183 TITLE:=Gandi API
184 DEPENDS:=ddns-scripts +curl
185 endef
186
187 define Package/ddns-scripts-gandi/description
188 Dynamic DNS Client scripts extension for "gandi.net".
189 It requires:
190 "option username" to be a valid subdomain for gandi.net
191 "option password" to be a valid API key for ganid.net
192 endef
193
194
195 define Package/ddns-scripts-pdns
196 $(call Package/ddns-scripts/Default)
197 TITLE:=PowerDNS API
198 DEPENDS:=ddns-scripts +curl
199 endef
200
201 define Package/ddns-scripts-pdns/description
202 Dynamic DNS Client scripts extension for "PowerDNS" via API.
203 It requires:
204 "option param_opt(Optional Parameter)" to be a valid root URL for the PowerDNS webserver
205 "option username" to be a valid subdomain for the PowerDNS domain
206 "option password" to be a valid API key for the PowerDNS webserver
207 endef
208
209
210 define Package/ddns-scripts-transip
211 $(call Package/ddns-scripts/Default)
212 TITLE:=Extension for TransIP API
213 DEPENDS:=ddns-scripts +curl +openssl-util +!BUSYBOX_CONFIG_MKTEMP:coreutils-mktemp
214 endef
215
216 define Package/ddns-scripts-transip/description
217 Dynamic DNS Client scripts extension for "transip.nl".
218 Note: You must also install ca-certificate or ca-bundle.
219 It requires:
220 "option username" to be a valid username for transip.nl
221 "option password" to be a valid matching private key
222 "option domain" to contain the base domain
223 "option param_enc" to contain the name of the DNS record to update
224 "option param_opt" to contain the TTL of the DNS record to update
225 endef
226
227
228 define Build/Configure
229 endef
230
231 define Build/Compile
232 endef
233
234
235 define Package/ddns-scripts/install
236 $(INSTALL_DIR) $(1)/etc/hotplug.d/iface
237 $(INSTALL_DATA) ./files/etc/hotplug.d/iface/ddns \
238 $(1)/etc/hotplug.d/iface/95-ddns
239
240 $(INSTALL_DIR) $(1)/etc/init.d
241 $(INSTALL_BIN) ./files/etc/init.d/ddns \
242 $(1)/etc/init.d/ddns
243
244 $(INSTALL_DIR) $(1)/etc/config
245 $(INSTALL_CONF) ./files/etc/config/ddns \
246 $(1)/etc/config/ddns
247
248 $(INSTALL_DIR) $(1)/usr/share/ddns
249 echo "$(PKG_VERSION)-$(PKG_RELEASE)" > $(1)/usr/share/ddns/version
250
251 $(INSTALL_DIR) $(1)/usr/lib/ddns
252 $(INSTALL_DATA) ./files/usr/lib/ddns/dynamic_dns_functions.sh \
253 $(1)/usr/lib/ddns
254 $(INSTALL_BIN) ./files/usr/lib/ddns/dynamic_dns_lucihelper.sh \
255 $(1)/usr/lib/ddns
256 $(INSTALL_BIN) ./files/usr/lib/ddns/dynamic_dns_updater.sh \
257 $(1)/usr/lib/ddns
258
259 $(INSTALL_DIR) $(1)/usr/bin
260 $(INSTALL_BIN) ./files/usr/bin/ddns.sh \
261 $(1)/usr/bin/ddns
262 endef
263
264 define Package/ddns-scripts/postinst
265 #!/bin/sh
266 if [ -z "$${IPKG_INSTROOT}" ]; then
267 /etc/init.d/ddns enabled
268 /etc/init.d/ddns start
269 fi
270 exit 0
271 endef
272
273 define Package/ddns-scripts/prerm
274 #!/bin/sh
275 if [ -n "$${IPKG_INSTROOT}" ]; then
276 /etc/init.d/ddns stop
277 /etc/init.d/ddns disable
278 fi
279 exit 0
280 endef
281
282
283 define Package/ddns-scripts-services/install
284 $(INSTALL_DIR) $(1)/usr/share/ddns/default
285 $(INSTALL_DATA) ./files/usr/share/ddns/default/* \
286 $(1)/usr/share/ddns/default
287
288 # Remove special services
289 rm $(1)/usr/share/ddns/default/cloudflare.com-v4.json
290 rm $(1)/usr/share/ddns/default/freedns.42.pl.json
291 rm $(1)/usr/share/ddns/default/godaddy.com-v1.json
292 rm $(1)/usr/share/ddns/default/digitalocean.com-v2.json
293 rm $(1)/usr/share/ddns/default/dnspod.cn.json
294 rm $(1)/usr/share/ddns/default/no-ip.com.json
295 rm $(1)/usr/share/ddns/default/bind-nsupdate.json
296 rm $(1)/usr/share/ddns/default/route53-v1.json
297 rm $(1)/usr/share/ddns/default/cnkuai.cn.json
298 rm $(1)/usr/share/ddns/default/gandi.net.json
299 rm $(1)/usr/share/ddns/default/pdns.json
300 rm $(1)/usr/share/ddns/default/transip.nl.json
301 endef
302
303
304 define Package/ddns-scripts-cloudflare/install
305 $(INSTALL_DIR) $(1)/usr/lib/ddns
306 $(INSTALL_BIN) ./files/usr/lib/ddns/update_cloudflare_com_v4.sh \
307 $(1)/usr/lib/ddns
308
309 $(INSTALL_DIR) $(1)/usr/share/ddns/default
310 $(INSTALL_DATA) ./files/usr/share/ddns/default/cloudflare.com-v4.json \
311 $(1)/usr/share/ddns/default/
312 endef
313
314 define Package/ddns-scripts-cloudflare/prerm
315 #!/bin/sh
316 if [ -z "$${IPKG_INSTROOT}" ]; then
317 /etc/init.d/ddns stop
318 fi
319 exit 0
320 endef
321
322
323 define Package/ddns-scripts-freedns/install
324 $(INSTALL_DIR) $(1)/usr/lib/ddns
325 $(INSTALL_BIN) ./files/usr/lib/ddns/update_freedns_42_pl.sh \
326 $(1)/usr/lib/ddns
327
328 $(INSTALL_DIR) $(1)/usr/share/ddns/default
329 $(INSTALL_DATA) ./files/usr/share/ddns/default/freedns.42.pl.json \
330 $(1)/usr/share/ddns/default
331 endef
332
333 define Package/ddns-scripts-freedns/prerm
334 #!/bin/sh
335 if [ -z "$${IPKG_INSTROOT}" ]; then
336 /etc/init.d/ddns stop
337 fi
338 exit 0
339 endef
340
341
342 define Package/ddns-scripts-godaddy/install
343 $(INSTALL_DIR) $(1)/usr/lib/ddns
344 $(INSTALL_BIN) ./files/usr/lib/ddns/update_godaddy_com_v1.sh \
345 $(1)/usr/lib/ddns
346
347 $(INSTALL_DIR) $(1)/usr/share/ddns/default
348 $(INSTALL_DATA) ./files/usr/share/ddns/default/godaddy.com-v1.json \
349 $(1)/usr/share/ddns/default
350 endef
351
352 define Package/ddns-scripts-godaddy/prerm
353 #!/bin/sh
354 if [ -z "$${IPKG_INSTROOT}" ]; then
355 /etc/init.d/ddns stop
356 fi
357 exit 0
358 endef
359
360
361 define Package/ddns-scripts-digitalocean/install
362 $(INSTALL_DIR) $(1)/usr/lib/ddns
363 $(INSTALL_BIN) ./files/usr/lib/ddns/update_digitalocean_com_v2.sh \
364 $(1)/usr/lib/ddns
365
366 $(INSTALL_DIR) $(1)/usr/share/ddns/default
367 $(INSTALL_DATA) ./files/usr/share/ddns/default/digitalocean.com-v2.json \
368 $(1)/usr/share/ddns/default
369 endef
370
371 define Package/ddns-scripts-digitalocean/prerm
372 #!/bin/sh
373 if [ -z "$${IPKG_INSTROOT}" ]; then
374 /etc/init.d/ddns stop
375 fi
376 exit 0
377 endef
378
379
380 define Package/ddns-scripts-dnspod/install
381 $(INSTALL_DIR) $(1)/usr/lib/ddns
382 $(INSTALL_BIN) ./files/usr/lib/ddns/update_dnspod_cn.sh \
383 $(1)/usr/lib/ddns
384
385 $(INSTALL_DIR) $(1)/usr/share/ddns/default
386 $(INSTALL_DATA) ./files/usr/share/ddns/default/dnspod.cn.json \
387 $(1)/usr/share/ddns/default/
388 endef
389
390 define Package/ddns-scripts-dnspod/prerm
391 #!/bin/sh
392 if [ -z "$${IPKG_INSTROOT}" ]; then
393 /etc/init.d/ddns stop
394 fi
395 exit 0
396 endef
397
398
399 define Package/ddns-scripts-noip/install
400 $(INSTALL_DIR) $(1)/usr/lib/ddns
401 $(INSTALL_BIN) ./files/usr/lib/ddns/update_no-ip_com.sh \
402 $(1)/usr/lib/ddns
403
404 $(INSTALL_DIR) $(1)/usr/share/ddns/default
405 $(INSTALL_DATA) ./files/usr/share/ddns/default/no-ip.com.json \
406 $(1)/usr/share/ddns/default
407 endef
408
409 define Package/ddns-scripts-noip/prerm
410 #!/bin/sh
411 if [ -z "$${IPKG_INSTROOT}" ]; then
412 /etc/init.d/ddns stop
413 fi
414 exit 0
415 endef
416
417
418 define Package/ddns-scripts-nsupdate/install
419 $(INSTALL_DIR) $(1)/usr/lib/ddns
420 $(INSTALL_BIN) ./files/usr/lib/ddns/update_nsupdate.sh \
421 $(1)/usr/lib/ddns
422
423 $(INSTALL_DIR) $(1)/usr/share/ddns/default
424 $(INSTALL_DATA) ./files/usr/share/ddns/default/bind-nsupdate.json \
425 $(1)/usr/share/ddns/default
426 endef
427
428 define Package/ddns-scripts-nsupdate/prerm
429 #!/bin/sh
430 if [ -z "$${IPKG_INSTROOT}" ]; then
431 /etc/init.d/ddns stop
432 fi
433 exit 0
434 endef
435
436
437 define Package/ddns-scripts-route53/install
438 $(INSTALL_DIR) $(1)/usr/lib/ddns
439 $(INSTALL_BIN) ./files/usr/lib/ddns/update_route53_v1.sh \
440 $(1)/usr/lib/ddns
441
442 $(INSTALL_DIR) $(1)/usr/share/ddns/default
443 $(INSTALL_DATA) ./files/usr/share/ddns/default/route53-v1.json \
444 $(1)/usr/share/ddns/default
445 endef
446
447 define Package/ddns-scripts-route53/prerm
448 #!/bin/sh
449 if [ -z "$${IPKG_INSTROOT}" ]; then
450 /etc/init.d/ddns stop
451 fi
452 exit 0
453 endef
454
455
456 define Package/ddns-scripts-cnkuai/install
457 $(INSTALL_DIR) $(1)/usr/lib/ddns
458 $(INSTALL_BIN) ./files/usr/lib/ddns/update_cnkuai_cn.sh \
459 $(1)/usr/lib/ddns
460
461 $(INSTALL_DIR) $(1)/usr/share/ddns/default
462 $(INSTALL_DATA) ./files/usr/share/ddns/default/cnkuai.cn.json \
463 $(1)/usr/share/ddns/default
464 endef
465
466 define Package/ddns-scripts-cnkuai/prerm
467 #!/bin/sh
468 if [ -z "$${IPKG_INSTROOT}" ]; then
469 /etc/init.d/ddns stop
470 fi
471 exit 0
472 endef
473
474
475 define Package/ddns-scripts-gandi/install
476 $(INSTALL_DIR) $(1)/usr/lib/ddns
477 $(INSTALL_BIN) ./files/usr/lib/ddns/update_gandi_net.sh \
478 $(1)/usr/lib/ddns
479
480 $(INSTALL_DIR) $(1)/usr/share/ddns/default
481 $(INSTALL_DATA) ./files/usr/share/ddns/default/gandi.net.json \
482 $(1)/usr/share/ddns/default
483 endef
484
485 define Package/ddns-scripts-gandi/prerm
486 #!/bin/sh
487 if [ -z "$${IPKG_INSTROOT}" ]; then
488 /etc/init.d/ddns stop
489 fi
490 exit 0
491 endef
492
493
494 define Package/ddns-scripts-pdns/install
495 $(INSTALL_DIR) $(1)/usr/lib/ddns
496 $(INSTALL_BIN) ./files/usr/lib/ddns/update_pdns.sh \
497 $(1)/usr/lib/ddns
498
499 $(INSTALL_DIR) $(1)/usr/share/ddns/default
500 $(INSTALL_DATA) ./files/usr/share/ddns/default/pdns.json \
501 $(1)/usr/share/ddns/default
502 endef
503
504 define Package/ddns-scripts-pdns/prerm
505 #!/bin/sh
506 if [ -z "$${IPKG_INSTROOT}" ]; then
507 /etc/init.d/ddns stop
508 fi
509 exit 0
510 endef
511
512
513 define Package/ddns-scripts-transip/install
514 $(INSTALL_DIR) $(1)/usr/lib/ddns
515 $(INSTALL_BIN) ./files/usr/lib/ddns/update_transip_nl.sh \
516 $(1)/usr/lib/ddns
517
518 $(INSTALL_DIR) $(1)/usr/share/ddns/default
519 $(INSTALL_DATA) ./files/usr/share/ddns/default/transip.nl.json \
520 $(1)/usr/share/ddns/default
521 endef
522
523 define Package/ddns-scripts-transip/prerm
524 #!/bin/sh
525 if [ -z "$${IPKG_INSTROOT}" ]; then
526 /etc/init.d/ddns stop
527 fi
528 exit 0
529 endef
530
531
532 $(eval $(call BuildPackage,ddns-scripts))
533 $(eval $(call BuildPackage,ddns-scripts-services))
534 $(eval $(call BuildPackage,ddns-scripts-cloudflare))
535 $(eval $(call BuildPackage,ddns-scripts-freedns))
536 $(eval $(call BuildPackage,ddns-scripts-godaddy))
537 $(eval $(call BuildPackage,ddns-scripts-digitalocean))
538 $(eval $(call BuildPackage,ddns-scripts-dnspod))
539 $(eval $(call BuildPackage,ddns-scripts-noip))
540 $(eval $(call BuildPackage,ddns-scripts-nsupdate))
541 $(eval $(call BuildPackage,ddns-scripts-route53))
542 $(eval $(call BuildPackage,ddns-scripts-cnkuai))
543 $(eval $(call BuildPackage,ddns-scripts-gandi))
544 $(eval $(call BuildPackage,ddns-scripts-pdns))
545 $(eval $(call BuildPackage,ddns-scripts-transip))