Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 814827
Collapse All | Expand All

(-)a/rsnapshot-program.pl (-22 / +32 lines)
Lines 4666-4673 sub rotate_higher_interval { Link Here
4666
4666
4667
	# ROTATE DIRECTORIES
4667
	# ROTATE DIRECTORIES
4668
	#
4668
	#
4669
	# delete the oldest one (if we're keeping more than one)
4669
	# delete the oldest one (if we're keeping more than one), if needed
4670
	if (-d "$config_vars{'snapshot_root'}/$interval.$interval_max") {
4670
	if ((-d "$config_vars{'snapshot_root'}/$prev_interval.$prev_interval_max") and (-d "$config_vars{'snapshot_root'}/$interval.$interval_max")) {	
4671
4671
4672
		# if use_lazy_deletes is set move the oldest directory to _delete.$$
4672
		# if use_lazy_deletes is set move the oldest directory to _delete.$$
4673
		# otherwise preform the default behavior
4673
		# otherwise preform the default behavior
Lines 4703-4737 sub rotate_higher_interval { Link Here
4703
		}
4703
		}
4704
4704
4705
	}
4705
	}
4706
	else {
4706
	elsif (-d "$config_vars{'snapshot_root'}/$prev_interval.$prev_interval_max") {
4707
		print_msg(
4707
		print_msg(
4708
			"$config_vars{'snapshot_root'}/$interval.$interval_max not present (yet), nothing to delete", 4);
4708
			"$config_vars{'snapshot_root'}/$interval.$interval_max not present (yet), nothing to delete", 4);
4709
	}
4709
	}
4710
	else {
4711
		print_msg(
4712
			"$config_vars{'snapshot_root'}/$interval.$prev_interval_max not present (yet), no need to delete $config_vars{'snapshot_root'}/$interval.$interval_max", 4);
4713
	}
4710
4714
4711
	# rotate the middle ones
4715
	# rotate the middle ones
4712
	for (my $i = ($interval_max - 1); $i >= 0; $i--) {
4716
	if (-d "$config_vars{'snapshot_root'}/$prev_interval.$prev_interval_max") {
4713
		if (-d "$config_vars{'snapshot_root'}/$interval.$i") {
4717
		for (my $i = ($interval_max - 1); $i >= 0; $i--) {
4714
			print_cmd(
4718
			if (-d "$config_vars{'snapshot_root'}/$interval.$i") {
4715
				"mv $config_vars{'snapshot_root'}/$interval.$i/ ",
4719
				print_cmd(
4716
				"$config_vars{'snapshot_root'}/$interval." . ($i + 1) . "/"
4720
					"mv $config_vars{'snapshot_root'}/$interval.$i/ ",
4717
			);
4721
					"$config_vars{'snapshot_root'}/$interval." . ($i + 1) . "/"
4718
4719
			if (0 == $test) {
4720
				my $result = safe_rename(
4721
					"$config_vars{'snapshot_root'}/$interval.$i",
4722
					("$config_vars{'snapshot_root'}/$interval." . ($i + 1))
4723
				);
4722
				);
4724
				if (0 == $result) {
4723
4725
					my $errstr = '';
4724
				if (0 == $test) {
4726
					$errstr .= "Error! safe_rename(\"$config_vars{'snapshot_root'}/$interval.$i/\", \"";
4725
					my $result = safe_rename(
4727
					$errstr .= "$config_vars{'snapshot_root'}/$interval." . ($i + 1) . '/' . "\")";
4726
						"$config_vars{'snapshot_root'}/$interval.$i",
4728
					bail($errstr);
4727
						("$config_vars{'snapshot_root'}/$interval." . ($i + 1))
4728
					);
4729
					if (0 == $result) {
4730
						my $errstr = '';
4731
						$errstr .= "Error! safe_rename(\"$config_vars{'snapshot_root'}/$interval.$i/\", \"";
4732
						$errstr .= "$config_vars{'snapshot_root'}/$interval." . ($i + 1) . '/' . "\")";
4733
						bail($errstr);
4734
					}
4729
				}
4735
				}
4730
			}
4736
			}
4737
			else {
4738
				print_msg("$config_vars{'snapshot_root'}/$interval.$i not present (yet), nothing to rotate", 4);
4739
			}
4731
		}
4740
		}
4732
		else {
4741
	}
4733
			print_msg("$config_vars{'snapshot_root'}/$interval.$i not present (yet), nothing to rotate", 4);
4742
	else {
4734
		}
4743
		print_msg(
4744
			"$config_vars{'snapshot_root'}/$interval.$prev_interval_max not present (yet), no need to rotate $config_vars{'snapshot_root'}/$interval.$interval.*", 4);
4735
	}
4745
	}
4736
4746
4737
	# prev.max and interval.0 require more attention
4747
	# prev.max and interval.0 require more attention

Return to bug 814827