summaryrefslogtreecommitdiffstats
path: root/boot-env/OpenSLX/BootEnvironment/Base.pm
diff options
context:
space:
mode:
Diffstat (limited to 'boot-env/OpenSLX/BootEnvironment/Base.pm')
-rw-r--r--boot-env/OpenSLX/BootEnvironment/Base.pm32
1 files changed, 30 insertions, 2 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;