#!/bin/sh set -f iep_preserve_env() { ## preserve LD_PRELOAD unset __IEP_LD_PRELOAD __IEP_LD_PRELOAD="${LD_PRELOAD:-}" unset LD_PRELOAD ## glibc: preserve MALLOC_ARENA_MAX unset __IEP_MALLOC_ARENA_MAX __IEP_MALLOC_ARENA_MAX=${MALLOC_ARENA_MAX:-2} export MALLOC_ARENA_MAX=2 } iep_restore_env() { unset IEP_VERBOSE IEP_TRACE IEP_ROOT IEP_LOCAL_OVERRIDE ## restore LD_PRELOAD if [ -n "${__IEP_LD_PRELOAD}" ] ; then export LD_PRELOAD="${__IEP_LD_PRELOAD}" fi unset __IEP_LD_PRELOAD ## glibc: restore MALLOC_ARENA_MAX if [ "${MALLOC_ARENA_MAX}" = 2 ] ; then export MALLOC_ARENA_MAX="${__IEP_MALLOC_ARENA_MAX}" fi unset __IEP_MALLOC_ARENA_MAX } iep_preserve_env ## early setup TMPDIR (affects "mktemp") export TMPDIR=/run/angie/tmp [ -d "${TMPDIR}" ] || install -d -m 03777 "${TMPDIR}" ## RFC: no need to run entire entrypoint for custom command # case "$1" in # angie | */angie ) ;; # * ) # unset IEP_INIT DUMB_INIT_ARGS # iep_restore_env # exec "$@" # ;; # esac unset __IEP_SRC ; __IEP_SRC="${0##*/}" . /image-entry.d/00-common.envsh unexport IEP_INIT DUMB_INIT_ARGS ## run parts (if any) while read -r f ; do [ -n "$f" ] || continue [ -f "$f" ] || continue case "$f" in *.envsh ) if ! [ -x "$f" ] ; then log "NOT sourcing $f - not executable" continue fi log_always "sourcing $f" __IEP_SRC="$f" . "$f" __IEP_SRC="${0##*/}" ;; * ) if ! [ -x "$f" ] ; then log "NOT running $f - not executable" continue fi log_always "running $f" "$f" ;; esac done <