--- /dev/null
+#!/usr/bin/perl -w
+
+# quick hack to create BackupPC pool out of increments
+
+# 2006-02-07 Dobrica Pavlinusic <dpavlin@rot13.org>
+
+use File::Find;
+use Data::Dumper;
+
+use lib "/data/backuppc/lib";
+use BackupPC::Lib;
+
+
+my $restore_path = './temp/restore.tar.gz';
+
+# connect to BackupPC_server
+
+die("BackupPC::Lib->new failed\n") if ( !(my $bpc = BackupPC::Lib->new) );
+my %Conf = $bpc->Conf();
+
+$bpc->ChildInit();
+
+my $err = $bpc->ServerConnect($Conf{ServerHost}, $Conf{ServerPort});
+if ( $err ) {
+ print("Can't connect to server ($err)\n");
+ exit(1);
+}
+
+sub increment {
+ my $path = $File::Find::name;
+
+ print "working on $path\n";
+
+ if (-e $restore_path) {
+ unlink $restore_path || die "can't remove $restore_path: $!\n";
+ }
+ link $path, $restore_path || die "can't create link $path -> $restore_path: $!\n";
+
+ $bpc->ServerMesg("log User backuppc started restore of $restore_path");
+
+ my $full = 0;
+ my $r = $bpc->ServerMesg("backup restore restore backuppc $full");
+ print "backup --> $r\n";
+
+ # Status_backup_in_progress
+ # Status_idle
+
+ my $state = 'unknown';
+
+ while ($state ne 'Status_idle') {
+ my $s = $bpc->ServerMesg("status hosts");
+ my %Status;
+ {
+ eval "$s";
+ }
+ $state = $Status{restore}->{state};
+ print "# $state\n"; #, Dumper($Status{restore});
+ sleep 1;
+ }
+}
+
+find({ wanted => \&increment, follow => 0 }, './temp');
+