1sources_=($sources)
2targets_=($targets)
3
4objects=($objects)
5symlinks=($symlinks)
6
7
8# Remove the initial slash from a path, since genisofs likes it that way.
9stripSlash() {
10 res="$1"
11 if test "${res:0:1}" = /; then res=${res:1}; fi
12}
13
14# Add the individual files.
15for ((i = 0; i < ${#targets_[@]}; i++)); do
16 stripSlash "${targets_[$i]}"
17 mkdir -p "$(dirname "$res")"
18 cp -a "${sources_[$i]}" "$res"
19done
20
21
22# Add the closures of the top-level store objects.
23chmod +w .
24mkdir -p nix/store
25for i in $(< $closureInfo/store-paths); do
26 cp -a "$i" "${i:1}"
27done
28
29
30# TODO tar ruxo
31# Also include a manifest of the closures in a format suitable for
32# nix-store --load-db.
33cp $closureInfo/registration nix-path-registration
34
35# Add symlinks to the top-level store objects.
36for ((n = 0; n < ${#objects[*]}; n++)); do
37 object=${objects[$n]}
38 symlink=${symlinks[$n]}
39 if test "$symlink" != "none"; then
40 mkdir -p $(dirname ./$symlink)
41 ln -s $object ./$symlink
42 fi
43done
44
45$extraCommands
46
47mkdir -p $out/tarball
48
49rm env-vars
50
51time tar --sort=name --mtime='@1' --owner=0 --group=0 --numeric-owner -c * $extraArgs | $compressCommand > $out/tarball/$fileName.tar${extension}
52
53mkdir -p $out/nix-support
54echo $system > $out/nix-support/system
55echo "file system-tarball $out/tarball/$fileName.tar${extension}" > $out/nix-support/hydra-build-products