From 272b14501e974b2731bac808265b2b94f48e6071 Mon Sep 17 00:00:00 2001 From: Oliver Tappe Date: Sat, 31 May 2008 18:53:21 +0000 Subject: * moved code from MakeInitRamFS::Engine that determines the list of available busybox applets into a separate function * use this function in OSSetup::Engine instead of relying on busybox.links, which may not be kept in sync. git-svn-id: http://svn.openslx.org/svn/openslx/openslx/trunk@1827 95ad53e4-c205-0410-b2fa-d234c58c8868 --- initramfs/OpenSLX/MakeInitRamFS/Engine.pm | 12 +----------- installer/OpenSLX/OSSetup/Engine.pm | 5 ++--- lib/OpenSLX/Utils.pm | 26 ++++++++++++++++++++++++++ 3 files changed, 29 insertions(+), 14 deletions(-) diff --git a/initramfs/OpenSLX/MakeInitRamFS/Engine.pm b/initramfs/OpenSLX/MakeInitRamFS/Engine.pm index 996d5f93..a5adb835 100644 --- a/initramfs/OpenSLX/MakeInitRamFS/Engine.pm +++ b/initramfs/OpenSLX/MakeInitRamFS/Engine.pm @@ -362,17 +362,7 @@ sub _copyBusybox = "$openslxConfig{'base-path'}/share/busybox/busybox" . ( hostIs64Bit() ? '.x86_64' : '.i586' ); - my $busyboxHelp = qx{$busyboxForHost --help}; - if ($busyboxHelp !~ m{defined functions:(.+)\z}ims) { - die "unable to parse busybox --help output:\n$busyboxHelp"; - } - my $rawAppletList = $1; - my @busyboxApplets - = map { - $_ =~ s{\s+}{}igms; - $_; - } - split m{,}, $rawAppletList; + my @busyboxApplets = getAvailableBusyboxApplets($busyboxForHost); foreach my $applet (@busyboxApplets) { $self->addCMD("ln -sf /bin/busybox $self->{'build-path'}/bin/$applet"); } diff --git a/installer/OpenSLX/OSSetup/Engine.pm b/installer/OpenSLX/OSSetup/Engine.pm index 86b262d8..2af1c3f1 100644 --- a/installer/OpenSLX/OSSetup/Engine.pm +++ b/installer/OpenSLX/OSSetup/Engine.pm @@ -1226,9 +1226,8 @@ sub _stage1A_createBusyboxEnvironment } # create all needed links to busybox: - my $links - = slurpFile("$openslxConfig{'base-path'}/share/busybox/busybox.links"); - foreach my $linkTarget (split "\n", $links) { + my @busyboxApplets = getAvailableBusyboxApplets($self->{'busybox-binary'}); + foreach my $linkTarget (@busyboxApplets) { linkFile('/bin/busybox', "$self->{stage1aDir}/$linkTarget"); } if ($self->_hostIs64Bit()) { diff --git a/lib/OpenSLX/Utils.pm b/lib/OpenSLX/Utils.pm index 346e9d4d..6ebd4d7c 100644 --- a/lib/OpenSLX/Utils.pm +++ b/lib/OpenSLX/Utils.pm @@ -34,6 +34,7 @@ $VERSION = 1.01; getFQDN readPassword hostIs64Bit + getAvailableBusyboxApplets ); =head1 NAME @@ -558,4 +559,29 @@ sub hostIs64Bit return $arch =~ m[64]; } +=item B + +Returns the list of the applets that is provided by the given busybox binary. + +=cut + +sub getAvailableBusyboxApplets +{ + my $busyboxBinary = shift; + + my $busyboxHelp = qx{$busyboxBinary --help}; + if ($busyboxHelp !~ m{defined functions:(.+)\z}ims) { + die "unable to parse busybox --help output:\n$busyboxHelp"; + } + my $rawAppletList = $1; + my @busyboxApplets + = map { + $_ =~ s{\s+}{}igms; + $_; + } + split m{,}, $rawAppletList; + + return @busyboxApplets; +} + 1; -- cgit v1.2.3-55-g7522