From 8a355327d25ee3aa29e88b5d8977e35378fcb1a7 Mon Sep 17 00:00:00 2001 From: Oliver Tappe Date: Thu, 26 Apr 2007 18:01:30 +0000 Subject: * cleaned up handling of busybox binary, we now copy the binary that corresponds to the host system (32-bit or 64-bit). Let's see if that improves the result on debian-4... git-svn-id: http://svn.openslx.org/svn/openslx/trunk@930 95ad53e4-c205-0410-b2fa-d234c58c8868 --- installer/OpenSLX/OSSetup/Engine.pm | 59 ++++++++++++++++++++++++------------- 1 file changed, 38 insertions(+), 21 deletions(-) (limited to 'installer/OpenSLX/OSSetup/Engine.pm') diff --git a/installer/OpenSLX/OSSetup/Engine.pm b/installer/OpenSLX/OSSetup/Engine.pm index d2feebd5..f829e3ba 100644 --- a/installer/OpenSLX/OSSetup/Engine.pm +++ b/installer/OpenSLX/OSSetup/Engine.pm @@ -168,7 +168,7 @@ sub installVendorOS $self->setupStage1A(); executeInSubprocess( sub { # some tasks that involve a chrooted environment: - changePersonalityIfNeeded($self->{distro}->{'base-name'}); + $self->changePersonalityIfNeeded(); $self->setupStage1B(); $self->setupStage1C(); }); @@ -178,7 +178,7 @@ sub installVendorOS } executeInSubprocess( sub { # another task that involves a chrooted environment: - changePersonalityIfNeeded($self->{distro}->{'base-name'}); + $self->changePersonalityIfNeeded(); $self->setupStage1D(); }); slxsystem("touch $installInfoFile"); @@ -260,7 +260,7 @@ sub updateVendorOS $self->{'vendor-os-path'}); } executeInSubprocess( sub { - changePersonalityIfNeeded($self->{distro}->{'base-name'}); + $self->changePersonalityIfNeeded(); $self->updateStage1D(); }); vlog 0, _tr("Vendor-OS '%s' updated succesfully.\n", @@ -456,8 +456,12 @@ sub stage1A_createBusyboxEnvironment # copy busybox and all required binaries into stage1a-dir: vlog 1, "creating busybox-environment..."; - copyFile("$openslxConfig{'share-path'}/busybox/busybox", - "$self->{stage1aDir}/bin"); + my $busyboxName + = $self->hostIs64Bit() + ? 'busybox.x86_64' + : 'busybox.i586'; + copyFile("$openslxConfig{'share-path'}/busybox/$busyboxName", + "$self->{stage1aDir}/bin", 'busybox'); # determine all required libraries and copy those, too: vlog 2, "calling slxldd for busybox"; @@ -717,6 +721,8 @@ sub stage1D_updateBasicVendorOS() chroot "." or die _tr("unable to chroot into '%s' (%s)\n", $osDir, $!); + $ENV{PATH} = "/bin:/sbin:/usr/bin:/usr/sbin"; + vlog 1, "updating basic vendor-os..."; $self->{'meta-packager'}->startSession(); $self->{'meta-packager'}->updateBasicVendorOS(); @@ -798,6 +804,33 @@ sub removeVendorOSFromConfigDB $openslxDB->disconnect(); } +################################################################################ +### utility methods +################################################################################ +sub changePersonalityIfNeeded { + my $self = shift; + + my $distroName = $self->{distro}->{'base-name'}; + if ($self->hostIs64Bit() && $distroName !~ m[_64]) { + # trying to handle a 32-bit vendor-OS on a 64-bit machine, so we change + # the personality accordingly (from 64-bit to 32-bit): + require 'syscall.ph' + or die _tr("unable to load '%s'\n", 'syscall.ph'); + require 'linux/personality.ph' + or die _tr("unable to load '%s'\n", 'linux/personality.ph'); + no strict; + syscall &SYS_personality, PER_LINUX32(); + } +} + +sub hostIs64Bit +{ + my $self = shift; + + $self->{arch} = `uname -m` unless defined $self->{arch}; + return ($self->{arch} =~ m[64]); +} + ################################################################################ ### utility functions ################################################################################ @@ -845,22 +878,6 @@ retry: return @foundFiles; } -sub changePersonalityIfNeeded { - my $distroName = shift; - - my $arch = `uname -m`; - if ($arch =~ m[64] && $distroName !~ m[_64]) { - # trying to handle a 32-bit vendor-OS on a 64-bit machine, so we change - # the personality accordingly (from 64-bit to 32-bit): - require 'syscall.ph' - or die _tr("unable to load '%s'\n", 'syscall.ph'); - require 'linux/personality.ph' - or die _tr("unable to load '%s'\n", 'linux/personality.ph'); - no strict; - syscall &SYS_personality, PER_LINUX32(); - } -} - 1; ################################################################################ -- cgit v1.2.3-55-g7522