summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--NEWS1
-rwxr-xr-xdraksnapshot-config19
2 files changed, 19 insertions, 1 deletions
diff --git a/NEWS b/NEWS
index 6772df1..9b7b2eb 100644
--- a/NEWS
+++ b/NEWS
@@ -6,6 +6,7 @@
- configurator:
o do not offer anymore to configure intervals
(too advanced option)
+ o enable to disable backups
o generate anacron friendly cron files (#43297)
o make advanced settings pop up like installer
diff --git a/draksnapshot-config b/draksnapshot-config
index 94f573b..95c6546 100755
--- a/draksnapshot-config
+++ b/draksnapshot-config
@@ -118,12 +118,23 @@ gtkadd($dialog->{rwindow},
]),
]));
-my $button;
+my $is_enabled = to_bool(glob("/etc/cron.*/rsnapshot"));
+
+my ($box, $button);
gtkadd($my_win->{window},
gtknew('VBox', children => [
if_(!$::isEmbedded, 0, Gtk2::Banner->new('draksnapshot-big',
N("Backup snapshots configuration"))),
0, gtknew('Title1', label => N("Settings")),
+ 0, gtknew('CheckButton', text => N("Enable Backups"), active_ref => \$is_enabled,
+ toggled => sub {
+ my ($w) = @_;
+ warn "===>>> !$w || !$box\n";
+ return if !$w || !$box;
+ warn "set to " . to_bool($w->get_active) . "\n";
+ $box->set_sensitive($w->get_active);
+ }),
+ 0, $box = gtknew('VBox', sensitive => $is_enabled, children => [
0, gtknew('CheckButton', text => N("Backup the whole system"),
toggled => sub {
my ($w) = @_;
@@ -169,6 +180,7 @@ gtkadd($my_win->{window},
])),
0, $button = gtknew('Install_Button', text => N("Advanced"),
clicked => sub { $d_window->show }),
+ ]),
0, gtknew('HButtonBox', layout => 'end', border_width => 5, spacing => 5, children_loose => [
gtknew('Button', text => N("Apply"), clicked => \&save),
gtknew('Button', text => $::isEmbedded ? N("Cancel") : N("Close"), clicked => sub { save(); quit() })
@@ -314,6 +326,11 @@ sub generate_cron_entry() {
my $cron_file = "$::prefix/etc/cron.\%s/rsnapshot";
+ if (!$is_enabled) { # Mandriva defaults
+ unlink(sprintf($cron_file, $_)) foreach qw(hourly daily weekly monthly);
+ return;
+ }
+
foreach my $type (qw(hourly daily weekly monthly)) {
my $file = sprintf($cron_file, $type);
output_with_perm($file, 0755,