correction d'un bug avec la recherche d'un fichier de recette
This commit is contained in:
parent
98ba626897
commit
35eadc17af
|
@ -479,6 +479,8 @@ function runs_find_scriptfile() {
|
|||
# initialiser les variables RUNSDIR, RUNSSCRIPT, RUNSSCRIPTDIR,
|
||||
# RUNSSCRIPTNAME, RUNSDIRPATH et RUNSSCRIPTPATH. Retourner 0 en cas de
|
||||
# succès, 1 en cas d'échec.
|
||||
# $6 vaut ".rs" par défaut est c'est une extension à rajouter au nom
|
||||
# spécifié si le fichier sans l'extension n'existe pas
|
||||
# RUNSDIR est le répertoire dans lequel a été trouvé le script (parmi les
|
||||
# valeurs fournies dans les tableaux RUNSSCRIPTSDIRS, RUNSMODULESDIRS,
|
||||
# RUNSHOSTSDIRS), RUNSDIRPATH est le répertoire à partir duquel est exprimé
|
||||
|
@ -493,6 +495,7 @@ function runs_find_scriptfile() {
|
|||
local __runsscriptsdirs="${3:-RUNSSCRIPTSDIRS}[@]"
|
||||
local __runsmodulesdirs="${4:-RUNSMODULESDIRS}[@]"
|
||||
local __runshostsdirs="${5:-RUNSHOSTSDIRS}[@]"
|
||||
local __runsext="${6:-.rs}"
|
||||
local __domain __hostname
|
||||
local __runsdir __runsfile
|
||||
|
||||
|
@ -505,8 +508,8 @@ function runs_find_scriptfile() {
|
|||
"$__runsdir/$__domain/$__hostname/runs/$__scriptfile" \
|
||||
"$__runsdir/$__runshost/$__scriptfile" \
|
||||
"$__runsdir/$__domain/$__hostname/$__scriptfile"; do
|
||||
if [ ! -f "$__runsfile" -a -f "$__runsfile.rs" ]; then
|
||||
__runsfile="$__runsfile.rs"
|
||||
if [ "${__runsfile%$__runsext}" == "$__runsfile" ]; then
|
||||
[ ! -f "$__runsfile" -a -f "$__runsfile$__runsext" ] && __runsfile="$__runsfile$__runsext"
|
||||
fi
|
||||
if [ -e "$__runsfile" ]; then
|
||||
runs_initvars "$__runsfile" "$__runsdir" "$__runsdirpath" "$__scriptfile"
|
||||
|
@ -518,8 +521,8 @@ function runs_find_scriptfile() {
|
|||
# puis chercher dans les répertoires des scripts et des modules
|
||||
for __runsdir in "${!__runsscriptsdirs}" "${!__runsmodulesdirs}"; do
|
||||
__runsfile="$__runsdir/$__scriptfile"
|
||||
if [ ! -f "$__runsfile" -a -f "$__runsfile.rs" ]; then
|
||||
__runsfile="$__runsfile.rs"
|
||||
if [ "${__runsfile%$__runsext}" == "$__runsfile" ]; then
|
||||
[ ! -f "$__runsfile" -a -f "$__runsfile$__runsext" ] && __runsfile="$__runsfile$__runsext"
|
||||
fi
|
||||
if [ -e "$__runsfile" ]; then
|
||||
runs_initvars "$__runsfile" "$__runsdir" "$__runsdir" "$__scriptfile"
|
||||
|
@ -646,7 +649,9 @@ function runs_recipe() {
|
|||
fi
|
||||
fi
|
||||
fi
|
||||
[ ! -f "$recipe" -a -f "$recipe.rr" ] && recipe="$recipe.rr"
|
||||
if [ "${recipe%.rr}" == "$recipe" ]; then
|
||||
[ ! -f "$recipe" -a -f "$recipe.rr" ] && recipe="$recipe.rr"
|
||||
fi
|
||||
if [ ! -f "$recipe" ]; then
|
||||
eerror "$(ppath "$recipe"): fichier introuvable"
|
||||
return 1
|
||||
|
@ -737,15 +742,7 @@ function runs_recipepath() {
|
|||
# pas été trouvé, sinon retourner la valeur de retour de runs_recipe()
|
||||
local RUNSDIR RUNSSCRIPT RUNSSCRIPTDIR RUNSSCRIPTNAME RUNSDIRPATH RUNSSCRIPTPATH
|
||||
local RUNSSCRIPTSDIRS RUNSMODULESDIRS RUNSHOSTSDIRS; __runs_setpath
|
||||
if [ "${1%.rr}" == "$1" ]; then
|
||||
# essayer d'abord avec l'extension .rr
|
||||
if runs_find_scriptfile "$1"; then
|
||||
runs_recipe "$RUNSSCRIPT"
|
||||
return $?
|
||||
fi
|
||||
fi
|
||||
|
||||
if ! runs_find_scriptfile "$1"; then
|
||||
if ! runs_find_scriptfile "$1" "" "" "" "" ".rr"; then
|
||||
eerror "$1: fichier introuvable. Vérifiez les valeurs suivantes:
|
||||
RUNSSCRIPTSPATH=$RUNSSCRIPTSPATH
|
||||
RUNSMODULESPATH=$RUNSMODULESPATH
|
||||
|
|
Loading…
Reference in New Issue