aboutsummaryrefslogtreecommitdiff
path: root/scripts/copy-from-other-stores.pl.in
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2012-10-02 14:08:59 -0400
committerEelco Dolstra <eelco.dolstra@logicblox.com>2012-10-02 14:08:59 -0400
commit9958bd6992e2b3e7bacb493a372d17d5a5b95d90 (patch)
tree48371e99e9ca79b8caa6152c1efed6174dd4e0c5 /scripts/copy-from-other-stores.pl.in
parente666e1156fba936dce93ccfa2486f67369a97129 (diff)
Add operation ‘nix-store --repair-path’
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.
Diffstat (limited to 'scripts/copy-from-other-stores.pl.in')
-rwxr-xr-xscripts/copy-from-other-stores.pl.in5
1 files changed, 3 insertions, 2 deletions
diff --git a/scripts/copy-from-other-stores.pl.in b/scripts/copy-from-other-stores.pl.in
index 3ee6f075b..9ed7e4cc2 100755
--- a/scripts/copy-from-other-stores.pl.in
+++ b/scripts/copy-from-other-stores.pl.in
@@ -83,12 +83,13 @@ if ($ARGV[0] eq "--query") {
elsif ($ARGV[0] eq "--substitute") {
- die unless scalar @ARGV == 2;
+ die unless scalar @ARGV == 3;
my $storePath = $ARGV[1];
+ my $destPath = $ARGV[2];
my ($store, $sourcePath) = findStorePath $storePath;
die unless $store;
print STDERR "\n*** Copying `$storePath' from `$sourcePath'\n\n";
- system("$binDir/nix-store --dump $sourcePath | $binDir/nix-store --restore $storePath") == 0
+ system("$binDir/nix-store --dump $sourcePath | $binDir/nix-store --restore $destPath") == 0
or die "cannot copy `$sourcePath' to `$storePath'";
print "\n"; # no hash to verify
}