summaryrefslogtreecommitdiffstats
path: root/perl-install
diff options
context:
space:
mode:
authorStew Benedict <stewb@mandriva.org>2003-07-23 00:37:52 +0000
committerStew Benedict <stewb@mandriva.org>2003-07-23 00:37:52 +0000
commit910868f725811a582c881fdae45699b1728f5979 (patch)
tree5723827444beca77d07bee85da22e223096cae74 /perl-install
parenta46b8b21bfc990332a440d4f1fe727792143dc03 (diff)
downloaddrakx-backup-do-not-use-910868f725811a582c881fdae45699b1728f5979.tar
drakx-backup-do-not-use-910868f725811a582c881fdae45699b1728f5979.tar.gz
drakx-backup-do-not-use-910868f725811a582c881fdae45699b1728f5979.tar.bz2
drakx-backup-do-not-use-910868f725811a582c881fdae45699b1728f5979.tar.xz
drakx-backup-do-not-use-910868f725811a582c881fdae45699b1728f5979.zip
Fix catalog restore for perl-Gtk2
Fix rsync behavior - broken in perl_checker fixes Fix wildcard_to_tarfile
Diffstat (limited to 'perl-install')
-rwxr-xr-xperl-install/standalone/drakbackup76
1 files changed, 45 insertions, 31 deletions
diff --git a/perl-install/standalone/drakbackup b/perl-install/standalone/drakbackup
index 9ced8f4db..ecbb662aa 100755
--- a/perl-install/standalone/drakbackup
+++ b/perl-install/standalone/drakbackup
@@ -967,7 +967,7 @@ sub rsync_client() {
my $rsync_cmd = "rsync -tv $save_path/* ";
$rsync_cmd = $rsync_cmd . "--password-file=$cfg_dir/rsync.user " if $passwd_user;
$rsync_cmd = $rsync_cmd . "$login_user\@" if $login_user;
- $rsync_cmd = $rsync_cmd . "$host_name::$host_path";
+ $rsync_cmd = $rsync_cmd . $host_name . "::" . $host_path;
spawn_progress($rsync_cmd, "Running rsync");
return 0;
}
@@ -1036,7 +1036,7 @@ sub spawn_progress {
my ($command, $descr) = @_;
my $value;
my $timer;
-
+print "$descr\n";
$interactive and progress($pbar3, $plabel3, 0, translate($descr));
$interactive and $pbar3->set_fraction(0);
$interactive and $timer = Glib::Timeout->add(2, \&progress_timeout);
@@ -2348,7 +2348,6 @@ sub advanced_where() {
}),
1, gtksignal_connect(my $button_where_tape = Gtk2::Button->new, clicked => sub {
destroy_widget();
- # message_underdevel();
advanced_where_tape() }),
1, new Gtk2::VBox(0, 5),
),
@@ -3455,48 +3454,62 @@ sub catalog_restore() {
#- catalog info in tree view
my $model = Gtk2::TreeStore->new("Glib::String");
- my $tree_catalog = Gtk2::TreeView->new_with_model($model);
- $tree_catalog->append_column(Gtk2::TreeViewColumn->new_with_attributes(undef, Gtk2::CellRendererText->new, 'text' => 0));
- $tree_catalog->set_headers_visible(0);
- $tree_catalog->get_selection->set_mode('single');
+ my $tree_catalog = Gtk2::TreeView->new_with_model($model);
+ $tree_catalog->append_column(Gtk2::TreeViewColumn->new_with_attributes(undef, Gtk2::CellRendererText->new, 'text' => 0));
+
+ $tree_catalog->set_headers_visible(0);
+ $tree_catalog->get_selection->set_mode('single');
# file details in list widget
my $lmodel = Gtk2::ListStore->new("Glib::String");
my $tree_files = Gtk2::TreeView->new_with_model($lmodel);
$tree_files->append_column(Gtk2::TreeViewColumn->new_with_attributes(undef, Gtk2::CellRendererText->new, 'text' => 0));
- $tree_files->set_headers_visible(0);
- $tree_files->get_selection->set_mode('extended');
+
+ $tree_files->set_headers_visible(0);
+ $tree_files->get_selection->set_mode('multiple');
#- read the catalog
my @catalog = cat_("$cfg_dir/drakbackup_catalog");
-
+ my %full_cat_entry;
+
foreach (@catalog) {
chop;
- my $full_cat_entry = $_;
my @line_data = split(':', $_);
my $t = $line_data[0];
-
+ $full_cat_entry{$t} = $_;
+
my $t_catalog = $model->append_set(undef, [ 0 => $t ]);
-
- $tree_catalog->get_selection->signal_connect(changed => sub {
+
+ $tree_catalog->get_selection->signal_connect(changed => sub {
+ my ($model, $iter) = $_[0]->get_selected;
+ $model && $iter or return;
+ $cat_entry = $model->get($iter, 0);
+ if ($cat_entry != $t) {
+ $cat_entry = '';
+ return;
+ }
cursor_wait();
- $cat_entry = $full_cat_entry;
@restore_files = ();
$lmodel->clear;
- foreach my $filename (glob("$save_path/list*$t.txt")) {
+ foreach my $filename (glob("$save_path/list*$cat_entry.txt")) {
my @contents = cat_($filename);
foreach (@contents) {
chop;
my $s = $_;
$lmodel->append_set(undef, $s);
-# $lmodel->signal_connect(select => sub {
-# push @restore_files, $s;
-# });
-# gtksignal_connect($f_item, select => sub { push @restore_files, $s });
-# gtksignal_connect($f_item, deselect => sub { @restore_files = () });
+ $tree_files->get_selection->signal_connect(changed => sub {
+ my (@what) = $_[0]->get_selected_rows;
+ @restore_files = ();
+ foreach (@what) {
+ my $iter = $lmodel->get_iter($_);
+ $s = $lmodel->get($iter, 0);
+ push @restore_files, $s;
+ }
+ });
}
}
cursor_norm();
+ $cat_entry = $full_cat_entry{$t};
});
my $indexer = 0;
@@ -3826,16 +3839,14 @@ sub restore_rsync_ssh_webdav {
my ($cat_entry, $hostname, $hostpath, $username, $mode, @restore_files) = @_;
my $indv_files = @restore_files;
my $command;
-
my $wild_card = catalog_to_wildcard($cat_entry);
-
if ($indv_files == 0) {
#- full catalog specified
foreach (wildcard_to_tarfile($wild_card)) {
if ($mode eq 'ssh') {
$command = "scp $username\@$hostname:$hostpath/$_ $cfg_dir/restores/";
} elsif ($mode eq 'rsync') {
- $command = "rsync --password-file=$cfg_dir/rsync.user $username\@$hostname::$hostpath/$_ $cfg_dir/restores/";
+ $command = "rsync --password-file=$cfg_dir/rsync.user $username\@$hostname" . "::" . "$hostpath/$_ $cfg_dir/restores/";
} else {
$command = "wget http://$hostname/$hostpath/$_ -P $cfg_dir/restores/";
}
@@ -3856,7 +3867,7 @@ sub restore_rsync_ssh_webdav {
if ($mode eq 'ssh') {
$command = "scp $username\@$hostname:$hostpath/$tarfile $cfg_dir/restores/";
} elsif ($mode eq 'rsync') {
- $command = "rsync --password-file=$cfg_dir/rsync.user $username\@$hostname::$hostpath/$tarfile $cfg_dir/restores/";
+ $command = "rsync --password-file=$cfg_dir/rsync.user $username\@$hostname" . "::" . "$hostpath/$tarfile $cfg_dir/restores/";
} else {
$command = "wget http://$hostname/$hostpath/$tarfile -P $cfg_dir/restores/";
}
@@ -3882,10 +3893,13 @@ sub catalog_to_wildcard {
sub wildcard_to_tarfile {
my ($wildcard) = @_;
- my $tarfile = basename(glob("$save_path/*$wildcard.txt"));
- $tarfile =~ s/txt/$tar_ext/;
- $tarfile =~ s/list/backup/;
- $tarfile;
+ my (@tarfile) = glob("$save_path/*$wildcard.txt");
+ foreach (@tarfile) {
+ $_ = basename($_);
+ s/txt/$tar_ext/;
+ s/list/backup/;
+ }
+ @tarfile;
}
sub file_to_tarfile {
@@ -4036,7 +4050,7 @@ sub restore_status() {
[$pbar3],
[""],
[""],
- [$pbar3->{label} = new Gtk2::Label(' ')],
+ [$plabel3 = new Gtk2::Label(' ')],
[""],
),
$stext,
@@ -4365,7 +4379,7 @@ sub button_box_main() {
################################################ MESSAGES ################################################
sub dialog_one {
- $table->destroy;
+ destroy_widget();
my ($label) = @_;
gtkadd($advanced_box,