From fde7d8f091d03b8d2c0c14e3f56eab700082beba Mon Sep 17 00:00:00 2001 From: Oliver Tappe Date: Sun, 27 Jan 2008 14:51:47 +0000 Subject: Hopefully finished the adjustments of the tools with respect to theme naming and other recent discussions of user interface. * adjusted and simplified code to the fact that plugins are now named in all lowercase * slxos-plugin --verbose list now shows description for each plugin and a list of supported attributes * fixed some outstanding issues with respect to lowercasing of plugin names * Separated theme::name into theme::splash, theme::displaymanager and theme::desktop, leading to DB-schema 0.24. Please note that although these attributes exist, currently only theme::splash is being used (the new ones will be used by the reimplemented mkdxsinitrd) * moved some information gathering from OSPlugin::Engine into OSPlugin::Roster, where it belongs git-svn-id: http://svn.openslx.org/svn/openslx/trunk@1500 95ad53e4-c205-0410-b2fa-d234c58c8868 --- config-db/OpenSLX/AttributeRoster.pm | 8 ++++---- config-db/OpenSLX/DBSchema.pm | 36 +++++++++++++++++++++++++++++++++++- config-db/slxconfig | 15 ++++++++------- config-db/slxconfig-demuxer | 9 ++++----- 4 files changed, 51 insertions(+), 17 deletions(-) (limited to 'config-db') diff --git a/config-db/OpenSLX/AttributeRoster.pm b/config-db/OpenSLX/AttributeRoster.pm index 0308540e..e196b5d3 100644 --- a/config-db/OpenSLX/AttributeRoster.pm +++ b/config-db/OpenSLX/AttributeRoster.pm @@ -410,14 +410,14 @@ sub getAttrInfo } elsif (defined $params->{scope}) { my %MatchingAttributeInfo; - my $lcScope = lc($params->{scope}); + my $selectedScope = lc($params->{scope}); foreach my $attr (keys %AttributeInfo) { my $attrScope = ''; if ($attr =~ m{^(.+?)::}) { - $attrScope = $1; + $attrScope = lc($1); } - if ((!$attrScope && $lcScope eq 'core') - || lc($attrScope) eq $lcScope) { + if ((!$attrScope && $selectedScope eq 'core') + || $attrScope eq $selectedScope) { $MatchingAttributeInfo{$attr} = $AttributeInfo{$attr}; } } diff --git a/config-db/OpenSLX/DBSchema.pm b/config-db/OpenSLX/DBSchema.pm index aa6ef1c1..ede1b9a3 100644 --- a/config-db/OpenSLX/DBSchema.pm +++ b/config-db/OpenSLX/DBSchema.pm @@ -35,7 +35,7 @@ use OpenSLX::Basics; ### fk => foreign key (integer) ################################################################################ -my $VERSION = 0.23; +my $VERSION = 0.24; my $DbSchema = { 'version' => $VERSION, @@ -622,6 +622,40 @@ sub _schemaUpgradeDBFrom $metaDB->schemaSetDBVersion(0.23); + return 1; + }, + 0.24 => sub { + my $metaDB = shift; + + vlog(0, "upgrading schema version to 0.24"); + + # split theme::name into theme::splash, theme::displaymanager and + # theme::desktop + foreach my $system ($metaDB->fetchSystemByFilter()) { + my $attrs = $system->{attrs} || {}; + next if !exists $attrs->{'theme::name'}; + $attrs->{'theme::splash'} + = $attrs->{'theme::displaymanager'} + = $attrs->{'theme::desktop'} + = $attrs->{'theme::name'}; + delete $attrs->{'theme::name'}; + $metaDB->setSystemAttrs($system->{id}, $attrs); + } + + # force all theme names to lowercase + foreach my $vendorOS ($metaDB->fetchVendorOSByFilter()) { + my @installedPlugins + = $metaDB->fetchInstalledPlugins($vendorOS->{id}); + foreach my $plugin (@installedPlugins) { + my $pluginName = $plugin->{plugin_name}; +print "$vendorOS->{id} $pluginName\n"; + $metaDB->removeInstalledPlugin($vendorOS->{id}, $pluginName); + $metaDB->addInstalledPlugin($vendorOS->{id}, lc($pluginName)); + } + } + + $metaDB->schemaSetDBVersion(0.24); + return 1; }, ); diff --git a/config-db/slxconfig b/config-db/slxconfig index da4e31f1..a357bc4a 100755 --- a/config-db/slxconfig +++ b/config-db/slxconfig @@ -93,7 +93,9 @@ elsif ($action =~ m[^change-c]i) { changeClientInConfigDB(@ARGV); } elsif ($action =~ m[^list-a]) { - print _tr("List of known attributes:\n"); + print @ARGV + ? _tr("List of known attributes for scope '%s':\n", $ARGV[0]) + : _tr("List of known attributes:\n"); listAttributes(@ARGV); } elsif ($action =~ m[^list-c]) { @@ -352,6 +354,7 @@ sub listAttributes map { my $attr = dclone($attrInfo->{$_}); $attr->{name} = $_; + delete $attr->{content_regex}; # no use for display purposes $attr; } sort keys %$attrInfo @@ -516,8 +519,7 @@ sub listSystems ); my $mergedAttrs = $mergedSystem->{attrs} || {}; foreach my $plugin (@installedPlugins) { - my $pluginScope = lc($plugin); - next if !$mergedAttrs->{"${pluginScope}::active"}; + next if !$mergedAttrs->{"${plugin}::active"}; push @activePlugins, $plugin; } if ($inherited) { @@ -695,12 +697,11 @@ sub searchSystems $openslxDB->mergeDefaultAttributesIntoSystem($mergedSystem); my $mergedAttrs = $mergedSystem->{attrs} || {}; foreach my $plugin (@installedPlugins) { - my $pluginScope = lc($plugin); - next if !$mergedAttrs->{"${pluginScope}::active"}; + next if !$mergedAttrs->{"${plugin}::active"}; my $precedence = sprintf( - "%02d", $mergedAttrs->{"${pluginScope}::precedence"} + "%02d", $mergedAttrs->{"${plugin}::precedence"} ); - push(@activePlugins, "$precedence...$plugin"); + push(@activePlugins, $plugin); } } $_->{PLUGINS} = [ sort @activePlugins ]; diff --git a/config-db/slxconfig-demuxer b/config-db/slxconfig-demuxer index 24501a97..c715caac 100755 --- a/config-db/slxconfig-demuxer +++ b/config-db/slxconfig-demuxer @@ -498,7 +498,7 @@ sub generateInitialRamFS $cmd .= "-S $info->{name} "; # pass on theme, if any - my $theme = $attrs->{'theme::name'} || ''; + my $theme = $attrs->{'theme::splash'} || ''; if (length $theme) { $cmd .= "-s $theme "; } @@ -705,8 +705,7 @@ sub writePluginConfigurationsForSystem vlog(2, _tr("checking configuration of plugin '%s'", $pluginName)); # skip inactive plugins - my $pluginScope = lc($pluginName); - next unless $attrs->{"${pluginScope}::active"}; + next unless $attrs->{"${pluginName}::active"}; push @activePlugins, $pluginName; @@ -717,7 +716,7 @@ sub writePluginConfigurationsForSystem vlog(2, _tr("writing configuration file for plugin '%s'", $pluginName)); # write plugin configuration to a file: my $content; - my @pluginAttrs = grep { $_ =~ m{^${pluginScope}::} } keys %$attrs; + my @pluginAttrs = grep { $_ =~ m{^${pluginName}::} } keys %$attrs; foreach my $attr (sort @pluginAttrs) { my $attrVal = $attrs->{$attr}; next if !defined $attrVal; @@ -734,7 +733,7 @@ sub writePluginConfigurationsForSystem # copy runlevel script to be used in stage3: my $precedence - = sprintf('%02d', $attrs->{"${pluginScope}::precedence"}); + = sprintf('%02d', $attrs->{"${pluginName}::precedence"}); my $pluginFolder = "$openslxConfig{'base-path'}/lib/plugins/$pluginName"; my $scriptName = "$pluginFolder/XX_${pluginName}.sh"; -- cgit v1.2.3-55-g7522