support de //...%h...

This commit is contained in:
Jephté Clain 2016-05-25 20:24:12 +04:00
parent 409e4062f1
commit 55c57551eb
1 changed files with 48 additions and 17 deletions

View File

@ -364,9 +364,8 @@ function runsmod_clone_or_pull() {
host="$host.$RUNSDOMAIN" host="$host.$RUNSDOMAIN"
enote "Autocorrection du nom d'hôte en $host" enote "Autocorrection du nom d'hôte en $host"
fi fi
#XXX implémenter all_hosts=1
local -a repolist reponames repourls local -a repolist reposuffixes reponames repourls
local RUNSMOD_PROFILE baseurl repopath repolistfile local RUNSMOD_PROFILE baseurl repopath repolistfile
local vprefix repospec reposuffix reponame repourl repodir module moduledir local vprefix repospec reposuffix reponame repourl repodir module moduledir
local r=0 local r=0
@ -392,6 +391,21 @@ function runsmod_clone_or_pull() {
reposuffix="${repospec#*//}" reposuffix="${repospec#*//}"
[ -n "$reposuffix" ] && reposuffix="/$reposuffix" [ -n "$reposuffix" ] && reposuffix="/$reposuffix"
repospec="${repospec%%//*}" 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
else else
reposuffix= reposuffix=
fi fi
@ -422,12 +436,13 @@ function runsmod_clone_or_pull() {
array_contains REPODIRS "$repodir" && continue array_contains REPODIRS "$repodir" && continue
array_addu REPODIRS "$repodir" array_addu REPODIRS "$repodir"
repodir="$repodir$reposuffix" for reposuffix in "${reposuffixes[@]}"; do
case "$vprefix" in case "$vprefix" in
SCRIPTS) array_addu SCRIPTSDIRS "$repodir";; SCRIPTS) array_addu SCRIPTSDIRS "$repodir$reposuffix";;
MODULES) array_addu MODULESDIRS "$repodir";; MODULES) array_addu MODULESDIRS "$repodir$reposuffix";;
HOSTS) array_addu HOSTSDIRS "$repodir";; HOSTS) array_addu HOSTSDIRS "$repodir$reposuffix";;
esac esac
done
done done
done done
done done
@ -471,6 +486,21 @@ function runsmod_clone_or_pull() {
reposuffix="${repospec#*//}" reposuffix="${repospec#*//}"
[ -n "$reposuffix" ] && reposuffix="/$reposuffix" [ -n "$reposuffix" ] && reposuffix="/$reposuffix"
repospec="${repospec%%//*}" 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
else else
reposuffix= reposuffix=
fi fi
@ -517,15 +547,16 @@ function runsmod_clone_or_pull() {
array_addu REPODIRS "$repodir" array_addu REPODIRS "$repodir"
[ -z "$all_modules" ] && array_addu foundmodules "$module" [ -z "$all_modules" ] && array_addu foundmodules "$module"
repodir="$repodir$reposuffix" for reposuffix in "${reposuffixes[@]}"; do
case "$vprefix" in case "$vprefix" in
SCRIPTS) array_addu SCRIPTSDIRS "$repodir";; SCRIPTS) array_addu SCRIPTSDIRS "$repodir$reposuffix";;
MODULES) MODULES)
setx moduledir=dirname -- "$repodir" setx moduledir=dirname -- "$repodir$reposuffix"
array_addu MODULESDIRS "$moduledir" array_addu MODULESDIRS "$moduledir"
;; ;;
HOSTS) array_addu HOSTSDIRS "$repodir";; HOSTS) array_addu HOSTSDIRS "$repodir$reposuffix";;
esac esac
done
done done
done done
done done