From c816de2507a6c638d0a25f4b404418a1518a57fa Mon Sep 17 00:00:00 2001 From: Oliver Tappe Date: Mon, 12 May 2008 12:59:10 +0000 Subject: * added explicit check for /srv/openslx/export/nfs being a bind-mount to /var/opt/openslx/stage1 and skip the rsync step in that case This makes it possible to use a bind mount during development, which in turn avoids having to wait for rsync to do copy the largish vendor-OS folder. git-svn-id: http://svn.openslx.org/svn/openslx/openslx/trunk@1763 95ad53e4-c205-0410-b2fa-d234c58c8868 --- installer/OpenSLX/OSExport/FileSystem/NFS.pm | 34 ++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) (limited to 'installer/OpenSLX/OSExport/FileSystem/NFS.pm') diff --git a/installer/OpenSLX/OSExport/FileSystem/NFS.pm b/installer/OpenSLX/OSExport/FileSystem/NFS.pm index f14bc497..b114348d 100644 --- a/installer/OpenSLX/OSExport/FileSystem/NFS.pm +++ b/installer/OpenSLX/OSExport/FileSystem/NFS.pm @@ -52,7 +52,41 @@ sub exportVendorOS my $source = shift; my $target = $self->{'export-path'}; + + # For development purposes, it is very desirable to be able to take a + # shortcut that avoids doing the actual copying of the folders (as that + # takes a considerable amount of time). + # In order to support this, we explicitly check if the OpenSLX NFS export + # root folder (/srv/openslx/export/nfs) is a bind-mount of the OpenSLX + # stage1 folder (/var/opt/openslx/stage1). + # If that is the case, we print a notice and skip the rsync step (which + # wouldn't work anyway, as source and target folder are the same). + my $stage1Root = dirname($source); + my $nfsRoot = dirname($target); + chomp(my $canonicalStage1Root = qx{readlink -f $stage1Root} || $stage1Root); + chomp(my $canonicalNFSRoot = qx{readlink -f $nfsRoot} || $nfsRoot); + my @mounts = slurpFile('/etc/mtab'); + for my $mount (@mounts) { + if ($mount =~ m{ + ^ + $canonicalStage1Root # mount source + \s+ + $canonicalNFSRoot # mount target + \s+ + none # filesystem for bind mounts is 'none' + \s+ + \S*\bbind\b\S* # look for bind mounts only + }gmsx) { + warn _tr( + "%s is a bind-mount to vendor-OS root - rsync step is skipped!", + $target + ); + return; + } + } + $self->_copyViaRsync($source, $target); + return; } -- cgit v1.2.3-55-g7522