ddns-scripts: apply needed changes in uci-defaults
authorChristian Schoenebeck <redacted>
Mon, 26 Sep 2016 19:33:01 +0000 (21:33 +0200)
committerChristian Schoenebeck <redacted>
Mon, 26 Sep 2016 19:33:01 +0000 (21:33 +0200)
commands to apply changes introduced during release changes, moved from Makefile postinst to /etc/uci-defaults

Signed-off-by: Christian Schoenebeck <redacted>
net/ddns-scripts/Makefile
net/ddns-scripts/files/ddns.defaults [new file with mode: 0755]

index e2bde8cd51863c9d3cfac42efb9c676879a18b35..9975e18522f59eb284cdd8c2b094e1ec8baa5262 100755 (executable)
@@ -116,6 +116,8 @@ endef
 
 ##### **********************************
 define Package/$(PKG_NAME)/install
+       $(INSTALL_DIR) $(1)/etc/uci-defaults
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/files/ddns.defaults $(1)/etc/uci-defaults/ddns
        $(INSTALL_DIR) $(1)/etc/hotplug.d/iface
        $(INSTALL_BIN) $(PKG_BUILD_DIR)/files/ddns.hotplug $(1)/etc/hotplug.d/iface/95-ddns
        $(INSTALL_DIR) $(1)/etc/init.d
@@ -132,19 +134,8 @@ define Package/$(PKG_NAME)/postinst
        # if run within buildroot exit
        [ -n "$${IPKG_INSTROOT}" ] && exit 0
 
-       # add new section "ddns" "global" if not exists
-       uci -q get ddns.global > /dev/null || uci -q set ddns.global='ddns'
-       uci -q get ddns.global.date_format > /dev/null || uci -q set ddns.global.date_format='%F %R'
-       uci -q get ddns.global.log_lines > /dev/null || uci -q set ddns.global.log_lines='250'
-       uci -q get ddns.global.allow_local_ip > /dev/null || uci -q set ddns.global.allow_local_ip='0'
-       uci -q commit ddns
-
-       # fix some service_name entries to new once
-       /bin/sed -i '/service_name/s/freedns.afraid.org/afraid.org/g' /etc/config/ddns
-       /bin/sed -i '/service_name/s/free.editdns.net/editdns.net/g' /etc/config/ddns
-       /bin/sed -i '/service_name/s/domains.google.com/google.com/g' /etc/config/ddns
-       /bin/sed -i '/service_name/s/spdns.de/spdyn.de/g' /etc/config/ddns
-       /bin/sed -i '/service_name/s/strato.de/strato.com/g' /etc/config/ddns
+       # apply changes introduced during release changes
+       /etc/uci-defaults/ddns
 
        # clear LuCI indexcache
        rm -f /tmp/luci-indexcache >/dev/null 2>&1
diff --git a/net/ddns-scripts/files/ddns.defaults b/net/ddns-scripts/files/ddns.defaults
new file mode 100755 (executable)
index 0000000..61fc120
--- /dev/null
@@ -0,0 +1,25 @@
+#!/bin/sh
+
+# add new section "ddns" "global" if not exists
+/sbin/uci -q get ddns.global > /dev/null               || /sbin/uci -q set ddns.global='ddns'
+/sbin/uci -q get ddns.global.date_format > /dev/null   || /sbin/uci -q set ddns.global.date_format='%F %R'
+/sbin/uci -q get ddns.global.log_lines > /dev/null     || /sbin/uci -q set ddns.global.log_lines='250'
+/sbin/uci -q get ddns.global.allow_local_ip > /dev/null        || /sbin/uci -q set ddns.global.allow_local_ip='0'
+/sbin/uci -q commit ddns
+
+# fix some service_name entries to new once
+/bin/sed -i \
+       -e '/service_name/s/CloudFlare/cloudflare\.com/g' \
+       -e '/service_name/s/NoIP\.com/no-ip\.com/g' \
+       -e '/service_name/s/No-IP\.com/no-ip\.com/g' \
+       -e '/service_name/s/freedns.afraid.org/afraid.org/g' \
+       -e '/service_name/s/free.editdns.net/editdns.net/g' \
+       -e '/service_name/s/domains.google.com/google.com/g' \
+       -e '/service_name/s/spdns.de/spdyn.de/g' \
+       -e '/service_name/s/strato.de/strato.com/g' \
+       /etc/config/ddns
+
+# clear LuCI indexcache
+rm -f /tmp/luci-indexcache >/dev/null 2>&1
+
+exit 0
git clone https://git.99rst.org/PROJECT