fix lib path
[BackupPC.git] / bin / BackupPC_updatedb
index e72ba3d..9315026 100755 (executable)
@@ -1,8 +1,7 @@
 #!/usr/bin/perl
 
 use strict;
-#use lib "/data/backuppc/lib";
-use lib "/usr/share/backuppc/lib";
+use lib "/usr/local/BackupPC/lib";
 
 use DBI;
 use BackupPC::Lib;
@@ -352,6 +351,28 @@ if ($opt{c}) {
                        date timestamp default now(),
                        primary key(id)
                );
+
+               -- report backups and corresponding dvd
+
+               create view backups_on_dvds as
+               select
+                       backups.id as id,
+                       hosts.name || ':' || shares.name as share,
+                       backups.num as num,
+                       backups.type as type,
+                       abstime(backups.date) as backup_date,
+                       backups.size as size,
+                       backups.inc_size as gzip_size,
+                       archive.id as archive_id,
+                       archive.dvd_nr
+               from backups
+               join shares on backups.shareid=shares.id
+               join hosts on shares.hostid = hosts.id
+               left outer join archive_backup on backups.id = archive_backup.backup_id
+               left outer join archive on archive_backup.archive_id = archive.id
+               where backups.parts > 0 and size > 0
+               order by backups.date
+               ;
        });
 
        print "creating indexes: ";
@@ -552,7 +573,8 @@ warn "XXXX ",dump(@backups);
                );
                print $share_header unless ($opt{q});
 
-               my $files = BackupPC::View->new($bpc, $hostname, \@backups, 1);
+               my $files = BackupPC::View->new($bpc, $hostname, \@backups, { only_first => 1 });
+
                foreach my $share ($files->shareList($backupNum)) {
 
                        my $t = time();