From 8ed93cb57664336d7e1a1ca63429d57d76d5fa47 Mon Sep 17 00:00:00 2001 From: Richard Hansen Date: Fri, 26 Jun 2020 12:46:31 -0400 Subject: [PATCH 1/8] Move per-service variables to the service definitions Most of the entries in `%variables` are only used once. Move them down to their respective service definitions. Also: * Use idiomatic hash merging instead of `merge()`. * Sort the variables by name. --- ddclient.in | 382 +++++++++++++++++++++++----------------------------- 1 file changed, 167 insertions(+), 215 deletions(-) diff --git a/ddclient.in b/ddclient.in index 9739190..4b05aa9 100755 --- a/ddclient.in +++ b/ddclient.in @@ -415,106 +415,10 @@ my %variables = ( 'warned-min-error-interval' => setv(T_ANY, 0, 1, 0, undef), }, 'dyndns-common-defaults' => { + 'backupmx' => setv(T_BOOL, 0, 1, 0, undef), + 'mx' => setv(T_OFQDN, 0, 1, '', undef), 'static' => setv(T_BOOL, 0, 1, 0, undef), 'wildcard' => setv(T_BOOL, 0, 1, 0, undef), - 'mx' => setv(T_OFQDN, 0, 1, '', undef), - 'backupmx' => setv(T_BOOL, 0, 1, 0, undef), - }, - 'easydns-common-defaults' => { - 'wildcard' => setv(T_BOOL, 0, 1, 0, undef), - 'mx' => setv(T_OFQDN, 0, 1, '', undef), - 'backupmx' => setv(T_BOOL, 0, 1, 0, undef), - }, - 'noip-common-defaults' => { - 'static' => setv(T_BOOL, 0, 1, 0, undef), - }, - 'noip-service-common-defaults' => { - 'server' => setv(T_FQDNP, 1, 0, 'dynupdate.no-ip.com',undef), - 'login' => setv(T_LOGIN, 1, 0, '', undef), - 'password' => setv(T_PASSWD,1, 0, '', undef), - 'host' => setv(T_STRING,1, 1, '', undef), - 'ip' => setv(T_IP, 0, 1, undef, undef), - 'wtime' => setv(T_DELAY, 0, 1, 0, interval('30s')), - 'mtime' => setv(T_NUMBER,0, 1, 0, undef), - 'atime' => setv(T_NUMBER,0, 1, 0, undef), - 'status' => setv(T_ANY, 0, 1, '', undef), - 'min-interval' => setv(T_DELAY, 0, 0, interval('30s'), 0), - 'max-interval' => setv(T_DELAY, 0, 0, interval('25d'), 0), - 'min-error-interval' => setv(T_DELAY, 0, 0, interval('5m'), 0), - 'warned-min-interval' => setv(T_ANY, 0, 1, 0, undef), - 'warned-min-error-interval' => setv(T_ANY, 0, 1, 0, undef), - }, - 'zoneedit-service-common-defaults' => { - 'zone' => setv(T_OFQDN, 0, 0, undef, undef), - }, - 'dtdns-common-defaults' => { - 'login' => setv(T_LOGIN, 0, 0, 'unused', undef), - 'client' => setv(T_STRING,0, 1, $program, undef), - }, - 'nsupdate-common-defaults' => { - 'ttl' => setv(T_NUMBER,0, 1, 600, undef), - 'zone' => setv(T_STRING,1, 1, '', undef), - 'tcp' => setv(T_BOOL, 0, 1, 0, undef), - }, - 'cloudflare-common-defaults' => { - 'server' => setv(T_FQDNP, 1, 0, 'api.cloudflare.com/client/v4', undef), - 'zone' => setv(T_FQDN, 1, 0, '', undef), - 'login' => setv(T_LOGIN, 0, 0, 'token', undef), - 'static' => setv(T_BOOL, 0, 1, 0, undef), - 'wildcard' => setv(T_BOOL, 0, 1, 0, undef), - 'mx' => setv(T_OFQDN, 0, 1, '', undef), - 'backupmx' => setv(T_BOOL, 0, 1, 0, undef), - 'ttl' => setv(T_NUMBER,1, 0, 1, undef), - }, - 'googledomains-common-defaults' => { - 'server' => setv(T_FQDNP, 1, 0, 'domains.google.com', undef), - }, - 'duckdns-common-defaults' => { - 'server' => setv(T_FQDNP, 1, 0, 'www.duckdns.org', undef), - 'login' => setv(T_LOGIN, 0, 0, 'unused', undef), - }, - 'freemyip-common-defaults' => { - 'server' => setv(T_FQDNP, 1, 0, 'freemyip.com', undef), - 'login' => setv(T_LOGIN, 0, 0, 'unused', undef), - }, - 'woima-common-defaults' => { - 'static' => setv(T_BOOL, 0, 1, 0, undef), - 'wildcard' => setv(T_BOOL, 0, 1, 0, undef), - 'mx' => setv(T_OFQDN, 0, 1, '', undef), - 'backupmx' => setv(T_BOOL, 0, 1, 0, undef), - 'custom' => setv(T_BOOL, 0, 1, 0, undef), - 'script' => setv(T_STRING,1, 1, '/nic/update', undef), - }, - 'woima-service-common-defaults' => { - 'server' => setv(T_FQDNP, 1, 0, 'dyn.woima.fi', undef), - 'login' => setv(T_LOGIN, 1, 0, '', undef), - 'password' => setv(T_PASSWD,1, 0, '', undef), - 'ip' => setv(T_IP, 0, 1, undef, undef), - 'wtime' => setv(T_DELAY, 0, 1, 0, interval('30s')), - 'mtime' => setv(T_NUMBER,0, 1, 0, undef), - 'atime' => setv(T_NUMBER,0, 1, 0, undef), - 'status' => setv(T_ANY, 0, 1, '', undef), - 'min-interval' => setv(T_DELAY, 0, 0, interval('30s'), 0), - 'max-interval' => setv(T_DELAY, 0, 0, interval('25d'), 0), - 'min-error-interval' => setv(T_DELAY, 0, 0, interval('5m'), 0), - 'warned-min-interval' => setv(T_ANY, 0, 1, 0, undef), - 'warned-min-error-interval' => setv(T_ANY, 0, 1, 0, undef), - }, - 'yandex-common-defaults' => { - 'server' => setv(T_FQDNP, 1, 0, 'pddimp.yandex.ru', undef), - }, - 'dnsmadeeasy-common-defaults' => { - 'server' => setv(T_FQDNP, 1, 0, 'cp.dnsmadeeasy.com', undef), - 'script' => setv(T_STRING,1, 1, '/servlet/updateip', undef), - }, - 'dondominio-common-defaults' => { - 'server' => setv(T_FQDNP, 1, 0, 'dondns.dondominio.com', undef), - }, - 'ovh-common-defaults' => { - 'server' => setv(T_FQDNP, 1, 0, 'www.ovh.com', undef), - 'script' => setv(T_STRING,1, 1, '/nic/update', undef), - 'login' => setv(T_LOGIN, 1, 0, '', undef), - 'password' => setv(T_PASSWD,1, 0, '', undef), }, ); my %services = ( @@ -522,22 +426,28 @@ my %services = ( 'updateable' => undef, 'update' => \&nic_changeip_update, 'examples' => \&nic_changeip_examples, - 'variables' => merge( - { 'server' => setv(T_FQDNP, 1, 0, 'nic.changeip.com', undef) }, - { 'min-interval' => setv(T_DELAY, 0, 0, 0, interval('5m')), }, - $variables{'service-common-defaults'}, - ), + 'variables' => { + %{$variables{'service-common-defaults'}}, + 'min-interval' => setv(T_DELAY, 0, 0, 0, interval('5m')), + 'server' => setv(T_FQDNP, 1, 0, 'nic.changeip.com', undef), + }, }, 'cloudflare' => { 'updateable' => undef, 'update' => \&nic_cloudflare_update, 'examples' => \&nic_cloudflare_examples, - 'variables' => merge( - { 'server' => setv(T_FQDNP, 1, 0, 'api.cloudflare.com/client/v4', undef) }, - { 'min-interval' => setv(T_DELAY, 0, 0, interval('5m'), 0), }, - $variables{'cloudflare-common-defaults'}, - $variables{'service-common-defaults'}, - ), + 'variables' => { + %{$variables{'service-common-defaults'}}, + 'backupmx' => setv(T_BOOL, 0, 1, 0, undef), + 'login' => setv(T_LOGIN, 0, 0, 'token', undef), + 'min-interval' => setv(T_DELAY, 0, 0, interval('5m'), 0), + 'mx' => setv(T_OFQDN, 0, 1, '', undef), + 'server' => setv(T_FQDNP, 1, 0, 'api.cloudflare.com/client/v4', undef), + 'static' => setv(T_BOOL, 0, 1, 0, undef), + 'ttl' => setv(T_NUMBER, 1, 0, 1, undef), + 'wildcard' => setv(T_BOOL, 0, 1, 0, undef), + 'zone' => setv(T_FQDN, 1, 0, '', undef), + }, }, 'cloudns' => { 'updateable' => undef, @@ -557,214 +467,256 @@ my %services = ( 'updateable' => undef, 'update' => \&nic_dnsmadeeasy_update, 'examples' => \&nic_dnsmadeeasy_examples, - 'variables' => merge( - $variables{'dnsmadeeasy-common-defaults'}, - $variables{'service-common-defaults'}, - ), + 'variables' => { + %{$variables{'service-common-defaults'}}, + 'script' => setv(T_STRING, 1, 1, '/servlet/updateip', undef), + 'server' => setv(T_FQDNP, 1, 0, 'cp.dnsmadeeasy.com', undef), + }, }, 'dondominio' => { 'updateable' => undef, 'update' => \&nic_dondominio_update, 'examples' => \&nic_dondominio_examples, - 'variables' => merge( - $variables{'dondominio-common-defaults'}, - $variables{'service-common-defaults'}, - ), + 'variables' => { + %{$variables{'service-common-defaults'}}, + 'server' => setv(T_FQDNP, 1, 0, 'dondns.dondominio.com', undef), + }, }, 'dslreports1' => { 'updateable' => undef, 'update' => \&nic_dslreports1_update, 'examples' => \&nic_dslreports1_examples, - 'variables' => merge( - { 'host' => setv(T_NUMBER, 1, 1, 0, undef) }, - $variables{'service-common-defaults'}, - ), + 'variables' => { + %{$variables{'service-common-defaults'}}, + 'host' => setv(T_NUMBER, 1, 1, 0, undef), + }, }, 'dtdns' => { 'updateable' => undef, 'update' => \&nic_dtdns_update, 'examples' => \&nic_dtdns_examples, - 'variables' => merge( - $variables{'dtdns-common-defaults'}, - $variables{'service-common-defaults'}, - ), + 'variables' => { + %{$variables{'service-common-defaults'}}, + 'client' => setv(T_STRING, 0, 1, $program, undef), + 'login' => setv(T_LOGIN, 0, 0, 'unused', undef), + }, }, 'duckdns' => { 'updateable' => undef, 'update' => \&nic_duckdns_update, 'examples' => \&nic_duckdns_examples, - 'variables' => merge( - $variables{'duckdns-common-defaults'}, - $variables{'service-common-defaults'}, - ), + 'variables' => { + %{$variables{'service-common-defaults'}}, + 'login' => setv(T_LOGIN, 0, 0, 'unused', undef), + 'server' => setv(T_FQDNP, 1, 0, 'www.duckdns.org', undef), + }, }, 'dyndns1' => { 'updateable' => \&nic_dyndns2_updateable, 'update' => \&nic_dyndns1_update, 'examples' => \&nic_dyndns1_examples, - 'variables' => merge( - $variables{'dyndns-common-defaults'}, - $variables{'service-common-defaults'}, - ), + 'variables' => { + %{$variables{'service-common-defaults'}}, + %{$variables{'dyndns-common-defaults'}}, + }, }, 'dyndns2' => { 'updateable' => \&nic_dyndns2_updateable, 'update' => \&nic_dyndns2_update, 'examples' => \&nic_dyndns2_examples, - 'variables' => merge( - { 'custom' => setv(T_BOOL, 0, 1, 0, undef), }, - { 'script' => setv(T_STRING, 1, 1, '/nic/update', undef), }, - $variables{'dyndns-common-defaults'}, - $variables{'service-common-defaults'}, - ), + 'variables' => { + %{$variables{'service-common-defaults'}}, + %{$variables{'dyndns-common-defaults'}}, + 'custom' => setv(T_BOOL, 0, 1, 0, undef), + 'script' => setv(T_STRING, 1, 1, '/nic/update', undef), + }, }, 'easydns' => { 'updateable' => undef, 'update' => \&nic_easydns_update, 'examples' => \&nic_easydns_examples, - 'variables' => merge( - { 'server' => setv(T_FQDNP, 1, 0, 'members.easydns.com', undef) }, - { 'min-interval' => setv(T_DELAY, 0, 0, interval('5m'), 0), }, - $variables{'easydns-common-defaults'}, - $variables{'service-common-defaults'}, - ), + 'variables' => { + %{$variables{'service-common-defaults'}}, + 'backupmx' => setv(T_BOOL, 0, 1, 0, undef), + 'min-interval' => setv(T_DELAY, 0, 0, interval('5m'), 0), + 'mx' => setv(T_OFQDN, 0, 1, '', undef), + 'server' => setv(T_FQDNP, 1, 0, 'members.easydns.com', undef), + 'wildcard' => setv(T_BOOL, 0, 1, 0, undef), + }, }, 'freedns' => { 'updateable' => undef, 'update' => \&nic_freedns_update, 'examples' => \&nic_freedns_examples, - 'variables' => merge( - { 'server' => setv(T_FQDNP, 1, 0, 'freedns.afraid.org', undef) }, - { 'min-interval' => setv(T_DELAY, 0, 0, 0, interval('5m')), }, - $variables{'service-common-defaults'}, - ), + 'variables' => { + %{$variables{'service-common-defaults'}}, + 'min-interval' => setv(T_DELAY, 0, 0, 0, interval('5m')), + 'server' => setv(T_FQDNP, 1, 0, 'freedns.afraid.org', undef), + }, }, 'freemyip' => { 'updateable' => undef, 'update' => \&nic_freemyip_update, 'examples' => \&nic_freemyip_examples, - 'variables' => merge( - $variables{'freemyip-common-defaults'}, - $variables{'service-common-defaults'}, - ), + 'variables' => { + %{$variables{'service-common-defaults'}}, + 'login' => setv(T_LOGIN, 0, 0, 'unused', undef), + 'server' => setv(T_FQDNP, 1, 0, 'freemyip.com', undef), + }, }, 'googledomains' => { 'updateable' => undef, 'update' => \&nic_googledomains_update, 'examples' => \&nic_googledomains_examples, - 'variables' => merge( - { 'min-interval' => setv(T_DELAY, 0, 0, interval('5m'), 0), }, - $variables{'googledomains-common-defaults'}, - $variables{'service-common-defaults'}, - ), + 'variables' => { + %{$variables{'service-common-defaults'}}, + 'min-interval' => setv(T_DELAY, 0, 0, interval('5m'), 0), + 'server' => setv(T_FQDNP, 1, 0, 'domains.google.com', undef), + }, }, 'hammernode1' => { 'updateable' => undef, 'update' => \&nic_hammernode1_update, 'examples' => \&nic_hammernode1_examples, - 'variables' => merge( - { 'server' => setv(T_FQDNP, 1, 0, 'dup.hn.org', undef) }, - { 'min-interval' => setv(T_DELAY, 0, 0, interval('5m'), 0), }, - $variables{'service-common-defaults'}, - ), + 'variables' => { + %{$variables{'service-common-defaults'}}, + 'min-interval' => setv(T_DELAY, 0, 0, interval('5m'), 0), + 'server' => setv(T_FQDNP, 1, 0, 'dup.hn.org', undef), + }, }, 'namecheap' => { 'updateable' => undef, 'update' => \&nic_namecheap_update, 'examples' => \&nic_namecheap_examples, - 'variables' => merge( - { 'server' => setv(T_FQDNP, 1, 0, 'dynamicdns.park-your-domain.com', undef) }, - { 'min-interval' => setv(T_DELAY, 0, 0, 0, interval('5m')), }, - $variables{'service-common-defaults'}, - ), + 'variables' => { + %{$variables{'service-common-defaults'}}, + 'min-interval' => setv(T_DELAY, 0, 0, 0, interval('5m')), + 'server' => setv(T_FQDNP, 1, 0, 'dynamicdns.park-your-domain.com', undef), + }, }, 'nfsn' => { 'updateable' => undef, 'update' => \&nic_nfsn_update, 'examples' => \&nic_nfsn_examples, - 'variables' => merge( - { 'server' => setv(T_FQDNP, 1, 0, 'api.nearlyfreespeech.net', undef) }, - { 'min_interval' => setv(T_FQDNP, 0, 0, 0, interval('5m')) }, - { 'ttl' => setv(T_NUMBER, 1, 0, 300, undef) }, - { 'zone' => setv(T_FQDN, 1, 0, undef, undef) }, - $variables{'service-common-defaults'}, - ), + 'variables' => { + %{$variables{'service-common-defaults'}}, + 'min_interval' => setv(T_FQDNP, 0, 0, 0, interval('5m')), + 'server' => setv(T_FQDNP, 1, 0, 'api.nearlyfreespeech.net', undef), + 'ttl' => setv(T_NUMBER, 1, 0, 300, undef), + 'zone' => setv(T_FQDN, 1, 0, undef, undef), + }, }, 'noip' => { 'updateable' => undef, 'update' => \&nic_noip_update, 'examples' => \&nic_noip_examples, - 'variables' => merge( - { 'custom' => setv(T_BOOL, 0, 1, 0, undef), }, - $variables{'noip-common-defaults'}, - $variables{'noip-service-common-defaults'}, - ), + 'variables' => { + 'atime' => setv(T_NUMBER, 0, 1, 0, undef), + 'custom' => setv(T_BOOL, 0, 1, 0, undef), + 'host' => setv(T_STRING, 1, 1, '', undef), + 'ip' => setv(T_IP, 0, 1, undef, undef), + 'login' => setv(T_LOGIN, 1, 0, '', undef), + 'max-interval' => setv(T_DELAY, 0, 0, interval('25d'), 0), + 'min-error-interval' => setv(T_DELAY, 0, 0, interval('5m'), 0), + 'min-interval' => setv(T_DELAY, 0, 0, interval('30s'), 0), + 'mtime' => setv(T_NUMBER, 0, 1, 0, undef), + 'password' => setv(T_PASSWD, 1, 0, '', undef), + 'server' => setv(T_FQDNP, 1, 0, 'dynupdate.no-ip.com', undef), + 'static' => setv(T_BOOL, 0, 1, 0, undef), + 'status' => setv(T_ANY, 0, 1, '', undef), + 'warned-min-error-interval' => setv(T_ANY, 0, 1, 0, undef), + 'warned-min-interval' => setv(T_ANY, 0, 1, 0, undef), + 'wtime' => setv(T_DELAY, 0, 1, 0, interval('30s')), + }, }, 'nsupdate' => { 'updateable' => undef, 'update' => \&nic_nsupdate_update, 'examples' => \&nic_nsupdate_examples, - 'variables' => merge( - { 'login' => setv(T_LOGIN, 1, 0, '/usr/bin/nsupdate', undef), }, - $variables{'nsupdate-common-defaults'}, - $variables{'service-common-defaults'}, - ), + 'variables' => { + %{$variables{'service-common-defaults'}}, + 'login' => setv(T_LOGIN, 1, 0, '/usr/bin/nsupdate', undef), + 'tcp' => setv(T_BOOL, 0, 1, 0, undef), + 'ttl' => setv(T_NUMBER, 0, 1, 600, undef), + 'zone' => setv(T_STRING, 1, 1, '', undef), + }, }, 'ovh' => { 'updateable' => undef, 'update' => \&nic_ovh_update, 'examples' => \&nic_ovh_examples, - 'variables' => merge( - $variables{'ovh-common-defaults'}, - $variables{'service-common-defaults'}, - ), + 'variables' => { + %{$variables{'service-common-defaults'}}, + 'login' => setv(T_LOGIN, 1, 0, '', undef), + 'password' => setv(T_PASSWD, 1, 0, '', undef), + 'script' => setv(T_STRING, 1, 1, '/nic/update', undef), + 'server' => setv(T_FQDNP, 1, 0, 'www.ovh.com', undef), + }, }, 'sitelutions' => { 'updateable' => undef, 'update' => \&nic_sitelutions_update, 'examples' => \&nic_sitelutions_examples, - 'variables' => merge( - { 'server' => setv(T_FQDNP, 1, 0, 'www.sitelutions.com', undef) }, - { 'min-interval' => setv(T_DELAY, 0, 0, 0, interval('5m')), }, - $variables{'service-common-defaults'}, - ), + 'variables' => { + %{$variables{'service-common-defaults'}}, + 'server' => setv(T_FQDNP, 1, 0, 'www.sitelutions.com', undef), + 'min-interval' => setv(T_DELAY, 0, 0, 0, interval('5m')), + }, }, 'woima' => { 'updateable' => undef, 'update' => \&nic_woima_update, 'examples' => \&nic_woima_examples, - 'variables' => merge( - $variables{'woima-common-defaults'}, - $variables{'woima-service-common-defaults'}, - ), + 'variables' => { + 'atime' => setv(T_NUMBER, 0, 1, 0, undef), + 'backupmx' => setv(T_BOOL, 0, 1, 0, undef), + 'custom' => setv(T_BOOL, 0, 1, 0, undef), + 'ip' => setv(T_IP, 0, 1, undef, undef), + 'login' => setv(T_LOGIN, 1, 0, '', undef), + 'max-interval' => setv(T_DELAY, 0, 0, interval('25d'), 0), + 'min-error-interval' => setv(T_DELAY, 0, 0, interval('5m'), 0), + 'min-interval' => setv(T_DELAY, 0, 0, interval('30s'), 0), + 'mtime' => setv(T_NUMBER, 0, 1, 0, undef), + 'mx' => setv(T_OFQDN, 0, 1, '', undef), + 'password' => setv(T_PASSWD, 1, 0, '', undef), + 'script' => setv(T_STRING, 1, 1, '/nic/update', undef), + 'server' => setv(T_FQDNP, 1, 0, 'dyn.woima.fi', undef), + 'static' => setv(T_BOOL, 0, 1, 0, undef), + 'status' => setv(T_ANY, 0, 1, '', undef), + 'warned-min-error-interval' => setv(T_ANY, 0, 1, 0, undef), + 'warned-min-interval' => setv(T_ANY, 0, 1, 0, undef), + 'wildcard' => setv(T_BOOL, 0, 1, 0, undef), + 'wtime' => setv(T_DELAY, 0, 1, 0, interval('30s')), + }, }, 'yandex' => { 'updateable' => undef, 'update' => \&nic_yandex_update, 'examples' => \&nic_yandex_examples, - 'variables' => merge( - { 'min-interval' => setv(T_DELAY, 0, 0, interval('5m'), 0), }, - $variables{'yandex-common-defaults'}, - $variables{'service-common-defaults'}, - ), + 'variables' => { + %{$variables{'service-common-defaults'}}, + 'min-interval' => setv(T_DELAY, 0, 0, interval('5m'), 0), + 'server' => setv(T_FQDNP, 1, 0, 'pddimp.yandex.ru', undef), + }, }, 'zoneedit1' => { 'updateable' => undef, 'update' => \&nic_zoneedit1_update, 'examples' => \&nic_zoneedit1_examples, - 'variables' => merge( - { 'server' => setv(T_FQDNP, 1, 0, 'dynamic.zoneedit.com', undef) }, - { 'min-interval' => setv(T_DELAY, 0, 0, interval('5m'), 0), }, - $variables{'service-common-defaults'}, - $variables{'zoneedit-service-common-defaults'}, - ), + 'variables' => { + %{$variables{'service-common-defaults'}}, + 'min-interval' => setv(T_DELAY, 0, 0, interval('5m'), 0), + 'server' => setv(T_FQDNP, 1, 0, 'dynamic.zoneedit.com', undef), + 'zone' => setv(T_OFQDN, 0, 0, undef, undef), + }, }, ); -$variables{'merged'} = merge($variables{'global-defaults'}, - $variables{'service-common-defaults'}, - $variables{'dyndns-common-defaults'}, - map { $services{$_}{'variables'} } keys %services, -); +$variables{'merged'} = { + map({ %{$services{$_}{'variables'}} } keys(%services)), + %{$variables{'dyndns-common-defaults'}}, + %{$variables{'service-common-defaults'}}, + %{$variables{'global-defaults'}}, +}; # This will hold the processed args. my %opt = (); From c4f2670d8bca3a723917be89bccdc85a4096f25f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sandro=20J=C3=A4ckel?= Date: Wed, 1 Jul 2020 01:40:47 +0200 Subject: [PATCH 2/8] Explicit require version because centos does not include it at all times --- configure.ac | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index 5b935f7..a6327d2 100644 --- a/configure.ac +++ b/configure.ac @@ -21,9 +21,12 @@ AX_PROG_PERL_VERSION([5.10.1], [], [AC_MSG_ERROR([Perl 5.10.1 or newer not found])]) AC_SUBST([PERL]) -# Perl modules required to run ddclient. Core modules may be omitted; -# they are assumed to always exist. +# Perl modules required to run ddclient. Note: CentOS, RHEL, and +# Fedora put some core modules in separate packages, and the perl +# package doesn't depend on all of them, so their availability can't +# be assumed. m4_foreach_w([_m], [ + version=0.77 ], [AX_PROG_PERL_MODULES([_m], [], [AC_MSG_ERROR([missing required Perl module _m])])]) From 290077dc5e9fa62ebb6ddb96aaef183d7c2e765d Mon Sep 17 00:00:00 2001 From: Richard Hansen Date: Tue, 30 Jun 2020 22:24:34 -0400 Subject: [PATCH 3/8] Document that contributions are subject to the DCO --- CONTRIBUTING.md | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 347cd1d..1b75b30 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -7,6 +7,52 @@ possible. To contribute changes, please open a pull request against the [ddclient GitHub project](https://github.com/ddclient/ddclient/pulls). +## Developer Certificate of Origin + +All contributions are subject to the [Developer Certificate of Origin +v1.1](https://developercertificate.org/), copied below. A +`Signed-off-by` line in each commit message is **not** required. + +``` +Developer Certificate of Origin +Version 1.1 + +Copyright (C) 2004, 2006 The Linux Foundation and its contributors. +1 Letterman Drive +Suite D4700 +San Francisco, CA, 94129 + +Everyone is permitted to copy and distribute verbatim copies of this +license document, but changing it is not allowed. + + +Developer's Certificate of Origin 1.1 + +By making a contribution to this project, I certify that: + +(a) The contribution was created in whole or in part by me and I + have the right to submit it under the open source license + indicated in the file; or + +(b) The contribution is based upon previous work that, to the best + of my knowledge, is covered under an appropriate open source + license and I have the right under that license to submit that + work with modifications, whether created in whole or in part + by me, under the same open source license (unless I am + permitted to submit under a different license), as indicated + in the file; or + +(c) The contribution was provided directly to me by some other + person who certified (a), (b) or (c) and I have not modified + it. + +(d) I understand and agree that this project and the contribution + are public and that a record of the contribution (including all + personal information I submit with it, including my sign-off) is + maintained indefinitely and may be redistributed consistent with + this project or the open source license(s) involved. +``` + ## Style * Above all else, try to match the existing style surrounding your From 2afdf5043c7d140e241af744d17d288489acf834 Mon Sep 17 00:00:00 2001 From: Thorsten Behrens Date: Wed, 1 Jul 2020 11:02:27 -0400 Subject: [PATCH 4/8] Add FreeBSD; change README to use json-pp for Ubuntu --- Makefile.am | 1 + README.md | 24 +++++++++++++++++++++++- sample-etc_rc.d_ddclient.freebsd | 31 +++++++++++++++++++++++++++++++ 3 files changed, 55 insertions(+), 1 deletion(-) create mode 100755 sample-etc_rc.d_ddclient.freebsd diff --git a/Makefile.am b/Makefile.am index 65bf402..a1a625d 100644 --- a/Makefile.am +++ b/Makefile.am @@ -15,6 +15,7 @@ EXTRA_DIST = \ sample-etc_dhclient-exit-hooks \ sample-etc_dhcpc_dhcpcd-eth0.exe \ sample-etc_ppp_ip-up.local \ + sample-etc_rc.d_ddclient.freebsd \ sample-etc_rc.d_init.d_ddclient \ sample-etc_rc.d_init.d_ddclient.alpine \ sample-etc_rc.d_init.d_ddclient.lsb \ diff --git a/README.md b/README.md index df5fe6b..2809018 100644 --- a/README.md +++ b/README.md @@ -141,7 +141,7 @@ make sure you have perl and the required modules installed if you plan to use cloudflare or feedns you need the perl json module - apt-get install libjson-any-perl + apt-get install libjson-pp-perl for IPv6 you also need to instal the perl io-socker-inet6 module @@ -151,6 +151,28 @@ start the first time by hand service ddclient start +### FreeBSD style rc files and daemon mode + + mkdir -p /usr/local/etc/rc.d + cp sample-etc_rc.d_ddclient.freebsd /usr/local/etc/rc.d/ddclient + +enable automatic startup when booting + + sysrc ddclient_enable=YES + +make sure you have perl and the required modules installed + + pkg install perl5 p5-Data-Validate-IP p5-IO-Socket-SSL + +if you plan to use cloudflare or feedns you need the perl json module + + pkg install p5-JSON-PP + +start the service manually for the first time + + service ddclient start + + If you are not using daemon-mode, configure cron and dhcp or ppp as described below. ------------------------------------------------------------------------------- diff --git a/sample-etc_rc.d_ddclient.freebsd b/sample-etc_rc.d_ddclient.freebsd new file mode 100755 index 0000000..d8dc341 --- /dev/null +++ b/sample-etc_rc.d_ddclient.freebsd @@ -0,0 +1,31 @@ +#!/bin/sh + +# PROVIDE: ddclient +# REQUIRE: LOGIN +# KEYWORD: shutdown +# +# Add the following lines to /etc/rc.conf.local or /etc/rc.conf +# to enable this service: +# +# ddclient_enable (bool): Set to NO by default. +# Set it to YES to enable ddclient. + +. /etc/rc.subr + +name=ddclient +rcvar=ddclient_enable +ddclient_conf="/etc/ddclient/ddclient.conf" + +command="/usr/local/sbin/${name}" +load_rc_config $name + +delay=$(grep -v '^\s*#' "${ddclient_conf}" | grep -i -m 1 "daemon" | awk -F '=' '{print $2}') + +if [ -z "${delay}" ] +then + ddclient_flags="-daemon 300" +else + ddclient_flags="" +fi + +run_rc_command "$1" From a23b8d558b71922e5586a41cb42b48ef9f9d4c81 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sandro=20J=C3=A4ckel?= Date: Wed, 1 Jul 2020 02:01:50 +0200 Subject: [PATCH 5/8] Add redhat to ci --- .github/workflows/ci.yml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e65d8aa..082ff40 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -76,3 +76,21 @@ jobs: run: make VERBOSE=1 check - name: distcheck run: make VERBOSE=1 distcheck + + test-redhat: + runs-on: ubuntu-latest + # we use redhats univeral base image which is not available on docker hub + # https://catalog.redhat.com/software/containers/ubi7/ubi/5c3592dcd70cc534b3a37814 + container: registry.access.redhat.com/ubi7/ubi + steps: + - uses: actions/checkout@v2 + - name: install dependencies + run: yum install -y perl-version automake make perl-Test-Simple + - name: autogen + run: ./autogen + - name: configure + run: ./configure + - name: check + run: make VERBOSE=1 check + - name: distcheck + run: make VERBOSE=1 distcheck From 283f609b28bc14445b1fc0f3b3fe196d6844cf65 Mon Sep 17 00:00:00 2001 From: Richard Hansen Date: Tue, 30 Jun 2020 14:25:06 -0400 Subject: [PATCH 6/8] Update Vim modeline and Emacs file-local variables Both: * Force the file type to Perl * Set the tab width to 8 so that people cringe in horror at the sight of a tab * Set the line with to 99 Emacs: * Disable indent-tabs-mode * Set the indentation level to 4 Vim: * Highlight column 100 Addresses #206 --- ddclient.in | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/ddclient.in b/ddclient.in index 4b05aa9..247bf7f 100755 --- a/ddclient.in +++ b/ddclient.in @@ -5215,7 +5215,16 @@ sub nic_cloudns_update { __PACKAGE__->main() unless caller() && caller() ne 'PAR'; ###################################################################### -# vim: ai et ts=4 sw=4 tw=78: +## Emacs and Vim settings +# Local Variables: +# mode: perl +# fill-column: 99 +# indent-tabs-mode: nil +# perl-indent-level: 4 +# tab-width: 8 +# End: + +# vim: ai et ts=8 sw=4 tw=99 cc=+1 filetype=perl __END__ From a00d2cc18e62c346d5776355ad092013a1657f7a Mon Sep 17 00:00:00 2001 From: Richard Hansen Date: Wed, 1 Jul 2020 19:19:54 -0400 Subject: [PATCH 7/8] Install findutils on Fedora --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 082ff40..9ec843b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -67,7 +67,7 @@ jobs: steps: - uses: actions/checkout@v2 - name: install dependencies - run: dnf install -y perl-version automake make perl-Test-Warnings + run: dnf install -y automake findutils make perl-Test-Warnings perl-version - name: autogen run: ./autogen - name: configure From 451bdd10862936eeed118b52f623b244caea7f0c Mon Sep 17 00:00:00 2001 From: Richard Hansen Date: Wed, 1 Jul 2020 14:34:36 -0400 Subject: [PATCH 8/8] Also run tests on Debian testing, stable, oldstable --- .github/workflows/ci.yml | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 082ff40..7d6cefa 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -9,17 +9,28 @@ on: - master jobs: - test-ubuntu: + test-debian-like: strategy: matrix: - ubuntu: - - 16.04 - - latest - runs-on: ubuntu-${{ matrix.ubuntu }} + image: + - ubuntu:latest + - ubuntu:16.04 + - debian:testing + - debian:stable + - debian:oldstable + runs-on: ubuntu-latest + container: + image: ${{ matrix.image }} steps: + - name: install dependencies + run: | + apt-get update && + DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \ + automake \ + libtest-warnings-perl \ + make \ + ; - uses: actions/checkout@v2 - - name: install test dependencies - run: sudo apt-get install libtest-warnings-perl - name: autogen run: ./autogen - name: configure