1 # Remove the initial slash from a path, since genisofs likes it that way.
4 if test "${res:0:1}" = /; then res
=${res:1}; fi
7 # Escape potential equal signs (=) with backslash (\=)
9 echo "$1" |
sed -e 's/\\/\\\\/g' -e 's/=/\\=/g'
12 # Queues an file/directory to be placed on the ISO.
13 # An entry consists of a local source path (2) and
14 # a destination path on the ISO (1).
18 echo "$(escapeEquals "$target")=$(escapeEquals "$source")" >> pathlist
21 stripSlash
"$bootImage"; bootImage
="$res"
24 if test -n "$bootable"; then
26 # The -boot-info-table option modifies the $bootImage file, so
27 # find it in `contents' and make a copy of it (since the original
28 # is read-only in the Nix store...).
29 for ((i
= 0; i
< ${#targets[@]}; i
++)); do
30 stripSlash
"${targets[$i]}"
31 if test "$res" = "$bootImage"; then
32 echo "copying the boot image ${sources[$i]}"
33 cp "${sources[$i]}" boot.img
39 isoBootFlags
="-eltorito-boot ${bootImage}
40 -eltorito-catalog .boot.cat
41 -no-emul-boot -boot-load-size 4 -boot-info-table
42 --sort-weight 1 /isolinux" # Make sure isolinux is near the beginning of the ISO
45 if test -n "$usbBootable"; then
46 usbBootFlags
="-isohybrid-mbr ${isohybridMbrImage}"
49 if test -n "$efiBootable"; then
50 efiBootFlags
="-eltorito-alt-boot
53 -isohybrid-gpt-basdat"
59 # Add the individual files.
60 for ((i
= 0; i
< ${#targets[@]}; i
++)); do
61 stripSlash
"${targets[$i]}"
62 addPath
"$res" "${sources[$i]}"
66 # Add the closures of the top-level store objects.
67 for i
in $
(< $closureInfo/store-paths
); do
71 # If needed, build a squashfs and add that
72 if [[ -n "$squashfsCommand" ]]; then
73 (out
="nix-store.squashfs" eval "$squashfsCommand")
74 addPath
"nix-store.squashfs" "nix-store.squashfs"
77 # Also include a manifest of the closures in a format suitable for
78 # nix-store --load-db.
79 if [[ ${#objects[*]} != 0 ]]; then
80 cp $closureInfo/registration nix-path-registration
81 addPath
"nix-path-registration" "nix-path-registration"
85 # Add symlinks to the top-level store objects.
86 for ((n
= 0; n
< ${#objects[*]}; n
++)); do
88 symlink
=${symlinks[$n]}
89 if test "$symlink" != "none"; then
90 mkdir
-p $
(dirname .
/$symlink)
91 ln -s $object .
/$symlink
92 addPath
"$symlink" "./$symlink"
98 # daed2280-b91e-42c0-aed6-82c825ca41f3 is an arbitrary namespace, to prevent
99 # independent applications from generating the same UUID for the same value.
100 # (the chance of that being problematic seem pretty slim here, but that's how
101 # version-5 UUID's work)
103 -boot_image any gpt_disk_guid=$(uuid -v 5 daed2280-b91e-42c0-aed6-82c825ca41f3 $out | tr -d -)
104 -volume_date all_file_dates =$SOURCE_DATE_EPOCH
111 -full-iso9660-filenames
121 $xorriso -output $out/iso
/$isoName
123 if test -n "$compressImage"; then
124 echo "Compressing image..."
125 zstd
-T$NIX_BUILD_CORES --rm $out/iso
/$isoName
128 mkdir
-p $out/nix-support
129 echo $system > $out/nix-support
/system
131 if test -n "$compressImage"; then
132 echo "file iso $out/iso/$isoName.zst" >> $out/nix-support
/hydra-build-products
134 echo "file iso $out/iso/$isoName" >> $out/nix-support
/hydra-build-products