From 1b804f88e44e7f6760e9c43e329a8a6eb368c52e Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Wed, 20 Sep 2006 16:23:14 +0000 Subject: * Absolute path to rm (NIX-51). * Don't hardcore /nix/bin and /nix/store. --- scripts/nix-pack-closure.in | 2 +- scripts/nix-unpack-closure.in | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'scripts') diff --git a/scripts/nix-pack-closure.in b/scripts/nix-pack-closure.in index ccc5f7eb886c..97de927bfcd0 100644 --- a/scripts/nix-pack-closure.in +++ b/scripts/nix-pack-closure.in @@ -17,7 +17,7 @@ $binDir = "@bindir@" unless defined $binDir; my $tmpDir; do { $tmpDir = tmpnam(); } until mkdir $tmpDir, 0777; -END { system "rm -rf '$tmpDir'"; } +END { system "@coreutils@/rm -rf '$tmpDir'"; } mkdir "$tmpDir/contents", 0777 or die; mkdir "$tmpDir/references", 0777 or die; mkdir "$tmpDir/derivers", 0777 or die; diff --git a/scripts/nix-unpack-closure.in b/scripts/nix-unpack-closure.in index 98c7d84db451..2c9b4873afcb 100644 --- a/scripts/nix-unpack-closure.in +++ b/scripts/nix-unpack-closure.in @@ -15,7 +15,7 @@ $binDir = "@bindir@" unless defined $binDir; my $tmpDir; do { $tmpDir = tmpnam(); } until mkdir $tmpDir, 0777; -END { system "rm -rf '$tmpDir'"; } +END { system "@coreutils@/rm -rf '$tmpDir'"; } # Unpack the NAR archive on standard input. @@ -34,15 +34,15 @@ opendir(DIR, "$tmpDir/unpacked/contents") or die "cannot open directory: $!"; foreach my $name (sort(readdir DIR)) { next if $name eq "." or $name eq ".."; - my $storePath = "/nix/store/$name"; # !!! + my $storePath = "@storedir@/$name"; # !!! # !!! this really isn't a good validity check! - system "/nix/bin/nix-store --check-validity '$storePath' 2> /dev/null"; + system "$binDir/nix-store --check-validity '$storePath' 2> /dev/null"; if ($? != 0) { print STDERR "unpacking `$storePath'...\n"; # !!! race - system("rm -rf '$storePath'") == 0 + system("@coreutils@/rm -rf '$storePath'") == 0 or die "cannot remove `$storePath': $?"; system("$binDir/nix-store --restore '$storePath' < '$tmpDir/unpacked/contents/$name'") == 0 -- cgit 1.4.1