nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at haskell-updates 45 lines 1.2 kB view raw
1set -o pipefail 2 3mkdir root 4 5# Needed for splash_helper, which gets run before init. 6mkdir root/dev 7mkdir root/sys 8mkdir root/proc 9 10 11for ((n = 0; n < ${#objects[@]}; n++)); do 12 object=${objects[n]} 13 symlink=${symlinks[n]} 14 suffix=${suffices[n]} 15 if test "$suffix" = none; then suffix=; fi 16 17 mkdir -p $(dirname root/$symlink) 18 ln -s $object$suffix root/$symlink 19done 20 21 22# Get the paths in the closure of `object'. 23storePaths="$(cat $closureInfo/store-paths)" 24 25 26# Paths in cpio archives *must* be relative, otherwise the kernel 27# won't unpack 'em. 28(cd root && cp -prP --parents $storePaths .) 29 30 31# Put the closure in a gzipped cpio archive. 32mkdir -p $out 33for PREP in ${prepend[@]}; do 34 cat $PREP >> $out/initrd 35done 36(cd root && find * .[^.*] -exec touch -h -d '@1' '{}' +) 37(cd root && find * .[^.*] -print0 | sort -z | cpio --quiet -o -H newc -R +0:+0 --reproducible --null | eval -- $compress >> "$out/initrd") 38 39if [ -n "$makeUInitrd" ]; then 40 mkimage -A "$uInitrdArch" -O linux -T ramdisk -C "$uInitrdCompression" -d "$out/initrd" $out/initrd.img 41 # Compatibility symlink 42 ln -sf "initrd.img" "$out/initrd" 43else 44 ln -s "initrd" "$out/initrd$extension" 45fi