corriger runphp

This commit is contained in:
Jephté Clain 2025-02-12 21:11:21 +04:00
parent 1448e18fe6
commit 682e4048b1
2 changed files with 50 additions and 34 deletions

View File

@ -22,7 +22,7 @@ done
if [ -z "$PROJDIR" ]; then if [ -z "$PROJDIR" ]; then
# s'il n'y a pas de projet, --bs est l'action par défaut # s'il n'y a pas de projet, --bs est l'action par défaut
[ $# -gt 0 ] || set -- --bs [ $# -gt 0 ] || set -- --bs --ue
elif [ "$MYNAME" == composer ]; then elif [ "$MYNAME" == composer ]; then
set -- composer "$@" set -- composer "$@"
else else

View File

@ -183,7 +183,10 @@ elif [ "$1" == --runphp-exec ]; then
Bootstrap= Bootstrap=
shift shift
elif [ "$1" == --runphp-install -o "$1" == --ci ]; then elif [ "$1" == --runphp-install -o "$1" == --ci ]; then
ComposerInstall=1 ComposerInstall=ci
shift
elif [ "$1" == --runphp-update -o "$1" == --cu ]; then
ComposerInstall=cu
shift shift
fi fi
@ -200,7 +203,7 @@ if [ -z "$Bootstrap" -a -z "$RUNPHP_STANDALONE" ]; then
if [ -n "$ForcedBootstrap" ]; then if [ -n "$ForcedBootstrap" ]; then
[ "$RUNPHP_MODE" != docker ] && eecho "== bootstrapping runphp" [ "$RUNPHP_MODE" != docker ] && eecho "== bootstrapping runphp"
Bootstrap=1 Bootstrap=1
ComposerInstall=1 ComposerInstall=ci
fi fi
fi fi
@ -298,7 +301,10 @@ if [ "$RUNPHP_MODE" != docker ]; then
after_source_buildenv after_source_buildenv
fi fi
ensure_image ensure_image
check_image || Bootstrap=1 if ! check_image; then
ForcedBootstrap=1
Bootstrap=1
fi
fi fi
Chdir= Chdir=
@ -342,7 +348,7 @@ if [ "$RUNPHP_MODE" != docker ]; then
runphp: construire l'image docker runphp: construire l'image docker
USAGE USAGE
$MYNAME --bootstrap [options...] $MYNAME --runphp-bootstrap [options...]
OPTIONS OPTIONS
-c, --config build.env -c, --config build.env
@ -369,7 +375,8 @@ OPTIONS
-z|--timezone) shift; TIMEZONE="$1";; -z|--timezone) shift; TIMEZONE="$1";;
-r|--privareg) shift; PRIVAREG="$1";; -r|--privareg) shift; PRIVAREG="$1";;
-p|--push) Push=1;; -p|--push) Push=1;;
--ci) ComposerInstall=1;; --ci) ComposerInstall=ci;;
--cu) ComposerInstall=cu;;
--no-use-rslave) UseRslave=;; --no-use-rslave) UseRslave=;;
*) die "$1: option non configurée";; *) die "$1: option non configurée";;
esac esac
@ -420,23 +427,31 @@ OPTIONS
fi fi
if [ -z "$RUNPHP_STANDALONE" -a ! -f "$PROJDIR/$VENDORDIR/nulib/php/load.sh" ]; then if [ -z "$RUNPHP_STANDALONE" -a ! -f "$PROJDIR/$VENDORDIR/nulib/php/load.sh" ]; then
# Forcer l'installation des dépendances si nécessaire # Forcer l'installation des dépendances si nécessaire
ComposerInstall=1 [ -n "$ComposerInstall" ] || ComposerInstall=ci
fi fi
[ -z "$ComposerInstall" -o -n "$UnlessExists" ] && exit 0
else if [ -n "$ForcedBootstrap" ]; then
## Mode exécution de commande ########################################## # si le bootstrap est forcé, ne continuer que s'il y a des arguments
# Ici, on a déterminé qu'il faut lancer une commande [ $# -eq 0 ] && exit 0
else
# si le bootstrap a été demandé, ne continuer que s'il faut
# installer les dépendances
[ -z "$ComposerInstall" ] && exit 0
fi
fi
SOPTS=+w: ## Mode exécution de commande ##########################################
LOPTS=help,chdir:,no-use-rslave # Ici, on a déterminé qu'il faut lancer une commande
args="$(getopt -n "$MYNAME" -o "$SOPTS" -l "$LOPTS" -- "$@")" || exit 1; eval "set -- $args"
while [ $# -gt 0 ]; do SOPTS=+w:
case "$1" in LOPTS=help,chdir:,no-use-rslave
--) shift; break;; args="$(getopt -n "$MYNAME" -o "$SOPTS" -l "$LOPTS" -- "$@")" || exit 1; eval "set -- $args"
--help)
eecho "\ while [ $# -gt 0 ]; do
case "$1" in
--) shift; break;;
--help)
eecho "\
runphp: lancer une commande dans un environnement PHP déterminé runphp: lancer une commande dans un environnement PHP déterminé
USAGE USAGE
@ -456,19 +471,18 @@ courant est forcé au répertoire du projet composer
OPTIONS OPTIONS
-w, --chdir CHDIR -w, --chdir CHDIR
aller dans le répertoire spécifié avant de lancer la commande" aller dans le répertoire spécifié avant de lancer la commande"
exit 0 exit 0
;; ;;
-w|--chdir) shift; Chdir="$1";; -w|--chdir) shift; Chdir="$1";;
--no-use-rslave) UseRslave=;; --no-use-rslave) UseRslave=;;
*) die "$1: option non configurée";; *) die "$1: option non configurée";;
esac esac
shift shift
done done
if [ -z "$RUNPHP_STANDALONE" -a ! -f "$PROJDIR/$VENDORDIR/nulib/php/load.sh" ]; then if [ -z "$RUNPHP_STANDALONE" -a ! -f "$PROJDIR/$VENDORDIR/nulib/php/load.sh" ]; then
# Forcer l'installation des dépendances si nécessaire # Forcer l'installation des dépendances si nécessaire
ComposerInstall=1 ComposerInstall=ci
fi
fi fi
## Lancer la commande ## Lancer la commande
@ -529,7 +543,7 @@ OPTIONS
"$Image" "$Image"
exec "$0" ${Chdir:+-w "$Chdir"} exec "$0" ${Chdir:+-w "$Chdir"}
) )
[ -n "$ComposerInstall" ] && set -- ci [ -n "$ComposerInstall" ] && set -- "$ComposerInstall" "$@"
[ -n "$Verbose" ] && eecho "\$ docker ${args[*]} $*" [ -n "$Verbose" ] && eecho "\$ docker ${args[*]} $*"
exec docker "${args[@]}" "$@" exec docker "${args[@]}" "$@"
@ -568,10 +582,12 @@ else
die "no command specified" die "no command specified"
elif [ "$1" == ci ]; then elif [ "$1" == ci ]; then
eecho "== installing composer dependencies" eecho "== installing composer dependencies"
composer i shift
composer i "$@"
elif [ "$1" == cu ]; then elif [ "$1" == cu ]; then
eecho "== upgrading composer dependencies" eecho "== upgrading composer dependencies"
composer u shift
composer u "$@"
elif [ "$1" == composer ]; then elif [ "$1" == composer ]; then
"$@" "$@"
else else