summaryrefslogtreecommitdiffstats
path: root/os-plugins
diff options
context:
space:
mode:
authorOliver Tappe2008-01-27 15:51:47 +0100
committerOliver Tappe2008-01-27 15:51:47 +0100
commitfde7d8f091d03b8d2c0c14e3f56eab700082beba (patch)
treed940abafc4d6b261805cd0cb7b381246ef85b732 /os-plugins
parent* fixed bug that left orphaned installed_plugins when removing a vendor-OS (diff)
downloadcore-fde7d8f091d03b8d2c0c14e3f56eab700082beba.tar.gz
core-fde7d8f091d03b8d2c0c14e3f56eab700082beba.tar.xz
core-fde7d8f091d03b8d2c0c14e3f56eab700082beba.zip
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
Diffstat (limited to 'os-plugins')
-rw-r--r--os-plugins/OpenSLX/OSPlugin/Engine.pm10
-rw-r--r--os-plugins/OpenSLX/OSPlugin/Roster.pm63
-rw-r--r--os-plugins/plugins/example/XX_example.sh2
-rw-r--r--os-plugins/plugins/theme/OpenSLX/OSPlugin/theme.pm26
-rw-r--r--os-plugins/plugins/theme/XX_theme.sh2
-rwxr-xr-xos-plugins/slxos-plugin22
6 files changed, 103 insertions, 22 deletions
diff --git a/os-plugins/OpenSLX/OSPlugin/Engine.pm b/os-plugins/OpenSLX/OSPlugin/Engine.pm
index bdf259f4..fe2bf1ac 100644
--- a/os-plugins/OpenSLX/OSPlugin/Engine.pm
+++ b/os-plugins/OpenSLX/OSPlugin/Engine.pm
@@ -36,16 +36,6 @@ sub new
return bless $self, $class;
}
-sub getAvailablePlugins
-{ # Class-method!
- my $class = shift;
-
- return
- map { basename($_); }
- sort
- glob("$openslxConfig{'base-path'}/lib/plugins/*");
-}
-
sub initialize
{
my $self = shift;
diff --git a/os-plugins/OpenSLX/OSPlugin/Roster.pm b/os-plugins/OpenSLX/OSPlugin/Roster.pm
index 776907e4..832b0bb3 100644
--- a/os-plugins/OpenSLX/OSPlugin/Roster.pm
+++ b/os-plugins/OpenSLX/OSPlugin/Roster.pm
@@ -18,6 +18,46 @@ use warnings;
use OpenSLX::Basics;
+my %plugins;
+
+=item C<getAvailablePlugins()>
+
+Returns a hash that keys the names of available plugins to their info hash.
+
+=cut
+
+sub getAvailablePlugins
+{
+ my $class = shift;
+
+ $class->_init() if !%plugins;
+
+ my %pluginInfo;
+ foreach my $pluginName (keys %plugins) {
+ $pluginInfo{$pluginName} = $plugins{$pluginName}->getInfo();
+ }
+ return \%pluginInfo;
+}
+
+=item C<getPluginAttrInfo()>
+
+Returns a hash that contains info about the attributes support by the
+given plugin
+
+=cut
+
+sub getPluginAttrInfo
+{
+ my $class = shift;
+ my $pluginName = shift;
+
+ $class->_init() if !%plugins;
+
+ return if !$plugins{$pluginName};
+
+ return $plugins{$pluginName}->getAttrInfo();
+}
+
=item C<addAllDefaultAttributesToHash()>
Fetches attribute info from all available plugins and adds it to the given
@@ -38,6 +78,22 @@ sub addAllDefaultAttributesToHash
my $class = shift;
my $attrInfo = shift;
+ $class->_init() if !%plugins;
+
+ foreach my $plugin (values %plugins) {
+ my $pluginAttrInfo = $plugin->getAttrInfo();
+ foreach my $attr (keys %$pluginAttrInfo) {
+ $attrInfo->{$attr} = $pluginAttrInfo->{$attr};
+ }
+ }
+ return 1;
+}
+
+sub _init
+{
+ my $class = shift;
+
+ %plugins = ();
my $pluginPath = "$openslxConfig{'base-path'}/lib/plugins";
foreach my $modulePath (glob("$pluginPath/*")) {
next if $modulePath !~ m{/([^/]+)$};
@@ -45,12 +101,9 @@ sub addAllDefaultAttributesToHash
my $class = "OpenSLX::OSPlugin::$pluginName";
vlog(2, "loading plugin $class from path '$modulePath'");
my $plugin = instantiateClass($class, { pathToClass => $modulePath });
- my $pluginAttrInfo = $plugin->getAttrInfo();
- foreach my $attr (keys %$pluginAttrInfo) {
- $attrInfo->{$attr} = $pluginAttrInfo->{$attr};
- }
+ $plugins{$pluginName} = $plugin;
}
- return 1;
+ return;
}
1;
diff --git a/os-plugins/plugins/example/XX_example.sh b/os-plugins/plugins/example/XX_example.sh
index ae8bcd64..d4496102 100644
--- a/os-plugins/plugins/example/XX_example.sh
+++ b/os-plugins/plugins/example/XX_example.sh
@@ -26,7 +26,7 @@
if [ -e /initramfs/plugin-conf/example.conf ]; then
. /initramfs/plugin-conf/example.conf
- if [ $Example_active -ne 0 ]; then
+ if [ $example_active -ne 0 ]; then
[ $DEBUGLEVEL -gt 0 ] && echo "executing the 'example' os-plugin ...";
# for this example plugin, we simply take a filename from the
diff --git a/os-plugins/plugins/theme/OpenSLX/OSPlugin/theme.pm b/os-plugins/plugins/theme/OpenSLX/OSPlugin/theme.pm
index 17170fbf..c6635ccb 100644
--- a/os-plugins/plugins/theme/OpenSLX/OSPlugin/theme.pm
+++ b/os-plugins/plugins/theme/OpenSLX/OSPlugin/theme.pm
@@ -40,7 +40,7 @@ sub getInfo
return {
description => unshiftHereDoc(<<' End-of-Here'),
- applies a graphical theme to the bootsplash and the displaymanager
+ Applies a graphical theme to the bootsplash and the displaymanager.
End-of-Here
mustRunAfter => [],
};
@@ -78,11 +78,31 @@ sub getAttrInfo
default => 30,
},
- 'theme::name' => {
+ 'theme::splash' => {
applies_to_systems => 1,
applies_to_clients => 0,
description => unshiftHereDoc(<<' End-of-Here'),
- the name of the theme to apply (or unset for no theme)
+ name of the theme to apply to bootsplash (unset for no theme)
+ End-of-Here
+ content_regex => undef,
+ content_descr => undef,
+ default => 'openslx',
+ },
+ 'theme::displaymanager' => {
+ applies_to_systems => 1,
+ applies_to_clients => 0,
+ description => unshiftHereDoc(<<' End-of-Here'),
+ name of the theme to apply to displaymanager (unset for no theme)
+ End-of-Here
+ content_regex => undef,
+ content_descr => undef,
+ default => 'openslx',
+ },
+ 'theme::desktop' => {
+ applies_to_systems => 1,
+ applies_to_clients => 0,
+ description => unshiftHereDoc(<<' End-of-Here'),
+ name of the theme to apply to desktop (unset for no theme)
End-of-Here
content_regex => undef,
content_descr => undef,
diff --git a/os-plugins/plugins/theme/XX_theme.sh b/os-plugins/plugins/theme/XX_theme.sh
index 4d166c13..2d2b0f0f 100644
--- a/os-plugins/plugins/theme/XX_theme.sh
+++ b/os-plugins/plugins/theme/XX_theme.sh
@@ -6,7 +6,7 @@
. /etc/sysconfig/config
if [ -e /initramfs/plugin-conf/theme.conf ]; then
. /initramfs/plugin-conf/theme.conf
- if [ $Theme_active -ne 0 ]; then
+ if [ $theme_active -ne 0 ]; then
[ $DEBUGLEVEL -gt 0 ] && echo "executing the 'theme' os-plugin ...";
testmkd /mnt/var/lib/openslx/themes/displaymanager
diff --git a/os-plugins/slxos-plugin b/os-plugins/slxos-plugin
index 981e6b41..52c80796 100755
--- a/os-plugins/slxos-plugin
+++ b/os-plugins/slxos-plugin
@@ -59,12 +59,30 @@ openslxInit();
my $action = shift @ARGV || '';
-if ($action =~ m[^list-av]i) {
+if ($action =~ m[^list]i) {
my @pluginFolders = glob("$openslxConfig{'base-path'}/lib/plugins/*");
print _tr("List of available plugins:\n");
+ require OpenSLX::OSPlugin::Roster;
+ my $pluginInfo = OpenSLX::OSPlugin::Roster->getAvailablePlugins();
print join(
'',
- map { "\t$_\n" } OpenSLX::OSPlugin::Engine->getAvailablePlugins()
+ map {
+ if ($verbose) {
+ my $description = $pluginInfo->{$_}->{description};
+ $description
+ .= "\t "
+ . _tr("The following attributes are suppported:")
+ . "\n\t ";
+ my $pluginAttrs
+ = OpenSLX::OSPlugin::Roster->getPluginAttrInfo($_);
+ $description .= join("\n\t ", sort keys %$pluginAttrs);
+ "\n\t$_\n\t $description\n";
+ }
+ else {
+ "\t$_\n";
+ }
+ }
+ sort keys %$pluginInfo
);
} elsif ($action =~ m[^install]i) {
if (scalar(@ARGV) != 2) {