2004-03-15 16:23:53 +01:00
|
|
|
#! @perl@ -w
|
2003-11-24 12:11:40 +01:00
|
|
|
|
|
|
|
use strict;
|
|
|
|
use POSIX qw(tmpnam);
|
|
|
|
|
|
|
|
my $pkgfile = $ARGV[0];
|
|
|
|
die unless defined $pkgfile;
|
|
|
|
|
|
|
|
my $tmpdir;
|
|
|
|
do { $tmpdir = tmpnam(); }
|
|
|
|
until mkdir $tmpdir, 0777;
|
|
|
|
|
|
|
|
# !!! remove tmpdir on exit
|
|
|
|
|
2004-01-14 12:13:08 +01:00
|
|
|
print "Unpacking $pkgfile in $tmpdir...\n";
|
2003-11-24 12:11:40 +01:00
|
|
|
system "bunzip2 < $pkgfile | (cd $tmpdir && tar xf -)";
|
|
|
|
die if $?;
|
|
|
|
|
2004-01-14 12:13:08 +01:00
|
|
|
print "This package contains the following derivations:\n";
|
2004-04-06 10:18:51 +02:00
|
|
|
system "@bindir@/nix-env -qasf $tmpdir/default.nix";
|
2003-11-24 12:11:40 +01:00
|
|
|
die if $?;
|
|
|
|
|
2004-01-14 12:13:08 +01:00
|
|
|
print "Do you wish to install these (Y/N)? ";
|
2003-11-24 12:11:40 +01:00
|
|
|
my $reply = <STDIN>;
|
|
|
|
chomp $reply;
|
|
|
|
exit if (!($reply eq "y"));
|
|
|
|
|
2004-01-14 12:13:08 +01:00
|
|
|
print "Pulling caches...\n";
|
2004-04-06 10:18:51 +02:00
|
|
|
system "@bindir@/nix-pull `cat $tmpdir/caches`";
|
2003-11-24 12:11:40 +01:00
|
|
|
die if $?;
|
|
|
|
|
2004-01-14 12:13:08 +01:00
|
|
|
print "Installing package...\n";
|
2004-04-06 10:18:51 +02:00
|
|
|
system "@bindir@/nix-env -if $tmpdir/default.nix '*'";
|
2003-11-24 12:11:40 +01:00
|
|
|
die if $?;
|
|
|
|
|
2004-01-14 12:13:08 +01:00
|
|
|
print "Installation succeeded! Press Enter to continue.\n";
|
2003-11-24 12:11:40 +01:00
|
|
|
<STDIN>;
|