diff options
author | Eelco Dolstra <e.dolstra@tudelft.nl> | 2003-07-14T10·45+0000 |
---|---|---|
committer | Eelco Dolstra <e.dolstra@tudelft.nl> | 2003-07-14T10·45+0000 |
commit | 8898e86b4fe1ecf8b34a5cca2a7b9b38d395678c (patch) | |
tree | 1806b917e07bde457aec66aecc23af27f0c9cdf6 /scripts/nix-collect-garbage.in | |
parent | 3509299aca833ed50faab146f985853255041cb2 (diff) |
* Get the garbage collector to work again.
Diffstat (limited to 'scripts/nix-collect-garbage.in')
-rwxr-xr-x | scripts/nix-collect-garbage.in | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/scripts/nix-collect-garbage.in b/scripts/nix-collect-garbage.in new file mode 100755 index 000000000000..1506416b23a5 --- /dev/null +++ b/scripts/nix-collect-garbage.in @@ -0,0 +1,25 @@ +#! /usr/bin/perl -w + +my $linkdir = "@localstatedir@/nix/links"; +my $storedir = "@prefix@/store"; + +my %alive; + +open HASHES, "nix -qrh \$(cat $linkdir/*.hash) |" or die "in `nix -qrh'"; +while (<HASHES>) { + chomp; + $alive{$_} = 1; +} +close HASHES; + +opendir(DIR, $storedir) or die "cannot opendir $storedir: $!"; +my @names = readdir(DIR); +closedir DIR; + +foreach my $name (@names) { + next if ($name eq "." || $name eq ".."); + $name = "$storedir/$name"; + if (!$alive{$name}) { + print "$name\n"; + } +} |