diff options
author | Oliver Tappe | 2006-10-29 18:27:55 +0100 |
---|---|---|
committer | Oliver Tappe | 2006-10-29 18:27:55 +0100 |
commit | 86499249cb5373c213c8c19635fc6b6c3bd73d5b (patch) | |
tree | b3b0c8e0c468c1d6a18ce5ecf56212b3d7c74179 /config-db/slxsettings | |
parent | * added support for new table 'settings', which contains (diff) | |
download | core-86499249cb5373c213c8c19635fc6b6c3bd73d5b.tar.gz core-86499249cb5373c213c8c19635fc6b6c3bd73d5b.tar.xz core-86499249cb5373c213c8c19635fc6b6c3bd73d5b.zip |
* added support for showing and changing the settings, too.
git-svn-id: http://svn.openslx.org/svn/openslx/trunk@490 95ad53e4-c205-0410-b2fa-d234c58c8868
Diffstat (limited to 'config-db/slxsettings')
-rwxr-xr-x | config-db/slxsettings | 31 |
1 files changed, 28 insertions, 3 deletions
diff --git a/config-db/slxsettings b/config-db/slxsettings index 130f49a7..57623891 100755 --- a/config-db/slxsettings +++ b/config-db/slxsettings @@ -33,11 +33,13 @@ use lib "$FindBin::RealBin"; # development path use OpenSLX::Basics; +use OpenSLX::ConfigDB qw(:access :manipulation); my ( $noShow, $quiet, @remove, + %cmdlineSettings, $helpReq, $manReq, $versionReq, @@ -50,6 +52,8 @@ GetOptions( # will avoid printing anything 'remove=s' => \@remove, # will avoid printing anything + 'setting=s' => \%cmdlineSettings, + # accepts setting for db-table 'settings' 'help|?' => \$helpReq, 'man' => \$manReq, @@ -64,7 +68,11 @@ if ($versionReq) { openslxInit() or pod2usage(2); -# fetch current content of local settings file... +# fetch slxconf entries... +my $openslxDB = connectConfigDB(); +my $currSettings = fetchSettings($openslxDB); + +# ...and fetch current content of local settings file... open(SETTINGS, "< $openslxConfig{'config-path'}/settings.local"); $/ = undef; my $settings = <SETTINGS>; @@ -109,10 +117,27 @@ if ($changeCount) { close(SETTINGS); } +if (scalar(keys %cmdlineSettings) > 0) { + foreach my $key (keys %cmdlineSettings) { + if (exists $currSettings->{$key}) { + changeSettings($openslxDB, { $key => $cmdlineSettings{$key} }); + $changeCount++; + } else { + die _tr("unknown settings key <%s>!\n", $key); + } + } + $currSettings = fetchSettings($openslxDB); +} + if (!($noShow || $quiet)) { - print "\n"._tr("resulting settings:")."\n"; + my $text = $changeCount ? "resulting settings:" : "current settings:"; + print "\n"._tr($text)."\n"; foreach my $key (sort keys %openslxConfig) { - print "\t$key=$openslxConfig{$key}\n"; + print qq[\t$key="$openslxConfig{$key}"\n]; + } + print "slxconf:\n"; + foreach my $key (sort keys %$currSettings) { + print qq[\t$key="$currSettings->{$key}"\n]; } } |