Merge pull request #16792 from damianorenfer/master
[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:=15
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 Build/Configure
211 endef
212
213 define Build/Compile
214 endef
215
216
217 define Package/ddns-scripts/install
218 $(INSTALL_DIR) $(1)/etc/hotplug.d/iface
219 $(INSTALL_DATA) ./files/etc/hotplug.d/iface/ddns \
220 $(1)/etc/hotplug.d/iface/95-ddns
221
222 $(INSTALL_DIR) $(1)/etc/init.d
223 $(INSTALL_BIN) ./files/etc/init.d/ddns \
224 $(1)/etc/init.d/ddns
225
226 $(INSTALL_DIR) $(1)/etc/config
227 $(INSTALL_CONF) ./files/etc/config/ddns \
228 $(1)/etc/config/ddns
229
230 $(INSTALL_DIR) $(1)/usr/share/ddns
231 echo "$(PKG_VERSION)-$(PKG_RELEASE)" > $(1)/usr/share/ddns/version
232
233 $(INSTALL_DIR) $(1)/usr/lib/ddns
234 $(INSTALL_DATA) ./files/usr/lib/ddns/dynamic_dns_functions.sh \
235 $(1)/usr/lib/ddns
236 $(INSTALL_BIN) ./files/usr/lib/ddns/dynamic_dns_lucihelper.sh \
237 $(1)/usr/lib/ddns
238 $(INSTALL_BIN) ./files/usr/lib/ddns/dynamic_dns_updater.sh \
239 $(1)/usr/lib/ddns
240
241 $(INSTALL_DIR) $(1)/usr/bin
242 $(INSTALL_BIN) ./files/usr/bin/ddns.sh \
243 $(1)/usr/bin/ddns
244 endef
245
246 define Package/ddns-scripts/postinst
247 #!/bin/sh
248 if [ -z "$${IPKG_INSTROOT}" ]; then
249 /etc/init.d/ddns enabled
250 /etc/init.d/ddns start
251 fi
252 exit 0
253 endef
254
255 define Package/ddns-scripts/prerm
256 #!/bin/sh
257 if [ -n "$${IPKG_INSTROOT}" ]; then
258 /etc/init.d/ddns stop
259 /etc/init.d/ddns disable
260 fi
261 exit 0
262 endef
263
264
265 define Package/ddns-scripts-services/install
266 $(INSTALL_DIR) $(1)/usr/share/ddns/default
267 $(INSTALL_DATA) ./files/usr/share/ddns/default/* \
268 $(1)/usr/share/ddns/default
269
270 # Remove special services
271 rm $(1)/usr/share/ddns/default/cloudflare.com-v4.json
272 rm $(1)/usr/share/ddns/default/freedns.42.pl.json
273 rm $(1)/usr/share/ddns/default/godaddy.com-v1.json
274 rm $(1)/usr/share/ddns/default/digitalocean.com-v2.json
275 rm $(1)/usr/share/ddns/default/dnspod.cn.json
276 rm $(1)/usr/share/ddns/default/no-ip.com.json
277 rm $(1)/usr/share/ddns/default/bind-nsupdate.json
278 rm $(1)/usr/share/ddns/default/route53-v1.json
279 rm $(1)/usr/share/ddns/default/cnkuai.cn.json
280 rm $(1)/usr/share/ddns/default/gandi.net.json
281 rm $(1)/usr/share/ddns/default/pdns.json
282 endef
283
284
285 define Package/ddns-scripts-cloudflare/install
286 $(INSTALL_DIR) $(1)/usr/lib/ddns
287 $(INSTALL_BIN) ./files/usr/lib/ddns/update_cloudflare_com_v4.sh \
288 $(1)/usr/lib/ddns
289
290 $(INSTALL_DIR) $(1)/usr/share/ddns/default
291 $(INSTALL_DATA) ./files/usr/share/ddns/default/cloudflare.com-v4.json \
292 $(1)/usr/share/ddns/default/
293 endef
294
295 define Package/ddns-scripts-cloudflare/prerm
296 #!/bin/sh
297 if [ -z "$${IPKG_INSTROOT}" ]; then
298 /etc/init.d/ddns stop
299 fi
300 exit 0
301 endef
302
303
304 define Package/ddns-scripts-freedns/install
305 $(INSTALL_DIR) $(1)/usr/lib/ddns
306 $(INSTALL_BIN) ./files/usr/lib/ddns/update_freedns_42_pl.sh \
307 $(1)/usr/lib/ddns
308
309 $(INSTALL_DIR) $(1)/usr/share/ddns/default
310 $(INSTALL_DATA) ./files/usr/share/ddns/default/freedns.42.pl.json \
311 $(1)/usr/share/ddns/default
312 endef
313
314 define Package/ddns-scripts-freedns/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-godaddy/install
324 $(INSTALL_DIR) $(1)/usr/lib/ddns
325 $(INSTALL_BIN) ./files/usr/lib/ddns/update_godaddy_com_v1.sh \
326 $(1)/usr/lib/ddns
327
328 $(INSTALL_DIR) $(1)/usr/share/ddns/default
329 $(INSTALL_DATA) ./files/usr/share/ddns/default/godaddy.com-v1.json \
330 $(1)/usr/share/ddns/default
331 endef
332
333 define Package/ddns-scripts-godaddy/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-digitalocean/install
343 $(INSTALL_DIR) $(1)/usr/lib/ddns
344 $(INSTALL_BIN) ./files/usr/lib/ddns/update_digitalocean_com_v2.sh \
345 $(1)/usr/lib/ddns
346
347 $(INSTALL_DIR) $(1)/usr/share/ddns/default
348 $(INSTALL_DATA) ./files/usr/share/ddns/default/digitalocean.com-v2.json \
349 $(1)/usr/share/ddns/default
350 endef
351
352 define Package/ddns-scripts-digitalocean/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-dnspod/install
362 $(INSTALL_DIR) $(1)/usr/lib/ddns
363 $(INSTALL_BIN) ./files/usr/lib/ddns/update_dnspod_cn.sh \
364 $(1)/usr/lib/ddns
365
366 $(INSTALL_DIR) $(1)/usr/share/ddns/default
367 $(INSTALL_DATA) ./files/usr/share/ddns/default/dnspod.cn.json \
368 $(1)/usr/share/ddns/default/
369 endef
370
371 define Package/ddns-scripts-dnspod/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-noip/install
381 $(INSTALL_DIR) $(1)/usr/lib/ddns
382 $(INSTALL_BIN) ./files/usr/lib/ddns/update_no-ip_com.sh \
383 $(1)/usr/lib/ddns
384
385 $(INSTALL_DIR) $(1)/usr/share/ddns/default
386 $(INSTALL_DATA) ./files/usr/share/ddns/default/no-ip.com.json \
387 $(1)/usr/share/ddns/default
388 endef
389
390 define Package/ddns-scripts-noip/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-nsupdate/install
400 $(INSTALL_DIR) $(1)/usr/lib/ddns
401 $(INSTALL_BIN) ./files/usr/lib/ddns/update_nsupdate.sh \
402 $(1)/usr/lib/ddns
403
404 $(INSTALL_DIR) $(1)/usr/share/ddns/default
405 $(INSTALL_DATA) ./files/usr/share/ddns/default/bind-nsupdate.json \
406 $(1)/usr/share/ddns/default
407 endef
408
409 define Package/ddns-scripts-nsupdate/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-route53/install
419 $(INSTALL_DIR) $(1)/usr/lib/ddns
420 $(INSTALL_BIN) ./files/usr/lib/ddns/update_route53_v1.sh \
421 $(1)/usr/lib/ddns
422
423 $(INSTALL_DIR) $(1)/usr/share/ddns/default
424 $(INSTALL_DATA) ./files/usr/share/ddns/default/route53-v1.json \
425 $(1)/usr/share/ddns/default
426 endef
427
428 define Package/ddns-scripts-route53/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-cnkuai/install
438 $(INSTALL_DIR) $(1)/usr/lib/ddns
439 $(INSTALL_BIN) ./files/usr/lib/ddns/update_cnkuai_cn.sh \
440 $(1)/usr/lib/ddns
441
442 $(INSTALL_DIR) $(1)/usr/share/ddns/default
443 $(INSTALL_DATA) ./files/usr/share/ddns/default/cnkuai.cn.json \
444 $(1)/usr/share/ddns/default
445 endef
446
447 define Package/ddns-scripts-cnkuai/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-gandi/install
457 $(INSTALL_DIR) $(1)/usr/lib/ddns
458 $(INSTALL_BIN) ./files/usr/lib/ddns/update_gandi_net.sh \
459 $(1)/usr/lib/ddns
460
461 $(INSTALL_DIR) $(1)/usr/share/ddns/default
462 $(INSTALL_DATA) ./files/usr/share/ddns/default/gandi.net.json \
463 $(1)/usr/share/ddns/default
464 endef
465
466 define Package/ddns-scripts-gandi/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-pdns/install
476 $(INSTALL_DIR) $(1)/usr/lib/ddns
477 $(INSTALL_BIN) ./files/usr/lib/ddns/update_pdns.sh \
478 $(1)/usr/lib/ddns
479
480 $(INSTALL_DIR) $(1)/usr/share/ddns/default
481 $(INSTALL_DATA) ./files/usr/share/ddns/default/pdns.json \
482 $(1)/usr/share/ddns/default
483 endef
484
485 define Package/ddns-scripts-pdns/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 $(eval $(call BuildPackage,ddns-scripts))
495 $(eval $(call BuildPackage,ddns-scripts-services))
496 $(eval $(call BuildPackage,ddns-scripts-cloudflare))
497 $(eval $(call BuildPackage,ddns-scripts-freedns))
498 $(eval $(call BuildPackage,ddns-scripts-godaddy))
499 $(eval $(call BuildPackage,ddns-scripts-digitalocean))
500 $(eval $(call BuildPackage,ddns-scripts-dnspod))
501 $(eval $(call BuildPackage,ddns-scripts-noip))
502 $(eval $(call BuildPackage,ddns-scripts-nsupdate))
503 $(eval $(call BuildPackage,ddns-scripts-route53))
504 $(eval $(call BuildPackage,ddns-scripts-cnkuai))
505 $(eval $(call BuildPackage,ddns-scripts-gandi))
506 $(eval $(call BuildPackage,ddns-scripts-pdns))