3 echo $(( "${#elements}" ))
7 prefix_chunks
=$(count_chunks $NIX_STORE)
9 : ${storepath_length=${#NIX_STORE}}
10 : ${storepath_chunks=$prefix_chunks}
12 if [ "$storepath_chunks" -lt $prefix_chunks ]; then
13 echo "Need to have at least as much path elements as the initial prefix"
17 min_length
=$(( ${#NIX_STORE} + 2 * $storepath_chunks - 2 * $prefix_chunks ))
18 if [ "$storepath_length" -lt "$min_length" ]; then
19 echo "The storepath length needs to be at least the length of the prefix"
23 if [ "$storepath_chunks" -eq "$prefix_chunks" -a "$storepath_length" -gt "$min_length" ]; then
24 echo "You need at least one more chunk for a non-standard path length"
29 chunk_prefix
=$(for (( c=$prefix_chunks ; c < $storepath_chunks ; c++ )); do echo -n "/x"; done)
30 length_prefix
=$(for (( c=$(( ${#NIX_STORE} + ${#chunk_prefix} )) ; c
< $storepath_length ; c
++ )); do echo -n "x"; done)
31 out
="$out$chunk_prefix$length_prefix"
32 if [ -n $chunk_prefix -o -n $length_prefix ]; then
33 mkdir -p $(dirname $out)
39 installFlags
="${installFlags//$oldout/$out}"
40 configureFlags
="${configureFlags//$oldout/$out}"
41 if [ -n "$libc_path" ]; then
42 libc_oldpath
=$libc_path/lib
43 libc_newpath
=$(cat $libc_path/nix-support/new-out)/lib
44 configureFlags
="${configureFlags//$libc_oldpath/$libc_newpath}"
45 installFlags
="${installFlags//$libc_oldpath/$libc_newpath}"
50 if [ ! -d $out ]; then
53 mkdir -p $out/nix
-support
54 echo $out > $out/nix
-support/new
-out
57 overridePlaceholder
() {
58 function _callImplicitHook
{
61 if declare -F "$hookName" > /dev
/null
; then
63 elif type -p "$hookName" > /dev
/null
; then
65 elif [ -n "${!hookName:-}" ]; then
66 content
="${!hookName}"
67 eval "${content//$oldout/$out}"
74 preHooks
+=(appendOut overridePlaceholder
)
77 if [ "$out" != "$oldout" -a -f $out ]; then
85 if [ "$out" != "$oldout" -a -d $out ]; then
90 rename_generic_build
() {
91 eval "$(echo "orig_genericBuild()"; declare -f genericBuild
| tail -n +2)"
92 function genericBuild {
93 orig_genericBuild "$@
"
100 exitHooks+=(restoreSingleFile addSymlinks addNixSupport)
101 postHooks+=(rename_generic_build)