Added dist_abstract and removed dependency on SHA1.

Added script simba_export.
This commit is contained in:
hjp 2013-11-13 00:20:00 +00:00
parent ff9f0d48f1
commit 6a1be23732
2 changed files with 49 additions and 1 deletions

View File

@ -6,15 +6,16 @@ use Simba::Build;
my $build = Simba::Build->new
(
module_name => 'Simba',
dist_abstract => 'Simple Integrated Multiplatform Backup and Archive',
license => 'perl',
requires => {
'Readonly' => 0,
'Digest::SHA1' => 0,
'Config::YAML' => 0,
},
script_files => [
'scripts/da',
'scripts/backup',
'scripts/simba_export',
],
);
$build->create_build_script;

47
scripts/simba_export Normal file
View File

@ -0,0 +1,47 @@
#!/usr/bin/perl
use warnings;
use strict;
use Simba::CA;
use autodie;
my $basedir = $ARGV[0];
usage() unless $basedir;
my $ca = Simba::CA->new({
dbi_file => $ENV{SIMBA_DB_CONN} || "$ENV{HOME}/.dbi/simba",
log_fh => \*STDERR,
});
my $dbh = $ca->{dbh};
my $sessions = $dbh->selectcol_arrayref("select id from sessions order by id");
for my $session_id (@$sessions) {
next if (-f "$basedir/$session_id.tsv");
$ca->log(3, "exporting session $session_id");
my $sth
= $dbh->prepare(
qq{select sessions.id as "sessions.id", start_date, end_date, prefix,
instances.id as "instances.id", file_id, date, online,
versions2.id as "versions2.id", file_type, file_size, file_mtime, file_owner, file_group, file_acl, file_unix_bits, file_rdev, checksum, file_linktarget,
files.id as "files.id", path,
filesets.id as "filesets.id", host, dir, options, pid
from sessions, instances, versions2, files, filesets
where sessions.id=$session_id
and sessions.id=instances.session
and instances.version=versions2.id
and instances.file=files.id
and files.fileset=filesets.id
});
$sth->execute;
open my $fh, '>', "$basedir/$session_id.tsv";
print $fh join("\t", @{$sth->{NAME}}), "\n";
while (my $r = $sth->fetchrow_arrayref) {
no warnings 'uninitialized';
print $fh join("\t", @$r), "\n";
}
close($fh);
}
sub usage {
print STDERR "Usage: $0 basedir\n";
exit(1);
}