modifs.mineures sans commentaires

This commit is contained in:
Jephté Clain 2024-10-12 14:58:48 +04:00
parent b42f558e81
commit 594033505f
1 changed files with 9 additions and 10 deletions

View File

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