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
# 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"