about summary refs log tree commit diff
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2006-05-08T20·00+0000
committerEelco Dolstra <e.dolstra@tudelft.nl>2006-05-08T20·00+0000
commite3c07782d124cdd8d0aab2b498225cdca28cad66 (patch)
tree3f9b2f55448546c6f313b8497b389ce04f1e3972
parentc54287eafe8435e71634df3957cd5e30b97bb6a6 (diff)
* Remove old manifests in `nix-channel --update'.
-rw-r--r--scripts/nix-channel.in8
1 files changed, 8 insertions, 0 deletions
diff --git a/scripts/nix-channel.in b/scripts/nix-channel.in
index 772fb10cfd3c..63a56616b130 100644
--- a/scripts/nix-channel.in
+++ b/scripts/nix-channel.in
@@ -4,6 +4,9 @@ use strict;
 
 my $rootsDir = "@localstatedir@/nix/gcroots/channels";
 
+my $stateDir = $ENV{"NIX_STATE_DIR"};
+$stateDir = "@localstatedir@/nix" unless defined $stateDir;
+
 
 # Figure out the name of the `.nix-channels' file to use.
 my $home = $ENV{"HOME"};
@@ -70,6 +73,11 @@ sub update {
     system "@bindir@/nix-store --clear-substitutes";
     die "cannot clear substitutes" if ($? != 0);
 
+    # Remove all the old manifests.
+    for my $manifest (glob "$stateDir/manifests/*.nixmanifest") {
+        unlink $manifest or die "cannot remove `$manifest': $!";
+    }
+
     # Pull cache manifests.
     foreach my $url (@channels) {
         print "pulling cache manifest from `$url'\n";