mapping des répertoires de destination
This commit is contained in:
parent
4b212d85ba
commit
96afb2a10f
380
lib/ulib/runsmod
380
lib/ulib/runsmod
|
@ -137,6 +137,27 @@ function __runsmod_fixurl() {
|
||||||
echo "$url$1"
|
echo "$url$1"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function __runsmod_mapdir() {
|
||||||
|
# mapper le répertoire $1, avec $2 est le répertoire de base à partir
|
||||||
|
# desquels les mappings sont définis
|
||||||
|
local dir="$1" basedir="$2"
|
||||||
|
local -a maps
|
||||||
|
local map from to
|
||||||
|
dir="${dir#$basedir/}"
|
||||||
|
__runsmod_get -a maps MAP
|
||||||
|
for map in "${maps[@]}"; do
|
||||||
|
splitpair "$map" from to
|
||||||
|
if [ "$dir" == "$from" ]; then
|
||||||
|
echo "$to"
|
||||||
|
return
|
||||||
|
elif [ "${dir#$from/}" != "$dir" ]; then
|
||||||
|
echo "$to/${dir#$from/}"
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
echo "$dir"
|
||||||
|
}
|
||||||
|
|
||||||
function __runsmod_getpath_from_baseurl() {
|
function __runsmod_getpath_from_baseurl() {
|
||||||
# obtenir le nom correspond à un url de base, utilisable dans un chemin
|
# obtenir le nom correspond à un url de base, utilisable dans un chemin
|
||||||
local url="$1" scheme path userhost user host dummy
|
local url="$1" scheme path userhost user host dummy
|
||||||
|
@ -220,18 +241,23 @@ function runsmod_should_update_repolists() {
|
||||||
# tester s'il faut mettre à jour au moins un des fichiers contenant les
|
# tester s'il faut mettre à jour au moins un des fichiers contenant les
|
||||||
# listes des dépôts
|
# listes des dépôts
|
||||||
local RUNSMOD_PROFILE
|
local RUNSMOD_PROFILE
|
||||||
local now baseurl repobase repopath repolistfile mtime
|
local now baseurl have_repolistfile repolistfile mtime
|
||||||
local -a urls
|
local -a baseurls
|
||||||
setx now=date +%s
|
setx now=date +%s
|
||||||
for RUNSMOD_PROFILE in "${RUNSMOD_PROFILES[@]}"; do
|
for RUNSMOD_PROFILE in "${RUNSMOD_PROFILES[@]}"; do
|
||||||
setx baseurl=__runsmod_get BASEURL || continue
|
__runsmod_get -a baseurls BASEURL
|
||||||
setx repolistfile=__runsmod_get_repolistfile "$baseurl"
|
have_repolistfile=
|
||||||
|
for baseurl in "${baseurls[@]}"; do
|
||||||
# si le fichier n'existe pas, il faut mettre à jour
|
setx repolistfile=__runsmod_get_repolistfile "$baseurl"
|
||||||
[ -f "$repolistfile" ] || return 0
|
if [ -f "$repolistfile" ]; then
|
||||||
# si le fichier a été modifié depuis plus de 24 heures, mettre à jour
|
have_repolistfile=1
|
||||||
setx mtime=stat -c %Y "$repolistfile"
|
# si le fichier a été modifié depuis plus de 24 heures, mettre à jour
|
||||||
[ $(($now - $mtime)) -lt 86400 ] || return 0
|
setx mtime=stat -c %Y "$repolistfile"
|
||||||
|
[ $(($now - $mtime)) -lt 86400 ] || return 0
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
# si aucun des fichiers n'existe, il faut mettre à jour
|
||||||
|
[ -n "$have_repolistfile" ] || return 0
|
||||||
done
|
done
|
||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
|
@ -241,34 +267,42 @@ function runsmod_update_repolists() {
|
||||||
# Si $1 n'est pas vide, forcer la mise à jour de tous les fichiers
|
# Si $1 n'est pas vide, forcer la mise à jour de tous les fichiers
|
||||||
local force="$1"; shift
|
local force="$1"; shift
|
||||||
local RUNSMOD_PROFILE
|
local RUNSMOD_PROFILE
|
||||||
local now baseurl repobase repopath repo mtime update
|
local now baseurl repobase repopath repo mtime update error
|
||||||
local -a urls
|
local -a baseurls
|
||||||
setx now=date +%s
|
setx now=date +%s
|
||||||
for RUNSMOD_PROFILE in "${RUNSMOD_PROFILES[@]}"; do
|
for RUNSMOD_PROFILE in "${RUNSMOD_PROFILES[@]}"; do
|
||||||
setx baseurl=__runsmod_get BASEURL || continue
|
__runsmod_get -a baseurls BASEURL
|
||||||
setx repolistfile=__runsmod_get_repolistfile "$baseurl"
|
for baseurl in "${baseurls[@]}"; do
|
||||||
|
setx repolistfile=__runsmod_get_repolistfile "$baseurl"
|
||||||
|
|
||||||
update="$force"
|
update="$force"
|
||||||
if [ -z "$update" ]; then
|
if [ -z "$update" ]; then
|
||||||
# si le fichier n'existe pas, il faut mettre à jour
|
# si le fichier n'existe pas, il faut mettre à jour
|
||||||
[ -f "$repolistfile" ] || update=1
|
[ -f "$repolistfile" ] || update=1
|
||||||
fi
|
|
||||||
if [ -z "$update" ]; then
|
|
||||||
# si le fichier a été modifié depuis plus de 24 heures, mettre à jour
|
|
||||||
setx mtime=stat -c %Y "$repolistfile"
|
|
||||||
[ $(($now - $mtime)) -lt 86400 ] || update=1
|
|
||||||
fi
|
|
||||||
if [ -n "$update" ]; then
|
|
||||||
local list
|
|
||||||
ebegin "$baseurl"
|
|
||||||
if setx list=__runsmod_getinfo "$baseurl"; then
|
|
||||||
echo "$list" | __runsmod_fixinfo >"$repolistfile"
|
|
||||||
edot 0
|
|
||||||
else
|
|
||||||
edot 1
|
|
||||||
fi
|
fi
|
||||||
eend
|
if [ -z "$update" ]; then
|
||||||
fi
|
# si le fichier a été modifié depuis plus de 24 heures, mettre à jour
|
||||||
|
setx mtime=stat -c %Y "$repolistfile"
|
||||||
|
[ $(($now - $mtime)) -lt 86400 ] || update=1
|
||||||
|
fi
|
||||||
|
|
||||||
|
error=
|
||||||
|
if [ -n "$update" ]; then
|
||||||
|
local list
|
||||||
|
ebegin "$baseurl"
|
||||||
|
if setx list=__runsmod_getinfo "$baseurl"; then
|
||||||
|
echo "$list" | __runsmod_fixinfo >"$repolistfile"
|
||||||
|
edot 0
|
||||||
|
else
|
||||||
|
error=1
|
||||||
|
edot 1
|
||||||
|
fi
|
||||||
|
eend
|
||||||
|
fi
|
||||||
|
[ -n "$error" ] && continue
|
||||||
|
|
||||||
|
break
|
||||||
|
done
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -326,7 +360,6 @@ function __runsmod_match_repo_add() {
|
||||||
|
|
||||||
function __runsmod_clone_or_pull() {
|
function __runsmod_clone_or_pull() {
|
||||||
local repourl="$1" repodir="$2"
|
local repourl="$1" repodir="$2"
|
||||||
mkdirof "$repodir"
|
|
||||||
if [ -d "$repodir" ]; then
|
if [ -d "$repodir" ]; then
|
||||||
if [ -n "$RUNSMOD_PULL" ]; then
|
if [ -n "$RUNSMOD_PULL" ]; then
|
||||||
estepi "pull $(ppath "$repodir") [$repourl]"
|
estepi "pull $(ppath "$repodir") [$repourl]"
|
||||||
|
@ -339,6 +372,7 @@ function __runsmod_clone_or_pull() {
|
||||||
else
|
else
|
||||||
if [ -n "$RUNSMOD_CLONE" ]; then
|
if [ -n "$RUNSMOD_CLONE" ]; then
|
||||||
estepi "clone $(ppath "$repodir") [$repourl]"
|
estepi "clone $(ppath "$repodir") [$repourl]"
|
||||||
|
mkdirof "$repodir"
|
||||||
git clone ${RUNSMOD_SHALLOW:+--depth 1} "$repourl" "$repodir"
|
git clone ${RUNSMOD_SHALLOW:+--depth 1} "$repourl" "$repodir"
|
||||||
return $?
|
return $?
|
||||||
else
|
else
|
||||||
|
@ -365,7 +399,7 @@ function runsmod_clone_or_pull() {
|
||||||
enote "Autocorrection du nom d'hôte en $host"
|
enote "Autocorrection du nom d'hôte en $host"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
local -a repolist reposuffixes reponames repourls
|
local -a baseurls 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
|
||||||
|
@ -373,115 +407,21 @@ function runsmod_clone_or_pull() {
|
||||||
# Tout d'abord, traiter les dépôts sans variable %m
|
# Tout d'abord, traiter les dépôts sans variable %m
|
||||||
edebug "Traitement des dépôts sans vmodule"
|
edebug "Traitement des dépôts sans vmodule"
|
||||||
for RUNSMOD_PROFILE in "${RUNSMOD_PROFILES[@]}"; do
|
for RUNSMOD_PROFILE in "${RUNSMOD_PROFILES[@]}"; do
|
||||||
setx baseurl=__runsmod_get BASEURL || continue
|
__runsmod_get -a baseurls BASEURL
|
||||||
setx repopath=__runsmod_getpath_from_baseurl "$baseurl"
|
for baseurl in "${baseurls[@]}"; do
|
||||||
setx repolistfile=__runsmod_get_repolistfile "$baseurl"
|
setx repopath=__runsmod_getpath_from_baseurl "$baseurl"
|
||||||
[ -f "$repolistfile" ] || continue
|
setx repolistfile=__runsmod_get_repolistfile "$baseurl"
|
||||||
array_from_lines repolist "$(<"$repolistfile")"
|
[ -f "$repolistfile" ] || continue
|
||||||
|
array_from_lines repolist "$(<"$repolistfile")"
|
||||||
edebug ".. baseurl=$baseurl, repopath=$repopath"
|
|
||||||
for vprefix in SCRIPTS MODULES HOSTS; do
|
|
||||||
__runsmod_get -a repourls "${vprefix}_URLS"
|
|
||||||
edebug ".... vprefix=$vprefix, repourls=(${repourls[*]})"
|
|
||||||
|
|
||||||
for repospec in "${repourls[@]}"; do
|
|
||||||
edebug "...... repospec=$repospec"
|
|
||||||
__runsmod_has_vmodule "$repospec" && continue
|
|
||||||
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
|
|
||||||
else
|
|
||||||
reposuffix=
|
|
||||||
fi
|
|
||||||
|
|
||||||
reponames=()
|
|
||||||
if __runsmod_has_vhost "$repospec"; then
|
|
||||||
if [ -n "$all_hosts" ]; then
|
|
||||||
setx repospec=__runsmod_replace1 "$repospec" "*"
|
|
||||||
__runsmod_match_repo_add repolist "$repospec" reponames
|
|
||||||
elif [ -n "$host" ]; then
|
|
||||||
setx reponame=__runsmod_replace1 "$repospec" "$host"
|
|
||||||
array_contains repolist "$reponame" && array_add reponames "$reponame"
|
|
||||||
setx reponame=__runsmod_replace2 "$repospec" "$host"
|
|
||||||
array_contains repolist "$reponame" && array_add reponames "$reponame"
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
array_contains repolist "$repospec" && array_add reponames "$repospec"
|
|
||||||
fi
|
|
||||||
|
|
||||||
edebug "...... reponames=(${reponames[*]})"
|
|
||||||
for reponame in "${reponames[@]}"; do
|
|
||||||
repodir="$RUNSMOD_BASEDIR/$repopath/$reponame"
|
|
||||||
|
|
||||||
setx repourl=__runsmod_fixurl "$reponame" "$baseurl"
|
|
||||||
__runsmod_clone_or_pull "$repourl" "$repodir" || r=1
|
|
||||||
|
|
||||||
[ -d "$repodir" ] || continue
|
|
||||||
array_contains REPODIRS "$repodir" && continue
|
|
||||||
array_addu REPODIRS "$repodir"
|
|
||||||
|
|
||||||
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
|
|
||||||
done
|
|
||||||
done
|
|
||||||
done
|
|
||||||
done
|
|
||||||
done
|
|
||||||
|
|
||||||
## Ensuite, traiter les dépôts de module
|
|
||||||
|
|
||||||
# modules contient la liste des modules qui ont été trouvés, pour ne pas les
|
|
||||||
# lister en double s'ils existent dans plusieurs sources
|
|
||||||
edebug "Traitement des dépôts de modules"
|
|
||||||
local -a modules foundmodules
|
|
||||||
local all_modules
|
|
||||||
|
|
||||||
modules=("$@")
|
|
||||||
for RUNSMOD_PROFILE in "${RUNSMOD_PROFILES[@]}"; do
|
|
||||||
setx baseurl=__runsmod_get BASEURL || continue
|
|
||||||
setx repopath=__runsmod_getpath_from_baseurl "$baseurl"
|
|
||||||
setx repolistfile=__runsmod_get_repolistfile "$baseurl"
|
|
||||||
[ -f "$repolistfile" ] || continue
|
|
||||||
array_from_lines repolist "$(<"$repolistfile")"
|
|
||||||
|
|
||||||
edebug ".. baseurl=$baseurl, repopath=$repopath"
|
|
||||||
for module in "${modules[@]}"; do
|
|
||||||
if [ "$module" == "*" ]; then
|
|
||||||
module=
|
|
||||||
all_modules=1
|
|
||||||
else
|
|
||||||
array_contains foundmodules "$module" && continue
|
|
||||||
all_modules=
|
|
||||||
fi
|
|
||||||
edebug ".... module=$module"
|
|
||||||
|
|
||||||
|
edebug ".. baseurl=$baseurl, repopath=$repopath"
|
||||||
for vprefix in SCRIPTS MODULES HOSTS; do
|
for vprefix in SCRIPTS MODULES HOSTS; do
|
||||||
__runsmod_get -a repourls "${vprefix}_URLS"
|
__runsmod_get -a repourls "${vprefix}_URLS"
|
||||||
edebug "...... vprefix=$vprefix, repourls=(${repourls[*]})"
|
edebug ".... vprefix=$vprefix, repourls=(${repourls[*]})"
|
||||||
|
|
||||||
for repospec in "${repourls[@]}"; do
|
for repospec in "${repourls[@]}"; do
|
||||||
edebug "........ repospec=$repospec"
|
edebug "...... repospec=$repospec"
|
||||||
__runsmod_has_vmodule "$repospec" || continue
|
__runsmod_has_vmodule "$repospec" && continue
|
||||||
if [[ "$repospec" == *//* ]]; then
|
if [[ "$repospec" == *//* ]]; then
|
||||||
reposuffix="${repospec#*//}"
|
reposuffix="${repospec#*//}"
|
||||||
[ -n "$reposuffix" ] && reposuffix="/$reposuffix"
|
[ -n "$reposuffix" ] && reposuffix="/$reposuffix"
|
||||||
|
@ -506,54 +446,36 @@ function runsmod_clone_or_pull() {
|
||||||
fi
|
fi
|
||||||
|
|
||||||
reponames=()
|
reponames=()
|
||||||
if [ -n "$all_modules" ]; then
|
if __runsmod_has_vhost "$repospec"; then
|
||||||
if __runsmod_has_vhost "$repospec"; then
|
if [ -n "$all_hosts" ]; then
|
||||||
if [ -n "$all_hosts" ]; then
|
setx repospec=__runsmod_replace1 "$repospec" "*"
|
||||||
setx repospec=__runsmod_replace1 "$repospec" "*" "*"
|
|
||||||
__runsmod_match_repo_add repolist "$repospec" reponames
|
|
||||||
elif [ -n "$host" ]; then
|
|
||||||
setx repospec=__runsmod_replace1 "$repospec" "$host" "*"
|
|
||||||
__runsmod_match_repo_add repolist "$repospec" reponames
|
|
||||||
setx repospec=__runsmod_replace2 "$repospec" "$host" "*"
|
|
||||||
__runsmod_match_repo_add repolist "$repospec" reponames
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
setx repospec=__runsmod_replace1 "$repospec" "" "*"
|
|
||||||
__runsmod_match_repo_add repolist "$repospec" reponames
|
__runsmod_match_repo_add repolist "$repospec" reponames
|
||||||
|
elif [ -n "$host" ]; then
|
||||||
|
setx reponame=__runsmod_replace1 "$repospec" "$host"
|
||||||
|
array_contains repolist "$reponame" && array_add reponames "$reponame"
|
||||||
|
setx reponame=__runsmod_replace2 "$repospec" "$host"
|
||||||
|
array_contains repolist "$reponame" && array_add reponames "$reponame"
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
if __runsmod_has_vhost "$repospec"; then
|
array_contains repolist "$repospec" && array_add reponames "$repospec"
|
||||||
if [ -n "$host" ]; then
|
|
||||||
setx reponame=__runsmod_replace1 "$repospec" "$host" "$module"
|
|
||||||
array_contains repolist "$reponame" && array_add reponames "$reponame"
|
|
||||||
setx reponame=__runsmod_replace2 "$repospec" "$host" "$module"
|
|
||||||
array_contains repolist "$reponame" && array_add reponames "$reponame"
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
setx reponame=__runsmod_replace1 "$repospec" "" "$module"
|
|
||||||
array_contains repolist "$reponame" && array_add reponames "$reponame"
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
edebug "........ reponames=(${reponames[*]})"
|
edebug "...... reponames=(${reponames[*]})"
|
||||||
for reponame in "${reponames[@]}"; do
|
for reponame in "${reponames[@]}"; do
|
||||||
repodir="$RUNSMOD_BASEDIR/$repopath/$reponame"
|
repodir="$RUNSMOD_BASEDIR/$repopath/$reponame"
|
||||||
|
|
||||||
setx repourl=__runsmod_fixurl "$reponame" "$baseurl"
|
setx repourl=__runsmod_fixurl "$reponame" "$baseurl"
|
||||||
|
setx repodir=__runsmod_mapdir "$repodir" "$RUNSMOD_BASEDIR/$repopath"
|
||||||
__runsmod_clone_or_pull "$repourl" "$repodir" || r=1
|
__runsmod_clone_or_pull "$repourl" "$repodir" || r=1
|
||||||
|
|
||||||
[ -d "$repodir" ] || continue
|
[ -d "$repodir" ] || continue
|
||||||
array_contains REPODIRS "$repodir" && continue
|
array_contains REPODIRS "$repodir" && continue
|
||||||
array_addu REPODIRS "$repodir"
|
array_addu REPODIRS "$repodir"
|
||||||
[ -z "$all_modules" ] && array_addu foundmodules "$module"
|
|
||||||
|
|
||||||
for reposuffix in "${reposuffixes[@]}"; do
|
for reposuffix in "${reposuffixes[@]}"; do
|
||||||
case "$vprefix" in
|
case "$vprefix" in
|
||||||
SCRIPTS) array_addu SCRIPTSDIRS "$repodir$reposuffix";;
|
SCRIPTS) array_addu SCRIPTSDIRS "$repodir$reposuffix";;
|
||||||
MODULES)
|
MODULES) array_addu MODULESDIRS "$repodir$reposuffix";;
|
||||||
setx moduledir=dirname -- "$repodir$reposuffix"
|
|
||||||
array_addu MODULESDIRS "$moduledir"
|
|
||||||
;;
|
|
||||||
HOSTS) array_addu HOSTSDIRS "$repodir$reposuffix";;
|
HOSTS) array_addu HOSTSDIRS "$repodir$reposuffix";;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
@ -563,6 +485,124 @@ function runsmod_clone_or_pull() {
|
||||||
done
|
done
|
||||||
done
|
done
|
||||||
|
|
||||||
|
## Ensuite, traiter les dépôts de module
|
||||||
|
|
||||||
|
# modules contient la liste des modules qui ont été trouvés, pour ne pas les
|
||||||
|
# lister en double s'ils existent dans plusieurs sources
|
||||||
|
edebug "Traitement des dépôts de modules"
|
||||||
|
local -a modules foundmodules
|
||||||
|
local all_modules
|
||||||
|
|
||||||
|
modules=("$@")
|
||||||
|
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
|
||||||
|
array_from_lines repolist "$(<"$repolistfile")"
|
||||||
|
|
||||||
|
edebug ".. baseurl=$baseurl, repopath=$repopath"
|
||||||
|
for module in "${modules[@]}"; do
|
||||||
|
if [ "$module" == "*" ]; then
|
||||||
|
module=
|
||||||
|
all_modules=1
|
||||||
|
else
|
||||||
|
array_contains foundmodules "$module" && continue
|
||||||
|
all_modules=
|
||||||
|
fi
|
||||||
|
edebug ".... module=$module"
|
||||||
|
|
||||||
|
for vprefix in SCRIPTS MODULES HOSTS; do
|
||||||
|
__runsmod_get -a repourls "${vprefix}_URLS"
|
||||||
|
edebug "...... vprefix=$vprefix, repourls=(${repourls[*]})"
|
||||||
|
|
||||||
|
for repospec in "${repourls[@]}"; do
|
||||||
|
edebug "........ repospec=$repospec"
|
||||||
|
__runsmod_has_vmodule "$repospec" || continue
|
||||||
|
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
|
||||||
|
else
|
||||||
|
reposuffix=
|
||||||
|
fi
|
||||||
|
|
||||||
|
reponames=()
|
||||||
|
if [ -n "$all_modules" ]; then
|
||||||
|
if __runsmod_has_vhost "$repospec"; then
|
||||||
|
if [ -n "$all_hosts" ]; then
|
||||||
|
setx repospec=__runsmod_replace1 "$repospec" "*" "*"
|
||||||
|
__runsmod_match_repo_add repolist "$repospec" reponames
|
||||||
|
elif [ -n "$host" ]; then
|
||||||
|
setx repospec=__runsmod_replace1 "$repospec" "$host" "*"
|
||||||
|
__runsmod_match_repo_add repolist "$repospec" reponames
|
||||||
|
setx repospec=__runsmod_replace2 "$repospec" "$host" "*"
|
||||||
|
__runsmod_match_repo_add repolist "$repospec" reponames
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
setx repospec=__runsmod_replace1 "$repospec" "" "*"
|
||||||
|
__runsmod_match_repo_add repolist "$repospec" reponames
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
if __runsmod_has_vhost "$repospec"; then
|
||||||
|
if [ -n "$host" ]; then
|
||||||
|
setx reponame=__runsmod_replace1 "$repospec" "$host" "$module"
|
||||||
|
array_contains repolist "$reponame" && array_add reponames "$reponame"
|
||||||
|
setx reponame=__runsmod_replace2 "$repospec" "$host" "$module"
|
||||||
|
array_contains repolist "$reponame" && array_add reponames "$reponame"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
setx reponame=__runsmod_replace1 "$repospec" "" "$module"
|
||||||
|
array_contains repolist "$reponame" && array_add reponames "$reponame"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
edebug "........ reponames=(${reponames[*]})"
|
||||||
|
for reponame in "${reponames[@]}"; do
|
||||||
|
repodir="$RUNSMOD_BASEDIR/$repopath/$reponame"
|
||||||
|
|
||||||
|
setx repourl=__runsmod_fixurl "$reponame" "$baseurl"
|
||||||
|
setx repodir=__runsmod_mapdir "$repodir" "$RUNSMOD_BASEDIR/$repopath"
|
||||||
|
__runsmod_clone_or_pull "$repourl" "$repodir" || r=1
|
||||||
|
|
||||||
|
[ -d "$repodir" ] || continue
|
||||||
|
array_contains REPODIRS "$repodir" && continue
|
||||||
|
array_addu REPODIRS "$repodir"
|
||||||
|
[ -z "$all_modules" ] && array_addu foundmodules "$module"
|
||||||
|
|
||||||
|
for reposuffix in "${reposuffixes[@]}"; do
|
||||||
|
case "$vprefix" in
|
||||||
|
SCRIPTS) array_addu SCRIPTSDIRS "$repodir$reposuffix";;
|
||||||
|
MODULES)
|
||||||
|
setx moduledir=dirname -- "$repodir$reposuffix"
|
||||||
|
array_addu MODULESDIRS "$moduledir"
|
||||||
|
;;
|
||||||
|
HOSTS) array_addu HOSTSDIRS "$repodir$reposuffix";;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
done
|
||||||
|
done
|
||||||
|
done
|
||||||
|
done
|
||||||
|
done
|
||||||
|
done
|
||||||
|
|
||||||
for module in "${modules[@]}"; do
|
for module in "${modules[@]}"; do
|
||||||
[ "$module" == "*" ] && continue
|
[ "$module" == "*" ] && continue
|
||||||
array_contains foundmodules "$module" || ewarn "$module: module non trouvé"
|
array_contains foundmodules "$module" || ewarn "$module: module non trouvé"
|
||||||
|
|
|
@ -17,6 +17,7 @@ RUNSMOD_MODULES_URLS=(hosts/%h/modules/%m hosts/%h/all modules/%m)
|
||||||
#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/all hosts/all/%n/%m modules/%m)
|
||||||
RUNSMOD_HOSTS_URLS=(runsh)
|
RUNSMOD_HOSTS_URLS=(runsh)
|
||||||
RUNSMOD_BASEDIR="$HOME/runs"
|
RUNSMOD_BASEDIR="$HOME/runs"
|
||||||
|
RUNSMOD_MAP=()
|
||||||
RUNSMOD_PROFILES=(pvcs vcs jclain)
|
RUNSMOD_PROFILES=(pvcs vcs jclain)
|
||||||
|
|
||||||
# pvcs
|
# pvcs
|
||||||
|
@ -25,6 +26,13 @@ RUNSMOD_pvcs_devel_BASEURL=pgit@vcs.univ.run
|
||||||
RUNSMOD_pvcs_SCRIPTS_URLS=("${RUNSMOD_SCRIPTS_URLS[@]}" si/base-runs)
|
RUNSMOD_pvcs_SCRIPTS_URLS=("${RUNSMOD_SCRIPTS_URLS[@]}" si/base-runs)
|
||||||
RUNSMOD_pvcs_MODULES_URLS=("${RUNSMOD_MODULES_URLS[@]}")
|
RUNSMOD_pvcs_MODULES_URLS=("${RUNSMOD_MODULES_URLS[@]}")
|
||||||
RUNSMOD_pvcs_HOSTS_URLS=("${RUNSMOD_HOSTS_URLS[@]}")
|
RUNSMOD_pvcs_HOSTS_URLS=("${RUNSMOD_HOSTS_URLS[@]}")
|
||||||
|
RUNSMOD_pvcs_MAP=(
|
||||||
|
si/base-runs:"$HOME/wop/legacy-runs"
|
||||||
|
runss:"$HOME/wop/runs"
|
||||||
|
modules:"$HOME/wop/pmodules"
|
||||||
|
hosts:"$HOME/wop/hosts"
|
||||||
|
runsh:"$HOME/wop/hosts/all/hosts"
|
||||||
|
)
|
||||||
|
|
||||||
# vcs
|
# vcs
|
||||||
RUNSMOD_vcs_BASEURL=(http://vcs.univ.run/anongit http://vcs.univ-reunion.fr/anongit)
|
RUNSMOD_vcs_BASEURL=(http://vcs.univ.run/anongit http://vcs.univ-reunion.fr/anongit)
|
||||||
|
@ -32,9 +40,21 @@ RUNSMOD_vcs_devel_BASEURL=git@vcs.univ.run
|
||||||
RUNSMOD_vcs_SCRIPTS_URLS=("${RUNSMOD_SCRIPTS_URLS[@]}")
|
RUNSMOD_vcs_SCRIPTS_URLS=("${RUNSMOD_SCRIPTS_URLS[@]}")
|
||||||
RUNSMOD_vcs_MODULES_URLS=("${RUNSMOD_MODULES_URLS[@]}")
|
RUNSMOD_vcs_MODULES_URLS=("${RUNSMOD_MODULES_URLS[@]}")
|
||||||
RUNSMOD_vcs_HOSTS_URLS=("${RUNSMOD_HOSTS_URLS[@]}")
|
RUNSMOD_vcs_HOSTS_URLS=("${RUNSMOD_HOSTS_URLS[@]}")
|
||||||
|
RUNSMOD_vcs_MAP=(
|
||||||
|
runss:"$HOME/wop/pruns"
|
||||||
|
modules:"$HOME/wop/modules"
|
||||||
|
hosts:"$HOME/wop/hosts"
|
||||||
|
runsh:"$HOME/wop/hosts/all/phosts"
|
||||||
|
)
|
||||||
|
|
||||||
# jclain
|
# jclain
|
||||||
RUNSMOD_jclain_BASEURL=git@jclain.fr
|
RUNSMOD_jclain_BASEURL=git@jclain.fr
|
||||||
RUNSMOD_jclain_SCRIPTS_URLS=("${RUNSMOD_SCRIPTS_URLS[@]}")
|
RUNSMOD_jclain_SCRIPTS_URLS=("${RUNSMOD_SCRIPTS_URLS[@]}")
|
||||||
RUNSMOD_jclain_MODULES_URLS=("${RUNSMOD_MODULES_URLS[@]}")
|
RUNSMOD_jclain_MODULES_URLS=("${RUNSMOD_MODULES_URLS[@]}")
|
||||||
RUNSMOD_jclain_HOSTS_URLS=("${RUNSMOD_HOSTS_URLS[@]}")
|
RUNSMOD_jclain_HOSTS_URLS=("${RUNSMOD_HOSTS_URLS[@]}")
|
||||||
|
RUNSMOD_jclain_MAP=(
|
||||||
|
runss:"$HOME/wop/j/runs"
|
||||||
|
modules:"$HOME/wop/j/modules"
|
||||||
|
hosts:"$HOME/wop/j/hosts"
|
||||||
|
runsh:"$HOME/wop/j/hosts/all/hosts"
|
||||||
|
)
|
||||||
|
|
Loading…
Reference in New Issue