aboutsummaryrefslogtreecommitdiffstats
path: root/testing
diff options
context:
space:
mode:
authorFrancesco Colista <fcolista@alpinelinux.org>2016-11-14 18:18:42 +0000
committerFrancesco Colista <fcolista@alpinelinux.org>2016-11-14 18:18:47 +0000
commitf712fd34f920f677d4cccab66f9eb12caeab296f (patch)
tree52946252c53e07783c8afe79030f422ca812257d /testing
parent5449e11d98d303ae5669b3f686aa4ff546b1d1dd (diff)
downloadaports-f712fd34f920f677d4cccab66f9eb12caeab296f.tar.bz2
aports-f712fd34f920f677d4cccab66f9eb12caeab296f.tar.xz
testing/ddclient: new aport
Diffstat (limited to 'testing')
-rw-r--r--testing/ddclient/APKBUILD43
-rw-r--r--testing/ddclient/ddclient-ipv6.patch165
2 files changed, 208 insertions, 0 deletions
diff --git a/testing/ddclient/APKBUILD b/testing/ddclient/APKBUILD
new file mode 100644
index 0000000000..9dcd2859d2
--- /dev/null
+++ b/testing/ddclient/APKBUILD
@@ -0,0 +1,43 @@
+# Contributor: Francesco Colista <fcolista@alpinelinux.org>
+# Maintainer: Francesco Colista <fcolista@alpinelinux.org>
+pkgname=ddclient
+pkgver=3.8.3
+pkgrel=0
+pkgdesc="Update dynamic DNS entries for accounts on many dynamic DNS services, with IPv6 patch"
+url="https://ddclient.sourceforge.net"
+arch="noarch"
+license="GPL2"
+depends="perl-io-socket-ssl perl-digest-sha1 perl-getopt-long net-tools"
+subpackages="$pkgname-doc"
+source="$pkgname-$pkgver.tar.gz::https://github.com/wimpunk/$pkgname/archive/v$pkgver.tar.gz
+ddclient-ipv6.patch"
+builddir="$srcdir/$pkgname-$pkgver"
+
+build() {
+ cd "$builddir"
+ return 0
+}
+
+package() {
+ cd "$builddir"
+ install -Dm755 $pkgname "$pkgdir"/usr/sbin/$pkgname
+ install -Dm600 sample-etc_$pkgname.conf "$pkgdir"/etc/$pkgname/$pkgname.conf
+ install -Dm755 sample-etc_rc.d_init.d_ddclient.alpine "$pkgdir"/etc/init.d/$pkgname
+ install -d "$pkgdir"/var/cache/$pkgname
+}
+
+doc() {
+ pkgdesc="Docuemntation and Sample files for $pkgname"
+ cd "$builddir"
+ install -Dm644 README.ssl "$subpkgdir"/usr/share/doc/$pkgname/README.ssl
+ install -Dm644 COPYING "$subpkgdir"/usr/share/licenses/$pkgname/COPYING
+ install -Dm644 sample-etc_cron.d_$pkgname "$subpkgdir"/usr/share/doc/$pkgname/sample-etc_cron.d_$pkgname
+ install -Dm644 sample-etc_dhclient-exit-hooks "$subpkgdir"/usr/share/doc/$pkgname/sample-etc_dhclient-exit-hooks
+}
+
+md5sums="a14973dd829180ef2cba96ff327b6fe0 ddclient-3.8.3.tar.gz
+103f8ccab734f84a1220e9d2afc23457 ddclient-ipv6.patch"
+sha256sums="a7a39ff7c5092564a7d22f86cfcb747bad30b8c4d8bef30b518eded1f91cba43 ddclient-3.8.3.tar.gz
+311ebaac97022c17ab2d4776d0d023df49da67a58a8c370c262cdec72c74b8f4 ddclient-ipv6.patch"
+sha512sums="df305c9f54559de089edc9fd1c19b36181048ded0a28fe7f6c2a15f624c692385232391943d85159dd1a60c0cd15484ef43340dd6884b6de44d421df720bc3c7 ddclient-3.8.3.tar.gz
+c20d97f3164560e794fc82cb8099c0248279377f43e123aaec30ef6f66e7fe8660f559b42110449487d5063ffa1605520d56cb9f511347ff6787ad781fab1698 ddclient-ipv6.patch"
diff --git a/testing/ddclient/ddclient-ipv6.patch b/testing/ddclient/ddclient-ipv6.patch
new file mode 100644
index 0000000000..52f80da54c
--- /dev/null
+++ b/testing/ddclient/ddclient-ipv6.patch
@@ -0,0 +1,165 @@
+--- a/ddclient.orig 2015-01-18 13:53:05.060668715 +0100
++++ b/ddclient 2015-01-18 13:59:55.607618249 +0100
+@@ -55,6 +55,7 @@
+ sub T_FQDNP {'fully qualified host name and optional port number'};
+ sub T_PROTO {'protocol'}
+ sub T_USE {'ip strategy'}
++sub T_USEV6 {'ipv6 strategy'}
+ sub T_IF {'interface'}
+ sub T_PROG {'program name'}
+ sub T_IP {'ip'}
+@@ -330,6 +331,7 @@
+ 'protocol' => setv(T_PROTO, 0, 0, 1, 'dyndns2', undef),
+
+ 'use' => setv(T_USE, 0, 0, 1, 'ip', undef),
++ 'usev6' => setv(T_USEV6, 0, 0, 1, undef, undef),
+ 'ip' => setv(T_IP, 0, 0, 1, undef, undef),
+ 'if' => setv(T_IF, 0, 0, 1, 'ppp0', undef),
+ 'if-skip' => setv(T_STRING,1, 0, 1, '', undef),
+@@ -370,6 +372,7 @@
+ 'host' => setv(T_STRING, 1, 1, 1, '', undef),
+
+ 'use' => setv(T_USE, 0, 0, 1, 'ip', undef),
++ 'usev6' => setv(T_USE, 0, 0, 1, undef, undef),
+ 'if' => setv(T_IF, 0, 0, 1, 'ppp0', undef),
+ 'if-skip' => setv(T_STRING,0, 0, 1, '', undef),
+ 'web' => setv(T_STRING,0, 0, 1, 'dyndns', undef),
+@@ -597,7 +600,8 @@
+ [ "cache", "=s", "-cache path : record address used in 'path'" ],
+ [ "pid", "=s", "-pid path : record process id in 'path'" ],
+ "",
+- [ "use", "=s", "-use which : how the should IP address be obtained." ],
++ [ "use", "=s", "-use which : how should the IP address be obtained." ],
++ [ "usev6", "=s", "-usev6 which : how should the IPv6 address be obtained." ],
+ &ip_strategies_usage(),
+ "",
+ [ "ip", "=s", "-ip address : set the IP address to 'address'" ],
+@@ -788,12 +792,20 @@
+ my (@hosts, %ips) = ();
+ my $updateable = $services{$s}{'updateable'};
+ my $update = $services{$s}{'update'};
++ my $ipv6 = 0;
+
+ foreach my $h (sort keys %config) {
+ next if $config{$h}{'protocol'} ne lc($s);
+ $examined{$h} = 1;
+ # we only do this once per 'use' and argument combination
+- my $use = opt('use', $h);
++ my $use = '';
++ $ipv6 = 1 if (defined $config{$h}{'usev6'});
++ if ($ipv6) {
++ $use = opt('usev6', $h);
++ }
++ else {
++ $use = opt('use', $h);
++ }
+ my $arg_ip = opt('ip', $h) || '';
+ my $arg_fw = opt('fw', $h) || '';
+ my $arg_if = opt('if', $h) || '';
+@@ -803,16 +815,20 @@
+ if (exists $iplist{$use}{$arg_ip}{$arg_fw}{$arg_if}{$arg_web}{$arg_cmd}) {
+ $ip = $iplist{$use}{$arg_ip}{$arg_fw}{$arg_if}{$arg_web}{$arg_cmd};
+ } else {
+- $ip = get_ip($use, $h);
++ $ip = get_ip($use, $h) if !$ipv6;
++ $ip = get_ipv6($use, $h) if $ipv6;
+ if (!defined $ip || !$ip) {
+ warning("unable to determine IP address")
+ if !$daemon || opt('verbose');
+ next;
+ }
+- if ($ip !~ /^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/) {
++ if (!$ipv6 and $ip !~ /^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/) {
+ warning("malformed IP address (%s)", $ip);
+ next;
+ }
++ if ($ipv6 and $ip !~ /^[0-9a-f:]+$/) {
++ warning("malformed IPv6 address (%s)", $ip);
++ }
+ $iplist{$use}{$arg_ip}{$arg_fw}{$arg_if}{$arg_web}{$arg_cmd} = $ip;
+ }
+ $config{$h}{'wantip'} = $ip;
+@@ -953,7 +969,7 @@
+ my ($c, $name, $value);
+ my ($escape, $quote) = (0, '');
+
+- if ($rest =~ /^\s*([a-z][a-z_-]*)=(.*)/i) {
++ if ($rest =~ /^\s*([a-z][0-9a-z_-]*)=(.*)/i) {
+ ($name, $rest, $value) = ($1, $2, '');
+
+ while (length($c = substr($rest,0,1))) {
+@@ -1131,6 +1147,11 @@
+ $opt{'use'} = 'if' if !define($opt{'use'}) && defined($opt{'if'});
+ $opt{'use'} = 'web' if !define($opt{'use'}) && defined($opt{'web'});
+
++ ## infer the IPv6 strategy if possible
++ $opt{'usev6'} = 'ip' if !define($opt{'usev6'}) && defined($opt{'ip'});
++ $opt{'usev6'} = 'if' if !define($opt{'usev6'}) && defined($opt{'if'});
++ $opt{'usev6'} = 'web' if !define($opt{'usev6'}) && defined($opt{'web'});
++
+ ## sanity check
+ $opt{'max-interval'} = min(interval(opt('max-interval')), interval(default('max-interval')));
+ $opt{'min-interval'} = max(interval(opt('min-interval')), interval(default('min-interval')));
+@@ -1740,6 +1761,10 @@
+ $value = lc $value;
+ return undef if ! exists $ip_strategies{$value};
+
++ } elsif ($type eq T_USEV6) {
++ $value = lc $value;
++ return undef if ! exists $ip_strategies{$value};
++
+ } elsif ($type eq T_FILE) {
+ return undef if $value eq "";
+
+@@ -1756,7 +1781,7 @@
+ # return undef if $value =~ /:/;
+
+ } elsif ($type eq T_IP) {
+- return undef if $value !~ /^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/;
++ return undef if $value !~ /^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/ and $value !~ /^[0-9a-f:]+$/;
+ }
+ return $value;
+ }
+@@ -2046,6 +2071,42 @@
+ $ip = $1;
+ }
+ if (($use ne 'ip') && (define($ip,'') eq '0.0.0.0')) {
++ $ip = undef;
++ }
++
++ debug("get_ip: using %s, %s reports %s", $use, $arg, define($ip, "<undefined>"));
++ return $ip;
++}
++
++######################################################################
++## get_ipv6
++######################################################################
++sub get_ipv6 {
++ my $use = lc shift;
++ my $h = shift;
++ my ($ip, $arg, $reply, $url, $skip) = (undef, opt($use), '');
++ $arg = '' unless $arg;
++
++ if ($use eq 'ip') {
++ $ip = opt('ip', $h);
++ $arg = 'ip';
++
++ } elsif ($use eq 'if') {
++ $skip = opt('if-skip', $h) || '';
++ $reply = `ip -6 addr list dev $arg | grep "scope.global" | grep -v temporary | grep -v "inet6 f[cd]" 2> /dev/null`;
++ $reply = '' if $?;
++ }
++ if (!defined $reply) {
++ $reply = '';
++ }
++ if ($skip) {
++ $skip =~ s/ /\\s/is;
++ $reply =~ s/^.*?${skip}//is;
++ }
++ if ($reply =~ /.*? ([0-9:][^\/]*)/i) {
++ $ip = $1;
++ }
++ if (($use ne 'ip') && (define($ip,'') eq '0.0.0.0')) {
+ $ip = undef;
+ }
+