about summary refs log tree commit diff
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2012-02-02T12·25+0000
committerEelco Dolstra <e.dolstra@tudelft.nl>2012-02-02T12·25+0000
commitce86a9a0ae928f8cdbe26021b6b757bf5b9d7693 (patch)
treea542732bbb31e41c053ac0f2bba48a72868e9600
parentbaa0501cc120619ac3b76eaa53fff10cffd02449 (diff)
* nix-channel: fail if we don't have write permission to the manifests
  directory.  Previously in this situation we did add the Nix
  expressions from the channel to allow installation from source, but
  this doesn't work for binary-only channels and leads to confusing
  error messages.

-rwxr-xr-xscripts/nix-channel.in20
1 files changed, 7 insertions, 13 deletions
diff --git a/scripts/nix-channel.in b/scripts/nix-channel.in
index d7573258c416..ebfc246cfa30 100755
--- a/scripts/nix-channel.in
+++ b/scripts/nix-channel.in
@@ -79,20 +79,14 @@ sub update {
     # Create the manifests directory if it doesn't exist.
     mkdir $manifestDir, 0755 unless -e $manifestDir;
 
-    # Do we have write permission to the manifests directory?  If not,
-    # then just skip pulling the manifest and just download the Nix
-    # expressions.  If the user is a non-privileged user in a
-    # multi-user Nix installation, he at least gets installation from
-    # source.
-    if (-W $manifestDir) {
-
-        # Pull cache manifests.
-        foreach my $url (@channels) {
-            #print "pulling cache manifest from `$url'\n";
-            system("$Nix::Config::binDir/nix-pull", "--skip-wrong-store", "$url/MANIFEST") == 0
-                or die "cannot pull cache manifest from `$url'";
-        }
+    # Do we have write permission to the manifests directory?
+    die "$0: you do not have write permission to `$manifestDir'!\n" unless -W $manifestDir;
 
+    # Pull cache manifests.
+    foreach my $url (@channels) {
+        #print "pulling cache manifest from `$url'\n";
+        system("$Nix::Config::binDir/nix-pull", "--skip-wrong-store", "$url/MANIFEST") == 0
+            or die "cannot pull cache manifest from `$url'";
     }
 
     # Create a Nix expression that fetches and unpacks the channel Nix