summaryrefslogtreecommitdiffstats
path: root/boot-env
diff options
context:
space:
mode:
authorOliver Tappe2008-08-31 17:41:30 +0200
committerOliver Tappe2008-08-31 17:41:30 +0200
commit6c0f5af254eca9e3b093052e1cae898e3b1a7c38 (patch)
treefb7079c189360f412327c8a02a19d07d9e080196 /boot-env
parent* made bastians script compatible with stage1 chroot (diff)
downloadcore-6c0f5af254eca9e3b093052e1cae898e3b1a7c38.tar.gz
core-6c0f5af254eca9e3b093052e1cae898e3b1a7c38.tar.xz
core-6c0f5af254eca9e3b093052e1cae898e3b1a7c38.zip
* refactored slxconfig-demuxer and boot environment implementations such that
demuxing to more than a single boot environment is supported now * renamed boot environment CD to PREBOOT_CD git-svn-id: http://svn.openslx.org/svn/openslx/openslx/trunk@2160 95ad53e4-c205-0410-b2fa-d234c58c8868
Diffstat (limited to 'boot-env')
-rw-r--r--boot-env/OpenSLX/BootEnvironment/Base.pm32
-rw-r--r--boot-env/OpenSLX/BootEnvironment/PREBOOT_CD.pm (renamed from boot-env/OpenSLX/BootEnvironment/CD.pm)23
-rw-r--r--boot-env/OpenSLX/BootEnvironment/PXE.pm19
3 files changed, 70 insertions, 4 deletions
diff --git a/boot-env/OpenSLX/BootEnvironment/Base.pm b/boot-env/OpenSLX/BootEnvironment/Base.pm
index bd8bef55..af47f859 100644
--- a/boot-env/OpenSLX/BootEnvironment/Base.pm
+++ b/boot-env/OpenSLX/BootEnvironment/Base.pm
@@ -18,6 +18,8 @@ use warnings;
our $VERSION = 1.01; # API-version . implementation-version
+use File::Path;
+
use OpenSLX::Basics;
use OpenSLX::ConfigDB;
@@ -35,12 +37,38 @@ sub initialize
my $self = shift;
my $params = shift;
- $self->{'target-path'} = $params->{'target-path'};
- $self->{'dry-run'} = $params->{'dry-run'};
+ $self->{'dry-run'} = $params->{'dry-run'};
return 1;
}
+sub finalize
+{
+ my $self = shift;
+ my $delete = shift;
+
+ return 1 if $self->{'dry-run'};
+
+ my $rsyncDeleteClause = $delete ? '--delete' : '';
+ my $rsyncCmd
+ = "rsync -a $rsyncDeleteClause --delay-updates $self->{'target-path'}/ $self->{'original-path'}/";
+ slxsystem($rsyncCmd) == 0
+ or die _tr(
+ "unable to rsync files from '%s' to '%s'! (%s)",
+ $self->{'target-path'}, $self->{'original-path'}, $!
+ );
+ rmtree([$self->{'target-path'}]);
+
+ return 1;
+}
+
+sub targetPath
+{
+ my $self = shift;
+
+ return $self->{'target-path'};
+}
+
sub writeBootloaderMenuFor
{
my $self = shift;
diff --git a/boot-env/OpenSLX/BootEnvironment/CD.pm b/boot-env/OpenSLX/BootEnvironment/PREBOOT_CD.pm
index 9328359b..62ab499f 100644
--- a/boot-env/OpenSLX/BootEnvironment/CD.pm
+++ b/boot-env/OpenSLX/BootEnvironment/PREBOOT_CD.pm
@@ -8,10 +8,10 @@
#
# General information about OpenSLX can be found at http://openslx.org/
# -----------------------------------------------------------------------------
-# BootEnvironment::CD.pm
+# BootEnvironment::PREBOOT_CD.pm
# - provides CD-specific implementation of the BootEnvironment API.
# -----------------------------------------------------------------------------
-package OpenSLX::BootEnvironment::CD;
+package OpenSLX::BootEnvironment::PREBOOT_CD;
use strict;
use warnings;
@@ -26,6 +26,25 @@ use OpenSLX::Basics;
use OpenSLX::MakeInitRamFS::Engine;
use OpenSLX::Utils;
+sub initialize
+{
+ my $self = shift;
+ my $params = shift;
+
+ return if !$self->SUPER::initialize($params);
+
+ $self->{'original-path'} = "$openslxConfig{'public-path'}/preboot-cd";
+ $self->{'target-path'} = "$openslxConfig{'public-path'}/preboot-cd.new";
+
+ if (!$self->{'dry-run'}) {
+ mkpath([$self->{'original-path'}]);
+ rmtree($self->{'target-path'});
+ mkpath("$self->{'target-path'}/client-config");
+ }
+
+ return 1;
+}
+
sub writeFilesRequiredForBooting
{
my $self = shift;
diff --git a/boot-env/OpenSLX/BootEnvironment/PXE.pm b/boot-env/OpenSLX/BootEnvironment/PXE.pm
index c362315f..25f2c77f 100644
--- a/boot-env/OpenSLX/BootEnvironment/PXE.pm
+++ b/boot-env/OpenSLX/BootEnvironment/PXE.pm
@@ -26,6 +26,25 @@ use OpenSLX::Basics;
use OpenSLX::MakeInitRamFS::Engine;
use OpenSLX::Utils;
+sub initialize
+{
+ my $self = shift;
+ my $params = shift;
+
+ return if !$self->SUPER::initialize($params);
+
+ $self->{'original-path'} = "$openslxConfig{'public-path'}/tftpboot";
+ $self->{'target-path'} = "$openslxConfig{'public-path'}/tftpboot.new";
+
+ if (!$self->{'dry-run'}) {
+ mkpath([$self->{'original-path'}]);
+ rmtree($self->{'target-path'});
+ mkpath("$self->{'target-path'}/client-config");
+ }
+
+ return 1;
+}
+
sub writeBootloaderMenuFor
{
my $self = shift;