summaryrefslogtreecommitdiffstats
path: root/installer/OpenSLX/OSSetup/Distro/Base.pm
diff options
context:
space:
mode:
authorOliver Tappe2008-03-24 11:41:16 +0100
committerOliver Tappe2008-03-24 11:41:16 +0100
commit4f6b63abf59c2478968506e0e779d0992323534f (patch)
tree94630439ab7d0d8d21ee05a6de5351bfec2f0ca8 /installer/OpenSLX/OSSetup/Distro/Base.pm
parent* moved syscall related code into a module of its own right (diff)
downloadcore-4f6b63abf59c2478968506e0e779d0992323534f.tar.gz
core-4f6b63abf59c2478968506e0e779d0992323534f.tar.xz
core-4f6b63abf59c2478968506e0e779d0992323534f.zip
* Switched from explicit cleanup functions to "resource acquisition by definition",
implemented by the new ScopedResource class. This change improves robustness with respect to signals and unexpected errors and makes the code cleaner. git-svn-id: http://svn.openslx.org/svn/openslx/openslx/trunk@1678 95ad53e4-c205-0410-b2fa-d234c58c8868
Diffstat (limited to 'installer/OpenSLX/OSSetup/Distro/Base.pm')
-rw-r--r--installer/OpenSLX/OSSetup/Distro/Base.pm13
1 files changed, 3 insertions, 10 deletions
diff --git a/installer/OpenSLX/OSSetup/Distro/Base.pm b/installer/OpenSLX/OSSetup/Distro/Base.pm
index 39572e5d..573114e8 100644
--- a/installer/OpenSLX/OSSetup/Distro/Base.pm
+++ b/installer/OpenSLX/OSSetup/Distro/Base.pm
@@ -122,11 +122,6 @@ sub startSession
my $self = shift;
my $osDir = shift;
- # ensure that the session will be finished even if the script crashes:
- addCleanupFunction(
- "slxos-setup::distro::chroot", sub { $self->finishSession(); }
- );
-
# setup a fixed locale environment to avoid warnings about unset locales
# (like for instance shown by apt-get)
$ENV{LC_ALL} = 'POSIX';
@@ -152,7 +147,7 @@ sub startSession
# mount /proc (if we have 'mount' available)
if (qx{which mount 2>/dev/null}) {
- if (!-e "$osDir/proc" && !mkpath("$osDir/proc")) {
+ if (!-e '/proc' && !mkpath('/proc')) {
die _tr("unable to create folder '%s' (%s)\n", "$osDir/proc", $!);
}
if (slxsystem("mount -t proc proc '/proc'")) {
@@ -160,15 +155,13 @@ sub startSession
}
}
- return;
+ return 1;
}
sub finishSession
{
my $self = shift;
- removeCleanupFunction('slxos-setup::distro::chroot');
-
# umount /proc (if we have 'umount' available)
if (qx{which umount 2>/dev/null}) {
if (slxsystem("umount /proc")) {
@@ -176,7 +169,7 @@ sub finishSession
}
}
- return;
+ return 1;
}
sub getDefaultPathList