#! @PERL@
-# Copyright (c) 2008,2009 Zmanda, Inc. All Rights Reserved.
+# Copyright (c) 2008, 2009, 2010 Zmanda, Inc. All Rights Reserved.
#
# This program is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 as published
use lib '@amperldir@';
use strict;
+use warnings;
use Amanda::Config qw( :getconf :init );
use Amanda::Debug qw( :logging );
use Amanda::Util qw( :constants );
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));
}
}
+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 {
## 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);
# 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();