summaryrefslogtreecommitdiffstats
path: root/perl-install/standalone/drakbackup
diff options
context:
space:
mode:
Diffstat (limited to 'perl-install/standalone/drakbackup')
-rwxr-xr-xperl-install/standalone/drakbackup287
1 files changed, 160 insertions, 127 deletions
diff --git a/perl-install/standalone/drakbackup b/perl-install/standalone/drakbackup
index d97a74262..cdafa7e00 100755
--- a/perl-install/standalone/drakbackup
+++ b/perl-install/standalone/drakbackup
@@ -92,7 +92,7 @@ my @list_other;
my $mdk_cc = 0;
my $DEBUG = 0;
-my $backup_sys = 1;
+my $backup_sys;# = 1;
@@ -128,7 +128,7 @@ sub debug {
}
# initial functions
-read_conf_file();
+#read_conf_file();
sub read_passwd {
@user_and_path_list = map { (split(':', $_))[0] . ":" . (split(':', $_))[5] } grep {( split(':', $_))[2] > 500} split ('\n', cat_('/etc/passwd'));
@@ -147,7 +147,7 @@ sub save_conf_file {
"PATH_TO_SAVE=$save_path\n",
);
$option_replace and push @cfg_list, "OPTION_REPLACE\n" ;
- if ($backup_sys == 0) { push @cfg_list, "NO_SYS_FILES\n";}
+ $backup_sys or push @cfg_list, "NO_SYS_FILES\n";
if ($comp_mode) {
push @cfg_list, "OPTION_COMP=TAR.BZ2\n";
} else {
@@ -160,7 +160,8 @@ sub save_conf_file {
sub read_conf_file {
read_passwd();
if (-e $cfg_file) {
- while (cat_ ('$cfg_file')) {
+ open ( CONF_FILE, "<"."$cfg_file") || die;
+ while (<CONF_FILE>) {
next unless /\S/;
next if /^#/;
chomp;
@@ -169,16 +170,45 @@ sub read_conf_file {
if (/^OTHER_FILES/) { s/^OTHER_FILES=//gi; @other_files = split(' ', $_ ); }
if (/^PATH_TO_SAVE/) { s/^PATH_TO_SAVE=//gi; $save_path = $_; }
if (/^OPTION_REPLACE/) { $option_replace = 1; }
- if (/^NO_SYS_FILES/) { $backup_sys = 0; }
+ if (/^NO_SYS_FILES/) { $backup_sys = 0;}
if (/^OPTION_COMP/) { s/^OPTION_COMP=//gi; /TAR.GZ/ and $comp_mode = 0; /TAR.BZ2/ and $comp_mode = 1; }
+ unless (/^NO_SYS_FILES/) { $backup_sys = 1;}
}
$cfg_file_exist = 1;
} else {
$cfg_file_exist = 0;
- }
-# $DEBUG and debug;
+ print "no exist\n";
+ }
+ close CONF_FILE;
+ $DEBUG and debug;
}
+# sub read_conf_file {
+# read_passwd();
+# if (-e $cfg_file) {
+# while (cat_ ('$cfg_file')) {
+# next unless /\S/;
+# next if /^#/;
+# chomp;
+# if (/^SYS_FILES/) { s/^SYS_FILES=//gi; @sys_files = split(' ', $_ ); }
+# if (/^HOME_FILES/) { s/^HOME_FILES=//gi; @home_files = split(' ', $_ ); }
+# if (/^OTHER_FILES/) { s/^OTHER_FILES=//gi; @other_files = split(' ', $_ ); }
+# if (/^PATH_TO_SAVE/) { s/^PATH_TO_SAVE=//gi; $save_path = $_; }
+# if (/^OPTION_REPLACE/) { $option_replace = 1; }
+# if (/^NO_SYS_FILES/) { $backup_sys = 0; print "I see NO_SYS_FILES\n"; }
+# if (/^OPTION_COMP/) { s/^OPTION_COMP=//gi; /TAR.GZ/ and $comp_mode = 0; /TAR.BZ2/ and $comp_mode = 1; }
+# unless (/^NO_SYS_FILES/) { $backup_sys = 1; print "I NO see NO_SYS_FILES\n"; }
+# }
+# $cfg_file_exist = 1;
+# } else {
+# $cfg_file_exist = 0;
+# print "no exist\n";
+# }
+# # $DEBUG and debug;
+# }
+
+
+
if ($mdk_cc) { $build_floppy || $build_cd || $default || @list_arg || $conf_file ? backend_mod() : interactive_mode();
} else { $build_floppy || $build_cd || $default || @list_arg || $conf_file ? backend_mod() : interactive_mode_my(); }
@@ -269,98 +299,6 @@ sub interactive_mode {
}
-sub about {
- my $text = new Gtk::Text(undef, undef);
- my $about_box;
- gtkpack($up_box,
- $about_box = gtkpack_(new Gtk::VBox(0,10),
- 1, gtkpack_(new Gtk::HBox(0,0),
- 1, gtktext_insert(gtkset_editable($text, 1), _("
- Copyright (C) 2001 by MandrakeSoft (sdupont\@mandrakesoft.com)
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-")),
- 0, new Gtk::VScrollbar($text->vadj),
- ),
- 0, gtkadd(gtkset_layout(new Gtk::HButtonBox, -spread),
- gtksignal_connect(new Gtk::Button(_("OK")), clicked =>
- sub { ${$central_widget}->destroy();
- $mdk_cc and interactive_mode();
- $mdk_cc or interactive_mode_my();
- }),
- ),
- )
- );
- $central_widget = \$about_box;
- $up_box->show_all();
-}
-
-
-sub adv_help {
- my $text = new Gtk::Text(undef, undef);
- my $about_box;
- gtkpack($up_box,
- $about_box = gtkpack_(new Gtk::VBox(0,10),
- 1, gtkpack_(new Gtk::HBox(0,0),
- 1, gtktext_insert(gtkset_editable($text, 1), _("
-description:
-
- Drakbacup is use to backup system files and user files
- Drakbacup allow to restore the system (etc, var files)
- from starup or on drakconf utility.
-
-backup name format: all the time from the / dir.
-
- system backup:
- backup_sys_12102001.tar.gz
- backup_sys_etc_var_proc_12102001.tar.gz
- user backup
- backup_user_james_12102001.tar.gz
- backup_user_james_documents_12102001.tar.gz
- other directories
- backup_other_proc_12102001.tar.gz
-
-backup name rules: system: begin by sys
- user: begin by user
- other: begin by other
- end of all `date`.tar.gz
-
-
-save only the differences...
-find / -mtime -1 \! -type d -print > /tmp/liste.jour
-
-build iso fs with rescue.
-
-configuration file:
-
- /etc/drakconf/drakbackup/drakbakup.conf
-
-
-")),
- 0, new Gtk::VScrollbar($text->vadj),
- ),
- 0, gtkadd(gtkset_layout(new Gtk::HButtonBox, -spread),
- gtksignal_connect(new Gtk::Button(_("OK")), clicked =>
- sub { ${$central_widget}->destroy(); advanced(); }),
- ),
- )
- );
- $central_widget = \$about_box;
- $up_box->show_all();
-}
sub list_remove {
my($widget, $list) = @_;
@@ -453,10 +391,12 @@ sub advanced {
my $book_closed;
my $book_closed_mask;
my $box_tmp;
-
$list_other = new Gtk::List();
$list_other->set_selection_mode(-extended);
+ read_conf_file();
+
+
my ($pix_net_map, $pix_net_mask) = gtkcreate_png("../pixmaps/backup_net.png");
my ($pix_hd_map, $pix_hd_mask) = gtkcreate_png("../pixmaps/backup_hd.png");
my ($pix_time_map, $pix_time_mask) = gtkcreate_png("../pixmaps/backup_time.png");
@@ -515,7 +455,7 @@ sub advanced {
my $box_what_sys = gtkpack_(new Gtk::VBox(0,1),
1, _("\nPlease check all options that you need.\n"),
#gtkset_active
- 0, gtksignal_connect(gtkset_active(new Gtk::CheckButton( _(" Backup your System files. (~ 10Mo)")), $backup_sys) , clicked => sub { $backup_sys = $backup_sys ? 0 : 1; print "backup sys : $backup_sys\n"; }),
+ 0, gtksignal_connect(gtkset_active(new Gtk::CheckButton( _(" Backup your System files. (~ 10Mo)")), 0) , clicked => sub { print "on affiche le check valeur :$backup_sys \n"; $backup_sys = $backup_sys ? 0 : 1; print "backup sys value__ : $backup_sys\n"; }),
0, gtkset_active(new Gtk::CheckButton( _(" Need to restore any versions (CVS)") ), 1),
1, _("With this option you will be able to restore any version\n of your /etc directory like in CVS this solution seems to be\n more interesting because it allow you to restore at any\n moment any vercions of your /etc"),
);
@@ -541,36 +481,31 @@ sub advanced {
gtksignal_connect(new Gtk::Button(_("Remove Selected")), clicked => \&list_remove, $list_other),
),
);
-
+
my $box_where_mdkonline = gtkpack_(new Gtk::VBox(0,1),
1, _("\nPlease check all options that you need.\n"),
0, new Gtk::CheckButton( _(" Backup your System files. (~ 10Mo)") ),
0, new Gtk::CheckButton( _(" Need to restore any versions (CVS)") ),
- 1, _("With this option you will be able to restore any version\n of your /etc directory like in CVS this solution seems to be\n more interesting because it allow you to restore at any\n moment any vercions of your /etc"),
);
-
-
my $box_where_hd = gtkpack_(new Gtk::VBox(0,1),
- 1, _("\nPlease check all options that you need.\n"),
- 0, new Gtk::CheckButton( _(" Backup your System files. (~ 10Mo)") ),
- 0, new Gtk::CheckButton( _(" Need to restore any versions (CVS)") ),
- 1, _("With this option you will be able to restore any version\n of your /etc directory like in CVS this solution seems to be\n more interesting because it allow you to restore at any\n moment any vercions of your /etc"),
- );
-
+ 1, _("\nPlease check all options that you need.\n"),
+ 0, new Gtk::CheckButton( _(" Backup your System files. (~ 10Mo)") ),
+ 0, new Gtk::CheckButton( _(" Need to restore any versions (CVS)") ),
+ );
+
my $box_where_cd = gtkpack_(new Gtk::VBox(0,1),
- 1, _("\nPlease check all options that you need.\n"),
- 0, new Gtk::CheckButton( _(" Backup your System files. (~ 10Mo)") ),
- 0, new Gtk::CheckButton( _(" Need to restore any versions (CVS)") ),
- 1, _("With this option you will be able to restore any version\n of your /etc directory like in CVS this solution seems to be\n more interesting because it allow you to restore at any\n moment any vercions of your /etc"),
- );
+ 1, _("\nPlease check all options that you need.\n"),
+ 0, new Gtk::CheckButton( _(" Backup your System files. (~ 10Mo)") ),
+ 0, new Gtk::CheckButton( _(" Need to restore any versions (CVS)") ),
+ );
my $box_what = gtkpack(new Gtk::VBox(0,1),
$notebook_what = new Gtk::Notebook,
$notebook_what->insert_page( $box_what_sys, $label_what_sys, 0),
$notebook_what->insert_page( $box_what_user, $label_what_user, 1),
$notebook_what->insert_page( $box_what_other, $label_what_other, 2),
- $notebook_what->set_scrollable( 1),
+ $notebook_what->set_scrollable(1),
);
my $box_where = gtkpack(new Gtk::VBox(0,1),
@@ -602,14 +537,15 @@ sub advanced {
),
0, gtkadd(new Gtk::HButtonBox,
gtksignal_connect(new Gtk::Button(_("Close")), clicked =>
- sub { ${$central_widget}->destroy();
+ sub { save_conf_file();
+ ${$central_widget}->destroy();
$mdk_cc and interactive_mode();
$mdk_cc or interactive_mode_my();
}),
gtksignal_connect(new Gtk::Button(_("Help")), clicked =>
sub { save_conf_file(); ${$central_widget}->destroy(); adv_help() }),
gtksignal_connect(new Gtk::Button(_("Ok")), clicked => sub {
- ${$central_widget}->destroy(); after_adv(); }),
+ save_conf_file(); ${$central_widget}->destroy(); after_adv(); }),
),
),
),
@@ -634,6 +570,7 @@ sub interactive_mode_my {
my $style;
my $box;
init Gtk;
+ my $box_cgf_state_sys = ("");
my $text2 = new Gtk::Text(undef, undef);
my $window1 = $::isEmbedded ? new Gtk::Plug ($::XID) : new Gtk::Window -toplevel;
$window1->signal_connect (delete_event => sub { Gtk->exit(0) });
@@ -645,6 +582,8 @@ sub interactive_mode_my {
my ($pix_r_map, $pix_r_mask) = gtkcreate_png("../pixmaps/backup_bot.png");
read_conf_file();
+ $backup_sys or $box_cgf_state_sys = _("Do not include System Files");
+
if ($option_replace) { $box_cgf_state_replace = _("Replace backups (do not update)"),
} else { $box_cgf_state_replace = _("Update backups (do not replace)"), }
@@ -652,7 +591,7 @@ sub interactive_mode_my {
} else { $box_cgf_state_comp = _("Backups use tar and gunzip"), }
if ($cfg_file_exist) {
- my $label_cfg_file = new Gtk::Label _("Backup Sources: \n-System Files: @sys_files \n-Users Files: @home_files\n-Other Files to backup: @other_files\nPath to save backups: $save_path\nOptions:\n$box_cgf_state_replace\n$box_cgf_state_comp\n\n");
+ my $label_cfg_file = new Gtk::Label _("Backup Sources: \n-System Files: @sys_files \n-Users Files: @home_files\n-Other Files to backup: @other_files\nPath to save backups: $save_path\nOptions:\n$box_cgf_state_replace\n$box_cgf_state_comp\n$box_cgf_state_sys\n");
$box_cfg_state = gtkpack(new Gtk::VBox( 0, 0),
gtkset_justify( $label_cfg_file , 'left'),
),
@@ -675,9 +614,9 @@ sub interactive_mode_my {
0, new Gtk::Pixmap($pix_r_map, $pix_r_mask),
1, gtkpack_(new Gtk::VBox(0, 1),
1, gtksignal_connect(new Gtk::Button(_(" Build Backup ")),
- clicked => sub { save_conf_file(); Gtk->main_quit() }),
+ clicked => sub { Gtk->main_quit() }),
1, gtksignal_connect(new Gtk::Button(_(" Restore ")),
- clicked => sub { save_conf_file(); Gtk->main_quit() }),
+ clicked => sub { Gtk->main_quit() }),
),
),
0, new Gtk::HSeparator,
@@ -688,7 +627,7 @@ sub interactive_mode_my {
1, gtksignal_connect(new Gtk::Button(_("Wizard Conf.")), clicked =>
sub { ${$central_widget}->destroy(); wizard() }),
1, gtksignal_connect(new Gtk::Button(_("close")), clicked =>
- sub { save_conf_file(); Gtk->main_quit() }),
+ sub { Gtk->main_quit() }),
),
),
),
@@ -710,6 +649,7 @@ sub after_adv {
my $box_cgf_state_comp;
my $mask;
my $style;
+ my $box_cgf_state_sys;
my $box;
init Gtk;
my $text2 = new Gtk::Text(undef, undef);
@@ -723,6 +663,7 @@ sub after_adv {
my ($pix_r_map, $pix_r_mask) = gtkcreate_png("../pixmaps/backup_bot.png");
read_conf_file();
+ $backup_sys or $box_cgf_state_sys = _("Do not include System Files");
if ($option_replace) { $box_cgf_state_replace = _("Replace backups (do not update)"),
} else { $box_cgf_state_replace = _("Update backups (do not replace)"), }
@@ -730,7 +671,7 @@ sub after_adv {
} else { $box_cgf_state_comp = _("Backups use tar and gunzip"), }
if ($cfg_file_exist) {
- my $label_cfg_file = new Gtk::Label _("Backup Sources: \n-System Files: @sys_files \n-Users Files: @home_files\n-Other Files to backup: @other_files\nPath to save backups: $save_path\nOptions:\n$box_cgf_state_replace\n$box_cgf_state_comp\n\n");
+ my $label_cfg_file = new Gtk::Label _("Backup Sources: \n-System Files: @sys_files \n-Users Files: @home_files\n-Other Files to backup: @other_files\nPath to save backups: $save_path\nOptions:\n$box_cgf_state_replace\n$box_cgf_state_comp\n$box_cgf_state_sys\n");
$box_cfg_state = gtkpack(new Gtk::VBox( 0, 0),
gtkset_justify( $label_cfg_file , 'left'),
),
@@ -753,9 +694,9 @@ sub after_adv {
0, new Gtk::Pixmap($pix_r_map, $pix_r_mask),
1, gtkpack_(new Gtk::VBox(0, 1),
1, gtksignal_connect(new Gtk::Button(_(" Build Backup ")),
- clicked => sub { save_conf_file(); Gtk->main_quit() }),
+ clicked => sub { Gtk->main_quit() }),
1, gtksignal_connect(new Gtk::Button(_(" Restore ")),
- clicked => sub { save_conf_file(); Gtk->main_quit() }),
+ clicked => sub { Gtk->main_quit() }),
),
),
0, new Gtk::HSeparator,
@@ -766,7 +707,7 @@ sub after_adv {
1, gtksignal_connect(new Gtk::Button(_("Wizard Conf.")), clicked =>
sub { ${$central_widget}->destroy(); wizard() }),
1, gtksignal_connect(new Gtk::Button(_("close")), clicked =>
- sub { save_conf_file(); Gtk->main_quit() }),
+ sub { Gtk->main_quit() }),
),
),
),
@@ -781,6 +722,98 @@ sub after_adv {
}
+sub about {
+ my $text = new Gtk::Text(undef, undef);
+ my $about_box;
+ gtkpack($up_box,
+ $about_box = gtkpack_(new Gtk::VBox(0,10),
+ 1, gtkpack_(new Gtk::HBox(0,0),
+ 1, gtktext_insert(gtkset_editable($text, 1), _("
+ Copyright (C) 2001 by MandrakeSoft (sdupont\@mandrakesoft.com)
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2, or (at your option)
+ any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+")),
+ 0, new Gtk::VScrollbar($text->vadj),
+ ),
+ 0, gtkadd(gtkset_layout(new Gtk::HButtonBox, -spread),
+ gtksignal_connect(new Gtk::Button(_("OK")), clicked =>
+ sub { ${$central_widget}->destroy();
+ $mdk_cc and interactive_mode();
+ $mdk_cc or interactive_mode_my();
+ }),
+ ),
+ )
+ );
+ $central_widget = \$about_box;
+ $up_box->show_all();
+}
+
+
+sub adv_help {
+ my $text = new Gtk::Text(undef, undef);
+ my $about_box;
+ gtkpack($up_box,
+ $about_box = gtkpack_(new Gtk::VBox(0,10),
+ 1, gtkpack_(new Gtk::HBox(0,0),
+ 1, gtktext_insert(gtkset_editable($text, 1), _("
+description:
+
+ Drakbacup is use to backup system files and user files
+ Drakbacup allow to restore the system (etc, var files)
+ from starup or on drakconf utility.
+
+backup name format: all the time from the / dir.
+
+ system backup:
+ backup_sys_12102001.tar.gz
+ backup_sys_etc_var_proc_12102001.tar.gz
+ user backup
+ backup_user_james_12102001.tar.gz
+ backup_user_james_documents_12102001.tar.gz
+ other directories
+ backup_other_proc_12102001.tar.gz
+
+backup name rules: system: begin by sys
+ user: begin by user
+ other: begin by other
+ end of all `date`.tar.gz
+
+
+save only the differences...
+find / -mtime -1 \! -type d -print > /tmp/liste.jour
+
+build iso fs with rescue.
+
+configuration file:
+
+ /etc/drakconf/drakbackup/drakbakup.conf
+
+
+")),
+ 0, new Gtk::VScrollbar($text->vadj),
+ ),
+ 0, gtkadd(gtkset_layout(new Gtk::HButtonBox, -spread),
+ gtksignal_connect(new Gtk::Button(_("OK")), clicked =>
+ sub { ${$central_widget}->destroy(); advanced(); }),
+ ),
+ )
+ );
+ $central_widget = \$about_box;
+ $up_box->show_all();
+}