* Tue Feb 25 2025 Brian Read <brianr@koozali.org> 11.0.0-58.sme

- re-organise open db placement [SME: 12695]
- Re-arrange parameters to tar to avoid warning message in logs [SME: 12943]
This commit is contained in:
Brian Read 2025-02-26 11:57:22 +00:00
parent ce96f72726
commit 1c93be6e8a
3 changed files with 44 additions and 26 deletions

View File

@ -135,7 +135,11 @@ sub do_display {
$c->stash(compressionlevel => $CompressionLevel, exclude => \@exclude, directories => \@directories);
# streaming download in template
return $c->render("/backdown");
$c->render(template=>"backdown");
#sleep(30);
# Redirect to the front page
#$c->redirect_to('/backup');
return ""
} ## end if ($function eq 'desktop_backup')
if ($function eq 'tape_configure') {

View File

@ -19,29 +19,38 @@
my $cmd = "/bin/tar --create --file=- --directory / @{$c->stash('exclude')} "
. "@{$c->stash('directories')} | /usr/bin/gzip $clvl ";
#die("$cmd");
my $success = open my $fh, '-|', $cmd;
unless ($success) { return "Error dowload command."; };
# Write chunk
$c->res->headers->content_type('application/x-tar');
$c->res->headers->content_disposition(qq/attachment; filename="smeserver.tgz"/);
my $cb;
$cb = sub {
my $c = shift;
my $size = 500 * 1024;
my $length = sysread($fh, my $buffer, $size);
unless ($length) {
close $fh;
undef $cb;
$c->finish;
return;
}
$c->write_chunk($buffer, $cb);
};
$c->$cb;
#unless ($success) { return "Error download command."; };
if ($success) {
# Try with download plugin - seems to fail to complete download and also
# name of file deposited is not as required.
#my $output = do { local $/; <$fh> };
#close $fh;
#$c->render_file(
#data => $output,
#filename => 'output.txt',
#content_type => 'text/plain'
#);
# So organise it ourselves.
$c->res->headers->content_type('application/x-tar');
$c->res->headers->content_disposition(qq/attachment; filename="smeserver.tgz"/);
my $cb;
$cb = sub {
my $c = shift;
my $size = 500 * 1024;
my $length = sysread($fh, my $buffer, $size);
unless ($length) {
close $fh;
undef $cb;
$c->finish;
return;
}
$c->write_chunk($buffer, $cb);
};
$c->$cb;
} else {
$c->render(text => "Failed to execute command: $!", status => 500);
}
# Remove the dumped tables.
$status = system("/sbin/e-smith/signal-event", "post-backup", "desktop");
@ -55,3 +64,4 @@
$backup_rec->set_prop('Result', "0");
%>
1;

View File

@ -2,7 +2,7 @@ Summary: Sme server navigation module : manager 2
%define name smeserver-manager
Name: %{name}
%define version 11.0.0
%define release 57
%define release 58
Version: %{version}
Release: %{release}%{?dist}
License: GPL
@ -143,6 +143,10 @@ true
%defattr(-,root,root)
%changelog
* Tue Feb 25 2025 Brian Read <brianr@koozali.org> 11.0.0-58.sme
- re-organise open db placement [SME: 12695]
- Re-arrange parameters to tar to avoid warning message in logs [SME: 12943]
* Fri Feb 21 2025 Jean-Philippe Pialasse <jpp@koozali.org> 11.0.0-57.sme
- upgrade validate_password sub to use esmith::util [SME: 12937]
and deduplicate code