ddns-scripts: make cloudflare v1 same "domain" parameter syntax

- cloudflare v1 change syntax of option domain to "host.sub@example.com" like already cloudflare v4 and godaddy to prepare logterm remove of public_suffix_list.dat from package
- change Makefile to be backportable to CC15.05 and working on DD
- change ddns.defaults to prepare future releases of ddns-scripts
- minor fixes

Signed-off-by: Christian Schoenebeck <christian.schoenebeck@gmail.com>
This commit is contained in:
Christian Schoenebeck
2017-01-09 21:30:55 +01:00
parent d13f3f2ab0
commit 2c7d476cd9
9 changed files with 414 additions and 256 deletions
+85 -51
View File
@@ -1,5 +1,5 @@
#
# Copyright (C) 2008-2016 OpenWrt.org
# Copyright (C) 2008-2017 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
#
@@ -12,7 +12,7 @@ PKG_NAME:=ddns-scripts
PKG_VERSION:=2.7.6
# Release == build
# increase on changes of services files or tld_names.dat
PKG_RELEASE:=9
PKG_RELEASE:=10
PKG_LICENSE:=GPL-2.0
PKG_MAINTAINER:=Christian Schoenebeck <christian.schoenebeck@gmail.com>
@@ -139,8 +139,8 @@ endef
###### *************************************************************************
define Package/$(PKG_NAME)/preinst
#!/bin/sh
# if NOT run buildroot and PKG_UPGRADE then stop service
[ -z "$${IPKG_INSTROOT}" -a "$${PKG_UPGRADE}" = "1" ] && /etc/init.d/ddns stop >/dev/null 2>&1
# if NOT run buildroot then stop service
[ -z "$${IPKG_INSTROOT}" ] && /etc/init.d/ddns stop >/dev/null 2>&1
exit 0 # suppress errors
endef
define Package/$(PKG_NAME)/install
@@ -162,23 +162,24 @@ endef
define Package/$(PKG_NAME)/postinst
#!/bin/sh
# if NOT run buildroot and PKG_UPGRADE then (re)start service if enabled
[ -z "$${IPKG_INSTROOT}" -a "$${PKG_UPGRADE}" = "1" ] \
&& /etc/init.d/ddns enabled \
&& /etc/init.d/ddns start >/dev/null 2>&1
[ -z "$${IPKG_INSTROOT}" -a "$${PKG_UPGRADE}" = "1" ] && {
[ -x /etc/uci-defaults/ddns ] && \
/etc/uci-defaults/ddns && \
rm -f /etc/uci-defaults/ddns >/dev/null 2>&1
/etc/init.d/ddns enabled && \
/etc/init.d/ddns start >/dev/null 2>&1
}
exit 0 # suppress errors
endef
define Package/$(PKG_NAME)/prerm
#!/bin/sh
# if run within buildroot exit
[ -n "$${IPKG_INSTROOT}" ] && exit 0
# stop running scripts
/etc/init.d/ddns stop
/etc/init.d/ddns disable
# clear LuCI indexcache
rm -f /tmp/luci-indexcache >/dev/null 2>&1
exit 0 # suppress errors
endef
@@ -192,28 +193,34 @@ endef
define Package/$(PKG_NAME)_cloudflare/install
$(INSTALL_DIR) $(1)/etc/uci-defaults
$(INSTALL_BIN) $(PKG_BUILD_DIR)/files/ddns.defaults $(1)/etc/uci-defaults/ddns_cloudflare
$(INSTALL_DIR) $(1)/usr/lib/ddns
$(INSTALL_BIN) $(PKG_BUILD_DIR)/files/update_cloudflare_com_v1.sh $(1)/usr/lib/ddns
$(INSTALL_DIR) $(1)/usr/share
$(INSTALL_DATA) $(PKG_BUILD_DIR)/files/public_suffix_list.dat.gz $(1)/usr/share
$(INSTALL_DIR) $(1)/usr/lib/ddns
$(INSTALL_BIN) $(PKG_BUILD_DIR)/files/update_cloudflare_com_v1.sh $(1)/usr/lib/ddns
endef
define Package/$(PKG_NAME)_cloudflare/postinst
#!/bin/sh
# if NOT upgrading add entries
[ "$${PKG_UPGRADE}" = "1" ] || {
printf "%s\\t%s\\n" '"cloudflare.com-v1"' '"update_cloudflare_com_v1.sh"' >> $${IPKG_INSTROOT}/etc/ddns/services
printf "%s\\t%s\\n" '"cloudflare.com-v1"' '"update_cloudflare_com_v1.sh"' >> $${IPKG_INSTROOT}/etc/ddns/services_ipv6
}
# remove old services file entries
/bin/sed -i '/cloudflare\.com-v1/d' $${IPKG_INSTROOT}/etc/ddns/services >/dev/null 2>&1
/bin/sed -i '/cloudflare\.com-v1/d' $${IPKG_INSTROOT}/etc/ddns/services_ipv6 >/dev/null 2>&1
# and create new
printf "%s\\t%s\\n" '"cloudflare.com-v1"' '"update_cloudflare_com_v1.sh"' >> $${IPKG_INSTROOT}/etc/ddns/services
printf "%s\\t%s\\n" '"cloudflare.com-v1"' '"update_cloudflare_com_v1.sh"' >> $${IPKG_INSTROOT}/etc/ddns/services_ipv6
# on real system restart service if enabled
[ -z "$${IPKG_INSTROOT}" ] \
&& /etc/init.d/ddns enabled \
&& /etc/init.d/ddns start >/dev/null 2>&1
[ -z "$${IPKG_INSTROOT}" ] && {
[ -x /etc/uci-defaults/ddns_cloudflare ] && \
/etc/uci-defaults/ddns_cloudflare && \
rm -f /etc/uci-defaults/ddns_cloudflare >/dev/null 2>&1
/etc/init.d/ddns enabled && \
/etc/init.d/ddns start >/dev/null 2>&1
}
exit 0 # suppress errors
endef
define Package/$(PKG_NAME)_cloudflare/prerm
#!/bin/sh
# if NOT run buildroot then stop service
[ -z "$${IPKG_INSTROOT}" ] && /etc/init.d/ddns stop >/dev/null 2>&1
# remove services file entries
/bin/sed -i '/cloudflare\.com-v1/d' $${IPKG_INSTROOT}/etc/ddns/services >/dev/null 2>&1
/bin/sed -i '/cloudflare\.com-v1/d' $${IPKG_INSTROOT}/etc/ddns/services_ipv6 >/dev/null 2>&1
exit 0 # suppress errors
@@ -234,20 +241,27 @@ define Package/$(PKG_NAME)_cloudflare.com-v4/install
endef
define Package/$(PKG_NAME)_cloudflare.com-v4/postinst
#!/bin/sh
# if NOT upgrading add entries
[ "$${PKG_UPGRADE}" = "1" ] || {
printf "%s\\t%s\\n" '"cloudflare.com-v4"' '"update_cloudflare_com_v4.sh"' >> $${IPKG_INSTROOT}/etc/ddns/services
printf "%s\\t%s\\n" '"cloudflare.com-v4"' '"update_cloudflare_com_v4.sh"' >> $${IPKG_INSTROOT}/etc/ddns/services_ipv6
}
# remove old services file entries
/bin/sed -i '/cloudflare\.com-v4/d' $${IPKG_INSTROOT}/etc/ddns/services >/dev/null 2>&1
/bin/sed -i '/cloudflare\.com-v4/d' $${IPKG_INSTROOT}/etc/ddns/services_ipv6 >/dev/null 2>&1
# and create new
printf "%s\\t%s\\n" '"cloudflare.com-v4"' '"update_cloudflare_com_v4.sh"' >> $${IPKG_INSTROOT}/etc/ddns/services
printf "%s\\t%s\\n" '"cloudflare.com-v4"' '"update_cloudflare_com_v4.sh"' >> $${IPKG_INSTROOT}/etc/ddns/services_ipv6
# on real system restart service if enabled
[ -z "$${IPKG_INSTROOT}" ] \
&& /etc/init.d/ddns enabled \
&& /etc/init.d/ddns start >/dev/null 2>&1
[ -z "$${IPKG_INSTROOT}" ] && {
[ -x /etc/uci-defaults/ddns_cloudflare.com-v4 ] && \
/etc/uci-defaults/ddns_cloudflare.com-v4 && \
rm -f /etc/uci-defaults/ddns_cloudflare.com-v4 >/dev/null 2>&1
/etc/init.d/ddns enabled && \
/etc/init.d/ddns start >/dev/null 2>&1
}
exit 0 # suppress errors
endef
define Package/$(PKG_NAME)_cloudflare.com-v4/prerm
#!/bin/sh
# if NOT run buildroot then stop service
[ -z "$${IPKG_INSTROOT}" ] && /etc/init.d/ddns stop >/dev/null 2>&1
# remove services file entries
/bin/sed -i '/cloudflare\.com-v4/d' $${IPKG_INSTROOT}/etc/ddns/services >/dev/null 2>&1
/bin/sed -i '/cloudflare\.com-v4/d' $${IPKG_INSTROOT}/etc/ddns/services_ipv6 >/dev/null 2>&1
exit 0 # suppress errors
@@ -268,20 +282,27 @@ define Package/$(PKG_NAME)_godaddy.com-v1/install
endef
define Package/$(PKG_NAME)_godaddy.com-v1/postinst
#!/bin/sh
# if NOT upgrading add entries
[ "$${PKG_UPGRADE}" = "1" ] || {
printf "%s\\t%s\\n" '"godaddy.com-v1"' '"update_godaddy_com_v1.sh"' >> $${IPKG_INSTROOT}/etc/ddns/services
printf "%s\\t%s\\n" '"godaddy.com-v1"' '"update_godaddy_com_v1.sh"' >> $${IPKG_INSTROOT}/etc/ddns/services_ipv6
}
# remove old services file entries
/bin/sed -i '/godaddy\.com-v1/d' $${IPKG_INSTROOT}/etc/ddns/services >/dev/null 2>&1
/bin/sed -i '/godaddy\.com-v1/d' $${IPKG_INSTROOT}/etc/ddns/services_ipv6 >/dev/null 2>&1
# and create new
printf "%s\\t%s\\n" '"godaddy.com-v1"' '"update_godaddy_com_v1.sh"' >> $${IPKG_INSTROOT}/etc/ddns/services
printf "%s\\t%s\\n" '"godaddy.com-v1"' '"update_godaddy_com_v1.sh"' >> $${IPKG_INSTROOT}/etc/ddns/services_ipv6
# on real system restart service if enabled
[ -z "$${IPKG_INSTROOT}" ] \
&& /etc/init.d/ddns enabled \
&& /etc/init.d/ddns start >/dev/null 2>&1
[ -z "$${IPKG_INSTROOT}" ] && {
[ -x /etc/uci-defaults/ddns_godaddy.com-v1 ] && \
/etc/uci-defaults/ddns_godaddy.com-v1 && \
rm -f /etc/uci-defaults/ddns_godaddy.com-v1 >/dev/null 2>&1
/etc/init.d/ddns enabled \
&& /etc/init.d/ddns start >/dev/null 2>&1
}
exit 0 # suppress errors
endef
define Package/$(PKG_NAME)_godaddy.com-v1/prerm
#!/bin/sh
# if NOT run buildroot then stop service
[ -z "$${IPKG_INSTROOT}" ] && /etc/init.d/ddns stop >/dev/null 2>&1
# remove services file entries
/bin/sed -i '/godaddy\.com-v1/d' $${IPKG_INSTROOT}/etc/ddns/services >/dev/null 2>&1
/bin/sed -i '/godaddy\.com-v1/d' $${IPKG_INSTROOT}/etc/ddns/services_ipv6 >/dev/null 2>&1
exit 0 # suppress errors
@@ -302,19 +323,25 @@ define Package/$(PKG_NAME)_no-ip_com/install
endef
define Package/$(PKG_NAME)_no-ip_com/postinst
#!/bin/sh
# if NOT upgrading add entries
[ "$${PKG_UPGRADE}" = "1" ] || {
printf "%s\\t%s\\n" '"no-ip.com"' '"update_no-ip_com.sh"' >> $${IPKG_INSTROOT}/etc/ddns/services
}
# remove old services file entries
/bin/sed -i '/no-ip\.com/d' $${IPKG_INSTROOT}/etc/ddns/services >/dev/null 2>&1
# and create new
printf "%s\\t%s\\n" '"no-ip.com"' '"update_no-ip_com.sh"' >> $${IPKG_INSTROOT}/etc/ddns/services
# on real system restart service if enabled
[ -z "$${IPKG_INSTROOT}" ] \
&& /etc/init.d/ddns enabled \
&& /etc/init.d/ddns start >/dev/null 2>&1
[ -z "$${IPKG_INSTROOT}" ] && {
[ -x /etc/uci-defaults/ddns_no-ip_com ] && \
/etc/uci-defaults/ddns_no-ip_com && \
rm -f /etc/uci-defaults/ddns_no-ip_com >/dev/null 2>&1
/etc/init.d/ddns enabled && \
/etc/init.d/ddns start >/dev/null 2>&1
}
exit 0 # suppress errors
endef
define Package/$(PKG_NAME)_no-ip_com/prerm
#!/bin/sh
# if NOT run buildroot then stop service
[ -z "$${IPKG_INSTROOT}" ] && /etc/init.d/ddns stop >/dev/null 2>&1
# remove services file entries
/bin/sed -i '/no-ip\.com/d' $${IPKG_INSTROOT}/etc/ddns/services >/dev/null 2>&1
exit 0 # suppress errors
endef
@@ -334,20 +361,27 @@ define Package/$(PKG_NAME)_nsupdate/install
endef
define Package/$(PKG_NAME)_nsupdate/postinst
#!/bin/sh
# if NOT upgrading add entries
[ "$${PKG_UPGRADE}" = "1" ] || {
printf "%s\\t%s\\n" '"bind-nsupdate"' '"update_nsupdate.sh"' >> $${IPKG_INSTROOT}/etc/ddns/services
printf "%s\\t%s\\n" '"bind-nsupdate"' '"update_nsupdate.sh"' >> $${IPKG_INSTROOT}/etc/ddns/services_ipv6
}
# remove old services file entries
/bin/sed -i '/bind-nsupdate/d' $${IPKG_INSTROOT}/etc/ddns/services >/dev/null 2>&1
/bin/sed -i '/bind-nsupdate/d' $${IPKG_INSTROOT}/etc/ddns/services_ipv6 >/dev/null 2>&1
# and create new
printf "%s\\t%s\\n" '"bind-nsupdate"' '"update_nsupdate.sh"' >> $${IPKG_INSTROOT}/etc/ddns/services
printf "%s\\t%s\\n" '"bind-nsupdate"' '"update_nsupdate.sh"' >> $${IPKG_INSTROOT}/etc/ddns/services_ipv6
# on real system restart service if enabled
[ -z "$${IPKG_INSTROOT}" ] \
&& /etc/init.d/ddns enabled \
&& /etc/init.d/ddns start >/dev/null 2>&1
[ -z "$${IPKG_INSTROOT}" ] && {
[ -x /etc/uci-defaults/ddns_nsupdate ] && \
/etc/uci-defaults/ddns_nsupdate && \
rm -f /etc/uci-defaults/ddns_nsupdate >/dev/null 2>&1
/etc/init.d/ddns enabled && \
/etc/init.d/ddns start >/dev/null 2>&1
}
exit 0 # suppress errors
endef
define Package/$(PKG_NAME)_nsupdate/prerm
#!/bin/sh
# if NOT run buildroot then stop service
[ -z "$${IPKG_INSTROOT}" ] && /etc/init.d/ddns stop >/dev/null 2>&1
# remove services file entries
/bin/sed -i '/bind-nsupdate/d' $${IPKG_INSTROOT}/etc/ddns/services >/dev/null 2>&1
/bin/sed -i '/bind-nsupdate/d' $${IPKG_INSTROOT}/etc/ddns/services_ipv6 >/dev/null 2>&1
exit 0 # suppress errors