summaryrefslogtreecommitdiffstats
path: root/perl-install/standalone
diff options
context:
space:
mode:
Diffstat (limited to 'perl-install/standalone')
-rwxr-xr-xperl-install/standalone/drakbackup157
1 files changed, 76 insertions, 81 deletions
diff --git a/perl-install/standalone/drakbackup b/perl-install/standalone/drakbackup
index c9cd56210..50171531d 100755
--- a/perl-install/standalone/drakbackup
+++ b/perl-install/standalone/drakbackup
@@ -44,12 +44,13 @@ my $restore_sys = 1;
my $restore_user = 1;
my $restore_other = 1;
my $restore_step_sys_date = "";
+my $restore_step_other_date = "";
my @user_backuped;
my @sys_backuped;
-my $sys_backuped = 0;
-my $other_backuped = 0;
+my @other_backuped;
my @user_list_to_restore;
my @sys_list_to_restore;
+my @other_list_to_restore;
my $button_box;
my $button_box_tmp;
my $next_widget;
@@ -80,7 +81,6 @@ my $backup_bef_restore = 0;
my $table;
my @user_list_backuped;
my @files_corrupted;
-#- ack - not a great default - changed 20020814 (SB)
my $remove_user_before_restore = 0;
my @file_list_to_send_by_ftp;
my $results;
@@ -120,7 +120,6 @@ my $net_proto = '';
my $host_path = '';
my $login_user = '';
my $daemon = 0;
-my $backend_only = 0;
my $daemon_media = '';
my $hd_quota = 0;
my $where_net = 0;
@@ -279,7 +278,6 @@ sub explain_conf() {
}
sub backend_mode() {
- $backend_only = 1;
build_backup_files();
exit(0);
}
@@ -2802,8 +2800,6 @@ sub find_backup_to_restore() {
s/_incr//gi;
push @list_backup , $_;
}
- if (any { /^backup_other/ } @list_backup) { $other_backuped = 1 }
- if (any { /^backup_sys/ } @list_backup) { $sys_backuped = 1 }
foreach (grep { /^backup_sys_/ } @list_backup) {
chomp;
s/^backup_sys_//gi;
@@ -2819,6 +2815,21 @@ sub find_backup_to_restore() {
push @sys_backuped , $to_put;
}
$restore_step_sys_date = $to_put;
+ foreach (grep { /^backup_other_/ } @list_backup) {
+ chomp;
+ s/^backup_other_//gi;
+ s/.tar.gz$//gi;
+ s/.tar.bz2$//gi;
+ my ($date, $heure) = /^(.*)_([^_]*)$/;
+ my $year = substr($date, 0, 4);
+ my $month = substr($date, 4, 2);
+ my $day = substr($date, 6, 2);
+ my $hour = substr($heure, 0, 2);
+ my $min = substr($heure, 2, 2);
+ $to_put = "$day/$month/$year $hour:$min $_";
+ push @other_backuped , $to_put;
+ }
+ $restore_step_other_date = $to_put;
foreach (grep { /^backup_user_/ } @list_backup) {
chomp;
s/^backup_user_//gi;
@@ -2892,19 +2903,21 @@ sub system_state() {
}
sub restore_state() {
- my @tmp = split(' ', $restore_step_sys_date);
$restore_state = N("List of data to restore:\n\n");
- if ($restore_sys) { $restore_state .= "- Restore System Files.\n";
- $restore_state .= " - from date: $tmp[0] $tmp[1]\n";
+ if ($restore_sys) {
+ $restore_state .= N("- Restore System Files.\n");
+ my @tmp = split(' ', $restore_step_sys_date);
+ $restore_state .= N(" - from date: %s %s\n", $tmp[0], $tmp[1]);
}
if ($restore_user) {
- $restore_state .= "- Restore User Files: \n";
+ $restore_state .= N("- Restore User Files: \n");
$restore_state .= "\t\t$_\n" foreach @user_list_to_restore2;
push @user_list_to_restore, (split(',', $_))[0] foreach @user_list_to_restore2;
}
if ($restore_other) {
- $restore_state .= "- Restore Other Files: \n";
- -f "$path_to_find_restore/list_other" and $restore_state .= "\t\t$_\n" foreach split("\n", cat_("$path_to_find_restore/list_other"));
+ $restore_state .= N("- Restore Other Files: \n");
+ my @tmp = split(' ', $restore_step_other_date);
+ $restore_state .= N(" - from date: %s %s\n", $tmp[0], $tmp[1]);
}
if ($restore_other_path) {
$restore_state .= "- Path to Restore: $restore_path \n";
@@ -2988,6 +3001,26 @@ sub select_sys_data_to_restore() {
$DEBUG and print "sys list to restore: $_\n " foreach @sys_list_to_restore;
}
+sub select_other_data_to_restore() {
+ my $var_eq = 1;
+ my @list_tmp;
+ local $_;
+ @other_list_to_restore = ();
+
+ -d $path_to_find_restore and @list_tmp = grep { /^backup/ } all($path_to_find_restore);
+ my @more_recent = split(' ', $restore_step_other_date);
+ my $more_recent = pop @more_recent;
+ foreach my $var_exist (grep { /_other_/ } sort @list_tmp) {
+ if ($var_exist =~ /$more_recent/) {
+ push @other_list_to_restore, $var_exist;
+ $var_eq = 0;
+ } else {
+ $var_eq and push @other_list_to_restore, $var_exist;
+ }
+ }
+ $DEBUG and print "other list to restore: $_\n " foreach @other_list_to_restore;
+}
+
sub show_backup_details {
my ($function, $mode, $name) = @_;
my $archive_file_detail;
@@ -3122,9 +3155,7 @@ sub restore_backend() {
my $untar_cmd;
my $exist_problem = 0;
my $user_dir;
- my $tnom;
my $username;
- my $theure2;
local $_;
-d $restore_path or mkdir_p $restore_path;
@@ -3142,9 +3173,9 @@ sub restore_backend() {
} else {
foreach (@user_list_to_restore) {
if ($backup_user_versions) {
- ($tnom, $username, $theure2) = /^(\w+_\w+_user_)(.*)_(\d+_\d+.*)$/;
+ (undef, $username, undef) = /^(\w+_\w+_user_)(.*)_(\d+_\d+.*)$/;
} else {
- ($tnom, $username, $theure2) = /^(\w+_user_)(.*)_(\d+_\d+.*)$/;
+ (undef, $username, undef) = /^(\w+_user_)(.*)_(\d+_\d+.*)$/;
}
$user_dir = return_path($username);
@@ -3160,20 +3191,21 @@ sub restore_backend() {
}
if ($restore_sys) {
- if ($backup_sys_versions) {
- select_sys_data_to_restore();
- if (valid_backup_test(@sys_list_to_restore) == -1) {
- $exist_problem = 1;
- restore_aff_backup_problems();
- } else {
- system("$untar_cmd $path_to_find_restore/$_ -C $restore_path") foreach @sys_list_to_restore;
- }
- } else {
- system("$untar_cmd $path_to_find_restore/backup_sys.tar.gz -C $restore_path ");
- }
+ select_sys_data_to_restore();
+ if (valid_backup_test(@sys_list_to_restore) == -1) {
+ $exist_problem = 1;
+ restore_aff_backup_problems();
+ } else {
+ system("$untar_cmd $path_to_find_restore/$_ -C $restore_path") foreach @sys_list_to_restore;
+ }
}
- if ($restore_other) {
- system("$untar_cmd $path_to_find_restore/backup_other.tar.gz -C $restore_path ");
+ if ($restore_other) {
+ if (valid_backup_test(@other_list_to_restore) == -1) {
+ $exist_problem = 1;
+ restore_aff_backup_problems();
+ } else {
+ system("$untar_cmd $path_to_find_restore/$_ -C $restore_path") foreach @other_list_to_restore;
+ }
}
$exist_problem or restore_aff_result();
}
@@ -3220,7 +3252,17 @@ sub restore_do2() {
sub restore_step_other() {
my $retore_step_other;
my $text = new Gtk2::TextView;
- my $other_rest = cat_("$path_to_find_restore/list_other");
+ my $untar_cmd = "tar tzf";
+ my $other_rest = "";
+ select_other_data_to_restore();
+ if ($restore_other) {
+ foreach (@other_list_to_restore) {
+ if (/tar.bz2$/) {
+ $untar_cmd = "tar tjf";
+ }
+ $other_rest .= "/" . `$untar_cmd $path_to_find_restore/$_ -C $restore_path`;
+ }
+ }
gtktext_insert($text, [ [ $other_rest ] ]);
gtkpack($advanced_box,
$retore_step_other = gtkpack_(new Gtk2::VBox(0,10),
@@ -3345,52 +3387,6 @@ sub restore_step_sys() {
$up_box->show_all;
}
-sub restore_other_media_hd {
- my ($previous_function) = @_;
- my $box_where_hd;
- my $button;
- my $adj = new Gtk2::Adjustment(550.0, 10.0, 10000.0, 10.0, 5.0, 0.0);
- my $spinner;
-
- gtkpack($advanced_box,
- $box_where_hd = gtkpack_(new Gtk2::VBox(0, 6),
- 0, new Gtk2::HSeparator,
- 0, my $check_where_hd = new Gtk2::CheckButton(N("Use Hard Disk to backup")),
- 0, new Gtk2::HSeparator,
- 0, gtkpack_(new Gtk2::HBox(0,10),
- 0, gtkset_sensitive(new Gtk2::Label(N("Enter the directory to save:")), $where_hd),
- 1, new Gtk2::VBox(0, 6),
- 0, gtkset_size_request(gtkset_sensitive($save_path_entry = new Gtk2::Entry(), $where_hd), 152, 20),
- 0, gtkset_sensitive($button = gtksignal_connect(Gtk2::Button->new, clicked => sub {
- filedialog_where_hd() }), $where_hd),
- ),
- 0, new Gtk2::VBox(0, 6),
- 0, gtkpack_(new Gtk2::HBox(0,10),
- 0, gtkset_sensitive(new Gtk2::Label(N("Enter the maximum size\n allowed for Drakbackup (MB)")), $where_hd),
- 1, new Gtk2::VBox(0, 6),
- 0, gtkset_size_request(gtkset_sensitive($spinner = new Gtk2::SpinButton($adj, 0, 0), $where_hd), 200, 20),
- ),
- 0, gtkpack_(new Gtk2::HBox(0,10),
- 1, new Gtk2::VBox(0, 6),
- 0, gtkset_sensitive(my $check_where_hd_quota = new Gtk2::CheckButton(N("Use quota for backup files.")), $where_hd),
- 0, new Gtk2::VBox(0, 6),
- ),
- ),
- );
- check_list([$check_where_hd_quota, \$hd_quota]);
- gtksignal_connect(gtkset_active($check_where_hd, $where_hd), toggled => sub {
- $where_hd = $where_hd ? 0 : 1;
- destroy_widget();
- $current_widget->();
- });
- $button->add(gtkpack(new Gtk2::HBox(0,10), gtkcreate_img("ic82-dossier-32")));
- $save_path_entry->set_text($save_path);
- $save_path_entry->signal_connect('changed', sub { $save_path = $save_path_entry->get_text });
- if ($previous_function) { fonction_env(\$box_where_hd, \&advanced_where_hd, \&$previous_function) }
- else { fonction_env(\$box_where_hd, \&advanced_where_hd, \&advanced_where) }
- $up_box->show_all;
-}
-
sub restore_other_media() {
my $box_find_restore;
my $button;
@@ -3435,7 +3431,7 @@ sub restore_step2() {
my $info_prefix = "backup";
$info_prefix = "list" if $where_net || $where_tape;
- if (-f "$restore_info_path/$info_prefix" . "_other*") {
+ if (any { /_other_/ } grep { /^$info_prefix/ } all("$restore_info_path/")) {
$other_exist = 1;
} else {
$other_exist = 0; $restore_other = 0;
@@ -4086,7 +4082,7 @@ sub restore_box() {
find_backup_to_restore();
button_box_restore_main();
- if ($other_backuped || $sys_backuped || @user_backuped) {
+ if (@other_backuped || @sys_backuped || @user_backuped) {
gtkpack($advanced_box,
$retore_box = gtkpack_(new Gtk2::HBox(0,1),
1, new Gtk2::VBox(0,10),
@@ -4782,7 +4778,6 @@ sub interactive_mode() {
$in = 'interactive'->vnew;
- my $box;
my $winht = 440;
$winht = 320 if $::isEmbedded;
my $winwidth = 540;
@@ -4817,7 +4812,7 @@ sub interactive_mode() {
gtkadd($window1,
gtkpack(new Gtk2::VBox(0,0),
gtkpack(gtkset_size_request($up_box = new Gtk2::VBox(0, 5), $winwidth, $winht),
- $box = gtkpack_(new Gtk2::VBox(0, 3),
+ gtkpack_(new Gtk2::VBox(0, 3),
if_(!$::isEmbedded, 0, $darea),
1, gtkpack_(new Gtk2::HBox(0, 3),
1, gtkpack_(new Gtk2::HBox(0, 15),