diff options
author | Eelco Dolstra <e.dolstra@tudelft.nl> | 2008-11-20T15·44+0000 |
---|---|---|
committer | Eelco Dolstra <e.dolstra@tudelft.nl> | 2008-11-20T15·44+0000 |
commit | 4213b8d8ec8cf478e43b0ec3dc4068e5e55f097a (patch) | |
tree | 2b95c8d933bae74c21d06ba7149d2ec1ab8924b0 /scripts | |
parent | eb86b6f5a5429075866eca40d3cc4b864e7499ae (diff) |
* Urgh.
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/copy-from-other-stores.pl.in | 5 | ||||
-rw-r--r-- | scripts/download-using-manifests.pl.in | 16 | ||||
-rw-r--r-- | scripts/nix-build.in | 6 | ||||
-rw-r--r-- | scripts/nix-collect-garbage.in | 6 | ||||
-rw-r--r-- | scripts/nix-copy-closure.in | 3 | ||||
-rw-r--r-- | scripts/nix-install-package.in | 8 | ||||
-rw-r--r-- | scripts/nix-pull.in | 3 | ||||
-rw-r--r-- | scripts/nix-push.in | 3 |
8 files changed, 29 insertions, 21 deletions
diff --git a/scripts/copy-from-other-stores.pl.in b/scripts/copy-from-other-stores.pl.in index 5b695ea1a66e..8f0ff4ca8df8 100644 --- a/scripts/copy-from-other-stores.pl.in +++ b/scripts/copy-from-other-stores.pl.in @@ -4,6 +4,9 @@ use strict; use File::Basename; use IO::Handle; +my $binDir = $ENV{"NIX_BIN_DIR"} || "@bindir@"; + + STDOUT->autoflush(1); my @remoteStoresAll = split ':', ($ENV{"NIX_OTHER_STORES"} or ""); @@ -87,7 +90,7 @@ elsif ($ARGV[0] eq "--substitute") { (my $infoFile, my $sourcePath) = findStorePath $storePath; die unless $infoFile; print "\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 $storePath") == 0 or die "cannot copy `$sourcePath' to `$storePath'"; } diff --git a/scripts/download-using-manifests.pl.in b/scripts/download-using-manifests.pl.in index 1b331ffe2f2b..e3aa0f138d5b 100644 --- a/scripts/download-using-manifests.pl.in +++ b/scripts/download-using-manifests.pl.in @@ -5,6 +5,8 @@ use readmanifest; use POSIX qw(strftime); use File::Temp qw(tempdir); +my $binDir = $ENV{"NIX_BIN_DIR"} || "@bindir@"; + STDOUT->autoflush(1); my $manifestDir = "@localstatedir@/nix/manifests"; @@ -98,7 +100,7 @@ foreach my $localPath (@{$localPathList}) { my $sourcePath = $localPath->{copyFrom}; if (-e $sourcePath) { print "\n*** Step 1/1: copying from $sourcePath\n"; - system("@bindir@/nix-store --dump $sourcePath | @bindir@/nix-store --restore $targetPath") == 0 + system("$binDir/nix-store --dump $sourcePath | $binDir/nix-store --restore $targetPath") == 0 or die "cannot copy `$sourcePath' to `$targetPath'"; exit 0; } @@ -147,7 +149,7 @@ addToQueue $targetPath; sub isValidPath { my $p = shift; - return system("@bindir@/nix-store --check-validity '$p' 2> /dev/null") == 0; + return system("$binDir/nix-store --check-validity '$p' 2> /dev/null") == 0; } sub parseHash { @@ -181,7 +183,7 @@ while ($queueFront < scalar @queue) { my ($baseHashAlgo, $baseHash) = parseHash $patch->{baseHash}; my $format = "--base32"; $format = "" if $baseHashAlgo eq "md5"; - my $hash = `@bindir@/nix-hash --type '$baseHashAlgo' $format "$patch->{basePath}"`; + my $hash = `$binDir/nix-hash --type '$baseHashAlgo' $format "$patch->{basePath}"`; chomp $hash; # print " MY HASH is $hash\n"; if ($hash ne $baseHash) { @@ -263,7 +265,7 @@ sub downloadFile { $ENV{"PRINT_PATH"} = 1; $ENV{"QUIET"} = 1; $ENV{"NIX_HASH_ALGO"} = $hashAlgo; - my ($hash2, $path) = `@bindir@/nix-prefetch-url '$url' '$hash'`; + my ($hash2, $path) = `$binDir/nix-prefetch-url '$url' '$hash'`; die "download of `$url' failed" unless $? == 0; chomp $hash2; chomp $path; @@ -287,7 +289,7 @@ while (scalar @path > 0) { # as a base to one or more patches. So turn the base path # into a NAR archive, to which we can apply the patch. print " packing base path...\n"; - system("@bindir@/nix-store --dump $v > $tmpNar") == 0 + system("$binDir/nix-store --dump $v > $tmpNar") == 0 or die "cannot dump `$v'"; } } @@ -315,7 +317,7 @@ while (scalar @path > 0) { # This was the last patch. Unpack the final NAR archive # into the target path. print " unpacking patched archive...\n"; - system("@bindir@/nix-store --restore $v < $tmpNar2") == 0 + system("$binDir/nix-store --restore $v < $tmpNar2") == 0 or die "cannot unpack $tmpNar2 into `$v'"; } } @@ -337,7 +339,7 @@ while (scalar @path > 0) { } else { # Unpack the archive into the target path. print " unpacking archive...\n"; - system("@bunzip2@ < '$narFilePath' | @bindir@/nix-store --restore '$v'") == 0 + system("@bunzip2@ < '$narFilePath' | $binDir/nix-store --restore '$v'") == 0 or die "cannot unpack `$narFilePath' into `$v'"; } } diff --git a/scripts/nix-build.in b/scripts/nix-build.in index a674a00415ea..30ada24e0d7c 100644 --- a/scripts/nix-build.in +++ b/scripts/nix-build.in @@ -2,6 +2,8 @@ use strict; +my $binDir = $ENV{"NIX_BIN_DIR"} || "@bindir@"; + my $addDrvLink = 0; my $addOutLink = 1; @@ -124,7 +126,7 @@ foreach my $expr (@exprs) { # Instantiate. my @drvPaths; # !!! would prefer the perl 5.8.0 pipe open feature here. - my $pid = open(DRVPATHS, "-|") || exec "@bindir@/nix-instantiate", "--add-root", $drvLink, "--indirect", @instArgs, $expr; + my $pid = open(DRVPATHS, "-|") || exec "$binDir/nix-instantiate", "--add-root", $drvLink, "--indirect", @instArgs, $expr; while (<DRVPATHS>) {chomp; push @drvPaths, $_;} close DRVPATHS or exit 1; @@ -135,7 +137,7 @@ foreach my $expr (@exprs) { # Build. my @outPaths; - $pid = open(OUTPATHS, "-|") || exec "@bindir@/nix-store", "--add-root", $outLink, "--indirect", "-rv", + $pid = open(OUTPATHS, "-|") || exec "$binDir/nix-store", "--add-root", $outLink, "--indirect", "-rv", @buildArgs, @drvPaths; while (<OUTPATHS>) {chomp; push @outPaths, $_;} close OUTPATHS or exit 1; diff --git a/scripts/nix-collect-garbage.in b/scripts/nix-collect-garbage.in index b92deefc2436..f445c1c71256 100644 --- a/scripts/nix-collect-garbage.in +++ b/scripts/nix-collect-garbage.in @@ -4,6 +4,8 @@ use strict; my $profilesDir = "@localstatedir@/nix/profiles"; +my $binDir = $ENV{"NIX_BIN_DIR"} || "@bindir@"; + # Process the command line arguments. my @args = (); @@ -34,7 +36,7 @@ sub removeOldGenerations { $name = $dir . "/" . $name; if (-l $name && (readlink($name) =~ /link/)) { print STDERR "removing old generations of profile $name\n"; - system("@bindir@/nix-env", "-p", $name, "--delete-generations", "old"); + system("$binDir/nix-env", "-p", $name, "--delete-generations", "old"); } elsif (! -l $name && -d $name) { removeOldGenerations $name; @@ -48,4 +50,4 @@ removeOldGenerations $profilesDir if $removeOld; # Run the actual garbage collector. -exec "@bindir@/nix-store", "--gc", @args; +exec "$binDir/nix-store", "--gc", @args; diff --git a/scripts/nix-copy-closure.in b/scripts/nix-copy-closure.in index 0fa4e870fb27..688bec72824d 100644 --- a/scripts/nix-copy-closure.in +++ b/scripts/nix-copy-closure.in @@ -1,7 +1,6 @@ #! @perl@ -w -my $binDir = $ENV{"NIX_BIN_DIR"}; -$binDir = "@bindir@" unless defined $binDir; +my $binDir = $ENV{"NIX_BIN_DIR"} || "@bindir@"; if (scalar @ARGV < 1) { diff --git a/scripts/nix-install-package.in b/scripts/nix-install-package.in index 3aaed7e59fc4..e37911e33438 100644 --- a/scripts/nix-install-package.in +++ b/scripts/nix-install-package.in @@ -3,6 +3,8 @@ use strict; use File::Temp qw(tempdir); +my $binDir = $ENV{"NIX_BIN_DIR"} || "@bindir@"; + sub usageError { print STDERR <<EOF; @@ -59,7 +61,7 @@ if ($interactive && !defined $ENV{"NIX_HAVE_TERMINAL"}) { $ENV{"NIX_HAVE_TERMINAL"} = "1"; $ENV{"LD_LIBRARY_PATH"} = ""; foreach my $term ("xterm", "konsole", "gnome-terminal", "xterm") { - exec($term, "-e", "@bindir@/nix-install-package", @ARGV); + exec($term, "-e", "$binDir/nix-install-package", @ARGV); } die "cannot execute `xterm'"; } @@ -122,12 +124,12 @@ if ($interactive) { print "\nPulling manifests...\n"; -system("@bindir@/nix-pull", $manifestURL) == 0 +system("$binDir/nix-pull", $manifestURL) == 0 or barf "nix-pull failed: $?"; print "\nInstalling package...\n"; -system("@bindir@/nix-env", "--install", $outPath, "--force-name", $drvName, @extraNixEnvArgs) == 0 +system("$binDir/nix-env", "--install", $outPath, "--force-name", $drvName, @extraNixEnvArgs) == 0 or barf "nix-env failed: $?"; diff --git a/scripts/nix-pull.in b/scripts/nix-pull.in index 016e330dcbe5..b3644b800e34 100644 --- a/scripts/nix-pull.in +++ b/scripts/nix-pull.in @@ -7,8 +7,7 @@ use readmanifest; my $tmpDir = tempdir("nix-pull.XXXXXX", CLEANUP => 1, TMPDIR => 1) or die "cannot create a temporary directory"; -my $binDir = $ENV{"NIX_BIN_DIR"}; -$binDir = "@bindir@" unless defined $binDir; +my $binDir = $ENV{"NIX_BIN_DIR"} || "@bindir@"; my $libexecDir = $ENV{"NIX_LIBEXEC_DIR"}; $libexecDir = "@libexecdir@" unless defined $libexecDir; diff --git a/scripts/nix-push.in b/scripts/nix-push.in index 8ac31d50165e..c7a0dc6687e4 100644 --- a/scripts/nix-push.in +++ b/scripts/nix-push.in @@ -16,8 +16,7 @@ my $curl = "@curl@ --fail --silent"; my $extraCurlFlags = ${ENV{'CURL_FLAGS'}}; $curl = "$curl $extraCurlFlags" if defined $extraCurlFlags; -my $binDir = $ENV{"NIX_BIN_DIR"}; -$binDir = "@bindir@" unless defined $binDir; +my $binDir = $ENV{"NIX_BIN_DIR"} || "@bindir@"; my $dataDir = $ENV{"NIX_DATA_DIR"}; $dataDir = "@datadir@" unless defined $dataDir; |