summaryrefslogtreecommitdiffstats
path: root/perl-install
diff options
context:
space:
mode:
Diffstat (limited to 'perl-install')
-rwxr-xr-xperl-install/standalone/drakbackup286
1 files changed, 207 insertions, 79 deletions
diff --git a/perl-install/standalone/drakbackup b/perl-install/standalone/drakbackup
index 66f256827..2b24043f6 100755
--- a/perl-install/standalone/drakbackup
+++ b/perl-install/standalone/drakbackup
@@ -25,10 +25,9 @@
# between all the backup
#
# save only the differences...
-# find / -mtime -1 \! -type d -print > /tmp/liste.jour
#
+# find / -mtime -1 \! -type d -print > /tmp/liste.jour
# build iso fs with rescue.
-#
# configuration file on /etc/drakconf/drakbackup/drakbakup.conf
# perl -ne 'split(":");print "$_[0]:*:$_[2]:$_[3]:::\n";' /etc/passwd > passwd
@@ -72,6 +71,7 @@ my $interactive;
my $up_box;
my $box;
my $backup_choice = 0;
+my $cfg_file_exist = 0;
# config. FILES -> PATH & Global variables.
my @sys_files = ("/etc");
@@ -113,9 +113,9 @@ sub save_conf_file {
# perl -ne 'split(":");print "$_[0]:*:$_[2]:$_[3]:::\n";' /etc/passwd > passwd
# gawk -F":" '{ if ($3 >= 500 ) print "login " $1 " uid = " $3 " rép perso : " $6}' /etc/passwdgawk -F":" '{ if ($3 >= 500 ) print "login " $1 " uid = " $3 " rép perso : " $6}' /etc/passwd
my @cfg_list = ( "SYS_FILES=@sys_files\n",
- "HOME_FILES=@home_files\n",
- "OTHER_FILES=@other_files\n",
- "PATH_TO_SAVE=$save_path\n",
+ "HOME_FILES=@home_files\n",
+ "OTHER_FILES=@other_files\n",
+ "PATH_TO_SAVE=$save_path\n",
);
$option_replace and push @cfg_list, "OPTION_REPLACE\n" ;
if ($comp_mode) {
@@ -143,7 +143,10 @@ sub read_conf_file {
if (/^OPTION_COMP/) { s/^OPTION_COMP=//gi; /TAR.GZ/ and $comp_mode = 0; /TAR.BZ2/ and $comp_mode = 1; }
}
close CONF_FILE;
- }
+ $cfg_file_exist = 1;
+ } else {
+ $cfg_file_exist = 0;
+ }
$DEBUG and debug;
}
@@ -167,6 +170,9 @@ sub build_backup_files {
sub interactive_mode {
$interactive = 1;
+ my $box_cfg_state;
+ my $box_cgf_state_replace;
+ my $box_cgf_state_comp;
my $mask;
my $style;
my $box;
@@ -177,69 +183,58 @@ sub interactive_mode {
$window1->set_position(1);
$window1->set_title(_("Drakbackup"));
- my ($pix_u_map, $pix_u_mask) = gtkcreate_png("pixmaps/backup_title.png");
- my ($pix_l_map, $pix_l_mask) = gtkcreate_png("pixmaps/backup_left.png");
- my ($pix_r_map, $pix_r_mask) = gtkcreate_png("pixmaps/backup_bot.png");
- my ($pix_hd_map, $pix_hd_mask) = gtkcreate_png("pixmaps/backup_hd.png");
-
- my $box2 = new Gtk::VBox( 0, 10 );
+ read_conf_file();
+ if ($option_replace) {
+ $box_cgf_state_replace = _("Replace backups (do not update)"),
+ } else {
+ $box_cgf_state_replace = _("Update backups (do not replace)"),
+ }
- my $label3 = gtkpack(new Gtk::HBox(0,10),
- new Gtk::Pixmap($pix_hd_map, $pix_hd_mask),
- _("Backup Wizard")
- );
+ if ($comp_mode) {
+ $box_cgf_state_comp = _("Backups use tar and gunzip "),
+ } else {
+ $box_cgf_state_comp = _("Backups use tar and gunzip"),
+ }
- my $radio1 = new Gtk::RadioButton( " Backup Wizard");
- $box2->add( $radio1);
- $radio1->set_active(1);
- my $radio2 = new Gtk::RadioButton( " Backup Advanced", $radio1);
- $box2->add( $radio2);
- my $radio3 = new Gtk::RadioButton( " Build Backup now", $radio2);
- $box2->add( $radio3);
- my $radio4 = new Gtk::RadioButton( " Restore Backup", $radio3);
- $box2->add( $radio4);
- gtksignal_connect( $radio1, clicked => sub { $backup_choice = 0 });
- gtksignal_connect( $radio2, clicked => sub { $backup_choice = 1 });
- gtksignal_connect( $radio3, clicked => sub { $backup_choice = 2 });
-
+
+ if ($cfg_file_exist) {
+ $box_cfg_state = gtkpack(new Gtk::VBox( 0, 0),
+ _("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"),
+ ),
+ } else {
+ $box_cfg_state = gtkpack(new Gtk::VBox(0,1),
+ _("No configuration please click Wizard or Advanced."),
+ ),
+ }
gtkadd($window1,
gtkpack(new Gtk::VBox(0,0),
- gtkpack(new Gtk::VBox(0,0),
- new Gtk::Pixmap($pix_u_map, $pix_u_mask),
- gtkpack_(new Gtk::HBox(0,0),
- 0, new Gtk::Pixmap($pix_l_map, $pix_l_mask),
- 1, gtkpack($up_box = new Gtk::VBox(0,5),
- $box = gtkpack_(new Gtk::VBox(0,0),
- 0, _("\n Please choose the method to configure your system backup."),
- 1, gtkpack(new Gtk::HBox(0,20),
- gtkpack(new Gtk::VBox(0,10),
- new Gtk::HBox(0,15),
- $box2,
- new Gtk::HBox(0,5),
- ),
- ),
- 1, gtkadd(gtkset_layout(new Gtk::HButtonBox, -end),
- gtksignal_connect(new Gtk::Button(_("Help")), clicked => sub {
- ${$central_widget}->destroy(); help() }),
- gtksignal_connect(new Gtk::Button(_("Next")), clicked => sub {
- ${$central_widget}->destroy();
- $backup_choice == 0 and print "Wizard\n";
- $backup_choice == 1 and advanced();
- $backup_choice == 2 and print "now\n";
- }),
- ),
- ),
- ),
- ),
- new Gtk::Pixmap($pix_r_map, $pix_r_mask),
- gtkadd(gtkset_layout(new Gtk::HButtonBox, -end),
- gtksignal_connect(new Gtk::Button(_("Close")), clicked => sub { save_conf_file(); Gtk->main_quit() }),
- gtksignal_connect(new Gtk::Button(_("About")), clicked => sub { $central_widget_save = $central_widget;
- ${$central_widget}->destroy(); about() }),
- gtksignal_connect(new Gtk::Button(_(" Help ")), clicked => sub {
- ${$central_widget}->destroy(); help() }),
- ),
- ),
+ gtkpack(gtkset_usize($up_box = new Gtk::VBox(0,5), 500, 350),
+ $box = gtkpack_(new Gtk::VBox(0,3),
+ 0, _("Welcome on DrakBackup"),
+ 1, gtkadd(new Gtk::Frame(_("State of configuration file.")),
+ gtkpack(new Gtk::VBox(0,10),
+ $box_cfg_state,
+ ),
+ ),
+ 0, gtkpack_(new Gtk::HBox(0, 0),
+ 0, gtksignal_connect(new Gtk::Button(_(" Build Backup ")),
+ clicked => sub { save_conf_file(); Gtk->main_quit() }),
+ ),
+ 0, gtkpack_(new Gtk::HBox(0, 0),
+ 0, gtksignal_connect(new Gtk::Button(_(" Restore ")),
+ clicked => sub { save_conf_file(); Gtk->main_quit() }),
+ ),
+ 0, new Gtk::HSeparator,
+ 0, gtkpack_(gtkset_layout(new Gtk::HButtonBox, -end),
+ 1, gtksignal_connect(new Gtk::Button(_("Advanced Configuration")), clicked =>
+ sub { ${$central_widget}->destroy(); advanced() }),
+ 1, gtksignal_connect(new Gtk::Button(_("Wizard Configuration")), clicked =>
+ sub { ${$central_widget}->destroy(); wizard() }),
+ 1, gtksignal_connect(new Gtk::Button(_("close")), clicked =>
+ sub { save_conf_file(); Gtk->main_quit() }),
+ ),
+ ),
+ ),
),
);
$central_widget = \$box;
@@ -297,7 +292,7 @@ sub about {
}
-sub help {
+sub adv_help {
my $text = new Gtk::Text(undef, undef);
my $about_box;
gtkpack($up_box,
@@ -342,7 +337,7 @@ configuration file:
),
0, gtkadd(gtkset_layout(new Gtk::HButtonBox, -spread),
gtksignal_connect(new Gtk::Button(_("OK")), clicked =>
- sub { ${$central_widget}->hide(); }),
+ sub { ${$central_widget}->destroy(); advanced(); }),
),
)
);
@@ -363,7 +358,50 @@ sub wizard {
$up_box->show_all();
}
+sub after_adv {
+ my $text = new Gtk::Text(undef, undef);
+ my $after_adv_box;
+ my $box_cfg_state;
+ my $box_cgf_state_replace;
+ my $box_cgf_state_comp;
+
+ read_conf_file();
+ if ($option_replace) { $box_cgf_state_replace = _("Replace backups (do not update)"),
+ } else { $box_cgf_state_replace = _("Update backups (do not replace)"), }
+
+ if ($comp_mode) { $box_cgf_state_comp = _("Backups use tar and gunzip "),
+ } else { $box_cgf_state_comp = _("Backups use tar and gunzip"), }
+
+ if ($cfg_file_exist) {
+ $box_cfg_state = gtkpack(new Gtk::VBox( 0, 0),
+ _("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"),
+ ),
+ } else { $box_cfg_state = gtkpack(new Gtk::VBox(0,1), _("No configuration please click Wizard or Advanced."), ), }
+ gtkpack($up_box,
+ $after_adv_box = gtkpack_(new Gtk::VBox(0,10),
+ 1, gtkadd(new Gtk::Frame(_("State of configuration file.")),
+ gtkpack(new Gtk::VBox(0,10),
+ $box_cfg_state,
+ ),
+ ),
+ 0, gtksignal_connect(new Gtk::Button(_("Click here if you want to build a backup now.")), clicked =>
+ sub { ${$central_widget}->destroy(); }),
+ 0, new Gtk::HSeparator,
+ 0, gtkadd(new Gtk::HButtonBox,
+ gtksignal_connect(new Gtk::Button(_("Close")), clicked => sub { Gtk->main_quit() }),
+ gtksignal_connect(new Gtk::Button(_("About")), clicked =>
+ sub { ${$central_widget}->destroy(); about() }),
+ 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(); }),
+ ),
+ ),
+ );
+ $central_widget = \$box;
+ $up_box->show_all();
+}
sub advanced {
my $notebook;
@@ -381,13 +419,13 @@ sub advanced {
my $checkbutton = new Gtk::CheckButton( "Check me please!" );
$checkbutton->set_usize( 100, 75 );
$checkbutton->show();
- 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");
+ 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");
my ($pix_user_map, $pix_user_mask) = gtkcreate_png("../pixmaps/user.png");
my ($pix_sys_map, $pix_sys_mask) = gtkcreate_png("../pixmaps/bootloader.png");
my ($pix_other_map, $pix_other_mask) = gtkcreate_png("../pixmaps/net_u.png");
- my ($pix_options_map, $pix_options_mask) = gtkcreate_png("pixmaps/backup_options.png");
+ my ($pix_options_map, $pix_options_mask) = gtkcreate_png("../pixmaps/backup_options.png");
# ($book_open, $book_open_mask) = Gtk::Gdk::Pixmap->create_from_xpm_d($up_box->window, $transparent, @book_open_xpm);
# ($book_closed, $book_closed_mask) = Gtk::Gdk::Pixmap->create_from_xpm_d($up_box->window, $transparent, @book_closed_xpm);
@@ -427,8 +465,10 @@ sub advanced {
my $box_what_sys = gtkpack(new Gtk::VBox(0,1),
+ _("\nPlease check all options that you need.\n"),
+ new Gtk::CheckButton( _("need to restore any versions (CVS)") ),
+ new Gtk::CheckButton( "Check me please!" ),
new Gtk::CheckButton( "Check me please!" ),
- new Gtk::Pixmap($pix_time_map, $pix_time_mask),
_("When backup.")
);
@@ -477,13 +517,12 @@ sub advanced {
),
),
0, gtkadd(new Gtk::HButtonBox,
- gtksignal_connect(new Gtk::Button(_("Previous")), clicked => sub { Gtk->main_quit() }),
- gtksignal_connect(new Gtk::Button(_("Save and Next")), clicked => sub {
- ${$central_widget}->destroy();
- $backup_choice == 0 and print "Wizard\n";
- $backup_choice == 1 and advanced();
- $backup_choice == 2 and print "now\n";
- }),
+ gtksignal_connect(new Gtk::Button(_("Close")), clicked =>
+ sub { ${$central_widget}->destroy(); interactive_mode() }),
+ 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(); }),
),
),
),
@@ -639,3 +678,92 @@ sub advanced {
# Gtk->main;
# Gtk->exit(0);
# }
+
+
+# ok
+
+sub interactive_mode_my {
+ $interactive = 1;
+ my $mask;
+ my $style;
+ my $box;
+ init Gtk;
+ 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) });
+ $window1->set_position(1);
+ $window1->set_title(_("Drakbackup"));
+
+ my ($pix_u_map, $pix_u_mask) = gtkcreate_png("pixmaps/backup_title.png");
+ my ($pix_l_map, $pix_l_mask) = gtkcreate_png("pixmaps/backup_left.png");
+ my ($pix_r_map, $pix_r_mask) = gtkcreate_png("pixmaps/backup_bot.png");
+ my ($pix_hd_map, $pix_hd_mask) = gtkcreate_png("pixmaps/backup_hd.png");
+
+ my $box2 = new Gtk::VBox( 0, 10 );
+
+ my $label3 = gtkpack(new Gtk::HBox(0,10),
+ new Gtk::Pixmap($pix_hd_map, $pix_hd_mask),
+ _("Backup Wizard")
+ );
+
+ my $radio1 = new Gtk::RadioButton( " Backup Wizard");
+ $box2->add( $radio1);
+ $radio1->set_active(1);
+ my $radio2 = new Gtk::RadioButton( " Backup Advanced", $radio1);
+ $box2->add( $radio2);
+ my $radio3 = new Gtk::RadioButton( " Build Backup now", $radio2);
+ $box2->add( $radio3);
+ my $radio4 = new Gtk::RadioButton( " Restore Backup", $radio3);
+ $box2->add( $radio4);
+ gtksignal_connect( $radio1, clicked => sub { $backup_choice = 0 });
+ gtksignal_connect( $radio2, clicked => sub { $backup_choice = 1 });
+ gtksignal_connect( $radio3, clicked => sub { $backup_choice = 2 });
+
+ gtkadd($window1,
+ gtkpack(new Gtk::VBox(0,0),
+ gtkpack(new Gtk::VBox(0,0),
+ new Gtk::Pixmap($pix_u_map, $pix_u_mask),
+ gtkpack_(new Gtk::HBox(0,0),
+ 0, new Gtk::Pixmap($pix_l_map, $pix_l_mask),
+ 1, gtkpack($up_box = new Gtk::VBox(0,5),
+ $box = gtkpack_(new Gtk::VBox(0,0),
+ 0, _("\n Please choose the method to configure your system backup."),
+ 1, gtkpack(new Gtk::HBox(0,20),
+ gtkpack(new Gtk::VBox(0,10),
+ new Gtk::HBox(0,15),
+ $box2,
+ new Gtk::HBox(0,5),
+ ),
+ ),
+ 1, gtkadd(gtkset_layout(new Gtk::HButtonBox, -end),
+ gtksignal_connect(new Gtk::Button(_("Help")), clicked => sub {
+ ${$central_widget}->destroy(); help() }),
+ gtksignal_connect(new Gtk::Button(_("Next")), clicked => sub {
+ ${$central_widget}->destroy();
+ $backup_choice == 0 and print "Wizard\n";
+ $backup_choice == 1 and advanced();
+ $backup_choice == 2 and print "now\n";
+ }),
+ ),
+ ),
+ ),
+ ),
+ new Gtk::Pixmap($pix_r_map, $pix_r_mask),
+ gtkadd(gtkset_layout(new Gtk::HButtonBox, -end),
+ gtksignal_connect(new Gtk::Button(_("Close")), clicked => sub { save_conf_file(); Gtk->main_quit() }),
+ gtksignal_connect(new Gtk::Button(_("About")), clicked => sub { $central_widget_save = $central_widget;
+ ${$central_widget}->destroy(); about() }),
+ gtksignal_connect(new Gtk::Button(_(" Help ")), clicked => sub {
+ ${$central_widget}->destroy(); help() }),
+ ),
+ ),
+ ),
+ );
+ $central_widget = \$box;
+ $window1->show_all;
+ $window1->realize;
+ $window1->show_all();
+
+ Gtk->main;
+ Gtk->exit(0);
+}