Browse Source

ddns-scripts: remove old and unmaintainded uci defaults scripts

From my point of view there are several reasons why this uci default
script should be deleted.

- This script is no longer maintained and there was no significant
change since the old stable release openwrt-18.06.

- The script is installed with every additional package. Which is kind
of funny. It would be better to maintain a separate uci default upgrade
script for each package. So uci default tasks that are no longer needed
can simply be deleted without having to watch and test the whole scirpt.

- The script is also not so easy to maintain, because the code is not
easy to read.

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
lilik-openwrt-22.03
Florian Eckert 4 years ago
parent
commit
7855caff9e
2 changed files with 0 additions and 227 deletions
  1. +0
    -26
      net/ddns-scripts/Makefile
  2. +0
    -201
      net/ddns-scripts/files/ddns.defaults

+ 0
- 26
net/ddns-scripts/Makefile View File

@ -184,8 +184,6 @@ define Package/ddns-scripts/preinst
endef
define Package/ddns-scripts/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
@ -233,9 +231,6 @@ define Package/ddns-scripts_cloudflare.com-v4/preinst
endef
define Package/ddns-scripts_cloudflare.com-v4/install
$(INSTALL_DIR) $(1)/etc/uci-defaults
$(INSTALL_BIN) $(PKG_BUILD_DIR)/files/ddns.defaults $(1)/etc/uci-defaults/ddns_cloudflare.com-v4
$(INSTALL_DIR) $(1)/usr/lib/ddns
$(INSTALL_BIN) ./files/usr/lib/ddns/update_cloudflare_com_v4.sh \
$(1)/usr/lib/ddns
@ -275,9 +270,6 @@ define Package/ddns-scripts_freedns_42_pl/preinst
endef
define Package/ddns-scripts_freedns_42_pl/install
$(INSTALL_DIR) $(1)/etc/uci-defaults
$(INSTALL_BIN) $(PKG_BUILD_DIR)/files/ddns.defaults $(1)/etc/uci-defaults/ddns_freedns_42_pl
$(INSTALL_DIR) $(1)/usr/lib/ddns
$(INSTALL_BIN) ./files/usr/lib/ddns/update_freedns_42_pl.sh \
$(1)/usr/lib/ddns
@ -317,9 +309,6 @@ define Package/ddns-scripts_godaddy.com-v1/preinst
endef
define Package/ddns-scripts_godaddy.com-v1/install
$(INSTALL_DIR) $(1)/etc/uci-defaults
$(INSTALL_BIN) $(PKG_BUILD_DIR)/files/ddns.defaults $(1)/etc/uci-defaults/ddns_godaddy.com-v1
$(INSTALL_DIR) $(1)/usr/lib/ddns
$(INSTALL_BIN) ./files/usr/lib/ddns/update_godaddy_com_v1.sh \
$(1)/usr/lib/ddns
@ -359,9 +348,6 @@ define Package/ddns-scripts_digitalocean.com-v2/preinst
endef
define Package/ddns-scripts_digitalocean.com-v2/install
$(INSTALL_DIR) $(1)/etc/uci-defaults
$(INSTALL_BIN) $(PKG_BUILD_DIR)/files/ddns.defaults $(1)/etc/uci-defaults/ddns_digtalocean.com-v2
$(INSTALL_DIR) $(1)/usr/lib/ddns
$(INSTALL_BIN) ./files/usr/lib/ddns/update_digitalocean_com_v2.sh \
$(1)/usr/lib/ddns
@ -401,9 +387,6 @@ define Package/ddns-scripts_no-ip_com/preinst
endef
define Package/ddns-scripts_no-ip_com/install
$(INSTALL_DIR) $(1)/etc/uci-defaults
$(INSTALL_BIN) $(PKG_BUILD_DIR)/files/ddns.defaults $(1)/etc/uci-defaults/ddns_no-ip_com
$(INSTALL_DIR) $(1)/usr/lib/ddns
$(INSTALL_BIN) ./files/usr/lib/ddns/update_no-ip_com.sh \
$(1)/usr/lib/ddns
@ -443,9 +426,6 @@ define Package/ddns-scripts_nsupdate/preinst
endef
define Package/ddns-scripts_nsupdate/install
$(INSTALL_DIR) $(1)/etc/uci-defaults
$(INSTALL_BIN) $(PKG_BUILD_DIR)/files/ddns.defaults $(1)/etc/uci-defaults/ddns_nsupdate
$(INSTALL_DIR) $(1)/usr/lib/ddns
$(INSTALL_BIN) ./files/usr/lib/ddns/update_nsupdate.sh \
$(1)/usr/lib/ddns
@ -485,9 +465,6 @@ define Package/ddns-scripts_route53-v1/preinst
endef
define Package/ddns-scripts_route53-v1/install
$(INSTALL_DIR) $(1)/etc/uci-defaults
$(INSTALL_BIN) $(PKG_BUILD_DIR)/files/ddns.defaults $(1)/etc/uci-defaults/ddns_route53-v1
$(INSTALL_DIR) $(1)/usr/lib/ddns
$(INSTALL_BIN) ./files/usr/lib/ddns/update_route53_v1.sh \
$(1)/usr/lib/ddns
@ -527,9 +504,6 @@ define Package/ddns-scripts_cnkuai_cn/preinst
endef
define Package/ddns-scripts_cnkuai_cn/install
$(INSTALL_DIR) $(1)/etc/uci-defaults
$(INSTALL_BIN) $(PKG_BUILD_DIR)/files/ddns.defaults $(1)/etc/uci-defaults/ddns_cnkuai_cn
$(INSTALL_DIR) $(1)/usr/lib/ddns
$(INSTALL_BIN) ./files/usr/lib/ddns/update_cnkuai_cn.sh \
$(1)/usr/lib/ddns


