#!/bin/sh set -ef . /run/ngx/iep/00-common.envsh ## hack: override "cache", "lib" and "log" from /angie (and possibly from /etc/angie) fake_dir=$(mktemp -d) if [ "${NGX_HTTP_STATIC_MERGE}" = 0 ] ; then persist_dirs="${persist_dirs} static" fi for n in ${persist_dirs} ; do touch "${fake_dir}/$n" ; done install -d "${target_root}" overlaydirs --merge "${target_root}" /etc/angie.dist /etc/angie /angie "${fake_dir}" ## fixup after merge for n in ${persist_dirs} ; do rm -f "${target_root}/$n" ; done rm -rf "${fake_dir}" if [ -d "${target_root}/mod" ] ; then find "${target_root}/mod/" -follow -name '.*.preseed' -type f -exec rm -f {} + fi if [ "${NGX_HTTP_STATIC_MERGE}" = 0 ] ; then src0=/etc/angie.dist/static dst="${target_root}/static" for r in /angie /etc/angie ; do src="$r/static" [ -d "${src}" ] || continue if [ -h "${src}" ] ; then log_always "${src} is a symbolic link, skipping!" continue fi install -d "${dst}" overlaydirs --merge "${dst}" ${src0} "${src}" break done [ -d "${dst}" ] || { log_always "static directory is almost empty!" install -d "${dst}" overlaydirs --merge "${dst}" ${src0} } fi exit 0