X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=common-src%2Famgetconf.pl;h=23a9f1e93e484808548ea5f3b25d85346c71083e;hb=refs%2Ftags%2Fupstream%2F3.3.1;hp=c6636cd34544273b6deb05faa9e6453a8acf5bd0;hpb=cd0b924f27312d57bd42f6c4fae2b795139e2d0b;p=debian%2Famanda diff --git a/common-src/amgetconf.pl b/common-src/amgetconf.pl index c6636cd..23a9f1e 100644 --- a/common-src/amgetconf.pl +++ b/common-src/amgetconf.pl @@ -237,6 +237,24 @@ sub conf_param { for my $subsec (@list) { print "$subsec\n"; } + } elsif ($parameter =~ /^property:/i) { + my %properties = %{ getconf($CNF_PROPERTY)}; + my $propname = $parameter; + $propname =~ s/^property://i; + $propname = lc($propname); + if (exists $properties{$propname}) { + print $properties{$propname}->{'values'}[0], "\n"; + } + } elsif ($parameter =~ /^device-property:/i || + $parameter =~ /^device_property:/i) { + my %properties = %{ getconf($CNF_DEVICE_PROPERTY) }; + my $propname = $parameter; + $propname =~ s/^device-property://i; + $propname =~ s/^device_property://i; + $propname = lc($propname); + if (exists $properties{$propname}) { + print $properties{$propname}->{'values'}[0], "\n"; + } } else { no_such_param($parameter) unless defined(getconf_byname($parameter)); @@ -248,14 +266,18 @@ sub conf_param { } } +Amanda::Util::setup_application("amgetconf", "server", $CONTEXT_SCRIPTUTIL); + ## Command-line parsing my $opt_list = ''; my $config_overrides = new_config_overrides($#ARGV+1); my $execute_where = undef; +debug("Arguments: " . join(' ', @ARGV)); Getopt::Long::Configure(qw{bundling}); GetOptions( + 'version' => \&Amanda::Util::version_opt, 'list|l' => \$opt_list, 'o=s' => sub { add_config_override_opt($config_overrides, $_[1]); }, 'execute-where=s' => sub { @@ -291,8 +313,6 @@ if (@ARGV == 1) { ## Now start looking at the parameter. -Amanda::Util::setup_application("amgetconf", "server", $CONTEXT_SCRIPTUTIL); - if ($parameter =~ /^build(?:\..*)?/) { config_init(0|$execute_where, undef); build_param($parameter, $opt_list); @@ -309,7 +329,17 @@ if ($parameter =~ /^db(open|close)\./) { # finally, finish up the application startup procedure set_config_overrides($config_overrides); -config_init($CONFIG_INIT_EXPLICIT_NAME | $CONFIG_INIT_USE_CWD | $execute_where, $config_name); +if ($execute_where == $CONFIG_INIT_CLIENT && + defined($config_name) && $config_name eq '.') { + config_init($CONFIG_INIT_USE_CWD | $execute_where, undef); +} elsif ($execute_where == $CONFIG_INIT_CLIENT && + defined($config_name) && $config_name ne '.') { + config_init($CONFIG_INIT_EXPLICIT_NAME | $execute_where, $config_name); +} elsif ($execute_where == $CONFIG_INIT_CLIENT) { + config_init($execute_where, undef); +} else { + config_init($CONFIG_INIT_EXPLICIT_NAME | $CONFIG_INIT_USE_CWD | $execute_where, $config_name); +} my ($cfgerr_level, @cfgerr_errors) = config_errors(); if ($cfgerr_level >= $CFGERR_WARNINGS) { config_print_errors();