Без опису

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209
  1. include $(TOPDIR)/rules.mk
  2. PKG_NAME:=ddns-scripts
  3. # Version == major.minor.patch
  4. # increase on new functionality (minor) or patches (patch)
  5. PKG_VERSION:=2.4.0
  6. # Release == build
  7. # increase on changes of services files or tld_names.dat
  8. PKG_RELEASE:=1
  9. PKG_LICENSE:=GPL-2.0
  10. PKG_MAINTAINER:=Christian Schoenebeck <christian.schoenebeck@gmail.com>
  11. include $(INCLUDE_DIR)/package.mk
  12. # no default dependencies
  13. PKG_DEFAULT_DEPENDS=
  14. define Package/$(PKG_NAME)/Default
  15. SECTION:=net
  16. CATEGORY:=Network
  17. SUBMENU:=IP Addresses and Names
  18. PKGARCH:=all
  19. endef
  20. ##### **********************************
  21. define Package/$(PKG_NAME)
  22. $(call Package/$(PKG_NAME)/Default)
  23. TITLE:=Dynamic DNS Client scripts (with IPv6 support)
  24. endef
  25. # shown in LuCI package description
  26. define Package/$(PKG_NAME)/description
  27. Dynamic DNS Client scripts (with IPv6 support) - Info: http://wiki.openwrt.org/doc/howto/ddns.client
  28. endef
  29. # shown in menuconfig <Help>
  30. define Package/$(PKG_NAME)/config
  31. help
  32. A highly configurable set of scripts for doing dynamic dns updates.
  33. - IPv6 support
  34. - force communication to IPv4 or IPv6 only
  35. - DNS server support
  36. - using BIND host if installed
  37. - DNS requests via TCP
  38. - Proxy server support
  39. - log file support
  40. - support to run once
  41. .
  42. Version: $(PKG_VERSION)-$(PKG_RELEASE)
  43. Info : http://wiki.openwrt.org/doc/howto/ddns.client
  44. .
  45. $(PKG_MAINTAINER)
  46. endef
  47. ##### **********************************
  48. define Package/$(PKG_NAME)_cloudflare
  49. $(call Package/$(PKG_NAME)/Default)
  50. TITLE:=DDNS extension for CloudFlare
  51. DEPENDS:=$(PKG_NAME)
  52. endef
  53. define Package/$(PKG_NAME)_cloudflare/description
  54. Dynamic DNS Client scripts extension for CloudFlare
  55. endef
  56. ##### **********************************
  57. define Package/$(PKG_NAME)_no-ip_com
  58. $(call Package/$(PKG_NAME)/Default)
  59. TITLE:=DDNS extension for No-IP.com
  60. DEPENDS:=$(PKG_NAME)
  61. endef
  62. define Package/$(PKG_NAME)_no-ip_com/description
  63. Dynamic DNS Client scripts extension for No-IP.com
  64. endef
  65. ##### **********************************
  66. define Package/$(PKG_NAME)_nsupdate
  67. $(call Package/$(PKG_NAME)/Default)
  68. TITLE:=DDNS extension using Bind nsupdate
  69. DEPENDS:=$(PKG_NAME) +bind-client
  70. endef
  71. define Package/$(PKG_NAME)_nsupdate/description
  72. Dynamic DNS Client scripts extension for direct updates using Bind nsupdate
  73. endef
  74. define Package/$(PKG_NAME)_nsupdate/config
  75. help
  76. The script directly updates a PowerDNS (or maybe bind server) via nsupdate
  77. from bind-client package. It requires
  78. "option dns_server" to be set to the server to be used by nsupdate.
  79. "option username" should be set to the key name and
  80. "option password" to the base64 encoded shared secret.
  81. endef
  82. ##### **********************************
  83. define Build/Configure
  84. endef
  85. define Build/Compile
  86. $(CP) ./files $(PKG_BUILD_DIR)
  87. for FILE in `find $(PKG_BUILD_DIR)/files -type f`; do \
  88. $(SED) 's/^\s*#/#/' \
  89. -e '/^#\s\|^#$$$$/d' \
  90. -e 's/\s#\s.*$$$$//' \
  91. -e 's/\s*$$$$//' \
  92. -e '/^\/\/\s/d' \
  93. -e '/^\s*$$$$/d' $$$$FILE; \
  94. done
  95. endef
  96. define Package/$(PKG_NAME)/conffiles
  97. /etc/config/ddns
  98. endef
  99. ##### **********************************
  100. define Package/$(PKG_NAME)/install
  101. $(INSTALL_DIR) $(1)/etc/hotplug.d/iface
  102. $(INSTALL_BIN) $(PKG_BUILD_DIR)/files/ddns.hotplug $(1)/etc/hotplug.d/iface/95-ddns
  103. $(INSTALL_DIR) $(1)/etc/init.d
  104. $(INSTALL_BIN) $(PKG_BUILD_DIR)/files/ddns.init $(1)/etc/init.d/ddns
  105. $(INSTALL_DIR) $(1)/etc/config
  106. $(INSTALL_CONF) $(PKG_BUILD_DIR)/files/ddns.config $(1)/etc/config/ddns
  107. $(INSTALL_DIR) $(1)/usr/lib/ddns
  108. $(INSTALL_DATA) $(PKG_BUILD_DIR)/files/services* $(1)/usr/lib/ddns
  109. $(INSTALL_BIN) $(PKG_BUILD_DIR)/files/dynamic_*.sh $(1)/usr/lib/ddns
  110. endef
  111. define Package/$(PKG_NAME)/postinst
  112. #!/bin/sh
  113. # if run within buildroot exit
  114. [ -n "$${IPKG_INSTROOT}" ] && exit 0
  115. # add new section "ddns" "global" if not exists
  116. uci -q get ddns.global > /dev/null || uci -q set ddns.global='ddns'
  117. uci -q get ddns.global.date_format > /dev/null || uci -q set ddns.global.date_format='%F %R'
  118. uci -q get ddns.global.log_lines > /dev/null || uci -q set ddns.global.log_lines='250'
  119. uci -q get ddns.global.allow_local_ip > /dev/null || uci -q set ddns.global.allow_local_ip='0'
  120. uci -q commit ddns
  121. # clear LuCI indexcache
  122. rm -f /tmp/luci-indexcache >/dev/null 2>&1
  123. exit 0
  124. endef
  125. define Package/$(PKG_NAME)/prerm
  126. #!/bin/sh
  127. # if run within buildroot exit
  128. [ -n "$${IPKG_INSTROOT}" ] && exit 0
  129. # stop running scripts
  130. /etc/init.d/ddns disable
  131. /etc/init.d/ddns stop
  132. # clear LuCI indexcache
  133. rm -f /tmp/luci-indexcache >/dev/null 2>&1
  134. exit 0
  135. endef
  136. ##### **********************************
  137. define Package/$(PKG_NAME)_cloudflare/install
  138. $(INSTALL_DIR) $(1)/usr/lib/ddns
  139. $(INSTALL_BIN) $(PKG_BUILD_DIR)/files/update_CloudFlare.sh $(1)/usr/lib/ddns
  140. $(INSTALL_DATA) $(PKG_BUILD_DIR)/files/tld_names.dat $(1)/usr/lib/ddns
  141. endef
  142. define Package/$(PKG_NAME)_cloudflare/postinst
  143. #!/bin/sh
  144. echo -e '"CloudFlare"\t"update_CloudFlare.sh"' >> $${IPKG_INSTROOT}/usr/lib/ddns/services
  145. echo -e '"CloudFlare"\t"update_CloudFlare.sh"' >> $${IPKG_INSTROOT}/usr/lib/ddns/services_ipv6
  146. endef
  147. define Package/$(PKG_NAME)_cloudflare/prerm
  148. #!/bin/sh
  149. /bin/sed -i '/update_CloudFlare\.sh/ d' $${IPKG_INSTROOT}/usr/lib/ddns/services
  150. /bin/sed -i '/update_CloudFlare\.sh/ d' $${IPKG_INSTROOT}/usr/lib/ddns/services_ipv6
  151. endef
  152. ##### **********************************
  153. define Package/$(PKG_NAME)_no-ip_com/install
  154. $(INSTALL_DIR) $(1)/usr/lib/ddns
  155. $(INSTALL_BIN) $(PKG_BUILD_DIR)/files/update_No-IP.com.sh $(1)/usr/lib/ddns
  156. endef
  157. define Package/$(PKG_NAME)_no-ip_com/postinst
  158. #!/bin/sh
  159. echo -e '"No-IP.com"\t"update_No-IP.com.sh"' >> $${IPKG_INSTROOT}/usr/lib/ddns/services
  160. echo -e '"NoIP.com"\t"update_No-IP.com.sh"' >> $${IPKG_INSTROOT}/usr/lib/ddns/services
  161. endef
  162. define Package/$(PKG_NAME)_no-ip_com/prerm
  163. #!/bin/sh
  164. /bin/sed -i '/update_No-IP\.com\.sh/ d' $${IPKG_INSTROOT}/usr/lib/ddns/services
  165. endef
  166. ##### **********************************
  167. define Package/$(PKG_NAME)_nsupdate/install
  168. $(INSTALL_DIR) $(1)/usr/lib/ddns
  169. $(INSTALL_BIN) $(PKG_BUILD_DIR)/files/update_nsupdate.sh $(1)/usr/lib/ddns
  170. endef
  171. define Package/$(PKG_NAME)_nsupdate/postinst
  172. #!/bin/sh
  173. echo -e '"Bind-nsupdate"\t"update_nsupdate.sh"' >> $${IPKG_INSTROOT}/usr/lib/ddns/services
  174. echo -e '"Bind-nsupdate"\t"update_nsupdate.sh"' >> $${IPKG_INSTROOT}/usr/lib/ddns/services_ipv6
  175. endef
  176. define Package/$(PKG_NAME)_nsupdate/prerm
  177. #!/bin/sh
  178. /bin/sed -i '/update_nsupdate\.sh/ d' $${IPKG_INSTROOT}/usr/lib/ddns/services
  179. /bin/sed -i '/update_nsupdate\.sh/ d' $${IPKG_INSTROOT}/usr/lib/ddns/services_ipv6
  180. endef
  181. ##### **********************************
  182. $(eval $(call BuildPackage,$(PKG_NAME)))
  183. $(eval $(call BuildPackage,$(PKG_NAME)_cloudflare))
  184. $(eval $(call BuildPackage,$(PKG_NAME)_no-ip_com))
  185. $(eval $(call BuildPackage,$(PKG_NAME)_nsupdate))