diff --git a/bin/._pman-composer_local_deps.php b/bin/._pman-composer_local_deps.php new file mode 100755 index 0000000..92aeda8 --- /dev/null +++ b/bin/._pman-composer_local_deps.php @@ -0,0 +1,14 @@ +#!/usr/bin/php +getLocalDeps(); +foreach ($deps as $dep => $path) { + echo "$path\n"; +} diff --git a/bin/._pman-composer_select_profile.php b/bin/._pman-composer_select_profile.php new file mode 100755 index 0000000..75cb8d9 --- /dev/null +++ b/bin/._pman-composer_select_profile.php @@ -0,0 +1,22 @@ +#!/usr/bin/php +selectProfile($profile, $config); +if (getenv("PMAN_COMPOSER_DEBUG")) { + $composer->print(); +} else { + $composer->write(); +} diff --git a/bin/_pman-composer_local_deps.php b/bin/_pman-composer_local_deps.php deleted file mode 100755 index 92aeda8..0000000 --- a/bin/_pman-composer_local_deps.php +++ /dev/null @@ -1,14 +0,0 @@ -#!/usr/bin/php -getLocalDeps(); -foreach ($deps as $dep => $path) { - echo "$path\n"; -} diff --git a/bin/_pman-composer_local_deps.php b/bin/_pman-composer_local_deps.php new file mode 120000 index 0000000..42fbf67 --- /dev/null +++ b/bin/_pman-composer_local_deps.php @@ -0,0 +1 @@ +runphp \ No newline at end of file diff --git a/bin/_pman-composer_select_profile.php b/bin/_pman-composer_select_profile.php deleted file mode 100755 index 75cb8d9..0000000 --- a/bin/_pman-composer_select_profile.php +++ /dev/null @@ -1,22 +0,0 @@ -#!/usr/bin/php -selectProfile($profile, $config); -if (getenv("PMAN_COMPOSER_DEBUG")) { - $composer->print(); -} else { - $composer->write(); -} diff --git a/bin/_pman-composer_select_profile.php b/bin/_pman-composer_select_profile.php new file mode 120000 index 0000000..42fbf67 --- /dev/null +++ b/bin/_pman-composer_select_profile.php @@ -0,0 +1 @@ +runphp \ No newline at end of file diff --git a/bin/runphp b/bin/runphp index 81a4f81..3e59b61 100755 --- a/bin/runphp +++ b/bin/runphp @@ -20,14 +20,25 @@ while true; do cd .. done -if [ -z "$PROJDIR" ]; then - # s'il n'y a pas de projet, --bs est l'action par défaut - [ $# -gt 0 ] || set -- --bs --ue -elif [ "$MYNAME" == composer ]; then +export RUNPHP_MOUNT= +if [ "$MYNAME" == composer ]; then set -- composer "$@" +elif [[ "$MYNAME" == *.php ]]; then + # frontend pour une commande php + set -- php "$MYDIR/.$MYNAME" "$@" + # s'assurer que NULIBDIR est monté + RUNPHP_MOUNT="$NULIBDIR" +elif [ $# -eq 0 ]; then + # s'il n'y a pas de projet, --bs est l'action par défaut + [ -n "$PROJDIR" ] || set -- --bs --ue else case "$1" in - *.php|*.phar) set -- php "$@";; + *.php|*.phar) + set -- php "$@" + # s'assurer que le répertoire du script est monté + setx RUNPHP_MOUNT=dirname "$1" + setx RUNPHP_MOUNT=abspath "$RUNPHP_MOUNT" + ;; esac fi diff --git a/runphp/runphp b/runphp/runphp index b227b17..74c682a 100755 --- a/runphp/runphp +++ b/runphp/runphp @@ -537,26 +537,34 @@ OPTIONS # monter le répertoire qui contient $PROJDIR mount_composer= - mount_runphp=1 + mount_standalone=1 + mount_mount=1 if [ -z "$PROJDIR" -o "${PROJDIR#$HOME/}" != "$PROJDIR" -o "$PROJDIR" == "$HOME" ]; then # bind mount $HOME args+=(-v "$HOME:$HOME${UseRslave:+:rslave}") - [ -n "$RUNPHP_STANDALONE" ] && - [ "${RUNPHP_STANDALONE#$HOME/}" != "$RUNPHP_STANDALONE" ] && - mount_runphp= + if [ -n "$RUNPHP_STANDALONE" -a "${RUNPHP_STANDALONE#$HOME/}" != "$RUNPHP_STANDALONE" ]; then + mount_standalone= + fi + if [ -n "$RUNPHP_MOUNT" -a "${RUNPHP_MOUNT#$HOME/}" != "$RUNPHP_MOUNT" ]; then + mount_mount= + fi elif [ -n "$PROJDIR" ]; then # bind mount uniquement le répertoire du projet args+=(-v "$PROJDIR:$PROJDIR${UseRslave:+:rslave}") mount_composer=1 - [ "$RUNPHP_STANDALONE" == "$PROJDIR" ] && mount_runphp= + [ "$RUNPHP_STANDALONE" == "$PROJDIR" ] && mount_standalone= + [ "$RUNPHP_MOUNT" == "$PROJDIR" ] && mount_mount= fi if [ -n "$mount_composer" -a -d "$HOME/.composer" ]; then # monter la configuration de composer args+=(-v "$HOME/.composer:$HOME/.composer") fi - if [ -n "$RUNPHP_STANDALONE" -a -n "$mount_runphp" ]; then + if [ -n "$RUNPHP_STANDALONE" -a -n "$mount_standalone" ]; then args+=(-v "$RUNPHP_STANDALONE:$RUNPHP_STANDALONE") fi + if [ -n "$RUNPHP_MOUNT" -a -n "$mount_mount" ]; then + args+=(-v "$RUNPHP_MOUNT:$RUNPHP_MOUNT") + fi args+=(-w "$(pwd)") # lancer avec l'utilisateur courant