From 096efb38194c5b662a9466a09a4be4b1fb28a117 Mon Sep 17 00:00:00 2001 From: Oliver Tappe Date: Fri, 6 Mar 2009 16:31:58 +0000 Subject: working at #393: * moved copying of uclibc-rootfs from stage2 (export) to stage1 (vendor-OS) git-svn-id: http://svn.openslx.org/svn/openslx/openslx/trunk@2692 95ad53e4-c205-0410-b2fa-d234c58c8868 --- installer/OpenSLX/OSExport/FileSystem/NFS.pm | 46 +------------------- installer/OpenSLX/OSExport/FileSystem/SquashFS.pm | 20 +-------- installer/OpenSLX/OSSetup/Engine.pm | 52 +++++++++++++++++++++++ 3 files changed, 54 insertions(+), 64 deletions(-) diff --git a/installer/OpenSLX/OSExport/FileSystem/NFS.pm b/installer/OpenSLX/OSExport/FileSystem/NFS.pm index 4cb6c1b7..b9d88689 100644 --- a/installer/OpenSLX/OSExport/FileSystem/NFS.pm +++ b/installer/OpenSLX/OSExport/FileSystem/NFS.pm @@ -61,7 +61,7 @@ sub exportVendorOS } $self->_copyViaRsync($source, $target); - $self->_copyUclibEnv($target); + return; } @@ -234,48 +234,4 @@ sub _isTargetBindMounted return 0; } -sub _copyUclibEnv -{ - my $self = shift; - my $target = shift; - my $targetRoot = $target; - - $target .= "/opt/openslx/uclib-rootfs"; - - if (system("mkdir -p $target")) { - die _tr("unable to create directory '%s', giving up! (%s)\n", - $target, $!); - } - - my $uclibcRootfs = "$openslxConfig{'base-path'}/share/uclib-rootfs"; - my @excludes = qw( - dialog - kexec - libcurses.so* - libncurses.so* - mconf - strace - ); - my $exclOpts = join ' ', map { "--exclude $_" } @excludes; - my $includeExcludeList = $self->_determineIncludeExcludeList(); - vlog(1, _tr("using exclude-filter:\n%s\n", $exclOpts)); - my $rsyncFH; - my $rsyncCmd - = "rsync -av --delete-excluded --exclude-from=-" . " $uclibcRootfs/ $target"; - vlog(2, "executing: $rsyncCmd\n"); - # link uClibc from the uclib-rootfs to /lib to make LD_PRELOAD=... working - my $uClibCmd = "ln -sf /opt/openslx/uclib-rootfs/lib/ld-uClibc.so.0"; - $uClibCmd .= " $targetRoot/lib/ld-uClibc.so.0"; - system("$uClibCmd"); - - open($rsyncFH, '|-', $rsyncCmd) - or die _tr("unable to start rsync for source '%s', giving up! (%s)", - $uclibcRootfs, $!); - print $rsyncFH $exclOpts; - close($rsyncFH) - or die _tr("unable to copy to target '%s', giving up! (%s)", - $target, $!); - return; -} - 1; diff --git a/installer/OpenSLX/OSExport/FileSystem/SquashFS.pm b/installer/OpenSLX/OSExport/FileSystem/SquashFS.pm index 12670dc4..d9760642 100644 --- a/installer/OpenSLX/OSExport/FileSystem/SquashFS.pm +++ b/installer/OpenSLX/OSExport/FileSystem/SquashFS.pm @@ -207,29 +207,11 @@ sub _createSquashFS my $filterFile = "/tmp/slx-nbdsquash-filter-$$"; spitFile($filterFile, $includeExcludeList); - # add uclib-root environment to stage2 by mounting it temporarily to stage1 - # subdirectory of openslx stuff - my $uclibcRootfs = "$openslxConfig{'base-path'}/share/uclib-rootfs"; - vlog(0, _tr("preparing stage1 to add uclib-rootfs...")); - my $res = system("mkdir -p $source/opt/openslx/uclib-rootfs"); - $res = system("mount -o ro --bind $uclibcRootfs $source/opt/openslx/uclib-rootfs"); - # link uClibc from the uclib-rootfs to /lib to make LD_PRELOAD=... working - my $uClibCmd = "ln -sf /opt/openslx/uclib-rootfs/lib/ld-uClibc.so.0"; - $uClibCmd .= " $source/lib/ld-uClibc.so.0"; - system("$uClibCmd"); - - if ($res) { - die _tr( - "unable to prepare addition of uclib-rootfs in '%s', giving up! (%s)", - $source, $!); - } - # ... invoke mksquashfs ... vlog(0, _tr("invoking mksquashfs...")); my $mksquashfsBinary = "$openslxConfig{'base-path'}/share/squashfs/mksquashfs"; - $res = system("$mksquashfsBinary $source $target -ff $filterFile"); - $res = system("umount $source/opt/openslx/uclib-rootfs"); + my $res = system("$mksquashfsBinary $source $target -ff $filterFile"); unlink($filterFile); # ... remove filter file if done if ($res) { diff --git a/installer/OpenSLX/OSSetup/Engine.pm b/installer/OpenSLX/OSSetup/Engine.pm index 0feb1ba6..14843f0b 100644 --- a/installer/OpenSLX/OSSetup/Engine.pm +++ b/installer/OpenSLX/OSSetup/Engine.pm @@ -270,6 +270,7 @@ sub installVendorOS ) ); + $self->_copyUclibcRootfs(); $self->_touchVendorOS(); $self->addInstalledVendorOSToConfigDB(); return; @@ -353,6 +354,7 @@ sub cloneVendorOS ); } + $self->_copyUclibcRootfs(); $self->_touchVendorOS(); $self->addInstalledVendorOSToConfigDB(); return; @@ -380,6 +382,7 @@ sub updateVendorOS } ); + $self->_copyUclibcRootfs(); $self->_touchVendorOS(); vlog( 0, @@ -1041,6 +1044,55 @@ sub _touchVendorOS return; } +sub _copyUclibcRootfs +{ + my $self = shift; + + vlog(0, _tr("copying uclibc-rootfs into vendor-OS ...\n")); + + my $targetRoot = $self->{'vendor-os-path'}; + my $target = "$targetRoot/opt/openslx/uclib-rootfs"; + + if (system("mkdir -p $target")) { + die _tr("unable to create directory '%s', giving up! (%s)\n", + $target, $!); + } + + my $uclibcRootfs = "$openslxConfig{'base-path'}/share/uclib-rootfs"; + my @excludes = qw( + dialog + kexec + libcurses.so* + libncurses.so* + mconf + strace + ); + my $exclOpts = join ' ', map { "--exclude $_" } @excludes; + vlog(3, _tr("using exclude-filter:\n%s\n", $exclOpts)); + my $rsyncFH; + my $rsyncCmd + = "rsync -aq --delete-excluded --exclude-from=- $uclibcRootfs/ $target"; + vlog(2, "executing: $rsyncCmd\n"); + # link uClibc from the uclib-rootfs to /lib to make LD_PRELOAD=... working + my $uClibCmd = "ln -sf /opt/openslx/uclib-rootfs/lib/ld-uClibc.so.0"; + $uClibCmd .= " $targetRoot/lib/ld-uClibc.so.0"; + system($uClibCmd); + + open($rsyncFH, '|-', $rsyncCmd) + or die _tr("unable to start rsync for source '%s', giving up! (%s)", + $uclibcRootfs, $!); + print $rsyncFH $exclOpts; + close($rsyncFH) + or die _tr("unable to copy to target '%s', giving up! (%s)", + $target, $!); + + # write version of uclibc-rootfs original into a file in order to be + # able to check the up-to-date state later (in the config-demuxer) + slxsystem("slxversion >${target}.version"); + + return; +} + sub _createPackager { my $self = shift; -- cgit v1.2.3-55-g7522