runs et rruns: améliorer le calcul des chemins
This commit is contained in:
parent
55c57551eb
commit
30e5ddabbb
|
@ -2,12 +2,15 @@
|
||||||
|
|
||||||
# Liste des répertoires à considérer pour la recherche de scripts runs
|
# Liste des répertoires à considérer pour la recherche de scripts runs
|
||||||
#RUNSSCRIPTSPATH=
|
#RUNSSCRIPTSPATH=
|
||||||
|
#RUNSSCRIPTSDIRS=()
|
||||||
|
|
||||||
# Liste des répertoires à considérer pour la recherche de modules installables
|
# Liste des répertoires à considérer pour la recherche de modules installables
|
||||||
#RUNSMODULESPATH=
|
#RUNSMODULESPATH=
|
||||||
|
#RUNSMODULESDIRS=()
|
||||||
|
|
||||||
# Liste des répertoires à considérer pour la recherche de répertoires d'hôtes
|
# Liste des répertoires à considérer pour la recherche de répertoires d'hôtes
|
||||||
#RUNSHOSTSPATH=
|
#RUNSHOSTSPATH=
|
||||||
|
#RUNSHOSTSDIRS=()
|
||||||
|
|
||||||
# Liste des domaines à rechercher, si un hôte déjà configuré est donné sans
|
# Liste des domaines à rechercher, si un hôte déjà configuré est donné sans
|
||||||
# domaine. Si cette liste est vide, le fichier /etc/resolv.conf est consulté
|
# domaine. Si cette liste est vide, le fichier /etc/resolv.conf est consulté
|
||||||
|
|
|
@ -900,6 +900,7 @@ exit 0
|
||||||
set_var "$runspath" "$(array_join runsdirs :)"
|
set_var "$runspath" "$(array_join runsdirs :)"
|
||||||
done
|
done
|
||||||
# XXX quelles autres variables doivent être corrigées?
|
# XXX quelles autres variables doivent être corrigées?
|
||||||
|
# XXX ==> il faut rajouter rscripts et recipes
|
||||||
fi
|
fi
|
||||||
elif [ -n "$runsworkdir" ]; then
|
elif [ -n "$runsworkdir" ]; then
|
||||||
RUNSWORKDIR="$runsworkdir"
|
RUNSWORKDIR="$runsworkdir"
|
||||||
|
|
51
rruns
51
rruns
|
@ -74,7 +74,21 @@ OPTIONS
|
||||||
argument (hors options)."
|
argument (hors options)."
|
||||||
}
|
}
|
||||||
|
|
||||||
|
RUNSSCRIPTSPATH=
|
||||||
|
RUNSSCRIPTSDIRS=()
|
||||||
|
RUNSMODULESPATH=
|
||||||
|
RUNSMODULESDIRS=()
|
||||||
|
RUNSHOSTSPATH=
|
||||||
|
RUNSHOSTSDIRS=()
|
||||||
|
RUNSDOMAINS=()
|
||||||
|
RUNSDOMAIN=
|
||||||
set_defaults runs
|
set_defaults runs
|
||||||
|
[ -n "$RUNSSCRIPTSPATH" ] && RUNSSCRIPTSDIRS=("$RUNSSCRIPTSPATH" "${RUNSSCRIPTSDIRS[@]}")
|
||||||
|
array_fix_paths RUNSSCRIPTSDIRS; setx RUNSSCRIPTSPATH=array_to_path RUNSSCRIPTSDIRS
|
||||||
|
[ -n "$RUNSMODULESPATH" ] && RUNSMODULESDIRS=("$RUNSMODULESPATH" "${RUNSMODULESDIRS[@]}")
|
||||||
|
array_fix_paths RUNSMODULESDIRS; setx RUNSMODULESPATH=array_to_path RUNSMODULESDIRS
|
||||||
|
[ -n "$RUNSHOSTSPATH" ] && RUNSHOSTSDIRS=("$RUNSHOSTSPATH" "${RUNSHOSTSDIRS[@]}")
|
||||||
|
array_fix_paths RUNSHOSTSDIRS; setx RUNSHOSTSPATH=array_to_path RUNSHOSTSDIRS
|
||||||
|
|
||||||
action=deploy
|
action=deploy
|
||||||
confuser=
|
confuser=
|
||||||
|
@ -89,8 +103,11 @@ init=auto
|
||||||
init_sysinfos=
|
init_sysinfos=
|
||||||
sysinfos_data=
|
sysinfos_data=
|
||||||
runsscriptspath=
|
runsscriptspath=
|
||||||
|
runsscriptsdirs=()
|
||||||
runsmodulespath=
|
runsmodulespath=
|
||||||
|
runsmodulesdirs=()
|
||||||
runshostspath=
|
runshostspath=
|
||||||
|
runshostsdirs=()
|
||||||
parse_opts "${PRETTYOPTS[@]}" \
|
parse_opts "${PRETTYOPTS[@]}" \
|
||||||
--help '$exit_with display_help' \
|
--help '$exit_with display_help' \
|
||||||
-C action=configure \
|
-C action=configure \
|
||||||
|
@ -107,13 +124,25 @@ parse_opts "${PRETTYOPTS[@]}" \
|
||||||
--no-init init= \
|
--no-init init= \
|
||||||
--sysinfos init_sysinfos=1 \
|
--sysinfos init_sysinfos=1 \
|
||||||
--runsscriptspath: runsscriptspath= \
|
--runsscriptspath: runsscriptspath= \
|
||||||
|
--runsscriptsdir: runsscriptsdirs \
|
||||||
--runsmodulespath: runsmodulespath= \
|
--runsmodulespath: runsmodulespath= \
|
||||||
|
--runsmodulesdir: runsmodulesdirs \
|
||||||
--runshostspath: runshostspath= \
|
--runshostspath: runshostspath= \
|
||||||
|
--runshostsdir: runshostsdirs \
|
||||||
@ args -- "$@" && set -- "${args[@]}" || die "$args"
|
@ args -- "$@" && set -- "${args[@]}" || die "$args"
|
||||||
|
|
||||||
|
[ -n "$runsscriptspath" ] && runsscriptsdirs=("$runsscriptspath" "${runsscriptsdirs[@]}")
|
||||||
|
array_fix_paths runsscriptsdirs; setx runsscriptspath=array_to_path runsscriptsdirs
|
||||||
[ -n "$runsscriptspath" ] && RUNSSCRIPTSPATH="$runsscriptspath"
|
[ -n "$runsscriptspath" ] && RUNSSCRIPTSPATH="$runsscriptspath"
|
||||||
|
[ -n "$runsmodulespath" ] && runsmodulesdirs=("$runsmodulespath" "${runsmodulesdirs[@]}")
|
||||||
|
array_fix_paths runsmodulesdirs; setx runsmodulespath=array_to_path runsmodulesdirs
|
||||||
[ -n "$runsmodulespath" ] && RUNSMODULESPATH="$runsmodulespath"
|
[ -n "$runsmodulespath" ] && RUNSMODULESPATH="$runsmodulespath"
|
||||||
|
[ -n "$runshostspath" ] && runshostsdirs=("$runshostspath" "${runshostsdirs[@]}")
|
||||||
|
array_fix_paths runshostsdirs; setx runshostspath=array_to_path runshostsdirs
|
||||||
[ -n "$runshostspath" ] && RUNSHOSTSPATH="$runshostspath"
|
[ -n "$runshostspath" ] && RUNSHOSTSPATH="$runshostspath"
|
||||||
|
[ -n "$RUNSSCRIPTSPATH" ] || RUNSSCRIPTSPATH=:
|
||||||
|
[ -n "$RUNSMODULESPATH" ] || RUNSMODULESPATH=:
|
||||||
|
[ -n "$RUNSHOSTSPATH" ] || RUNSHOSTSPATH=:
|
||||||
|
|
||||||
__PARSED_HOSTS=()
|
__PARSED_HOSTS=()
|
||||||
__PARSED_FILES=()
|
__PARSED_FILES=()
|
||||||
|
@ -204,11 +233,12 @@ if [ "$action" == "configure" ]; then
|
||||||
${tmproot:+--tmproot "$tmproot"} ${SSH:+-S "$SSH"} \
|
${tmproot:+--tmproot "$tmproot"} ${SSH:+-S "$SSH"} \
|
||||||
${force_make_archive:+--force-make-archive} \
|
${force_make_archive:+--force-make-archive} \
|
||||||
-h "$user@$host" || continue
|
-h "$user@$host" || continue
|
||||||
|
|
||||||
etitle "Configuration initiale pour runs" \
|
etitle "Configuration initiale pour runs" \
|
||||||
"$scriptdir/runs" \
|
"$scriptdir/runs" \
|
||||||
${runsscriptspath:+--runsscriptspath "$runsscriptspath"} \
|
--runsscriptspath "$RUNSSCRIPTSPATH" \
|
||||||
${runsmodulespath:+--runsmodulespath "$runsmodulespath"} \
|
--runsmodulespath "$RUNSMODULESPATH" \
|
||||||
${runshostspath:+--runshostspath "$runshostspath"} \
|
--runshostspath "$RUNSHOSTSPATH" \
|
||||||
--init -h "$host"
|
--init -h "$host"
|
||||||
done
|
done
|
||||||
exit 0
|
exit 0
|
||||||
|
@ -299,9 +329,9 @@ for userhost in "${hosts[@]}"; do
|
||||||
|
|
||||||
estep "Vérification de la configuration de l'hôte pour runs"
|
estep "Vérification de la configuration de l'hôte pour runs"
|
||||||
"$scriptdir/runs" \
|
"$scriptdir/runs" \
|
||||||
${runsscriptspath:+--runsscriptspath "$runsscriptspath"} \
|
--runsscriptspath "$RUNSSCRIPTSPATH" \
|
||||||
${runsmodulespath:+--runsmodulespath "$runsmodulespath"} \
|
--runsmodulespath "$RUNSMODULESPATH" \
|
||||||
${runshostspath:+--runshostspath "$runshostspath"} \
|
--runshostspath "$RUNSHOSTSPATH" \
|
||||||
$action -h "$host" || { eend; continue; }
|
$action -h "$host" || { eend; continue; }
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -317,10 +347,11 @@ for userhost in "${hosts[@]}"; do
|
||||||
|
|
||||||
# Création de l'export
|
# Création de l'export
|
||||||
etitle "Préparation de l'export"
|
etitle "Préparation de l'export"
|
||||||
args=(--export --runsexportdir "$exportdir"
|
args=(
|
||||||
${runsscriptspath:+--runsscriptspath "$runsscriptspath"}
|
--export --runsexportdir "$exportdir"
|
||||||
${runsmodulespath:+--runsmodulespath "$runsmodulespath"}
|
--runsscriptspath "$RUNSSCRIPTSPATH"
|
||||||
${runshostspath:+--runshostspath "$runshostspath"}
|
--runsmodulespath "$RUNSMODULESPATH"
|
||||||
|
--runshostspath "$RUNSHOSTSPATH"
|
||||||
)
|
)
|
||||||
[ "$host" != "localhost" ] && args=("${args[@]}" -h "$host")
|
[ "$host" != "localhost" ] && args=("${args[@]}" -h "$host")
|
||||||
[ -n "$runsreset" ] && args=("${args[@]}" -z)
|
[ -n "$runsreset" ] && args=("${args[@]}" -z)
|
||||||
|
|
65
runs
65
runs
|
@ -58,11 +58,28 @@ Gestion des scripts
|
||||||
-z Forcer la réinstallation des scripts qui se basent sur shouldrun/setdone"
|
-z Forcer la réinstallation des scripts qui se basent sur shouldrun/setdone"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
RUNSSCRIPTSPATH=
|
||||||
|
RUNSSCRIPTSDIRS=()
|
||||||
|
RUNSMODULESPATH=
|
||||||
|
RUNSMODULESDIRS=()
|
||||||
|
RUNSHOSTSPATH=
|
||||||
|
RUNSHOSTSDIRS=()
|
||||||
|
RUNSDOMAINS=()
|
||||||
|
RUNSDOMAIN=
|
||||||
set_defaults runs
|
set_defaults runs
|
||||||
|
[ -n "$RUNSSCRIPTSPATH" ] && RUNSSCRIPTSDIRS=("$RUNSSCRIPTSPATH" "${RUNSSCRIPTSDIRS[@]}")
|
||||||
|
array_fix_paths RUNSSCRIPTSDIRS; setx RUNSSCRIPTSPATH=array_to_path RUNSSCRIPTSDIRS
|
||||||
|
[ -n "$RUNSMODULESPATH" ] && RUNSMODULESDIRS=("$RUNSMODULESPATH" "${RUNSMODULESDIRS[@]}")
|
||||||
|
array_fix_paths RUNSMODULESDIRS; setx RUNSMODULESPATH=array_to_path RUNSMODULESDIRS
|
||||||
|
[ -n "$RUNSHOSTSPATH" ] && RUNSHOSTSDIRS=("$RUNSHOSTSPATH" "${RUNSHOSTSDIRS[@]}")
|
||||||
|
array_fix_paths RUNSHOSTSDIRS; setx RUNSHOSTSPATH=array_to_path RUNSHOSTSDIRS
|
||||||
|
|
||||||
function runs_path_required() {
|
function runs_path_required() {
|
||||||
die "Vous devez définir $1 dans ~/etc/default/runs"
|
die "Vous devez définir $1 dans ~/etc/default/runs"
|
||||||
}
|
}
|
||||||
|
function runs_path_undefined() {
|
||||||
|
ewarn "La variable $1 n'est pas définie dans ~/etc/default/runs"
|
||||||
|
}
|
||||||
|
|
||||||
action=runs
|
action=runs
|
||||||
create_verbose=
|
create_verbose=
|
||||||
|
@ -77,8 +94,11 @@ runssysdist=
|
||||||
runssysver=
|
runssysver=
|
||||||
runsbits=
|
runsbits=
|
||||||
runsscriptspath=
|
runsscriptspath=
|
||||||
|
runsscriptsdirs=()
|
||||||
runsmodulespath=
|
runsmodulespath=
|
||||||
|
runsmodulesdirs=()
|
||||||
runshostspath=
|
runshostspath=
|
||||||
|
runshostsdirs=()
|
||||||
runsexportdir= # répertoire dans lequel exporter les fichiers
|
runsexportdir= # répertoire dans lequel exporter les fichiers
|
||||||
runsworkdir= # si runsexportdir n'est pas spécifié, répertoire de travail
|
runsworkdir= # si runsexportdir n'est pas spécifié, répertoire de travail
|
||||||
runsvarsfile= # fichier contenant des définitions à charger
|
runsvarsfile= # fichier contenant des définitions à charger
|
||||||
|
@ -106,16 +126,25 @@ parse_opts "${PRETTYOPTS[@]}" \
|
||||||
--sysver: runssysver= \
|
--sysver: runssysver= \
|
||||||
--bits: runsbits= \
|
--bits: runsbits= \
|
||||||
--runsscriptspath: runsscriptspath= \
|
--runsscriptspath: runsscriptspath= \
|
||||||
|
--runsscriptsdir: runsscriptsdirs \
|
||||||
--runsmodulespath: runsmodulespath= \
|
--runsmodulespath: runsmodulespath= \
|
||||||
|
--runsmodulesdir: runsmodulesdirs \
|
||||||
--runshostspath: runshostspath= \
|
--runshostspath: runshostspath= \
|
||||||
|
--runshostsdir: runshostsdirs \
|
||||||
--runsexportdir: runsexportdir= \
|
--runsexportdir: runsexportdir= \
|
||||||
--runsworkdir: runsworkdir= \
|
--runsworkdir: runsworkdir= \
|
||||||
--runsvarsfile: runsvarsfile= \
|
--runsvarsfile: runsvarsfile= \
|
||||||
-z RUNSRESET=1 \
|
-z RUNSRESET=1 \
|
||||||
@ args -- "$@" && set -- "${args[@]}" || die "$args"
|
@ args -- "$@" && set -- "${args[@]}" || die "$args"
|
||||||
|
|
||||||
|
[ -n "$runsscriptspath" ] && runsscriptsdirs=("$runsscriptspath" "${runsscriptsdirs[@]}")
|
||||||
|
array_fix_paths runsscriptsdirs; setx runsscriptspath=array_to_path runsscriptsdirs
|
||||||
[ -n "$runsscriptspath" ] && RUNSSCRIPTSPATH="$runsscriptspath"
|
[ -n "$runsscriptspath" ] && RUNSSCRIPTSPATH="$runsscriptspath"
|
||||||
|
[ -n "$runsmodulespath" ] && runsmodulesdirs=("$runsmodulespath" "${runsmodulesdirs[@]}")
|
||||||
|
array_fix_paths runsmodulesdirs; setx runsmodulespath=array_to_path runsmodulesdirs
|
||||||
[ -n "$runsmodulespath" ] && RUNSMODULESPATH="$runsmodulespath"
|
[ -n "$runsmodulespath" ] && RUNSMODULESPATH="$runsmodulespath"
|
||||||
|
[ -n "$runshostspath" ] && runshostsdirs=("$runshostspath" "${runshostsdirs[@]}")
|
||||||
|
array_fix_paths runshostsdirs; setx runshostspath=array_to_path runshostsdirs
|
||||||
[ -n "$runshostspath" ] && RUNSHOSTSPATH="$runshostspath"
|
[ -n "$runshostspath" ] && RUNSHOSTSPATH="$runshostspath"
|
||||||
|
|
||||||
if [ "$action" == runs \
|
if [ "$action" == runs \
|
||||||
|
@ -171,6 +200,9 @@ if ! is_root && [ -n "$run_as_root" ]; then
|
||||||
for recipe in "${recipes[@]}"; do
|
for recipe in "${recipes[@]}"; do
|
||||||
args=("${args[@]}" -r "$recipe")
|
args=("${args[@]}" -r "$recipe")
|
||||||
done
|
done
|
||||||
|
[ -n "$RUNSSCRIPTSPATH" ] || RUNSSCRIPTSPATH=:
|
||||||
|
[ -n "$RUNSMODULESPATH" ] || RUNSMODULESPATH=:
|
||||||
|
[ -n "$RUNSHOSTSPATH" ] || RUNSHOSTSPATH=:
|
||||||
args=("${args[@]}" ${runshost:+-h "$runshost"}
|
args=("${args[@]}" ${runshost:+-h "$runshost"}
|
||||||
${runssysname:+--sysname "$runssysname"} ${runssysdist:+--sysdist "$runssysdist"} ${runssysver:+--sysver "$runssysver"} ${runsbits:+--bits "$runsbits"}
|
${runssysname:+--sysname "$runssysname"} ${runssysdist:+--sysdist "$runssysdist"} ${runssysver:+--sysver "$runssysver"} ${runsbits:+--bits "$runsbits"}
|
||||||
${RUNSSCRIPTSPATH:+--runsscriptspath "$RUNSSCRIPTSPATH"}
|
${RUNSSCRIPTSPATH:+--runsscriptspath "$RUNSSCRIPTSPATH"}
|
||||||
|
@ -220,8 +252,8 @@ bits=$MYBITS"
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
elif [ "$action" == "create" ]; then
|
elif [ "$action" == "create" ]; then
|
||||||
if [ -n "$runshost" ]; then
|
|
||||||
__runs_setpath
|
__runs_setpath
|
||||||
|
if [ -n "$runshost" ]; then
|
||||||
[ -n "${RUNSHOSTSDIRS[*]}" ] || runs_path_required RUNSHOSTSPATH
|
[ -n "${RUNSHOSTSDIRS[*]}" ] || runs_path_required RUNSHOSTSPATH
|
||||||
etitle "$runshost" runs_initdir "$runshost" "$create_verbose"
|
etitle "$runshost" runs_initdir "$runshost" "$create_verbose"
|
||||||
fi
|
fi
|
||||||
|
@ -267,9 +299,9 @@ elif [ "$action" == "list" ]; then
|
||||||
}
|
}
|
||||||
|
|
||||||
__runs_setpath
|
__runs_setpath
|
||||||
[ -n "${RUNSSCRIPTSDIRS[*]}" ] || runs_path_required RUNSSCRIPTSPATH
|
[ -n "${RUNSSCRIPTSDIRS[*]}" ] || runs_path_undefined RUNSSCRIPTSPATH
|
||||||
[ -n "${RUNSMODULESDIRS[*]}" ] || runs_path_required RUNSMODULESPATH
|
[ -n "${RUNSMODULESDIRS[*]}" ] || runs_path_undefined RUNSMODULESPATH
|
||||||
[ -z "$runshost" -o -n "${RUNSHOSTSDIRS[*]}" ] || runs_path_required RUNSHOSTSPATH
|
[ -z "$runshost" -o -n "${RUNSHOSTSDIRS[*]}" ] || runs_path_undefined RUNSHOSTSPATH
|
||||||
|
|
||||||
splithost "$runshost" hostname domain
|
splithost "$runshost" hostname domain
|
||||||
|
|
||||||
|
@ -310,12 +342,27 @@ elif [ "$action" == "list" ]; then
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
elif [ "$action" == "runs" ]; then
|
elif [ "$action" == "runs" ]; then
|
||||||
if [ -n "${rscripts[*]}" ]; then
|
|
||||||
# sans l'option -f, il faut définir RUNS*PATH
|
|
||||||
__runs_setpath
|
__runs_setpath
|
||||||
[ -n "${RUNSSCRIPTSDIRS[*]}" ] || runs_path_required RUNSSCRIPTSPATH
|
if [ -z "${rscripts[*]}" -a -z "${recipes[*]}" ]; then
|
||||||
[ -n "${RUNSMODULESDIRS[*]}" ] || runs_path_required RUNSMODULESPATH
|
# sans les options -f et -r, prendre par défaut le répertoire courant
|
||||||
[ -z "$runshost" -o -n "${RUNSHOSTSDIRS[*]}" ] || runs_path_required RUNSHOSTSPATH
|
# comme répertoire de script, de module et d'hôtes
|
||||||
|
refix=
|
||||||
|
[ -n "${RUNSSCRIPTSDIRS[*]}" ] || {
|
||||||
|
runs_path_undefined RUNSSCRIPTSPATH
|
||||||
|
setx RUNSSCRIPTSPATH=pwd
|
||||||
|
refix=1
|
||||||
|
}
|
||||||
|
[ -n "${RUNSMODULESDIRS[*]}" ] || {
|
||||||
|
runs_path_undefined RUNSMODULESPATH
|
||||||
|
setx RUNSMODULESPATH=pwd
|
||||||
|
refix=1
|
||||||
|
}
|
||||||
|
[ -z "$runshost" -o -n "${RUNSHOSTSDIRS[*]}" ] || {
|
||||||
|
runs_path_undefined RUNSHOSTSPATH
|
||||||
|
setx RUNSHOSTSPATH=pwd
|
||||||
|
refix=1
|
||||||
|
}
|
||||||
|
[ -n "$refix" ] && __runs_setpath
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# initialisation
|
# initialisation
|
||||||
|
|
Loading…
Reference in New Issue