From a02d25f8d1b1c5949390a63a95a5e37c5b0f8aad Mon Sep 17 00:00:00 2001 From: Jephte Clain Date: Wed, 27 Mar 2024 21:39:01 +0400 Subject: [PATCH] modifs.mineures sans commentaires --- support/rundk | 24 +++++++++++++++++------- support/template.sh | 9 ++++++--- 2 files changed, 23 insertions(+), 10 deletions(-) diff --git a/support/rundk b/support/rundk index f959e00..f2407f7 100755 --- a/support/rundk +++ b/support/rundk @@ -13,7 +13,6 @@ # racine du projet. Le cas échéant, modifier les valeurs ci-dessous MYDIR="$(cd "$(dirname -- "$0")"; pwd)" MYNAME="$(basename -- "$0")" -MYSELF="$MYDIR/$MYNAME" ################################################################################ # Modifier les valeurs suivantes si nécessaire @@ -80,16 +79,19 @@ function composer() { bootstrap= BootstrapOnly=1 +ComposerInstall= ForcedBootstrap= parse_opts=1 args=() for arg in "$@"; do if [ -z "$parse_opts" ]; then args+=("$arg") - elif [ "$arg" == --bootstrap ]; then + elif [ "$arg" == --bootstrap -o "$arg" == --bs ]; then bootstrap=1 elif [ "$arg" == --exec ]; then BootstrapOnly= + elif [ "$arg" == --composer-install -o "$arg" == --ci ]; then + ComposerInstall=1 elif [[ "$arg" == -* ]]; then args+=("$arg") else @@ -113,7 +115,7 @@ if [ -z "$bootstrap" ]; then fi if [ -n "$ForcedBootstrap" ]; then - [ -z "$_RUNDK_IN_DOCKER" ] && eecho "== rundk bootstrap is needed" + [ -z "$_RUNDK_IN_DOCKER" ] && eecho "== bootstrap rundk is needed" bootstrap=1 BootstrapOnly= fi @@ -220,7 +222,7 @@ if [ -z "$_RUNDK_IN_DOCKER" ]; then ) SOPTS=+d:9876543210:c:UjDx:z:r:pw:v - LOPTS=help,dist:,d19,d18,d17,d16,d15,d14,d13,d12,d11,d10,config:,unless-exists,pull,no-cache,plain-output,apt-proxy:,timezone:,privareg:,push,chdir:,verbose,no-use-rslave + LOPTS=help,dist:,d19,d18,d17,d16,d15,d14,d13,d12,d11,d10,config:,ue,unless-exists,pull,nc,no-cache,po,plain-output,apt-proxy:,timezone:,privareg:,push,chdir:,verbose,no-use-rslave args="$(getopt -n "$MYNAME" -o "$SOPTS" -l "$LOPTS" -- "$@")" || exit 1; eval "set -- $args" Dist= @@ -268,10 +270,10 @@ OPTIONS -[0-9]) Dist="d1${1#-}";; --d*) Dist="${1#--}";; -c|--config) shift; Config="$1";; - --unless-exists) UnlessExists=1;; + --ue|--unless-exists) UnlessExists=1;; -U|--pull) Pull=1;; - -j|--no-cache) NoCache=1;; - -D|--plain-output) PlainOutput=1;; + -j|--nc|--no-cache) NoCache=1;; + -D|--po|--plain-output) PlainOutput=1;; -x|--apt-proxy) shift; APT_PROXY="$1";; -z|--timezone) shift; TIMEZONE="$1";; -r|--privareg) shift; PRIVAREG="$1";; @@ -319,6 +321,10 @@ OPTIONS docker push "$IMAGE" || exit 1 fi fi + if [ -n "$ComposerInstall" -a ! -f "$PROJDIR/$VENDORDIR/nulib/php/load.sh" ]; then + BootstrapOnly= + ForcedBootstrap=1 + fi [ -n "$BootstrapOnly" ] && exit 0 else @@ -363,6 +369,10 @@ OPTIONS esac shift done + + if [ -n "$ComposerInstall" -a ! -f "$PROJDIR/$VENDORDIR/nulib/php/load.sh" ]; then + ForcedBootstrap=1 + fi fi ## Lancer la commande diff --git a/support/template.sh b/support/template.sh index c92b292..bf0f4d1 100755 --- a/support/template.sh +++ b/support/template.sh @@ -1,11 +1,14 @@ #!/bin/bash # -*- coding: utf-8 mode: sh -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8 # Modèle de script utilisant rundk pour lancer un traitement dans un container +# Ce script est à la racine du projet et rundk se trouve dans sbin/ MYDIR="$(dirname -- "$0")"; MYNAME="$(basename -- "$0")" -[ -n "$_RUNDK_IN_DOCKER" ] || -exec "$MYDIR/rundk" --bootstrap --unless-exists --exec -- "$MYDIR/$MYNAME" "$@" -source "$MYDIR/../vendor/nulib/php/load.sh" || exit 1 +if [ -z "$_RUNDK_IN_DOCKER" ]; then + "$MYDIR/sbin/rundk" --bs --ue --ci || exit 1 + exec "$MYDIR/sbin/rundk" "$0" "$@" +fi +source "$MYDIR/vendor/nulib/php/load.sh" || exit 1 args=( "description"