summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Harpin <development@landsofshadow.co.uk>2015-01-02 09:03:43 +0000
committerDaniil Baturin <daniil@baturin.org>2017-09-14 13:42:34 +0200
commitd2331b4734904d45e60876ed0e625b98d825986f (patch)
tree6d8b29a4fd8ff319c412e979b3dcffe87cb1e9ba
parent7471cd6cf0c5db7b1c185116d2c37a16401c5981 (diff)
downloadvyatta-cfg-system-d2331b4734904d45e60876ed0e625b98d825986f.tar.gz
vyatta-cfg-system-d2331b4734904d45e60876ed0e625b98d825986f.zip
vyatta-cfg-system: formatting changes for style consistency
Update scripts/dynamic-dns/vyatta-dynamic-dns.pl to have consistent identation levels and style throughout.
-rwxr-xr-xscripts/dynamic-dns/vyatta-dynamic-dns.pl61
1 files changed, 32 insertions, 29 deletions
diff --git a/scripts/dynamic-dns/vyatta-dynamic-dns.pl b/scripts/dynamic-dns/vyatta-dynamic-dns.pl
index 69592593..59495f99 100755
--- a/scripts/dynamic-dns/vyatta-dynamic-dns.pl
+++ b/scripts/dynamic-dns/vyatta-dynamic-dns.pl
@@ -41,17 +41,19 @@ my $ddclient_config_dir = '/etc/ddclient';
my ($update_dynamicdns, $op_mode_update_dynamicdns, $stop_dynamicdns, $interface);
-GetOptions("update-dynamicdns!" => \$update_dynamicdns,
- "stop-dynamicdns!" => \$stop_dynamicdns,
- "op-mode-update-dynamicdns!" => \$op_mode_update_dynamicdns,
- "interface=s" => \$interface);
+GetOptions(
+ "update-dynamicdns!" => \$update_dynamicdns,
+ "stop-dynamicdns!" => \$stop_dynamicdns,
+ "op-mode-update-dynamicdns!" => \$op_mode_update_dynamicdns,
+ "interface=s" => \$interface
+);
if (defined $update_dynamicdns) {
- my $config;
- $config = dynamicdns_get_constants();
- $config .= dynamicdns_get_values();
- dynamicdns_write_file($config);
- dynamicdns_restart();
+ my $config;
+ $config = dynamicdns_get_constants();
+ $config .= dynamicdns_get_values();
+ dynamicdns_write_file($config);
+ dynamicdns_restart();
}
dynamicdns_restart() if (defined $op_mode_update_dynamicdns);
@@ -70,9 +72,9 @@ sub dynamicdns_restart {
sub dynamicdns_start {
mkdir $ddclient_run_dir
- unless ( -d $ddclient_run_dir );
+ unless (-d $ddclient_run_dir);
mkdir $ddclient_cache_dir
- unless ( -d $ddclient_cache_dir );
+ unless (-d $ddclient_cache_dir);
system("/usr/sbin/ddclient -file $ddclient_config_dir/ddclient_$interface.conf >&/dev/null");
@@ -106,22 +108,23 @@ sub dynamicdns_get_values {
my @services = $config->listNodes("service");
foreach my $service (@services) {
- $config->setLevel("service dns dynamic interface $interface service $service");
- $service="dslreports1" if ($service eq "dslreports");
- $service="dyndns2" if ($service eq "dyndns");
- $service="zoneedit1" if ($service eq "zoneedit");
- my $login = $config->returnValue("login");
- my $password = $config->returnValue("password");
- my @hostnames = $config->returnValues("host-name");
- my $server = $config->returnValue("server");
- foreach my $hostname (@hostnames) {
- $output .= "server=$server," if defined $server;
- $output .= "protocol=$service\n";
- $output .= "max-interval=28d\n";
- $output .= "login=$login\n";
- $output .= "password='$password'\n";
- $output .= "$hostname\n\n";
- }
+ $config->setLevel("service dns dynamic interface $interface service $service");
+ $service="dslreports1" if ($service eq "dslreports");
+ $service="dyndns2" if ($service eq "dyndns");
+ $service="zoneedit1" if ($service eq "zoneedit");
+ my $login = $config->returnValue("login");
+ my $password = $config->returnValue("password");
+ my @hostnames = $config->returnValues("host-name");
+ my $server = $config->returnValue("server");
+
+ foreach my $hostname (@hostnames) {
+ $output .= "server=$server," if defined $server;
+ $output .= "protocol=$service\n";
+ $output .= "max-interval=28d\n";
+ $output .= "login=$login\n";
+ $output .= "password='$password'\n";
+ $output .= "$hostname\n\n";
+ }
}
return $output;
@@ -131,10 +134,10 @@ sub dynamicdns_write_file {
my ($config) = @_;
mkdir $ddclient_config_dir
- unless (-d $ddclient_config_dir );
+ unless (-d $ddclient_config_dir);
open(my $fh, '>', "$ddclient_config_dir/ddclient_$interface.conf")
- || die "Couldn't open \"$ddclient_config_dir/ddclient_$interface.conf\" - $!";
+ || die "Couldn't open \"$ddclient_config_dir/ddclient_$interface.conf\" - $!";
print $fh $config;
close $fh;
}