diff --git a/support/template-_wrapper.sh b/support/template-_wrapper.sh index 23170f3..5d75dd8 100644 --- a/support/template-_wrapper.sh +++ b/support/template-_wrapper.sh @@ -21,7 +21,7 @@ COMPOSE_SERVICE=web # Montages dans docker-compose.yml # les répertoires relatifs le sont par rapport au répertoire du projet COMPOSE_MOUNTS=( - devel:/data/php74-template + devel:/data/PROJNAME .:/var/www/app ) @@ -29,14 +29,11 @@ COMPOSE_MOUNTS=( case "${RUNPHP_MODE:-auto}" in auto) - RUNPHP_MODE=host - if [ -f /.dockerenv ]; then - RUNPHP_MODE=docker - elif [ -f /proc/1/cgroup ]; then - grep -q ':/docker/' /proc/1/cgroup && RUNPHP_MODE=docker - elif [ -f /proc/self/mountinfo ]; then - grep -q ' /docker/' /proc/self/mountinfo && RUNPHP_MODE=docker - fi + RUNPHP_MODE= + [ -f /.dockerenv ] && RUNPHP_MODE=docker + [ -z "$RUNPHP_MODE" -a -f /proc/self/mountinfo ] && grep -q ' /docker/' /proc/self/mountinfo && RUNPHP_MODE=docker + [ -z "$RUNPHP_MODE" -a -f /proc/1/cgroup ] && grep -q ':/docker/' /proc/1/cgroup && RUNPHP_MODE=docker + [ -n "$RUNPHP_MODE" ] || RUNPHP_MODE=host ;; docker) RUNPHP_MODE=docker;; host) RUNPHP_MODE=host;; @@ -81,13 +78,15 @@ MYTRUEDIR="$(dirname -- "$MYTRUESELF")" PROJDIR="$(cd "$MYTRUEDIR${PROJPATH:+/$PROJPATH}"; pwd)" if [ "$RUNPHP_MODE" == host ]; then + projname="$(basename "$PROJDIR")"; projname="${projname%-app}" cwd="$(pwd)" found= workdir= for mounts in "${COMPOSE_MOUNTS[@]}"; do hdir="${mounts%%:*}" - ddir="${mounts#*:}" hdir="$(cd "$PROJDIR/$hdir"; pwd)" + ddir="${mounts#*:}" + ddir="${ddir/PROJNAME/$projname}" if [ "$cwd" == "$hdir" ]; then found=1 workdir="$ddir"