about summary refs log tree commit diff
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rw-r--r--scripts/Makefile.am2
-rwxr-xr-xscripts/nix-pull-prebuilts16
-rwxr-xr-xscripts/nix-push-prebuilts10
-rwxr-xr-xscripts/nix-switch2
4 files changed, 22 insertions, 8 deletions
diff --git a/scripts/Makefile.am b/scripts/Makefile.am
index f1d008f1e76d..cf70f1574464 100644
--- a/scripts/Makefile.am
+++ b/scripts/Makefile.am
@@ -1,4 +1,4 @@
-bin_SCRIPTS = nix-generate-regscript nix-switch nix-collect-garbage \
+bin_SCRIPTS = nix-switch nix-collect-garbage \
  nix-pull-prebuilts nix-push-prebuilts
 
 install-exec-local:
diff --git a/scripts/nix-pull-prebuilts b/scripts/nix-pull-prebuilts
index 91bbf8082b35..9cc6683378df 100755
--- a/scripts/nix-pull-prebuilts
+++ b/scripts/nix-pull-prebuilts
@@ -9,13 +9,25 @@ my $conffile = "$etcdir/prebuilts.conf";
 
 sub register {
     my $fn = shift;
+    my $url = shift;
     return unless $fn =~ /([^\/]*)-([0-9a-z]{32})-([0-9a-z]{32})\.tar\.bz2/;
     my $id = $1;
     my $pkghash = $2;
     my $prebuilthash = $3;
+
     print "$pkghash => $prebuilthash ($id)\n";
+
     system "nix regprebuilt $pkghash $prebuilthash";
     if ($?) { die "`nix regprebuilt' failed"; }
+
+    if ($url =~ /^\//) {
+	system "nix regfile $url";
+	if ($?) { die "`nix regfile' failed"; }
+    } else {
+	system "nix regurl $prebuilthash $url";
+	if ($?) { die "`nix regurl' failed"; }
+    }
+
     print KNOWNS "$pkghash\n";
 }
 
@@ -35,7 +47,7 @@ while (<CONFFILE>) {
             # It's a local path.
 
             foreach my $fn (glob "$url/*") {
-                register $fn;
+                register($fn, $fn);
             }
 
         } else {
@@ -54,7 +66,7 @@ while (<CONFFILE>) {
                 my $fn = $1;
                 next if $fn =~ /\.\./;
                 next if $fn =~ /\//;
-                register $fn;
+                register($fn, "$url/$fn");
             }
 
             close INDEX;
diff --git a/scripts/nix-push-prebuilts b/scripts/nix-push-prebuilts
index 2e3029b1699f..95289787995b 100755
--- a/scripts/nix-push-prebuilts
+++ b/scripts/nix-push-prebuilts
@@ -17,7 +17,6 @@ close KNOWNS;
 # For each installed package, check whether a prebuilt is known.
 
 open PKGS, "nix listinst|";
-open KNOWNS, ">>$knowns";
 
 while (<PKGS>) {
     chomp;
@@ -28,13 +27,16 @@ while (<PKGS>) {
         print "exporting $pkghash...\n";
         system "nix export '$exportdir' $pkghash";
         if ($?) { die "`nix export' failed"; }
-        print KNOWNS "$pkghash\n";
     }
 }
 
-close KNOWNS;
 close PKGS;
 
 # Push the prebuilts to the server. !!! FIXME
 
-system "rsync -av -e ssh '$exportdir' losser:/home/eelco/public_html/nix-prebuilts/";
+system "rsync -av -e ssh '$exportdir'/ losser:/home/eelco/public_html/nix-prebuilts/";
+
+# Rerun `nix-pull-prebuilts' to rescan the prebuilt source locations.
+
+print "running nix-pull-prebuilts...";
+system "nix-pull-prebuilts";
diff --git a/scripts/nix-switch b/scripts/nix-switch
index 570f7e9e9227..d58a5f249e18 100755
--- a/scripts/nix-switch
+++ b/scripts/nix-switch
@@ -30,7 +30,7 @@ while (-e "$linkdir/$id-$nr") { $nr++; }
 my $link = "$linkdir/$id-$nr";
 
 # Create a symlink from $link to $pkgdir.
-symlink($pkgdir, $link) or die "cannot create $link";
+symlink($pkgdir, $link) or die "cannot create $link: $!";
 
 # Also store the hash of $pkgdir.  This is useful for garbage
 # collection and the like.