diff options
author | Oliver Tappe | 2008-02-16 18:18:42 +0100 |
---|---|---|
committer | Oliver Tappe | 2008-02-16 18:18:42 +0100 |
commit | 78a77be447311f092e92c19b0371379f533c4ec5 (patch) | |
tree | c6d0fd0d52cd29e346362250d3579e0ca8f2be3b /initramfs/OpenSLX/MakeInitRamFS | |
parent | * when invoking init-hook scripts and plugin scripts, now only *.sh files (diff) | |
download | core-78a77be447311f092e92c19b0371379f533c4ec5.tar.gz core-78a77be447311f092e92c19b0371379f533c4ec5.tar.xz core-78a77be447311f092e92c19b0371379f533c4ec5.zip |
Refactored call-out to plugins when making the initramfs:
* The code for setting up the plugin in the initramfs has been moved into
the plugin base, as this makes it possible for any plugin to override it
(should the need ever arise).
* The plugin scripts themselves are now being copied into the initramfs,
instead of being part of the config-TGZ - they are static scripts, so
there's no need to make them part of the config. Only the actual settings
of each plugin are part of the config-TGZ now.
* Cleaned up most accesses from plugins to private data of the makeInitRamFS-
engine.
I have tested with these changes with Ubuntu and Debian, and splashy still works
for both, so it should be ok.
git-svn-id: http://svn.openslx.org/svn/openslx/trunk@1551 95ad53e4-c205-0410-b2fa-d234c58c8868
Diffstat (limited to 'initramfs/OpenSLX/MakeInitRamFS')
-rw-r--r-- | initramfs/OpenSLX/MakeInitRamFS/Engine.pm | 80 |
1 files changed, 44 insertions, 36 deletions
diff --git a/initramfs/OpenSLX/MakeInitRamFS/Engine.pm b/initramfs/OpenSLX/MakeInitRamFS/Engine.pm index bd30d15f..577cb168 100644 --- a/initramfs/OpenSLX/MakeInitRamFS/Engine.pm +++ b/initramfs/OpenSLX/MakeInitRamFS/Engine.pm @@ -93,6 +93,41 @@ sub execute return; } +sub haveKernelParam +{ + my $self = shift; + my $param = shift; + + return ref $param eq 'Regexp' + ? grep { $_ =~ $param } @{ $self->{'kernel-params'} } + : grep { $_ eq $param } @{ $self->{'kernel-params'} }; +} + +sub addKernelParams +{ + my $self = shift; + + push @{ $self->{'kernel-params'} }, @_; + + return; +} + +sub kernelParams +{ + my $self = shift; + + return @{ $self->{'kernel-params'} }; +} + +sub addKernelModules +{ + my $self = shift; + + push @{ $self->{'suggested-kernel-modules'} }, @_; + + return; +} + ################################################################################ ### implementation methods ################################################################################ @@ -128,7 +163,7 @@ sub _collectCMDs $self->_copyDebugTools(); } - $self->_handlePlugins(); + $self->_calloutToPlugins(); $self->{distro}->applyChanges($self); @@ -446,10 +481,10 @@ sub _copyRequiredLayeredFSTools my $self = shift; my @tools; - if ($self->{'kernel-params'} =~ m{\bunionfs\b}) { + if ($self->haveKernelParam('unionfs')) { push @tools, 'unionctl'; } - if ($self->{'kernel-params'} =~ m{\bcowloop\b}) { + if ($self->haveKernelParam('cowloop')) { push @tools, 'cowdev'; } foreach my $tool (@tools) { @@ -695,45 +730,18 @@ sub _writeSlxSystemConf return; } -sub _handlePlugins +sub _calloutToPlugins { my $self = shift; - my $pluginSrcPath = "$openslxConfig{'base-path'}/lib/plugins"; - my $buildPath = $self->{'build-path'}; + my $pluginInitdPath = "$self->{'build-path'}/etc/plugin-init.d"; + my $initHooksPath = "$self->{'build-path'}/etc/init-hooks"; + $self->addCMD("mkdir -p $pluginInitdPath $initHooksPath"); + foreach my $pluginName (@{$self->{'plugins'}}) { - if (-d "$pluginSrcPath/$pluginName/init-hooks") { - my $hookSrcPath = "$pluginSrcPath/$pluginName/init-hooks"; - $self->addCMD("cp -r $hookSrcPath/* $buildPath/etc/init-hooks/"); - } my $plugin = OpenSLX::OSPlugin::Roster->getPlugin($pluginName); next if !$plugin; - - my @suggestedKernelParams - = $plugin->suggestAdditionalKernelParams($self->{'kernel-params'}); - if (@suggestedKernelParams) { - my $paramsList = join ' ', @suggestedKernelParams; - vlog( - 2, - "plugin $pluginName suggests these kernel params: $paramsList" - ); - $self->{'kernel-params'} - .= ($self->{'kernel-params'} ? ' ' : '') . $paramsList; - } - - my @suggestedModules = $plugin->suggestAdditionalKernelModules($self); - if (@suggestedModules) { - vlog( - 2, - "plugin $pluginName suggests these kernel modules: " - . join(',', @suggestedModules) - ); - push @{ $self->{'suggested-kernel-modules'} }, @suggestedModules; - } - - $plugin->copyRequiredFilesIntoInitramfs( - $self->{'build-path'}, $self->{attrs}, $self - ); + $plugin->setupPluginInInitramfs($self->{attrs}, $self); } return; } |