2 # Copyright (C) 2008-2016 OpenWrt.org
4 # This is free software, licensed under the GNU General Public License v2.
7 include $(TOPDIR)/rules.mk
10 # Version == major.minor.patch
11 # increase on new functionality (minor) or patches (patch)
14 # increase on changes of services files or tld_names.dat
18 PKG_MAINTAINER:=Christian Schoenebeck <christian.schoenebeck@gmail.com>
20 include $(INCLUDE_DIR)/package.mk
22 # no default dependencies
25 define Package/$(PKG_NAME)/Default
28 SUBMENU:=IP Addresses and Names
32 ###### *************************************************************************
33 define Package/$(PKG_NAME)
34 $(call Package/$(PKG_NAME)/Default)
35 TITLE:=Dynamic DNS Client scripts (with IPv6 support)
37 # shown in LuCI package description
38 define Package/$(PKG_NAME)/description
39 Dynamic DNS Client scripts (with IPv6 support) - Info: http://wiki.openwrt.org/doc/howto/ddns.client
41 # shown in menuconfig <Help>
42 define Package/$(PKG_NAME)/config
44 A highly configurable set of scripts for doing dynamic dns updates.
47 - Glue Record support (require BIND host or KNOT host)
48 - DNS requests via TCP
49 - Proxy server support
52 Version: $(PKG_VERSION)-$(PKG_RELEASE)
53 Info : http://wiki.openwrt.org/doc/howto/ddns.client
56 ###### *************************************************************************
57 define Package/$(PKG_NAME)_cloudflare
58 $(call Package/$(PKG_NAME)/Default)
59 TITLE:=CloudFlare.com API v1 (deprecated)
62 define Package/$(PKG_NAME)_cloudflare/description
63 Dynamic DNS Client scripts extension for CloudFlare.com API-v1 (deprecated)
66 ###### *************************************************************************
67 define Package/$(PKG_NAME)_cloudflare.com-v4
68 $(call Package/$(PKG_NAME)/Default)
69 TITLE:=CloudFlare.com API v4 (require cURL)
70 DEPENDS:=$(PKG_NAME) +curl
72 define Package/$(PKG_NAME)_cloudflare.com-v4/description
73 Dynamic DNS Client scripts extension for CloudFlare.com API-v4 (require/install cURL)
76 ###### *************************************************************************
77 define Package/$(PKG_NAME)_godaddy.com-v1
78 $(call Package/$(PKG_NAME)/Default)
79 TITLE:=GoDaddy.com (require cURL)
80 DEPENDS:=$(PKG_NAME) +curl
82 define Package/$(PKG_NAME)_godaddy.com-v1/description
83 Dynamic DNS Client scripts extension for GoDaddy.com (require/install cURL)
86 ###### *************************************************************************
87 define Package/$(PKG_NAME)_no-ip_com
88 $(call Package/$(PKG_NAME)/Default)
89 TITLE:=DDNS extension for No-IP.com
92 define Package/$(PKG_NAME)_no-ip_com/description
93 Dynamic DNS Client scripts extension for No-IP.com
96 ###### *************************************************************************
97 define Package/$(PKG_NAME)_nsupdate
98 $(call Package/$(PKG_NAME)/Default)
99 TITLE:=DDNS extension using Bind nsupdate
100 DEPENDS:=$(PKG_NAME) +bind-client
102 define Package/$(PKG_NAME)_nsupdate/description
103 Dynamic DNS Client scripts extension for direct updates using Bind nsupdate
105 define Package/$(PKG_NAME)_nsupdate/config
107 The script directly updates a PowerDNS (or maybe bind server) via nsupdate
108 from bind-client package. It requires
109 "option dns_server" to be set to the server to be used by nsupdate.
110 "option username" should be set to the key name and
111 "option password" to the base64 encoded shared secret.
115 ###### *************************************************************************
116 define Build/Configure
119 $(CP) ./files $(PKG_BUILD_DIR)
120 for FILE in `find $(PKG_BUILD_DIR)/files -type f`; do \
121 $(SED) 's/^\s*#/#/' \
122 -e '/^#\s\|^#$$$$/d' \
123 -e 's/\s#\s.*$$$$//' \
126 -e '/^\s*$$$$/d' $$$$FILE; \
128 # ensure that VERSION inside dynamic_dns_functions.sh reflect PKG_VERSION of Makefile
129 $(SED) '/^VERSION=*/s/.*/VERSION="$(PKG_VERSION)"/' $(PKG_BUILD_DIR)/files/dynamic_dns_functions.sh
130 $(CP) ./tools $(PKG_BUILD_DIR)
131 chmod 755 $(PKG_BUILD_DIR)/tools/*
132 $(PKG_BUILD_DIR)/tools/public_suffix_list.sh
133 mv -f $(PKG_BUILD_DIR)/tools/public_suffix_list.dat.gz \
134 $(PKG_BUILD_DIR)/files/public_suffix_list.dat.gz
137 define Package/$(PKG_NAME)/conffiles
141 ###### *************************************************************************
142 define Package/$(PKG_NAME)/preinst
144 # if NOT run buildroot and PKG_UPGRADE then stop service
145 [ -z "$${IPKG_INSTROOT}" -a "$${PKG_UPGRADE}" = "1" ] && /etc/init.d/ddns stop >/dev/null 2>&1
146 exit 0 # suppress errors
148 define Package/$(PKG_NAME)/install
149 $(INSTALL_DIR) $(1)/etc/uci-defaults
150 $(INSTALL_BIN) $(PKG_BUILD_DIR)/files/ddns.defaults $(1)/etc/uci-defaults/ddns
151 $(INSTALL_DIR) $(1)/etc/hotplug.d/iface
152 $(INSTALL_BIN) $(PKG_BUILD_DIR)/files/ddns.hotplug $(1)/etc/hotplug.d/iface/95-ddns
153 $(INSTALL_DIR) $(1)/etc/init.d
154 $(INSTALL_BIN) $(PKG_BUILD_DIR)/files/ddns.init $(1)/etc/init.d/ddns
155 $(INSTALL_DIR) $(1)/etc/config
156 $(INSTALL_CONF) $(PKG_BUILD_DIR)/files/ddns.config $(1)/etc/config/ddns
158 $(INSTALL_DIR) $(1)/etc/ddns
159 $(INSTALL_DATA) $(PKG_BUILD_DIR)/files/services* $(1)/etc/ddns
161 $(INSTALL_DIR) $(1)/usr/lib/ddns
162 $(INSTALL_BIN) $(PKG_BUILD_DIR)/files/dynamic_dns_*.sh $(1)/usr/lib/ddns
164 define Package/$(PKG_NAME)/postinst
166 # if NOT run buildroot and PKG_UPGRADE then (re)start service if enabled
167 [ -z "$${IPKG_INSTROOT}" -a "$${PKG_UPGRADE}" = "1" ] \
168 && /etc/init.d/ddns enabled \
169 && /etc/init.d/ddns start >/dev/null 2>&1
170 exit 0 # suppress errors
172 define Package/$(PKG_NAME)/prerm
174 # if run within buildroot exit
175 [ -n "$${IPKG_INSTROOT}" ] && exit 0
177 # stop running scripts
178 /etc/init.d/ddns stop
179 /etc/init.d/ddns disable
181 # clear LuCI indexcache
182 rm -f /tmp/luci-indexcache >/dev/null 2>&1
184 exit 0 # suppress errors
187 ###### *************************************************************************
188 define Package/$(PKG_NAME)_cloudflare/preinst
190 # if NOT run buildroot then stop service
191 [ -z "$${IPKG_INSTROOT}" ] && /etc/init.d/ddns stop >/dev/null 2>&1
192 exit 0 # suppress errors
194 define Package/$(PKG_NAME)_cloudflare/install
195 $(INSTALL_DIR) $(1)/etc/uci-defaults
196 $(INSTALL_BIN) $(PKG_BUILD_DIR)/files/ddns.defaults $(1)/etc/uci-defaults/ddns_cloudflare
197 $(INSTALL_DIR) $(1)/usr/lib/ddns
198 $(INSTALL_BIN) $(PKG_BUILD_DIR)/files/update_cloudflare_com_v1.sh $(1)/usr/lib/ddns
199 $(INSTALL_DIR) $(1)/usr/share
200 $(INSTALL_DATA) $(PKG_BUILD_DIR)/files/public_suffix_list.dat.gz $(1)/usr/share
202 define Package/$(PKG_NAME)_cloudflare/postinst
204 # if NOT upgrading add entries
205 [ "$${PKG_UPGRADE}" = "1" ] || {
206 printf "%s\\t%s\\n" '"cloudflare.com-v1"' '"update_cloudflare_com_v1.sh"' >> $${IPKG_INSTROOT}/etc/ddns/services
207 printf "%s\\t%s\\n" '"cloudflare.com-v1"' '"update_cloudflare_com_v1.sh"' >> $${IPKG_INSTROOT}/etc/ddns/services_ipv6
209 # on real system restart service if enabled
210 [ -z "$${IPKG_INSTROOT}" ] \
211 && /etc/init.d/ddns enabled \
212 && /etc/init.d/ddns start >/dev/null 2>&1
213 exit 0 # suppress errors
215 define Package/$(PKG_NAME)_cloudflare/prerm
217 # if NOT run buildroot then stop service
218 [ -z "$${IPKG_INSTROOT}" ] && /etc/init.d/ddns stop >/dev/null 2>&1
219 /bin/sed -i '/cloudflare\.com-v1/d' $${IPKG_INSTROOT}/etc/ddns/services >/dev/null 2>&1
220 /bin/sed -i '/cloudflare\.com-v1/d' $${IPKG_INSTROOT}/etc/ddns/services_ipv6 >/dev/null 2>&1
221 exit 0 # suppress errors
224 ###### *************************************************************************
225 define Package/$(PKG_NAME)_cloudflare.com-v4/preinst
227 # if NOT run buildroot then stop service
228 [ -z "$${IPKG_INSTROOT}" ] && /etc/init.d/ddns stop >/dev/null 2>&1
229 exit 0 # suppress errors
231 define Package/$(PKG_NAME)_cloudflare.com-v4/install
232 $(INSTALL_DIR) $(1)/etc/uci-defaults
233 $(INSTALL_BIN) $(PKG_BUILD_DIR)/files/ddns.defaults $(1)/etc/uci-defaults/ddns_cloudflare.com-v4
234 $(INSTALL_DIR) $(1)/usr/lib/ddns
235 $(INSTALL_BIN) $(PKG_BUILD_DIR)/files/update_cloudflare_com_v4.sh $(1)/usr/lib/ddns
237 define Package/$(PKG_NAME)_cloudflare.com-v4/postinst
239 # if NOT upgrading add entries
240 [ "$${PKG_UPGRADE}" = "1" ] || {
241 printf "%s\\t%s\\n" '"cloudflare.com-v4"' '"update_cloudflare_com_v4.sh"' >> $${IPKG_INSTROOT}/etc/ddns/services
242 printf "%s\\t%s\\n" '"cloudflare.com-v4"' '"update_cloudflare_com_v4.sh"' >> $${IPKG_INSTROOT}/etc/ddns/services_ipv6
244 # on real system restart service if enabled
245 [ -z "$${IPKG_INSTROOT}" ] \
246 && /etc/init.d/ddns enabled \
247 && /etc/init.d/ddns start >/dev/null 2>&1
248 exit 0 # suppress errors
250 define Package/$(PKG_NAME)_cloudflare.com-v4/prerm
252 [ -z "$${IPKG_INSTROOT}" ] && /etc/init.d/ddns stop >/dev/null 2>&1
253 /bin/sed -i '/cloudflare\.com-v4/d' $${IPKG_INSTROOT}/etc/ddns/services >/dev/null 2>&1
254 /bin/sed -i '/cloudflare\.com-v4/d' $${IPKG_INSTROOT}/etc/ddns/services_ipv6 >/dev/null 2>&1
255 exit 0 # suppress errors
258 ###### *************************************************************************
259 define Package/$(PKG_NAME)_godaddy.com-v1/preinst
261 # if NOT run buildroot then stop service
262 [ -z "$${IPKG_INSTROOT}" ] && /etc/init.d/ddns stop >/dev/null 2>&1
263 exit 0 # suppress errors
265 define Package/$(PKG_NAME)_godaddy.com-v1/install
266 $(INSTALL_DIR) $(1)/etc/uci-defaults
267 $(INSTALL_BIN) $(PKG_BUILD_DIR)/files/ddns.defaults $(1)/etc/uci-defaults/ddns_godaddy.com-v1
268 $(INSTALL_DIR) $(1)/usr/lib/ddns
269 $(INSTALL_BIN) $(PKG_BUILD_DIR)/files/update_godaddy_com_v1.sh $(1)/usr/lib/ddns
271 define Package/$(PKG_NAME)_godaddy.com-v1/postinst
273 # if NOT upgrading add entries
274 [ "$${PKG_UPGRADE}" = "1" ] || {
275 printf "%s\\t%s\\n" '"godaddy.com-v1"' '"update_godaddy_com_v1.sh"' >> $${IPKG_INSTROOT}/etc/ddns/services
276 printf "%s\\t%s\\n" '"godaddy.com-v1"' '"update_godaddy_com_v1.sh"' >> $${IPKG_INSTROOT}/etc/ddns/services_ipv6
278 # on real system restart service if enabled
279 [ -z "$${IPKG_INSTROOT}" ] \
280 && /etc/init.d/ddns enabled \
281 && /etc/init.d/ddns start >/dev/null 2>&1
282 exit 0 # suppress errors
284 define Package/$(PKG_NAME)_godaddy.com-v1/prerm
286 [ -z "$${IPKG_INSTROOT}" ] && /etc/init.d/ddns stop >/dev/null 2>&1
287 /bin/sed -i '/godaddy\.com-v1/d' $${IPKG_INSTROOT}/etc/ddns/services >/dev/null 2>&1
288 /bin/sed -i '/godaddy\.com-v1/d' $${IPKG_INSTROOT}/etc/ddns/services_ipv6 >/dev/null 2>&1
289 exit 0 # suppress errors
292 ###### *************************************************************************
293 define Package/$(PKG_NAME)_no-ip_com/preinst
295 # if NOT run buildroot then stop service
296 [ -z "$${IPKG_INSTROOT}" ] && /etc/init.d/ddns stop >/dev/null 2>&1
297 exit 0 # suppress errors
299 define Package/$(PKG_NAME)_no-ip_com/install
300 $(INSTALL_DIR) $(1)/etc/uci-defaults
301 $(INSTALL_BIN) $(PKG_BUILD_DIR)/files/ddns.defaults $(1)/etc/uci-defaults/ddns_no-ip_com
302 $(INSTALL_DIR) $(1)/usr/lib/ddns
303 $(INSTALL_BIN) $(PKG_BUILD_DIR)/files/update_no-ip_com.sh $(1)/usr/lib/ddns
305 define Package/$(PKG_NAME)_no-ip_com/postinst
307 # if NOT upgrading add entries
308 [ "$${PKG_UPGRADE}" = "1" ] || {
309 printf "%s\\t%s\\n" '"no-ip.com"' '"update_no-ip_com.sh"' >> $${IPKG_INSTROOT}/etc/ddns/services
311 # on real system restart service if enabled
312 [ -z "$${IPKG_INSTROOT}" ] \
313 && /etc/init.d/ddns enabled \
314 && /etc/init.d/ddns start >/dev/null 2>&1
315 exit 0 # suppress errors
317 define Package/$(PKG_NAME)_no-ip_com/prerm
319 [ -z "$${IPKG_INSTROOT}" ] && /etc/init.d/ddns stop >/dev/null 2>&1
320 /bin/sed -i '/no-ip\.com/d' $${IPKG_INSTROOT}/etc/ddns/services >/dev/null 2>&1
321 exit 0 # suppress errors
324 ###### *************************************************************************
325 define Package/$(PKG_NAME)_nsupdate/preinst
327 # if NOT run buildroot then stop service
328 [ -z "$${IPKG_INSTROOT}" ] && /etc/init.d/ddns stop >/dev/null 2>&1
329 exit 0 # suppress errors
331 define Package/$(PKG_NAME)_nsupdate/install
332 $(INSTALL_DIR) $(1)/etc/uci-defaults
333 $(INSTALL_BIN) $(PKG_BUILD_DIR)/files/ddns.defaults $(1)/etc/uci-defaults/ddns_nsupdate
334 $(INSTALL_DIR) $(1)/usr/lib/ddns
335 $(INSTALL_BIN) $(PKG_BUILD_DIR)/files/update_nsupdate.sh $(1)/usr/lib/ddns
337 define Package/$(PKG_NAME)_nsupdate/postinst
339 # if NOT upgrading add entries
340 [ "$${PKG_UPGRADE}" = "1" ] || {
341 printf "%s\\t%s\\n" '"bind-nsupdate"' '"update_nsupdate.sh"' >> $${IPKG_INSTROOT}/etc/ddns/services
342 printf "%s\\t%s\\n" '"bind-nsupdate"' '"update_nsupdate.sh"' >> $${IPKG_INSTROOT}/etc/ddns/services_ipv6
344 # on real system restart service if enabled
345 [ -z "$${IPKG_INSTROOT}" ] \
346 && /etc/init.d/ddns enabled \
347 && /etc/init.d/ddns start >/dev/null 2>&1
348 exit 0 # suppress errors
350 define Package/$(PKG_NAME)_nsupdate/prerm
352 [ -z "$${IPKG_INSTROOT}" ] && /etc/init.d/ddns stop >/dev/null 2>&1
353 /bin/sed -i '/bind-nsupdate/d' $${IPKG_INSTROOT}/etc/ddns/services >/dev/null 2>&1
354 /bin/sed -i '/bind-nsupdate/d' $${IPKG_INSTROOT}/etc/ddns/services_ipv6 >/dev/null 2>&1
355 exit 0 # suppress errors
358 ###### *************************************************************************
359 $(eval $(call BuildPackage,$(PKG_NAME)))
360 $(eval $(call BuildPackage,$(PKG_NAME)_cloudflare))
361 $(eval $(call BuildPackage,$(PKG_NAME)_cloudflare.com-v4))
362 $(eval $(call BuildPackage,$(PKG_NAME)_godaddy.com-v1))
363 $(eval $(call BuildPackage,$(PKG_NAME)_no-ip_com))
364 $(eval $(call BuildPackage,$(PKG_NAME)_nsupdate))