2006-11-02 18:56:50 +01:00
|
|
|
source $stdenv/setup
|
|
|
|
|
|
|
|
set -o pipefail
|
|
|
|
|
2006-11-17 15:13:21 +01:00
|
|
|
# Get the paths in the closure of `init'.
|
|
|
|
if ! test -e ./init-closure; then
|
|
|
|
echo 'Your Nix installation is too old! Upgrade to nix-0.11pre7038 or newer.'
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
storePaths=$($SHELL $pathsFromGraph ./init-closure)
|
2006-11-02 18:56:50 +01:00
|
|
|
|
|
|
|
# Paths in cpio archives *must* be relative, otherwise the kernel
|
|
|
|
# won't unpack 'em.
|
|
|
|
mkdir root
|
|
|
|
cd root
|
2006-11-17 15:13:21 +01:00
|
|
|
cp -prd --parents $storePaths .
|
2006-11-02 18:56:50 +01:00
|
|
|
|
|
|
|
# Put the closure in a gzipped cpio archive.
|
|
|
|
ensureDir $out
|
|
|
|
ln -s $init init
|
|
|
|
find * -print0 | cpio -ov -H newc --null | gzip -9 > $out/initrd
|