diff --git a/boot/make-initrd.nix b/boot/make-initrd.nix index b737b2f9779..3e5133be08b 100644 --- a/boot/make-initrd.nix +++ b/boot/make-initrd.nix @@ -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; } diff --git a/boot/make-initrd.sh b/boot/make-initrd.sh index 45ee036e4e8..d930e51a03f 100644 --- a/boot/make-initrd.sh +++ b/boot/make-initrd.sh @@ -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) diff --git a/helpers/paths-from-graph.sh b/helpers/paths-from-graph.sh deleted file mode 100644 index 4a134cb3165..00000000000 --- a/helpers/paths-from-graph.sh +++ /dev/null @@ -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 diff --git a/system/system.nix b/system/system.nix index b63e48ce201..4f272d8d7a5 100644 --- a/system/system.nix +++ b/system/system.nix @@ -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";