nulib/bin/runphp

41 lines
1003 B
Bash
Executable File

#!/bin/bash
# -*- coding: utf-8 mode: sh -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8
source "$(dirname -- "$0")/../load.sh" || exit 1
PROJDIR=
while true; do
cwd="$(pwd)"
if [ -f .runphp.conf ]; then
PROJDIR="$cwd"
break
elif [ -f composer.json ]; then
PROJDIR="$cwd"
break
fi
if [ "$cwd" == "$HOME" -o "$cwd" == / ]; then
die "Impossible de trouver un projet PHP"
fi
cd ..
done
case "$MYNAME" in
composer) set -- composer "$@";;
esac
export RUNPHP_STANDALONE=
RUNPHP=; DIST=; REGISTRY=
if [ -f "$PROJDIR/.runphp.conf" ]; then
source "$PROJDIR/.runphp.conf"
[ -n "$RUNPHP" ] && exec "$PROJDIR/$RUNPHP" "$@"
elif [ -f "$PROJDIR/sbin/runphp" ]; then
exec "$PROJDIR/sbin/runphp" "$@"
elif [ -f "$PROJDIR/runphp" ]; then
exec "$PROJDIR/runphp" "$@"
fi
export RUNPHP_STANDALONE="$NULIBDIR"
export RUNPHP_PROJDIR="$PROJDIR"
export RUNPHP_REGISTRY="$REGISTRY"
export RUNPHP_DIST="$DIST"
exec "$MYDIR/../runphp/runphp" "$@"