From 78cf8306a952c9feb052bed28ea6b7432a25c727 Mon Sep 17 00:00:00 2001 From: karchnu Date: Tue, 29 Dec 2015 00:15:20 +0100 Subject: [PATCH] =?UTF-8?q?d=C3=A9mon=20un=20peu=20plus=20simple,=20messag?= =?UTF-8?q?e=20d'erreur=20si=20pas=20d'IP=20trouv=C3=A9e?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cli/daemon/daemon.pl | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/cli/daemon/daemon.pl b/cli/daemon/daemon.pl index 9e040cd..c031361 100755 --- a/cli/daemon/daemon.pl +++ b/cli/daemon/daemon.pl @@ -30,20 +30,15 @@ our $type = 'A'; # could be AAAA our $cacert = "ca.cert"; sub get_ip { - my @tmp_ip = split "\n", `wget -nv -O - $checkip`; - my $ip; - - for(@tmp_ip) { - if($_ =~ /^[0-9.]+$/ || $_ =~ /^[0-9a-f:]+$/) { - $ip = $_; - } + for (split "\n", `wget -nv -O - $checkip`) { + /^[0-9.]+$/ || /^[0-9a-f:]+$/ and return $_ } - - $ip; + undef } sub update { my $ip = get_ip; + die "Can't get your IP address !" unless $ip; say "UPDATE :: domain $name.$domain => IP $ip, type $type"; my $passb64 = encode_base64($pass);