rruns calcule aussi les chemins d'hôtes automatiquement
This commit is contained in:
parent
40f5347656
commit
830a33b96f
|
@ -747,6 +747,39 @@ RUNSHOST=$RUNSHOST"
|
|||
################################################################################
|
||||
# Moteur de script
|
||||
|
||||
function runs_before_parse_args() {
|
||||
RUNSSCRIPTSPATH=
|
||||
RUNSSCRIPTSDIRS=()
|
||||
RUNSMODULESPATH=
|
||||
RUNSMODULESDIRS=()
|
||||
RUNSHOSTSPATH=
|
||||
RUNSHOSTSDIRS=()
|
||||
RUNSDOMAINS=()
|
||||
RUNSDOMAIN=
|
||||
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_after_parse_args() {
|
||||
[ -n "$runsscriptspath" ] && runsscriptsdirs=("$runsscriptspath" "${runsscriptsdirs[@]}")
|
||||
array_fix_paths runsscriptsdirs; setx runsscriptspath=array_to_path runsscriptsdirs
|
||||
[ -n "$runsscriptspath" ] && RUNSSCRIPTSPATH="$runsscriptspath"
|
||||
[ -n "$runsmodulespath" ] && runsmodulesdirs=("$runsmodulespath" "${runsmodulesdirs[@]}")
|
||||
array_fix_paths runsmodulesdirs; setx runsmodulespath=array_to_path runsmodulesdirs
|
||||
[ -n "$runsmodulespath" ] && RUNSMODULESPATH="$runsmodulespath"
|
||||
[ -n "$runshostspath" ] && runshostsdirs=("$runshostspath" "${runshostsdirs[@]}")
|
||||
array_fix_paths runshostsdirs; setx runshostspath=array_to_path runshostsdirs
|
||||
[ -n "$runshostspath" ] && RUNSHOSTSPATH="$runshostspath"
|
||||
[ -n "$RUNSSCRIPTSPATH" ] || RUNSSCRIPTSPATH=:
|
||||
[ -n "$RUNSMODULESPATH" ] || RUNSMODULESPATH=:
|
||||
[ -n "$RUNSHOSTSPATH" ] || RUNSHOSTSPATH=:
|
||||
}
|
||||
|
||||
function runs_init() {
|
||||
RUNSSRCDIR="${1:-$scriptdir}" # répertoire d'où sont copiés les scripts
|
||||
RUNSACTION=runs_action_run
|
||||
|
|
165
lib/ulib/runsmod
165
lib/ulib/runsmod
|
@ -219,6 +219,19 @@ function __runsmod_fixinfo() {
|
|||
sed -n '3,$p' | sed 's/^.*\t//g'
|
||||
}
|
||||
|
||||
function runsmod_autoconf() {
|
||||
if __runsmod_loadconf && runsmod_checkenv --check-only; then
|
||||
runsmod_setup_vars
|
||||
runsmod_update_vars "${1:-self}"
|
||||
runsmod_teardown_vars
|
||||
if show_debug; then
|
||||
etitle SCRIPTSDIRS array_each SCRIPTSDIRS ppath
|
||||
etitle MODULESDIRS array_each MODULESDIRS ppath
|
||||
etitle HOSTSDIRS array_each HOSTSDIRS ppath
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
function runsmod_checkenv() {
|
||||
# vérifier l'environement. créer les répertoires nécessaires.
|
||||
local check_only
|
||||
|
@ -636,6 +649,7 @@ function runsmod_update_vars() {
|
|||
# le nom d'hôte doit être avec un domaine
|
||||
[ -n "$host" -a "${host%%.*}" == "$host" -a -n "$RUNSDOMAIN" ] && host="$host.$RUNSDOMAIN"
|
||||
|
||||
# Calcul des répertoires d'hôte
|
||||
for RUNSMOD_PROFILE in "${RUNSMOD_PROFILES[@]}"; do
|
||||
__runsmod_get -a baseurls BASEURL
|
||||
for baseurl in "${baseurls[@]}"; do
|
||||
|
@ -643,14 +657,72 @@ function runsmod_update_vars() {
|
|||
setx repolistfile=__runsmod_get_repolistfile "$baseurl"
|
||||
[ -f "$repolistfile" ] || continue
|
||||
|
||||
edebug ".. baseurl=$baseurl, repopath=$repopath"
|
||||
#edebug ".. baseurl=$baseurl, repopath=$repopath"
|
||||
for vprefix in SCRIPTS MODULES HOSTS; do
|
||||
__runsmod_get -a repourls "${vprefix}_URLS"
|
||||
edebug ".... vprefix=$vprefix, repourls=(${repourls[*]})"
|
||||
#edebug ".... vprefix=$vprefix, repourls=(${repourls[*]})"
|
||||
|
||||
for repospec in "${repourls[@]}"; do
|
||||
edebug "...... repospec=$repospec"
|
||||
__runsmod_has_vmodule "$repospec" && repospec="${repospec%%/%m*}"
|
||||
#edebug "...... repospec=$repospec"
|
||||
if [ "$vprefix" == HOSTS ]; then :
|
||||
elif __runsmod_has_vhost "$repospec"; then
|
||||
repospec="${repospec%%/%h*}"
|
||||
else continue
|
||||
fi
|
||||
reposuffixes=("")
|
||||
if [[ "$repospec" == *//* ]]; then
|
||||
reposuffix="${repospec#*//}"
|
||||
[ -n "$reposuffix" ] && reposuffix="/$reposuffix"
|
||||
repospec="${repospec%%//*}"
|
||||
reposuffixes=("$reposuffix")
|
||||
fi
|
||||
|
||||
if setx repospec=__runsmod_mapdir "$repospec"; then
|
||||
repodirs=("$repospec")
|
||||
else
|
||||
array_lsdirs repodirs "$RUNSMOD_BASEDIR/$repopath" "$repospec"
|
||||
fi
|
||||
for repodir in "${repodirs[@]}"; do
|
||||
#edebug "........ repodir=$repodir"
|
||||
[ -d "$repodir" ] || continue
|
||||
for reposuffix in "${reposuffixes[@]}"; do
|
||||
array_addu HOSTSDIRS "$repodir$reposuffix"
|
||||
done
|
||||
done
|
||||
done
|
||||
done
|
||||
done
|
||||
done
|
||||
|
||||
# Calcul des répertoires de module
|
||||
for RUNSMOD_PROFILE in "${RUNSMOD_PROFILES[@]}"; do
|
||||
__runsmod_get -a baseurls BASEURL
|
||||
for baseurl in "${baseurls[@]}"; do
|
||||
setx repopath=__runsmod_getpath_from_baseurl "$baseurl"
|
||||
setx repolistfile=__runsmod_get_repolistfile "$baseurl"
|
||||
[ -f "$repolistfile" ] || continue
|
||||
|
||||
#edebug ".. baseurl=$baseurl, repopath=$repopath"
|
||||
for vprefix in MODULES HOSTS; do
|
||||
if [ "$vprefix" == HOSTS ]; then
|
||||
__runsmod_get -a tmprepourls "${vprefix}_URLS"
|
||||
repourls=()
|
||||
for repourl in "${tmprepourls[@]}"; do
|
||||
if __runsmod_has_vmodule "$repourl"; then
|
||||
array_add repourls "$repourl"
|
||||
else
|
||||
array_add repourls "$repourl/%h/modules"
|
||||
array_add repourls "$repourl/%h"
|
||||
fi
|
||||
done
|
||||
else
|
||||
__runsmod_get -a repourls "${vprefix}_URLS"
|
||||
fi
|
||||
#edebug ".... vprefix=$vprefix, repourls=(${repourls[*]})"
|
||||
|
||||
for repospec in "${repourls[@]}"; do
|
||||
#edebug "...... repospec=$repospec"
|
||||
repospec="${repospec%%/%m*}"
|
||||
reposuffixes=("")
|
||||
if [[ "$repospec" == *//* ]]; then
|
||||
reposuffix="${repospec#*//}"
|
||||
|
@ -688,7 +760,7 @@ function runsmod_update_vars() {
|
|||
array_addu repospecs "$repospec"
|
||||
fi
|
||||
|
||||
edebug "...... repospecs=(${repospecs[*]})"
|
||||
#edebug "...... repospecs=(${repospecs[*]})"
|
||||
for repospec in "${repospecs[@]}"; do
|
||||
if setx repospec=__runsmod_mapdir "$repospec"; then
|
||||
repodirs=("$repospec")
|
||||
|
@ -696,14 +768,85 @@ function runsmod_update_vars() {
|
|||
array_lsdirs repodirs "$RUNSMOD_BASEDIR/$repopath" "$repospec"
|
||||
fi
|
||||
for repodir in "${repodirs[@]}"; do
|
||||
edebug "........ repodir=$repodir"
|
||||
#edebug "........ repodir=$repodir"
|
||||
[ -d "$repodir" ] || continue
|
||||
for reposuffix in "${reposuffixes[@]}"; do
|
||||
case "$vprefix" in
|
||||
SCRIPTS) array_addu SCRIPTSDIRS "$repodir$reposuffix";;
|
||||
MODULES) array_addu MODULESDIRS "$repodir$reposuffix";;
|
||||
HOSTS) array_addu HOSTSDIRS "$repodir$reposuffix";;
|
||||
esac
|
||||
array_addu MODULESDIRS "$repodir$reposuffix"
|
||||
done
|
||||
done
|
||||
done
|
||||
done
|
||||
done
|
||||
done
|
||||
done
|
||||
|
||||
# Calcul des répertoires de script
|
||||
for RUNSMOD_PROFILE in "${RUNSMOD_PROFILES[@]}"; do
|
||||
__runsmod_get -a baseurls BASEURL
|
||||
for baseurl in "${baseurls[@]}"; do
|
||||
setx repopath=__runsmod_getpath_from_baseurl "$baseurl"
|
||||
setx repolistfile=__runsmod_get_repolistfile "$baseurl"
|
||||
[ -f "$repolistfile" ] || continue
|
||||
|
||||
#edebug ".. baseurl=$baseurl, repopath=$repopath"
|
||||
for vprefix in SCRIPTS HOSTS; do
|
||||
__runsmod_get -a repourls "${vprefix}_URLS"
|
||||
#edebug ".... vprefix=$vprefix, repourls=(${repourls[*]})"
|
||||
|
||||
for repospec in "${repourls[@]}"; do
|
||||
#edebug "...... repospec=$repospec"
|
||||
if [ "$vprefix" == HOSTS ]; then
|
||||
__runsmod_has_vhost "$repospec" || repospec="$repospec/%h/runs"
|
||||
fi
|
||||
reposuffixes=("")
|
||||
if [[ "$repospec" == *//* ]]; then
|
||||
reposuffix="${repospec#*//}"
|
||||
[ -n "$reposuffix" ] && reposuffix="/$reposuffix"
|
||||
repospec="${repospec%%//*}"
|
||||
if __runsmod_has_vhost "$reposuffix"; then
|
||||
if [ -n "$all_hosts" -o -z "$host" ]; then
|
||||
reposuffix="${reposuffix//%h\//}"
|
||||
reposuffix="${reposuffix//\/%h/}"
|
||||
reposuffixes=("$reposuffix")
|
||||
elif [ -n "$host" ]; then
|
||||
local rs1 rs2
|
||||
setx rs1=__runsmod_replace1 "$reposuffix" "$host"
|
||||
setx rs2=__runsmod_replace2 "$reposuffix" "$host"
|
||||
reposuffixes=("$rs1")
|
||||
[ "$rs2" != "$rs1" ] && array_add reposuffixes "$rs2"
|
||||
fi
|
||||
else
|
||||
reposuffixes=("$reposuffix")
|
||||
fi
|
||||
fi
|
||||
|
||||
repospecs=()
|
||||
if __runsmod_has_vhost "$repospec"; then
|
||||
if [ -n "$all_hosts" ]; then
|
||||
setx rs1=__runsmod_replace1 "$repospec" "*"
|
||||
array_addu repospecs "$rs1"
|
||||
elif [ -n "$host" ]; then
|
||||
setx rs1=__runsmod_replace1 "$repospec" "$host"
|
||||
array_addu repospecs "$rs1"
|
||||
setx rs2=__runsmod_replace2 "$repospec" "$host"
|
||||
array_addu repospecs "$rs2"
|
||||
fi
|
||||
else
|
||||
array_addu repospecs "$repospec"
|
||||
fi
|
||||
|
||||
#edebug "...... repospecs=(${repospecs[*]})"
|
||||
for repospec in "${repospecs[@]}"; do
|
||||
if setx repospec=__runsmod_mapdir "$repospec"; then
|
||||
repodirs=("$repospec")
|
||||
else
|
||||
array_lsdirs repodirs "$RUNSMOD_BASEDIR/$repopath" "$repospec"
|
||||
fi
|
||||
for repodir in "${repodirs[@]}"; do
|
||||
#edebug "........ repodir=$repodir"
|
||||
[ -d "$repodir" ] || continue
|
||||
for reposuffix in "${reposuffixes[@]}"; do
|
||||
array_addu SCRIPTSDIRS "$repodir$reposuffix"
|
||||
done
|
||||
done
|
||||
done
|
||||
|
|
|
@ -12,9 +12,9 @@ RUNSMOD_UPDATE=auto
|
|||
RUNSMOD_IDENTITY=
|
||||
RUNSMOD_BASEURL=
|
||||
RUNSMOD_SCRIPTS_URLS=(hosts/%h/runs hosts/%h/all//runs runss)
|
||||
RUNSMOD_MODULES_URLS=(hosts/%h/modules/%m hosts/%h/all modules/%m)
|
||||
RUNSMOD_MODULES_URLS=(hosts/%h/modules/%m hosts/%h/%m hosts/%h/all modules/%m)
|
||||
# quand on supportera %n
|
||||
#RUNSMOD_MODULES_URLS=(hosts/%h/modules/%m hosts/%h/all hosts/all/%n/%m modules/%m)
|
||||
#RUNSMOD_MODULES_URLS=(hosts/%h/modules/%m hosts/%h/%m hosts/%h/all hosts/all/%n/%m modules/%m)
|
||||
RUNSMOD_HOSTS_URLS=(runsh)
|
||||
RUNSMOD_BASEDIR="$HOME/runs"
|
||||
RUNSMOD_MAP=()
|
||||
|
|
68
rruns
68
rruns
|
@ -1,7 +1,7 @@
|
|||
#!/bin/bash
|
||||
# -*- coding: utf-8 mode: sh -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8
|
||||
source "$(dirname "$0")/lib/ulib/ulib" || exit 1
|
||||
urequire DEFAULTS runs
|
||||
urequire DEFAULTS runs runsmod
|
||||
|
||||
function display_help() {
|
||||
uecho "$scriptname: Déploiement distant avec runs
|
||||
|
@ -74,22 +74,9 @@ OPTIONS
|
|||
argument (hors options)."
|
||||
}
|
||||
|
||||
RUNSSCRIPTSPATH=
|
||||
RUNSSCRIPTSDIRS=()
|
||||
RUNSMODULESPATH=
|
||||
RUNSMODULESDIRS=()
|
||||
RUNSHOSTSPATH=
|
||||
RUNSHOSTSDIRS=()
|
||||
RUNSDOMAINS=()
|
||||
RUNSDOMAIN=
|
||||
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
|
||||
runs_before_parse_args
|
||||
|
||||
auto_runsmod=1
|
||||
action=deploy
|
||||
confuser=
|
||||
tmproot=
|
||||
|
@ -110,6 +97,7 @@ runshostspath=
|
|||
runshostsdirs=()
|
||||
parse_opts "${PRETTYOPTS[@]}" \
|
||||
--help '$exit_with display_help' \
|
||||
--no-auto-runsmod auto_runsmod= \
|
||||
-C action=configure \
|
||||
--configure: '$set@ confuser;action=configure' \
|
||||
-T:,--tmproot: tmproot= \
|
||||
|
@ -131,18 +119,7 @@ parse_opts "${PRETTYOPTS[@]}" \
|
|||
--runshostsdir: runshostsdirs \
|
||||
@ 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 "$runsmodulespath" ] && runsmodulesdirs=("$runsmodulespath" "${runsmodulesdirs[@]}")
|
||||
array_fix_paths runsmodulesdirs; setx runsmodulespath=array_to_path runsmodulesdirs
|
||||
[ -n "$runsmodulespath" ] && RUNSMODULESPATH="$runsmodulespath"
|
||||
[ -n "$runshostspath" ] && runshostsdirs=("$runshostspath" "${runshostsdirs[@]}")
|
||||
array_fix_paths runshostsdirs; setx runshostspath=array_to_path runshostsdirs
|
||||
[ -n "$runshostspath" ] && RUNSHOSTSPATH="$runshostspath"
|
||||
[ -n "$RUNSSCRIPTSPATH" ] || RUNSSCRIPTSPATH=:
|
||||
[ -n "$RUNSMODULESPATH" ] || RUNSMODULESPATH=:
|
||||
[ -n "$RUNSHOSTSPATH" ] || RUNSHOSTSPATH=:
|
||||
runs_after_parse_args
|
||||
|
||||
__PARSED_HOSTS=()
|
||||
__PARSED_FILES=()
|
||||
|
@ -207,6 +184,17 @@ function fix_hosts() {
|
|||
array_map hosts __dot_is_localhost
|
||||
}
|
||||
|
||||
function save_initial_paths() {
|
||||
RUNSSCRIPTSPATH_BACKUP="$RUNSSCRIPTSPATH"
|
||||
RUNSMODULESPATH_BACKUP="$RUNSMODULESPATH"
|
||||
RUNSHOSTSPATH_BACKUP="$RUNSHOSTSPATH"
|
||||
}
|
||||
function restore_initial_paths() {
|
||||
RUNSSCRIPTSPATH="$RUNSSCRIPTSPATH_BACKUP"
|
||||
RUNSMODULESPATH="$RUNSMODULESPATH_BACKUP"
|
||||
RUNSHOSTSPATH="$RUNSHOSTSPATH_BACKUP"
|
||||
}
|
||||
|
||||
################################################################################
|
||||
# Configuration de l'accès par clé aux hôtes
|
||||
|
||||
|
@ -234,12 +222,15 @@ if [ "$action" == "configure" ]; then
|
|||
${force_make_archive:+--force-make-archive} \
|
||||
-h "$user@$host" || continue
|
||||
|
||||
save_initial_paths
|
||||
[ -n "$auto_runsmod" ] && runsmod_autoconf
|
||||
etitle "Configuration initiale pour runs" \
|
||||
"$scriptdir/runs" \
|
||||
--runsscriptspath "$RUNSSCRIPTSPATH" \
|
||||
--runsmodulespath "$RUNSMODULESPATH" \
|
||||
--runshostspath "$RUNSHOSTSPATH" \
|
||||
--init -h "$host"
|
||||
"$scriptdir/runs" --no-auto-runsmod \
|
||||
--runsscriptspath "$RUNSSCRIPTSPATH" \
|
||||
--runsmodulespath "$RUNSMODULESPATH" \
|
||||
--runshostspath "$RUNSHOSTSPATH" \
|
||||
--init -h "$host"
|
||||
restore_initial_paths
|
||||
done
|
||||
exit 0
|
||||
fi
|
||||
|
@ -252,6 +243,8 @@ make_archive=
|
|||
|
||||
## Hôtes sur lesquels faire le déploiement
|
||||
if array_isempty hosts; then
|
||||
save_initial_paths
|
||||
[ -n "$auto_runsmod" ] && runsmod_autoconf all
|
||||
array_split hostsdirs "$RUNSHOSTSPATH" :
|
||||
cwd="$(pwd)"
|
||||
for hostsdir in "${hostsdirs[@]}"; do
|
||||
|
@ -264,6 +257,7 @@ if array_isempty hosts; then
|
|||
break
|
||||
fi
|
||||
done
|
||||
restore_initial_paths
|
||||
fi
|
||||
if array_isempty hosts; then
|
||||
read_value "Entrez une liste d'hôtes séparés par ':'" hosts "localhost"
|
||||
|
@ -320,6 +314,9 @@ for userhost in "${hosts[@]}"; do
|
|||
enote "Le nom d'hôte utilisé est $host"
|
||||
fi
|
||||
|
||||
save_initial_paths
|
||||
[ -n "$auto_runsmod" ] && runsmod_autoconf one "$host"
|
||||
|
||||
if [ "$host" != "localhost" ]; then
|
||||
if [ -n "$init" ]; then
|
||||
action=--init
|
||||
|
@ -328,7 +325,7 @@ for userhost in "${hosts[@]}"; do
|
|||
fi
|
||||
|
||||
estep "Vérification de la configuration de l'hôte pour runs"
|
||||
"$scriptdir/runs" \
|
||||
"$scriptdir/runs" --no-auto-runsmod \
|
||||
--runsscriptspath "$RUNSSCRIPTSPATH" \
|
||||
--runsmodulespath "$RUNSMODULESPATH" \
|
||||
--runshostspath "$RUNSHOSTSPATH" \
|
||||
|
@ -348,6 +345,7 @@ for userhost in "${hosts[@]}"; do
|
|||
# Création de l'export
|
||||
etitle "Préparation de l'export"
|
||||
args=(
|
||||
--no-auto-runsmod
|
||||
--export --runsexportdir "$exportdir"
|
||||
--runsscriptspath "$RUNSSCRIPTSPATH"
|
||||
--runsmodulespath "$RUNSMODULESPATH"
|
||||
|
@ -455,5 +453,7 @@ bits=$MYBITS"'
|
|||
eend
|
||||
fi
|
||||
|
||||
restore_initial_paths
|
||||
|
||||
eend
|
||||
done
|
||||
|
|
43
runs
43
runs
|
@ -58,22 +58,6 @@ Gestion des scripts
|
|||
-z Forcer la réinstallation des scripts qui se basent sur shouldrun/setdone"
|
||||
}
|
||||
|
||||
RUNSSCRIPTSPATH=
|
||||
RUNSSCRIPTSDIRS=()
|
||||
RUNSMODULESPATH=
|
||||
RUNSMODULESDIRS=()
|
||||
RUNSHOSTSPATH=
|
||||
RUNSHOSTSDIRS=()
|
||||
RUNSDOMAINS=()
|
||||
RUNSDOMAIN=
|
||||
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() {
|
||||
die "Vous devez définir $1 dans ~/etc/default/runs"
|
||||
}
|
||||
|
@ -81,6 +65,8 @@ function runs_path_undefined() {
|
|||
ewarn "La variable $1 n'est pas définie dans ~/etc/default/runs"
|
||||
}
|
||||
|
||||
runs_before_parse_args
|
||||
|
||||
auto_runsmod=1
|
||||
action=runs
|
||||
create_verbose=
|
||||
|
@ -139,15 +125,7 @@ parse_opts "${PRETTYOPTS[@]}" \
|
|||
-z RUNSRESET=1 \
|
||||
@ 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 "$runsmodulespath" ] && runsmodulesdirs=("$runsmodulespath" "${runsmodulesdirs[@]}")
|
||||
array_fix_paths runsmodulesdirs; setx runsmodulespath=array_to_path runsmodulesdirs
|
||||
[ -n "$runsmodulespath" ] && RUNSMODULESPATH="$runsmodulespath"
|
||||
[ -n "$runshostspath" ] && runshostsdirs=("$runshostspath" "${runshostsdirs[@]}")
|
||||
array_fix_paths runshostsdirs; setx runshostspath=array_to_path runshostsdirs
|
||||
[ -n "$runshostspath" ] && RUNSHOSTSPATH="$runshostspath"
|
||||
runs_after_parse_args
|
||||
|
||||
if [ "$action" == runs \
|
||||
-o "$action" == init -o "$action" == verify \
|
||||
|
@ -172,17 +150,7 @@ if [ "$action" == runs \
|
|||
fi
|
||||
fi
|
||||
|
||||
if [ -n "$auto_runsmod" ] && __runsmod_loadconf && runsmod_checkenv --check-only; then
|
||||
function __runsmod_clone_or_pull() { :; }
|
||||
runsmod_setup_vars
|
||||
runsmod_update_vars self "$RUNSHOST"
|
||||
runsmod_teardown_vars
|
||||
#XXX
|
||||
echo === SCRIPTSDIRS ===; array_each SCRIPTSDIRS ppath
|
||||
echo === MODULESDIRS ===; array_each MODULESDIRS ppath
|
||||
echo === HOSTSDIRS ===; array_each HOSTSDIRS ppath
|
||||
#XXX
|
||||
fi
|
||||
[ -n "$auto_runsmod" ] && runsmod_autoconf
|
||||
|
||||
if ! is_root && [ -n "$run_as_root" ]; then
|
||||
# reconstruire la ligne de commande
|
||||
|
@ -214,9 +182,6 @@ if ! is_root && [ -n "$run_as_root" ]; then
|
|||
for recipe in "${recipes[@]}"; do
|
||||
args=("${args[@]}" -r "$recipe")
|
||||
done
|
||||
[ -n "$RUNSSCRIPTSPATH" ] || RUNSSCRIPTSPATH=:
|
||||
[ -n "$RUNSMODULESPATH" ] || RUNSMODULESPATH=:
|
||||
[ -n "$RUNSHOSTSPATH" ] || RUNSHOSTSPATH=:
|
||||
args=("${args[@]}" ${runshost:+-h "$runshost"}
|
||||
${runssysname:+--sysname "$runssysname"} ${runssysdist:+--sysdist "$runssysdist"} ${runssysver:+--sysver "$runssysver"} ${runsbits:+--bits "$runsbits"}
|
||||
${RUNSSCRIPTSPATH:+--runsscriptspath "$RUNSSCRIPTSPATH"}
|
||||
|
|
Loading…
Reference in New Issue