1
0
angie-conv-image/image-entry.d/72-merge-tree.sh

44 lines
869 B
Bash
Raw Normal View History

2024-07-11 13:37:35 +03:00
#!/bin/sh
set -ef
. /image-entry.d/00-common.envsh
[ -d "${merged_root}" ] || install -d "${merged_root}"
2024-07-26 01:18:59 +03:00
remap_path_int() {
printf '%s' "$2/${1#*/}"
}
remap_path() {
case "$1" in
/etc/angie/* ) remap_path_int "${1#/etc/angie/}" "$2" ;;
/angie/* ) remap_path_int "${1#/angie/}" "$2" ;;
## misbehavior!
* )
log_always "remap_path() doesn't know how to handle this path: '$1'"
return 1
;;
esac
}
2024-07-31 14:04:15 +03:00
for n in j2cfg ${NGX_DIRS_MERGE} ; do
2024-07-20 16:35:39 +03:00
[ -n "$n" ] || continue
2024-07-11 13:37:35 +03:00
merged_dir="${merged_root}/$n"
while read -r old_path ; do
[ -n "${old_path}" ] || continue
new_path=$(remap_path "${old_path}" "${merged_dir}")
[ -n "${new_path}" ]
new_dir="${new_path%/*}"
[ -d "${new_dir}" ] || mkdir -p "${new_dir}"
ln_s "${old_path}" "${new_path}"
done <<-EOF
$(overlay-dir-list.sh "/etc/angie/$n.dist" "/etc/angie/$n" "/angie/$n")
EOF
done
exit 0