2006-11-02 18:56:50 +01:00
|
|
|
source $stdenv/setup
|
|
|
|
|
|
|
|
set -o pipefail
|
|
|
|
|
2006-11-27 02:35:34 +01:00
|
|
|
objects=($objects)
|
|
|
|
symlinks=($symlinks)
|
|
|
|
suffices=($suffices)
|
|
|
|
|
2006-11-02 18:56:50 +01:00
|
|
|
mkdir root
|
2006-11-27 02:35:34 +01:00
|
|
|
|
|
|
|
# Needed for splash_helper, which gets run before init.
|
|
|
|
mkdir root/dev
|
|
|
|
mkdir root/sys
|
|
|
|
mkdir root/proc
|
|
|
|
|
|
|
|
|
|
|
|
for ((n = 0; n < ${#objects[*]}; n++)); do
|
|
|
|
object=${objects[$n]}
|
|
|
|
symlink=${symlinks[$n]}
|
|
|
|
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
|
2006-12-10 23:29:44 +01:00
|
|
|
|
2006-11-02 18:56:50 +01:00
|
|
|
|
|
|
|
# Put the closure in a gzipped cpio archive.
|
|
|
|
ensureDir $out
|
2006-11-27 02:35:34 +01:00
|
|
|
(cd root && find * -print0 | cpio -ov -H newc --null | gzip -9 > $out/initrd)
|