From 9958bd6992e2b3e7bacb493a372d17d5a5b95d90 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Tue, 2 Oct 2012 14:08:59 -0400 Subject: Add operation ‘nix-store --repair-path’ MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This operation allows fixing corrupted or accidentally deleted store paths by redownloading them using substituters, if available. Since the corrupted path cannot be replaced atomically, there is a very small time window (one system call) during which neither the old (corrupted) nor the new (repaired) contents are available. So repairing should be used with some care on critical packages like Glibc. --- scripts/download-using-manifests.pl.in | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'scripts/download-using-manifests.pl.in') diff --git a/scripts/download-using-manifests.pl.in b/scripts/download-using-manifests.pl.in index 8f66a292e361..c73511f85090 100755 --- a/scripts/download-using-manifests.pl.in +++ b/scripts/download-using-manifests.pl.in @@ -238,8 +238,9 @@ elsif ($ARGV[0] ne "--substitute") { } -die unless scalar @ARGV == 2; +die unless scalar @ARGV == 3; my $targetPath = $ARGV[1]; +my $destPath = $ARGV[2]; $fast = 0; @@ -324,7 +325,7 @@ while (scalar @path > 0) { # This was the last patch. Unpack the final NAR archive # into the target path. print STDERR " unpacking patched archive...\n"; - system("$Nix::Config::binDir/nix-store --restore $v < $tmpNar2") == 0 + system("$Nix::Config::binDir/nix-store --restore $destPath < $tmpNar2") == 0 or die "cannot unpack $tmpNar2 to `$v'\n"; } @@ -351,7 +352,7 @@ while (scalar @path > 0) { or die "cannot download and unpack `$narFile->{url}' to `$v'\n"; } else { # Unpack the archive to the target path. - system("$curl '$narFile->{url}' | $decompressor | $Nix::Config::binDir/nix-store --restore '$v'") == 0 + system("$curl '$narFile->{url}' | $decompressor | $Nix::Config::binDir/nix-store --restore '$destPath'") == 0 or die "cannot download and unpack `$narFile->{url}' to `$v'\n"; } -- cgit 1.4.1