2023-10-03 04:17:01 +04:00
|
|
|
#!/bin/bash
|
|
|
|
# -*- coding: utf-8 mode: sh -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8
|
2023-10-03 05:48:47 +04:00
|
|
|
source "$(dirname -- "$0")/../load.sh" || exit 1
|
2023-10-03 04:17:01 +04:00
|
|
|
|
|
|
|
case "$MYNAME" in
|
|
|
|
runphp) ;;
|
|
|
|
composer)
|
|
|
|
if [ -f "$MYDIR/composer.phar" ]; then
|
|
|
|
set -- "$MYDIR/composer.phar" "$@"
|
|
|
|
elif [ -f "$MYDIR/../sbin/composer.phar" ]; then
|
|
|
|
set -- "$MYDIR/../sbin/composer.phar" "$@"
|
|
|
|
elif [ -f "/usr/bin/composer" ]; then
|
|
|
|
set -- "/usr/bin/composer" "$@"
|
|
|
|
else
|
|
|
|
set -- "" "$@"
|
|
|
|
fi
|
|
|
|
;;
|
|
|
|
*) die "$MYNAME: nom de script invalide";;
|
|
|
|
esac
|
|
|
|
|
|
|
|
function runphp_help() {
|
|
|
|
echo "$MYNAME: lance un programme PHP en sélectionnant une version en particulier
|
|
|
|
|
|
|
|
USAGE
|
|
|
|
$MYNAME [options] <SCRIPT.php> [args...]
|
|
|
|
|
|
|
|
OPTIONS
|
|
|
|
-s, --min PHP_MIN
|
|
|
|
-m, --max PHP_MAX
|
|
|
|
-i, --image IMAGE"
|
|
|
|
}
|
|
|
|
|
|
|
|
SOPTS=+smi
|
|
|
|
LOPTS=help,php-min,min,php-max,max,image
|
|
|
|
args="$(getopt -n runphp -o "$SOPTS" -l "$LOPTS" -- "$@")" || exit 1; eval "set -- $args"
|
|
|
|
|
|
|
|
while [ $# -gt 0 ]; do
|
|
|
|
case "$1" in
|
|
|
|
--) shift; break;;
|
|
|
|
--help) runphp_help; exit 0;;
|
|
|
|
*) die "$1: option non configurée";;
|
|
|
|
esac
|
|
|
|
shift
|
|
|
|
done
|
|
|
|
|
|
|
|
script="$1"; shift
|
|
|
|
[ -n "$script" ] || die "vous devez spécifier le script à lancer"
|
|
|
|
[ -f "$script" ] || die "$script: script introuvable"
|
|
|
|
|
|
|
|
scriptdir="$(dirname -- "$script")"
|
|
|
|
scritname="$(basename -- "$script")"
|