+ 0
- 201
net/ddns-scripts/files/ddns.defaults View File

@ -1,201 +0,0 @@
#!/bin/sh
g_pslfile=/usr/share/public_suffix_list.dat.gz
[ -f "$g_pslfile" ] || g_pslfile="$(dirname $0)/public_suffix_list.dat.gz"
g_pslerr=0
g_cfgfile="ddns"
# modify timer settings from interval and unit to dhms format
timer2dhms() {
# $1 Number and
# $2 Unit of time interval
local t=0
case $2 in
days) t=$(( $1 * 86400 ));;
hours) t=$(( $1 * 3600 ));;
minutes) t=$(( $1 * 60 ));;
*) t=$1;;
esac
local d=$(( $t / 86400 ))
local h=$(( $t % 86400 / 3600 ))
local m=$(( $t % 3600 / 60 ))
local s=$(( $t % 60 ))
if [ $d -gt 0 ]; then printf "%dd %02dh %02dm %02ds" "$d" "$h" "$m" "$s"
elif [ $h -gt 0 ]; then printf "%dh %02dm %02ds" "$h" "$m" "$s"
elif [ $m -gt 0 ]; then printf "%dm %02ds" "$m" "$s"
else printf "%ds" "$s"; fi
unset d h m s t
return 0
}
# using function to not confuse function calls with existing ones inside /lib/functions.sh
update_config() {
uc_uci="$(command -v uci) -q" # ignore errors
uc_cfg=""
uc_name=""
uc_var=""
uc_val=""
package() { return 0; }
config () {
uc_cfg="$1"
uc_name="$2"
# Type = ddns Name = global
if [ "$uc_cfg" = "$g_cfgfile" -a "$uc_name" = "global" ]; then
option() {
uc_var="$1"; shift
uc_val="$*"
case "$uc_var" in
allow_local_ip) $uc_uci rename $g_cfgfile.$uc_name.$uc_var="upd_privateip";;
date_format) $uc_uci rename $g_cfgfile.$uc_name.$uc_var="ddns_dateformat";;
log_lines) $uc_uci rename $g_cfgfile.$uc_name.$uc_var="ddns_loglines";;
log_dir) $uc_uci rename $g_cfgfile.$uc_name.$uc_var="ddns_logdir";;
run_dir) $uc_uci rename $g_cfgfile.$uc_name.$uc_var="ddns_rundir";;
# leave all other options currently unchanged
*) ;;
esac
}
# Type = service Name = ???
elif [ "$uc_cfg" = "service" ]; then
option() {
uc_var="$1"; shift
uc_val="$*"
case "$uc_var" in
# fix some option service_name values
# and some settings for specific providers
service_name|upd_provider)
case "$uc_val" in
freedns\.afraid\.org|afraid\.org)
$uc_uci set $g_cfgfile.$uc_name.$uc_var="afraid.org-keyauth";;
Bind-nsupdate)
$uc_uci set $g_cfgfile.$uc_name.$uc_var="bind-nsupdate";;
dyndns\.org|dyndns\.com)
$uc_uci set $g_cfgfile.$uc_name.$uc_var="dyn.com";;
free\.editdns\.net)
$uc_uci set $g_cfgfile.$uc_name.$uc_var="editdns.net";;
FreeDNS\.42\.pl)
$uc_uci set $g_cfgfile.$uc_name.$uc_var="freedns.42.pl";;
domains\.google\.com)
$uc_uci set $g_cfgfile.$uc_name.$uc_var="google.com";;
loopia\.com)
$uc_uci set $g_cfgfile.$uc_name.$uc_var="loopia.se";;
NoIP\.com|No-IP\.com)
$uc_uci set $g_cfgfile.$uc_name.$uc_var="no-ip.com";;
spdns\.de)
$uc_uci set $g_cfgfile.$uc_name.$uc_var="spdyn.de";;
strato\.de)
$uc_uci set $g_cfgfile.$uc_name.$uc_var="strato.com";;
*)
# all others leave unchanged
;;
esac
# rename option service_name to option upd_provider
# $uc_uci rename $g_cfgfile.$uc_name.$uc_var="upd_provider"
;;
domain|upd_object)
# verify if lookup_host is set
$uc_uci get $g_cfgfile.$uc_name.lookup_host >/dev/null 2>&1 || \
$uc_uci set $g_cfgfile.$uc_name.lookup_host="$uc_val"
if [ -f "$g_pslfile" ]; then
# if service_name/upd_provider cloudflare_v1 then change domain/upd_object to new syntax
# there is no sort order inside uci data so we need multiple checks
uco_provider=$($uc_uci get $g_cfgfile.$uc_name.upd_provider 2>/dev/null) || \
uco_provider=$($uc_uci get $g_cfgfile.$uc_name.service_name 2>/dev/null)
unset uco_provider
fi
# rename option domain to option upd_object
# $uc_uci rename $g_cfgfile.$uc_name.$uc_var="upd_object"
;;
# dns_server)
# # if bind-nsupdate takeover old "dns_server" value as new "upd_nsupd_server" value
# uco_provider=$($uc_uci get $g_cfgfile.$uc_name.upd_provider 2>/dev/null) || \
# uco_provider=$($uc_uci get $g_cfgfile.$uc_name.service_name 2>/dev/null)
# [ "$uco_provider" = "Bind-nsupdate" -o \
# "$uco_provider" = "bind-nsupdate" ] && \
# $uc_uci set $g_cfgfile.$uc_name.upd_nsupd_server="$uc_val"
# # rename option dns_server to new option global_dnssvr
# $udc_uci rename $g_cfgfile.$uc_name.$uc_var="global_dnssvr"
# ;;
# bind_network)
# $udc_uci set $g_cfgfile.$uc_name.upd_url_bindnet="$uc_val"
# $udc_uci rename $g_cfgfile.$uc_name.$uc_var="lip_url_bindnet"
# ;;
# proxy)
# # proxy value must include protocoll
# $udc_uci set $g_cfgfile.$uc_name.$uc_var="http://$uc_val"
# $udc_uci rename $g_cfgfile.$uc_name.$uc_var="upd_url_proxy"
# ;;
# use_ipv6)
# $udc_uci set $g_cfgfile.$uc_name.$uc_var="$(( 4 + ( 2 * $uc_val ) ))"
# $udc_uci rename $g_cfgfile.$uc_name.$uc_var="upd_ipversion"
# TODO update_url)
# TODO update_script)
# other renames
# TODO lookup_host) -> rip_host
# enabled) $udc_uci rename $g_cfgfile.$uc_name.$uc_var="upd_enabled";;
# force_dnstcp) $udc_uci rename $g_cfgfile.$uc_name.$uc_var="rip_host_dnstcp";;
# is_glue) $udc_uci rename $g_cfgfile.$uc_name.$uc_var="rip_host_isglue";;
# ip_interface) $udc_uci rename $g_cfgfile.$uc_name.$uc_var="lip_iface";;
# ip_network) $udc_uci rename $g_cfgfile.$uc_name.$uc_var="lip_net";;
# use_https) $udc_uci rename $g_cfgfile.$uc_name.$uc_var="upd_url_secure";;
# cacert) $udc_uci rename $g_cfgfile.$uc_name.$uc_var="upd_url_cacert";;
# username) $udc_uci rename $g_cfgfile.$uc_name.$uc_var="upd_username";;
# password) $udc_uci rename $g_cfgfile.$uc_name.$uc_var="upd_password";;
# param_opt) $udc_uci rename $g_cfgfile.$uc_name.$uc_var="upd_paramopt";;
# param_enc) $udc_uci rename $g_cfgfile.$uc_name.$uc_var="upd_paramenc";;
# leave all other options currently unchanged
*) ;;
esac
return 0
}
return 0
# ignore unknown
else
return 0
fi
}
# read config file
uc_data=$($uc_uci -S -n export "$g_cfgfile")
uc_ret="$?"
# Error then create config file
[ $uc_ret -ne 0 ] && {
touch /etc/config/$uc_cfgfile
chmod 644 /etc/config/$uc_cfgfile
}
# No error and uc_data then execute (eval)
# this will call functions defined above
[ $uc_ret -eq 0 -a -n "$uc_data" ] && eval "$uc_data"
# add config ddns "global" (ignore error if exists)
$uc_uci set ddns.global="$g_cfgfile"
# write changes to config file
$uc_uci commit "$g_cfgfile"
unset uc_uci uc_cfg uc_name uc_var uc_val uc_ret uc_data
return 0
}
# clear LuCI indexcache
rm -f /tmp/luci-indexcache >/dev/null 2>&1
# do config update
update_config
#cleanup
[ $g_pslerr -ne 0 ] && {
unset g_pslfile g_pslerr g_cfgfile
return 1
}
[ -f "$g_pslfile" ] && rm -f "$g_pslfile"
unset g_pslfile g_pslerr g_cfgfile
return 0

Loading…
Cancel
Save