* Use the Perl version of paths-from-graphs everywhere.

svn path=/nixos/trunk/; revision=7774
This commit is contained in:
Eelco Dolstra 2007-01-23 14:37:42 +00:00
parent 903a64c87d
commit d197a0f2cc
4 changed files with 13 additions and 26 deletions

View File

@ -12,12 +12,12 @@
# `contents = {object = ...; symlink = /init;}' is a typical
# argument.
{stdenv, cpio, contents}:
{stdenv, perl, cpio, contents}:
stdenv.mkDerivation {
name = "initrd";
builder = ./make-initrd.sh;
buildInputs = [cpio];
buildInputs = [perl cpio];
# !!! should use XML.
objects = map (x: x.object) contents;
@ -27,5 +27,5 @@ stdenv.mkDerivation {
# For obtaining the closure of `contents'.
exportReferencesGraph =
map (x: [("closure-" + baseNameOf x.symlink) x.object]) contents;
pathsFromGraph = ../helpers/paths-from-graph.sh;
pathsFromGraph = ../helpers/paths-from-graph.pl;
}

View File

@ -20,23 +20,20 @@ for ((n = 0; n < ${#objects[*]}; n++)); do
suffix=${suffices[$n]}
if test "$suffix" = none; then suffix=; fi
# Get the paths in the closure of `object'.
closure=closure-$(basename $symlink)
if ! test -e $closure; then
echo 'Your Nix installation is too old! Upgrade to nix-0.11pre7038 or newer.'
exit 1
fi
storePaths=$($SHELL $pathsFromGraph $closure)
# Paths in cpio archives *must* be relative, otherwise the kernel
# won't unpack 'em.
(cd root && cp -prd --parents $storePaths .)
mkdir -p $(dirname root/$symlink)
ln -s $object$suffix root/$symlink
done
# Get the paths in the closure of `object'.
storePaths=$(perl $pathsFromGraph closure-*)
# Paths in cpio archives *must* be relative, otherwise the kernel
# won't unpack 'em.
(cd root && cp -prd --parents $storePaths .)
# Put the closure in a gzipped cpio archive.
ensureDir $out
(cd root && find * -print0 | cpio -ov -H newc --null | gzip -9 > $out/initrd)

View File

@ -1,10 +0,0 @@
graph="$1"
while read storePath; do
echo $storePath
read deriver
read count
for ((i = 0; i < $count; i++)); do
read ref
done
done < $graph

View File

@ -86,7 +86,7 @@ rec {
# The closure of the init script of boot stage 1 is what we put in
# the initial RAM disk.
initialRamdisk = import ../boot/make-initrd.nix {
inherit (pkgs) stdenv cpio;
inherit (pkgs) perl stdenv cpio;
contents = [
{ object = bootStage1;
symlink = "/init";