Intégration de la branche release-5.2.0
This commit is contained in:
commit
f253728463
17
CHANGES.txt
17
CHANGES.txt
|
@ -1,3 +1,20 @@
|
||||||
|
## Version 5.2.0 du 31/08/2016-22:30
|
||||||
|
|
||||||
|
+ 361f1b2 Intégration de la branche runsmod-goodies
|
||||||
|
| 8854469 maj de la config par défaut
|
||||||
|
| f0a71e4 bug avec la génération de sysinfos.conf
|
||||||
|
| 830a33b rruns calcule aussi les chemins d'hôtes automatiquement
|
||||||
|
| 40f5347 préparer le calcul automatique des chemins
|
||||||
|
| 2fbc599 bug avec git clone lors du basculement sur la branche develop
|
||||||
|
| 5bef9b1 utiliser la même logique que uproject pour cloner en mode devel
|
||||||
|
| 96afb2a mapping des répertoires de destination
|
||||||
|
| 4b212d8 ne pas utiliser %n tout de suite
|
||||||
|
| 30e5dda runs et rruns: améliorer le calcul des chemins
|
||||||
|
| 55c5755 support de //...%h...
|
||||||
|
| 409e406 préparer implémentation de %n
|
||||||
|
+ 208f30d Intégration de la branche better-fndate
|
||||||
|
| f388f27 ajouter des liens pour les fonctions courantes de fndate. En mode automatique, si le fichier contient déjà une mention de date, ne pas la modifier. rajouter l'option -@ pour forcer la modification de la date
|
||||||
|
|
||||||
## Version 5.1.0 du 25/08/2016-15:36
|
## Version 5.1.0 du 25/08/2016-15:36
|
||||||
|
|
||||||
8a33418 ulib/ldif: support de l'opération modrdn
|
8a33418 ulib/ldif: support de l'opération modrdn
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
5.1.0
|
5.2.0
|
||||||
|
|
200
fndate
200
fndate
|
@ -1,5 +1,16 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# -*- coding: utf-8 mode: sh -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8
|
# -*- coding: utf-8 mode: sh -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8
|
||||||
|
|
||||||
|
TOOLS=(ddir dfile dcopy dmove dcmd)
|
||||||
|
if [ "$#" -eq 1 -a "$1" == --nutools-makelinks ]; then
|
||||||
|
# créer les liens
|
||||||
|
scriptname="$(basename "$0")"
|
||||||
|
for tool in "${TOOLS[@]}"; do
|
||||||
|
ln -s "$scriptname" "$tool"
|
||||||
|
done
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
source "$(dirname "$0")/lib/ulib/ulib" || exit 1
|
source "$(dirname "$0")/lib/ulib/ulib" || exit 1
|
||||||
urequire DEFAULTS
|
urequire DEFAULTS
|
||||||
|
|
||||||
|
@ -41,10 +52,17 @@ OPTIONS
|
||||||
arguments, alors ajouter la date à la fin de la commande. Par exemple,
|
arguments, alors ajouter la date à la fin de la commande. Par exemple,
|
||||||
voici comment émuler l'option -k
|
voici comment émuler l'option -k
|
||||||
$scriptname -c cp src dest/~~
|
$scriptname -c cp src dest/~~
|
||||||
|
--string
|
||||||
|
Remplacer dans chaque argument le placeholder par la date et afficher le
|
||||||
|
résultat.
|
||||||
-P, --placeholder PLACEHOLDER
|
-P, --placeholder PLACEHOLDER
|
||||||
Dans le nom spécifié, remplacer PLACEHOLDER par la date. Par défaut,
|
Dans le nom spécifié, remplacer PLACEHOLDER par la date. Par défaut,
|
||||||
PLACEHOLDER vaut ~~. Si le nom spécifié ne contient pas le PLACEHOLDER,
|
PLACEHOLDER vaut ~~. Si le nom spécifié ne contient pas le PLACEHOLDER,
|
||||||
il est placé au début.
|
il est placé au début.
|
||||||
|
-@, --force-date DATE
|
||||||
|
Dans le nom spécifié, si la date est déjà présente, forcer son
|
||||||
|
remplacement par la valeur spécifiée. Par défaut, le fichier n'est pas
|
||||||
|
modifié si la date est déjà présente.
|
||||||
-F, --format FORMAT
|
-F, --format FORMAT
|
||||||
Spécifier le format de la date à insérer dans le nom du fichier. Par
|
Spécifier le format de la date à insérer dans le nom du fichier. Par
|
||||||
défaut, FORMAT vaut 'YYMMDD-'
|
défaut, FORMAT vaut 'YYMMDD-'
|
||||||
|
@ -53,7 +71,13 @@ OPTIONS
|
||||||
YY année sur 2 chiffres
|
YY année sur 2 chiffres
|
||||||
MM mois sur 2 chiffres
|
MM mois sur 2 chiffres
|
||||||
DD jour sur 2 chiffres
|
DD jour sur 2 chiffres
|
||||||
Tous les autres caractères sont pris tels-quels"
|
Tous les autres caractères sont pris tels-quels
|
||||||
|
-s, --short
|
||||||
|
Equivalent à -F YYMMDD --autof
|
||||||
|
-l, --long
|
||||||
|
Equivalent à -F YYYMMDD --autof
|
||||||
|
--autof
|
||||||
|
Option non (pas encore) documentée"
|
||||||
}
|
}
|
||||||
|
|
||||||
function create() {
|
function create() {
|
||||||
|
@ -66,13 +90,43 @@ function have_ph() {
|
||||||
[[ "$1" == *"$placeholder"* ]]
|
[[ "$1" == *"$placeholder"* ]]
|
||||||
}
|
}
|
||||||
function replace_ph() {
|
function replace_ph() {
|
||||||
awkrun ph="$placeholder" format="$format" autof:int="$autof" '
|
local fy fm fd
|
||||||
|
if [ -n "$force_date" ]; then
|
||||||
|
fd="${force_date:0:2}"
|
||||||
|
fm="${force_date:3:2}"
|
||||||
|
fy="${force_date:6:4}"
|
||||||
|
fi
|
||||||
|
awkrun ph="$placeholder" \
|
||||||
|
force_date="$force_date" fy:str="$fy" fm:str="$fm" fd:str="$fd" \
|
||||||
|
format="$format" autof:int="$autof" '
|
||||||
|
function short2long(s, cy, py, sy, ly) {
|
||||||
|
cy = strftime("%Y") + 0
|
||||||
|
cy = cy - cy % 100
|
||||||
|
py = cy - 100
|
||||||
|
sy = substr(s, 1, 2) + 0
|
||||||
|
if (sy >= 80) ly = py + sy
|
||||||
|
else ly = cy + sy
|
||||||
|
return ly substr(s, 3)
|
||||||
|
}
|
||||||
|
|
||||||
BEGIN {
|
BEGIN {
|
||||||
|
if (format ~ /YYYYMMDD/) type = "long"
|
||||||
|
else if (format ~ /YYMMDD/) type = "short"
|
||||||
|
else type = "custom"
|
||||||
|
|
||||||
|
if (force_date != "") {
|
||||||
|
gsub(/%/, "%%", format)
|
||||||
|
gsub(/YYYY/, fy, format)
|
||||||
|
gsub(/YY/, substr(fy, 3, 2), format)
|
||||||
|
gsub(/MM/, fm, format)
|
||||||
|
gsub(/DD/, fd, format)
|
||||||
|
} else {
|
||||||
gsub(/%/, "%%", format)
|
gsub(/%/, "%%", format)
|
||||||
gsub(/YYYY/, "%Y", format)
|
gsub(/YYYY/, "%Y", format)
|
||||||
gsub(/YY/, "%y", format)
|
gsub(/YY/, "%y", format)
|
||||||
gsub(/MM/, "%m", format)
|
gsub(/MM/, "%m", format)
|
||||||
gsub(/DD/, "%d", format)
|
gsub(/DD/, "%d", format)
|
||||||
|
}
|
||||||
date = strftime(format)
|
date = strftime(format)
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
|
@ -88,7 +142,43 @@ BEGIN {
|
||||||
if (autof) {
|
if (autof) {
|
||||||
pos = index(name, ph)
|
pos = index(name, ph)
|
||||||
if (pos == 0) {
|
if (pos == 0) {
|
||||||
|
if (force_date != "") {
|
||||||
|
if (type == "long") {
|
||||||
|
if (name ~ /^[0-9]{8}/) {
|
||||||
|
name = substr(name, 9)
|
||||||
|
print dir date name
|
||||||
|
} else if (name ~ /^[0-9]{6}/) {
|
||||||
|
name = substr(name, 7)
|
||||||
|
print dir date name
|
||||||
|
} else {
|
||||||
print dir date "-" name
|
print dir date "-" name
|
||||||
|
}
|
||||||
|
} else if (type == "short") {
|
||||||
|
if (name ~ /^[0-9]{8}/) {
|
||||||
|
name = substr(name, 9)
|
||||||
|
print dir date name
|
||||||
|
} else if (name ~ /^[0-9]{6}/) {
|
||||||
|
name = substr(name, 7)
|
||||||
|
print dir date name
|
||||||
|
} else {
|
||||||
|
print dir date "-" name
|
||||||
|
}
|
||||||
|
} else if (type == "custom") {
|
||||||
|
print dir date "-" name
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (type == "long") {
|
||||||
|
if (name ~ /^[0-9]{8}/) print dir name
|
||||||
|
else if (name ~ /^[0-9]{6}/) print dir short2long(name)
|
||||||
|
else print dir date "-" name
|
||||||
|
} else if (type == "short") {
|
||||||
|
if (name ~ /^[0-9]{8}/) print dir substr(name, 3)
|
||||||
|
else if (name ~ /^[0-9]{6}/) print dir name
|
||||||
|
else print dir date "-" name
|
||||||
|
} else if (type == "custom") {
|
||||||
|
print dir date "-" name
|
||||||
|
}
|
||||||
|
}
|
||||||
} else if (pos == 1) {
|
} else if (pos == 1) {
|
||||||
print dir date "-" substr(name, length(ph) + 1)
|
print dir date "-" substr(name, length(ph) + 1)
|
||||||
} else if (pos == length(name) - length(ph) + 1) {
|
} else if (pos == length(name) - length(ph) + 1) {
|
||||||
|
@ -99,7 +189,27 @@ BEGIN {
|
||||||
} else {
|
} else {
|
||||||
pos = index(name, ph)
|
pos = index(name, ph)
|
||||||
if (pos == 0) {
|
if (pos == 0) {
|
||||||
|
if (force_date != "") {
|
||||||
|
if (type == "long") {
|
||||||
|
if (name ~ /^[0-9]{8}/) name = substr(name, 9)
|
||||||
print dir date name
|
print dir date name
|
||||||
|
} else if (type == "short") {
|
||||||
|
if (name ~ /^[0-9]{6}/) name = substr(name, 7)
|
||||||
|
print dir date name
|
||||||
|
} else if (type == "custom") {
|
||||||
|
print dir date name
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (type == "long") {
|
||||||
|
if (name ~ /^[0-9]{8}/) print dir name
|
||||||
|
else print dir date name
|
||||||
|
} else if (type == "short") {
|
||||||
|
if (name ~ /^[0-9]{6}/) print dir name
|
||||||
|
else print dir date name
|
||||||
|
} else if (type == "custom") {
|
||||||
|
print dir date name
|
||||||
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
print dir substr(name, 1, pos - 1) date substr(name, pos + length(ph))
|
print dir substr(name, 1, pos - 1) date substr(name, pos + length(ph))
|
||||||
}
|
}
|
||||||
|
@ -109,8 +219,17 @@ BEGIN {
|
||||||
|
|
||||||
action=create
|
action=create
|
||||||
create=
|
create=
|
||||||
|
case "$scriptname" in
|
||||||
|
ddir) action=create; create=dir;;
|
||||||
|
dfile) action=create; create=file;;
|
||||||
|
dcopy) action=copy;;
|
||||||
|
dmove) action=move;;
|
||||||
|
dcmd) action=cmd;;
|
||||||
|
esac
|
||||||
placeholder=
|
placeholder=
|
||||||
|
force_date=
|
||||||
format=
|
format=
|
||||||
|
autof=
|
||||||
parse_opts "${PRETTYOPTS[@]}" \
|
parse_opts "${PRETTYOPTS[@]}" \
|
||||||
--help '$exit_with display_help' \
|
--help '$exit_with display_help' \
|
||||||
--create-or-rename action=create \
|
--create-or-rename action=create \
|
||||||
|
@ -119,16 +238,19 @@ parse_opts "${PRETTYOPTS[@]}" \
|
||||||
-k,--copy action=copy \
|
-k,--copy action=copy \
|
||||||
-m,--move action=move \
|
-m,--move action=move \
|
||||||
-c,--cmd action=cmd \
|
-c,--cmd action=cmd \
|
||||||
|
--string action=string \
|
||||||
-P:,--placeholder: placeholder= \
|
-P:,--placeholder: placeholder= \
|
||||||
|
-@:,--force-date: force_date= \
|
||||||
-F:,--format: format= \
|
-F:,--format: format= \
|
||||||
|
-s,--short '$format=YYMMDD; autof=1' \
|
||||||
|
-l,--long '$format=YYYYMMDD; autof=1' \
|
||||||
--autof autof=1 \
|
--autof autof=1 \
|
||||||
@ args -- "$@" && set -- "${args[@]}" || die "$args"
|
@ args -- "$@" && set -- "${args[@]}" || die "$args"
|
||||||
|
|
||||||
[ -n "$create" ] || create=file
|
[ -n "$create" ] || create=file
|
||||||
[ -n "$placeholder" ] || placeholder="~~"
|
[ -n "$placeholder" ] || placeholder="~~"
|
||||||
if [ -n "$format" ]; then
|
[ -n "$force_date" ] && setx force_date=parse_date "$force_date"
|
||||||
autof=
|
if [ -z "$format" ]; then
|
||||||
else
|
|
||||||
format=YYMMDD
|
format=YYMMDD
|
||||||
autof=1
|
autof=1
|
||||||
fi
|
fi
|
||||||
|
@ -141,20 +263,20 @@ if [ "$action" == cmd ]; then
|
||||||
for arg in "$@"; do
|
for arg in "$@"; do
|
||||||
if have_ph "$arg"; then
|
if have_ph "$arg"; then
|
||||||
check_interaction -c && evalx qvals "${args[@]}" "$arg" // estepi "Commande:"
|
check_interaction -c && evalx qvals "${args[@]}" "$arg" // estepi "Commande:"
|
||||||
setx arg=replace_ph "$arg"
|
setx arg=replace_ph "$arg" "$force_date"
|
||||||
read_value "Veuillez confirmer le nom" arg "$arg"
|
read_value "Veuillez confirmer le nom" arg "$arg"
|
||||||
found=1
|
found=1
|
||||||
fi
|
fi
|
||||||
args=("${args[@]}" "$arg")
|
args=("${args[@]}" "$arg")
|
||||||
done
|
done
|
||||||
if [ -z "$found" ]; then
|
if [ -z "$found" ]; then
|
||||||
setx arg=replace_ph
|
setx arg=replace_ph "" "$force_date"
|
||||||
read_value "Veuillez entrer le nom du fichier" arg "$arg"
|
read_value "Veuillez entrer le nom du fichier" arg "$arg"
|
||||||
args=("${args[@]}" "$arg")
|
args=("${args[@]}" "$arg")
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if show_debug; then
|
if show_debug; then
|
||||||
evalx qvals "${args[@]}" // edebug "Commande:"
|
evalx qvals "${args[@]}" // edebug "Commande effective:"
|
||||||
ask_yesno "Voulez-vous continuer?" X || die
|
ask_yesno "Voulez-vous continuer?" X || die
|
||||||
fi
|
fi
|
||||||
"${args[@]}"
|
"${args[@]}"
|
||||||
|
@ -184,12 +306,17 @@ elif [ "$action" == copy -o "$action" == move ]; then
|
||||||
cmd=(mv -i)
|
cmd=(mv -i)
|
||||||
fi
|
fi
|
||||||
for src in "${srcs[@]}"; do
|
for src in "${srcs[@]}"; do
|
||||||
|
setx src=abspath "$src"
|
||||||
setx srcname=basename -- "$src"
|
setx srcname=basename -- "$src"
|
||||||
if [ -e "$src" ]; then
|
if [ -e "$src" ]; then
|
||||||
einfo "$cmdinfo de $(ppath "$src")"
|
estep "$cmdinfo de $(ppath "$src")"
|
||||||
setx destname=replace_ph "$srcname"
|
setx destname=replace_ph "$srcname" "$force_date"
|
||||||
|
setx dest=abspath "$destdir/$destname"
|
||||||
|
[ "$src" != "$dest" ] || ewarn "La source et la destination sont identiques"
|
||||||
read_value "Veuillez confirmer le nom" destname "$destname"
|
read_value "Veuillez confirmer le nom" destname "$destname"
|
||||||
"${cmd[@]}" "$src" "$destdir/$destname"
|
|
||||||
|
setx dest=abspath "$destdir/$destname"
|
||||||
|
[ "$src" != "$dest" ] && "${cmd[@]}" "$src" "$destdir/$destname"
|
||||||
else
|
else
|
||||||
ewarn "$src: fichier introuvable"
|
ewarn "$src: fichier introuvable"
|
||||||
fi
|
fi
|
||||||
|
@ -198,30 +325,63 @@ elif [ "$action" == copy -o "$action" == move ]; then
|
||||||
elif [ "$action" == create ]; then
|
elif [ "$action" == create ]; then
|
||||||
if [ $# -gt 0 ]; then
|
if [ $# -gt 0 ]; then
|
||||||
for src in "$@"; do
|
for src in "$@"; do
|
||||||
|
setx src=abspath "$src"
|
||||||
setx dir=dirname -- "$src"
|
setx dir=dirname -- "$src"
|
||||||
setx srcname=basename -- "$src"
|
setx srcname=basename -- "$src"
|
||||||
if [ -e "$src" ]; then
|
if [ -e "$src" ]; then
|
||||||
einfo "Renommage de $(ppath "$src")"
|
estep "Renommage de $(ppath "$src")"
|
||||||
setx destname=replace_ph "$srcname"
|
setx destname=replace_ph "$srcname" "$force_date"
|
||||||
|
setx dest=abspath "$dir/$destname"
|
||||||
|
[ "$src" != "$dest" ] || ewarn "La source et la destination sont identiques"
|
||||||
read_value "Veuillez confirmer le nom" destname "$destname"
|
read_value "Veuillez confirmer le nom" destname "$destname"
|
||||||
mv -i "$src" "$dir/$destname"
|
|
||||||
|
setx dest=abspath "$dir/$destname"
|
||||||
|
[ "$src" != "$dest" ] && mv -i "$src" "$dir/$destname"
|
||||||
else
|
else
|
||||||
einfo "Création de $(ppath "$src")"
|
setx destname=replace_ph "$srcname" "$force_date"
|
||||||
setx destname=replace_ph "$srcname"
|
setx dest=abspath "$dir/$destname"
|
||||||
|
if [ -d "$dest" ]; then
|
||||||
|
ewarn "$srcname --> $(ppath "$dest"): répertoire existant"
|
||||||
|
elif [ -e "$dest" ]; then
|
||||||
|
ewarn "$srcname --> $(ppath "$dest"): fichier existant"
|
||||||
|
else
|
||||||
|
estep "$srcname --> Création de $(ppath "$dest")"
|
||||||
|
fi
|
||||||
read_value "Veuillez confirmer le nom" destname "$destname"
|
read_value "Veuillez confirmer le nom" destname "$destname"
|
||||||
|
|
||||||
|
setx dest=abspath "$dir/$destname"
|
||||||
create "$dir/$destname"
|
create "$dir/$destname"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
else
|
||||||
|
setx destname=replace_ph "" "$force_date"
|
||||||
|
confirm_action=entrer
|
||||||
|
if [ -d "$destname" ]; then
|
||||||
|
ewarn "$destname: répertoire existant"
|
||||||
|
confirm_action=confirmer
|
||||||
|
elif [ -e "$destname" ]; then
|
||||||
|
ewarn "$destname: fichier existant"
|
||||||
|
confirm_action=confirmer
|
||||||
else
|
else
|
||||||
case "$create" in
|
case "$create" in
|
||||||
file) einfo "Création d'un nouveau fichier";;
|
file) estep "Création d'un nouveau fichier";;
|
||||||
dir) einfo "Création d'un nouveau répertoire";;
|
dir) estep "Création d'un nouveau répertoire";;
|
||||||
esac
|
esac
|
||||||
setx destname=replace_ph
|
fi
|
||||||
read_value "Veuillez entrer le nom" destname "$destname"
|
|
||||||
|
read_value "Veuillez $confirm_action le nom" destname "$destname"
|
||||||
create "$destname"
|
create "$destname"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
elif [ "$action" == string ]; then
|
||||||
|
if [ $# -gt 0 ]; then
|
||||||
|
for string in "$@"; do
|
||||||
|
replace_ph "$string" "$force_date"
|
||||||
|
done
|
||||||
|
else
|
||||||
|
replace_ph "" "$force_date"
|
||||||
|
fi
|
||||||
|
|
||||||
else
|
else
|
||||||
die "$action: action non implémentée"
|
die "$action: action non implémentée"
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -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é
|
||||||
|
|
|
@ -34,6 +34,7 @@ done
|
||||||
./udist --nutools-makelinks
|
./udist --nutools-makelinks
|
||||||
./ulink --nutools-makelinks
|
./ulink --nutools-makelinks
|
||||||
./doinplace --nutools-makelinks
|
./doinplace --nutools-makelinks
|
||||||
|
./fndate --nutools-makelinks
|
||||||
|
|
||||||
# complétion programmable
|
# complétion programmable
|
||||||
rm -f ~/etc/bashrc.d/bash_completion.nutools # renommé
|
rm -f ~/etc/bashrc.d/bash_completion.nutools # renommé
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
013001000
|
013002000
|
||||||
|
|
|
@ -141,7 +141,8 @@ function runs_initdir() {
|
||||||
estep "Création de $(ppath "$runshostdir/runs.conf")"
|
estep "Création de $(ppath "$runshostdir/runs.conf")"
|
||||||
echo "$runsconft" >"$runshostdir/runs.conf"
|
echo "$runsconft" >"$runshostdir/runs.conf"
|
||||||
fi
|
fi
|
||||||
if [ ! -f "$runshostdir/sysinfos.conf" ]; then
|
[ -f "$runshostdir/sysinfos.conf" ] || touch "$runshostdir/sysinfos.conf"
|
||||||
|
if [ -z "$(<"$runshostdir/sysinfos.conf" filter_comment)" ]; then
|
||||||
estep "Création de $(ppath "$runshostdir/sysinfos.conf")"
|
estep "Création de $(ppath "$runshostdir/sysinfos.conf")"
|
||||||
echo "$sysinfost" >"$runshostdir/sysinfos.conf"
|
echo "$sysinfost" >"$runshostdir/sysinfos.conf"
|
||||||
fi
|
fi
|
||||||
|
@ -747,6 +748,39 @@ RUNSHOST=$RUNSHOST"
|
||||||
################################################################################
|
################################################################################
|
||||||
# Moteur de script
|
# 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() {
|
function runs_init() {
|
||||||
RUNSSRCDIR="${1:-$scriptdir}" # répertoire d'où sont copiés les scripts
|
RUNSSRCDIR="${1:-$scriptdir}" # répertoire d'où sont copiés les scripts
|
||||||
RUNSACTION=runs_action_run
|
RUNSACTION=runs_action_run
|
||||||
|
@ -900,6 +934,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"
|
||||||
|
|
417
lib/ulib/runsmod
417
lib/ulib/runsmod
|
@ -3,7 +3,7 @@
|
||||||
##@cooked nocomments
|
##@cooked nocomments
|
||||||
##@require base
|
##@require base
|
||||||
uprovide runsmod
|
uprovide runsmod
|
||||||
urequire base
|
urequire base vcs
|
||||||
|
|
||||||
function __runsmod_loadconf() {
|
function __runsmod_loadconf() {
|
||||||
# Charger le fichier de configuration $1. Les paramètres RUNSMOD_MODE,
|
# Charger le fichier de configuration $1. Les paramètres RUNSMOD_MODE,
|
||||||
|
@ -137,6 +137,29 @@ 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
|
||||||
|
# retourner vrai si un mapping a eu lieu
|
||||||
|
local dir="$1" basedir="$2"
|
||||||
|
local -a maps
|
||||||
|
local map from to
|
||||||
|
[ -n "$basedir" ] && dir="${dir#$basedir/}"
|
||||||
|
__runsmod_get -a maps MAP
|
||||||
|
for map in "${maps[@]}"; do
|
||||||
|
splitpair "$map" from to
|
||||||
|
if [ "$dir" == "$from" ]; then
|
||||||
|
echo "$to"
|
||||||
|
return 0
|
||||||
|
elif [ "${dir#$from/}" != "$dir" ]; then
|
||||||
|
echo "$to/${dir#$from/}"
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
echo "$dir"
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
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
|
||||||
|
@ -196,13 +219,28 @@ function __runsmod_fixinfo() {
|
||||||
sed -n '3,$p' | sed 's/^.*\t//g'
|
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() {
|
function runsmod_checkenv() {
|
||||||
# vérifier l'environement. créer les répertoires nécessaires.
|
# vérifier l'environement. créer les répertoires nécessaires.
|
||||||
|
local check_only
|
||||||
|
[ "$1" == --check-only ] && check_only=1
|
||||||
if [ -z "$RUNSMOD_BASEDIR" ]; then
|
if [ -z "$RUNSMOD_BASEDIR" ]; then
|
||||||
eerror "Vous devez définir RUNSMOD_BASEDIR"
|
[ -z "$check_only" ] && eerror "Vous devez définir RUNSMOD_BASEDIR"
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
if [ ! -d "$RUNSMOD_BASEDIR" ]; then
|
if [ ! -d "$RUNSMOD_BASEDIR" -a -z "$check_only" ]; then
|
||||||
estep "Création de $(ppath "$RUNSMOD_BASEDIR")"
|
estep "Création de $(ppath "$RUNSMOD_BASEDIR")"
|
||||||
mkdir -p "$RUNSMOD_BASEDIR" || return 1
|
mkdir -p "$RUNSMOD_BASEDIR" || return 1
|
||||||
fi
|
fi
|
||||||
|
@ -220,18 +258,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
|
||||||
|
have_repolistfile=
|
||||||
|
for baseurl in "${baseurls[@]}"; do
|
||||||
setx repolistfile=__runsmod_get_repolistfile "$baseurl"
|
setx repolistfile=__runsmod_get_repolistfile "$baseurl"
|
||||||
|
if [ -f "$repolistfile" ]; then
|
||||||
# si le fichier n'existe pas, il faut mettre à jour
|
have_repolistfile=1
|
||||||
[ -f "$repolistfile" ] || return 0
|
|
||||||
# si le fichier a été modifié depuis plus de 24 heures, mettre à jour
|
# si le fichier a été modifié depuis plus de 24 heures, mettre à jour
|
||||||
setx mtime=stat -c %Y "$repolistfile"
|
setx mtime=stat -c %Y "$repolistfile"
|
||||||
[ $(($now - $mtime)) -lt 86400 ] || return 0
|
[ $(($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,11 +284,12 @@ 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
|
||||||
|
for baseurl in "${baseurls[@]}"; do
|
||||||
setx repolistfile=__runsmod_get_repolistfile "$baseurl"
|
setx repolistfile=__runsmod_get_repolistfile "$baseurl"
|
||||||
|
|
||||||
update="$force"
|
update="$force"
|
||||||
|
@ -258,6 +302,8 @@ function runsmod_update_repolists() {
|
||||||
setx mtime=stat -c %Y "$repolistfile"
|
setx mtime=stat -c %Y "$repolistfile"
|
||||||
[ $(($now - $mtime)) -lt 86400 ] || update=1
|
[ $(($now - $mtime)) -lt 86400 ] || update=1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
error=
|
||||||
if [ -n "$update" ]; then
|
if [ -n "$update" ]; then
|
||||||
local list
|
local list
|
||||||
ebegin "$baseurl"
|
ebegin "$baseurl"
|
||||||
|
@ -265,10 +311,15 @@ function runsmod_update_repolists() {
|
||||||
echo "$list" | __runsmod_fixinfo >"$repolistfile"
|
echo "$list" | __runsmod_fixinfo >"$repolistfile"
|
||||||
edot 0
|
edot 0
|
||||||
else
|
else
|
||||||
|
error=1
|
||||||
edot 1
|
edot 1
|
||||||
fi
|
fi
|
||||||
eend
|
eend
|
||||||
fi
|
fi
|
||||||
|
[ -n "$error" ] && continue
|
||||||
|
|
||||||
|
break
|
||||||
|
done
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -326,7 +377,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,8 +389,18 @@ 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]"
|
||||||
git clone ${RUNSMOD_SHALLOW:+--depth 1} "$repourl" "$repodir"
|
mkdirof "$repodir"
|
||||||
return $?
|
git clone ${RUNSMOD_SHALLOW:+--depth 1} "$repourl" "$repodir" || return $?
|
||||||
|
if [ "$RUNSMOD_MODE" == devel ]; then
|
||||||
|
(
|
||||||
|
cd "$repodir"
|
||||||
|
if git_have_rbranch develop; then
|
||||||
|
git checkout develop || exit 1
|
||||||
|
fi
|
||||||
|
) || return $?
|
||||||
|
fi
|
||||||
|
git_annex_initial "$repodir" || return $?
|
||||||
|
return 0
|
||||||
else
|
else
|
||||||
estepe "noclone $(ppath "$repodir")"
|
estepe "noclone $(ppath "$repodir")"
|
||||||
return 1
|
return 1
|
||||||
|
@ -364,9 +424,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 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
|
||||||
|
@ -374,7 +433,8 @@ 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
|
||||||
|
for baseurl in "${baseurls[@]}"; do
|
||||||
setx repopath=__runsmod_getpath_from_baseurl "$baseurl"
|
setx repopath=__runsmod_getpath_from_baseurl "$baseurl"
|
||||||
setx repolistfile=__runsmod_get_repolistfile "$baseurl"
|
setx repolistfile=__runsmod_get_repolistfile "$baseurl"
|
||||||
[ -f "$repolistfile" ] || continue
|
[ -f "$repolistfile" ] || continue
|
||||||
|
@ -389,23 +449,39 @@ function runsmod_clone_or_pull() {
|
||||||
edebug "...... repospec=$repospec"
|
edebug "...... repospec=$repospec"
|
||||||
__runsmod_has_vmodule "$repospec" && continue
|
__runsmod_has_vmodule "$repospec" && continue
|
||||||
if [[ "$repospec" == *//* ]]; then
|
if [[ "$repospec" == *//* ]]; then
|
||||||
|
reposuffixes=()
|
||||||
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
|
else
|
||||||
reposuffix=
|
reposuffixes=("$reposuffix")
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
reposuffixes=("")
|
||||||
fi
|
fi
|
||||||
|
|
||||||
reponames=()
|
reponames=()
|
||||||
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 rs1=__runsmod_replace1 "$repospec" "*"
|
||||||
__runsmod_match_repo_add repolist "$repospec" reponames
|
__runsmod_match_repo_add repolist "$rs1" reponames
|
||||||
elif [ -n "$host" ]; then
|
elif [ -n "$host" ]; then
|
||||||
setx reponame=__runsmod_replace1 "$repospec" "$host"
|
setx rs1=__runsmod_replace1 "$repospec" "$host"
|
||||||
array_contains repolist "$reponame" && array_add reponames "$reponame"
|
array_contains repolist "$rs1" && array_add reponames "$rs1"
|
||||||
setx reponame=__runsmod_replace2 "$repospec" "$host"
|
setx rs2=__runsmod_replace2 "$repospec" "$host"
|
||||||
array_contains repolist "$reponame" && array_add reponames "$reponame"
|
array_contains repolist "$rs2" && array_add reponames "$rs2"
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
array_contains repolist "$repospec" && array_add reponames "$repospec"
|
array_contains repolist "$repospec" && array_add reponames "$repospec"
|
||||||
|
@ -416,22 +492,25 @@ function runsmod_clone_or_pull() {
|
||||||
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"
|
||||||
|
|
||||||
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
|
done
|
||||||
|
done
|
||||||
|
done
|
||||||
|
|
||||||
## Ensuite, traiter les dépôts de module
|
## Ensuite, traiter les dépôts de module
|
||||||
|
|
||||||
|
@ -443,7 +522,8 @@ function runsmod_clone_or_pull() {
|
||||||
|
|
||||||
modules=("$@")
|
modules=("$@")
|
||||||
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
|
||||||
|
for baseurl in "${baseurls[@]}"; do
|
||||||
setx repopath=__runsmod_getpath_from_baseurl "$baseurl"
|
setx repopath=__runsmod_getpath_from_baseurl "$baseurl"
|
||||||
setx repolistfile=__runsmod_get_repolistfile "$baseurl"
|
setx repolistfile=__runsmod_get_repolistfile "$baseurl"
|
||||||
[ -f "$repolistfile" ] || continue
|
[ -f "$repolistfile" ] || continue
|
||||||
|
@ -468,40 +548,56 @@ function runsmod_clone_or_pull() {
|
||||||
edebug "........ repospec=$repospec"
|
edebug "........ repospec=$repospec"
|
||||||
__runsmod_has_vmodule "$repospec" || continue
|
__runsmod_has_vmodule "$repospec" || continue
|
||||||
if [[ "$repospec" == *//* ]]; then
|
if [[ "$repospec" == *//* ]]; then
|
||||||
|
reposuffixes=()
|
||||||
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
|
else
|
||||||
reposuffix=
|
reposuffixes=("$reposuffix")
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
reposuffixes=("")
|
||||||
fi
|
fi
|
||||||
|
|
||||||
reponames=()
|
reponames=()
|
||||||
if [ -n "$all_modules" ]; then
|
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 rs1=__runsmod_replace1 "$repospec" "*" "*"
|
||||||
__runsmod_match_repo_add repolist "$repospec" reponames
|
__runsmod_match_repo_add repolist "$rs1" reponames
|
||||||
elif [ -n "$host" ]; then
|
elif [ -n "$host" ]; then
|
||||||
setx repospec=__runsmod_replace1 "$repospec" "$host" "*"
|
setx rs1=__runsmod_replace1 "$repospec" "$host" "*"
|
||||||
__runsmod_match_repo_add repolist "$repospec" reponames
|
__runsmod_match_repo_add repolist "$rs1" reponames
|
||||||
setx repospec=__runsmod_replace2 "$repospec" "$host" "*"
|
setx rs2=__runsmod_replace2 "$repospec" "$host" "*"
|
||||||
__runsmod_match_repo_add repolist "$repospec" reponames
|
__runsmod_match_repo_add repolist "$rs2" reponames
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
setx repospec=__runsmod_replace1 "$repospec" "" "*"
|
setx rs1=__runsmod_replace1 "$repospec" "" "*"
|
||||||
__runsmod_match_repo_add repolist "$repospec" reponames
|
__runsmod_match_repo_add repolist "$rs1" reponames
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
if __runsmod_has_vhost "$repospec"; then
|
if __runsmod_has_vhost "$repospec"; then
|
||||||
if [ -n "$host" ]; then
|
if [ -n "$host" ]; then
|
||||||
setx reponame=__runsmod_replace1 "$repospec" "$host" "$module"
|
setx rs1=__runsmod_replace1 "$repospec" "$host" "$module"
|
||||||
array_contains repolist "$reponame" && array_add reponames "$reponame"
|
array_contains repolist "$rs1" && array_add reponames "$rs1"
|
||||||
setx reponame=__runsmod_replace2 "$repospec" "$host" "$module"
|
setx rs2=__runsmod_replace2 "$repospec" "$host" "$module"
|
||||||
array_contains repolist "$reponame" && array_add reponames "$reponame"
|
array_contains repolist "$rs2" && array_add reponames "$rs2"
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
setx reponame=__runsmod_replace1 "$repospec" "" "$module"
|
setx rs1=__runsmod_replace1 "$repospec" "" "$module"
|
||||||
array_contains repolist "$reponame" && array_add reponames "$reponame"
|
array_contains repolist "$rs1" && array_add reponames "$rs1"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -510,6 +606,7 @@ function runsmod_clone_or_pull() {
|
||||||
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
|
||||||
|
@ -517,20 +614,22 @@ 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
|
done
|
||||||
done
|
done
|
||||||
|
done
|
||||||
|
done
|
||||||
|
|
||||||
for module in "${modules[@]}"; do
|
for module in "${modules[@]}"; do
|
||||||
[ "$module" == "*" ] && continue
|
[ "$module" == "*" ] && continue
|
||||||
|
@ -540,8 +639,228 @@ function runsmod_clone_or_pull() {
|
||||||
return $r
|
return $r
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function runsmod_update_vars() {
|
||||||
|
local all_hosts host_mode="$1" host="$2"
|
||||||
|
case "$host_mode" in
|
||||||
|
none) host=;;
|
||||||
|
all) host=; all_hosts=1;;
|
||||||
|
self) host="${RUNSHOST:-$MYHOST}";;
|
||||||
|
esac
|
||||||
|
# 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
|
||||||
|
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 MODULES 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 :
|
||||||
|
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#*//}"
|
||||||
|
[ -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 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
|
||||||
|
done
|
||||||
|
done
|
||||||
|
done
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
function runsmod_teardown_vars() {
|
function runsmod_teardown_vars() {
|
||||||
setx RUNSSCRIPTSPATH=array_join SCRIPTSDIRS :
|
setx RUNSSCRIPTSPATH=array_join SCRIPTSDIRS :
|
||||||
setx RUNSMODULESPATH=array_join MODULESDIRS :
|
setx RUNSMODULESPATH=array_join MODULESDIRS :
|
||||||
setx RUNSHOSTSPATH=array_join HOSTSDIRS :
|
setx RUNSHOSTSPATH=array_join HOSTSDIRS :
|
||||||
|
[ -n "$RUNSSCRIPTSPATH" ] || RUNSSCRIPTSPATH=:
|
||||||
|
[ -n "$RUNSMODULESPATH" ] || RUNSMODULESPATH=:
|
||||||
|
[ -n "$RUNSHOSTSPATH" ] || RUNSHOSTSPATH=:
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,11 +11,36 @@ RUNSMOD_SHALLOW=auto
|
||||||
RUNSMOD_UPDATE=auto
|
RUNSMOD_UPDATE=auto
|
||||||
RUNSMOD_IDENTITY=
|
RUNSMOD_IDENTITY=
|
||||||
RUNSMOD_BASEURL=
|
RUNSMOD_BASEURL=
|
||||||
RUNSMOD_SCRIPTS_URLS=(hosts/%h/runs hosts/%h/all//runs runss)
|
RUNSMOD_SCRIPTS_URLS=(
|
||||||
RUNSMOD_MODULES_URLS=(hosts/%h/modules/%m hosts/%h/all modules/%m)
|
hosts/%h/runs
|
||||||
RUNSMOD_HOSTS_URLS=(runsh)
|
hosts/%h/all//runs
|
||||||
|
runss
|
||||||
|
)
|
||||||
|
RUNSMOD_MODULES_URLS=(
|
||||||
|
hosts/%h/modules/%m
|
||||||
|
hosts/%h/%m
|
||||||
|
hosts/%h/all//modules
|
||||||
|
hosts/%h/all
|
||||||
|
# quand on supportera %n
|
||||||
|
#hosts/all/%n/%m
|
||||||
|
modules/%m
|
||||||
|
)
|
||||||
|
RUNSMOD_HOSTS_URLS=(
|
||||||
|
runsh
|
||||||
|
)
|
||||||
RUNSMOD_BASEDIR="$HOME/runs"
|
RUNSMOD_BASEDIR="$HOME/runs"
|
||||||
RUNSMOD_PROFILES=(pvcs vcs jclain)
|
RUNSMOD_MAP=(
|
||||||
|
# mapping par défaut
|
||||||
|
runss:"$HOME/wop/runs"
|
||||||
|
modules:"$HOME/wop/modules"
|
||||||
|
hosts:"$HOME/wop/hosts"
|
||||||
|
runsh:"$HOME/wop/hosts/all/hosts"
|
||||||
|
)
|
||||||
|
RUNSMOD_PROFILES=(
|
||||||
|
pvcs
|
||||||
|
vcs
|
||||||
|
jclain
|
||||||
|
)
|
||||||
|
|
||||||
# pvcs
|
# pvcs
|
||||||
RUNSMOD_pvcs_BASEURL=(http://pvcs.univ.run/anongit http://pvcs.univ-reunion.fr/anongit)
|
RUNSMOD_pvcs_BASEURL=(http://pvcs.univ.run/anongit http://pvcs.univ-reunion.fr/anongit)
|
||||||
|
@ -23,6 +48,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)
|
||||||
|
@ -30,9 +62,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"
|
||||||
|
)
|
||||||
|
|
10
lib/ulib/vcs
10
lib/ulib/vcs
|
@ -3,7 +3,7 @@
|
||||||
##@cooked nocomments
|
##@cooked nocomments
|
||||||
##@require base
|
##@require base
|
||||||
uprovide vcs
|
uprovide vcs
|
||||||
urequire base
|
urequire ulib base
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
# Général
|
# Général
|
||||||
|
@ -772,6 +772,14 @@ function git_is_merged() {
|
||||||
}
|
}
|
||||||
|
|
||||||
# fonctions pour git annex
|
# fonctions pour git annex
|
||||||
|
function git_annex_use_ssh_wrapper() {
|
||||||
|
__UTOOLS_FORCE_PATH="$PATH"
|
||||||
|
__UTOOLS_FORCE_SSH="${GIT_SSH:-ssh}"
|
||||||
|
export __UTOOLS_FORCE_PATH __UTOOLS_FORCE_SSH
|
||||||
|
udelpath "$ULIBDIR/support/ssh-wrapper" __UTOOLS_FORCE_PATH
|
||||||
|
uinspath "$ULIBDIR/support/ssh-wrapper" PATH
|
||||||
|
}
|
||||||
|
|
||||||
function git_annex_initial() {
|
function git_annex_initial() {
|
||||||
# sur le dépôt $1 fraichement cloné, vérifier s'il faut faire git annex
|
# sur le dépôt $1 fraichement cloné, vérifier s'il faut faire git annex
|
||||||
# init. Si oui, l'initialiser avec le nom d'hôte, et récupérer tous les
|
# init. Si oui, l'initialiser avec le nom d'hôte, et récupérer tous les
|
||||||
|
|
65
rruns
65
rruns
|
@ -1,7 +1,7 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# -*- coding: utf-8 mode: sh -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8
|
# -*- 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
|
source "$(dirname "$0")/lib/ulib/ulib" || exit 1
|
||||||
urequire DEFAULTS runs
|
urequire DEFAULTS runs runsmod
|
||||||
|
|
||||||
function display_help() {
|
function display_help() {
|
||||||
uecho "$scriptname: Déploiement distant avec runs
|
uecho "$scriptname: Déploiement distant avec runs
|
||||||
|
@ -74,8 +74,9 @@ OPTIONS
|
||||||
argument (hors options)."
|
argument (hors options)."
|
||||||
}
|
}
|
||||||
|
|
||||||
set_defaults runs
|
runs_before_parse_args
|
||||||
|
|
||||||
|
auto_runsmod=1
|
||||||
action=deploy
|
action=deploy
|
||||||
confuser=
|
confuser=
|
||||||
tmproot=
|
tmproot=
|
||||||
|
@ -89,10 +90,14 @@ 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' \
|
||||||
|
--no-auto-runsmod auto_runsmod= \
|
||||||
-C action=configure \
|
-C action=configure \
|
||||||
--configure: '$set@ confuser;action=configure' \
|
--configure: '$set@ confuser;action=configure' \
|
||||||
-T:,--tmproot: tmproot= \
|
-T:,--tmproot: tmproot= \
|
||||||
|
@ -107,13 +112,14 @@ 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" ] && RUNSSCRIPTSPATH="$runsscriptspath"
|
runs_after_parse_args
|
||||||
[ -n "$runsmodulespath" ] && RUNSMODULESPATH="$runsmodulespath"
|
|
||||||
[ -n "$runshostspath" ] && RUNSHOSTSPATH="$runshostspath"
|
|
||||||
|
|
||||||
__PARSED_HOSTS=()
|
__PARSED_HOSTS=()
|
||||||
__PARSED_FILES=()
|
__PARSED_FILES=()
|
||||||
|
@ -178,6 +184,17 @@ function fix_hosts() {
|
||||||
array_map hosts __dot_is_localhost
|
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
|
# Configuration de l'accès par clé aux hôtes
|
||||||
|
|
||||||
|
@ -204,12 +221,16 @@ 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
|
||||||
|
|
||||||
|
save_initial_paths
|
||||||
|
[ -n "$auto_runsmod" ] && runsmod_autoconf
|
||||||
etitle "Configuration initiale pour runs" \
|
etitle "Configuration initiale pour runs" \
|
||||||
"$scriptdir/runs" \
|
"$scriptdir/runs" --no-auto-runsmod \
|
||||||
${runsscriptspath:+--runsscriptspath "$runsscriptspath"} \
|
--runsscriptspath "$RUNSSCRIPTSPATH" \
|
||||||
${runsmodulespath:+--runsmodulespath "$runsmodulespath"} \
|
--runsmodulespath "$RUNSMODULESPATH" \
|
||||||
${runshostspath:+--runshostspath "$runshostspath"} \
|
--runshostspath "$RUNSHOSTSPATH" \
|
||||||
--init -h "$host"
|
--init -h "$host"
|
||||||
|
restore_initial_paths
|
||||||
done
|
done
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
@ -222,6 +243,8 @@ make_archive=
|
||||||
|
|
||||||
## Hôtes sur lesquels faire le déploiement
|
## Hôtes sur lesquels faire le déploiement
|
||||||
if array_isempty hosts; then
|
if array_isempty hosts; then
|
||||||
|
save_initial_paths
|
||||||
|
[ -n "$auto_runsmod" ] && runsmod_autoconf all
|
||||||
array_split hostsdirs "$RUNSHOSTSPATH" :
|
array_split hostsdirs "$RUNSHOSTSPATH" :
|
||||||
cwd="$(pwd)"
|
cwd="$(pwd)"
|
||||||
for hostsdir in "${hostsdirs[@]}"; do
|
for hostsdir in "${hostsdirs[@]}"; do
|
||||||
|
@ -234,6 +257,7 @@ if array_isempty hosts; then
|
||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
restore_initial_paths
|
||||||
fi
|
fi
|
||||||
if array_isempty hosts; then
|
if array_isempty hosts; then
|
||||||
read_value "Entrez une liste d'hôtes séparés par ':'" hosts "localhost"
|
read_value "Entrez une liste d'hôtes séparés par ':'" hosts "localhost"
|
||||||
|
@ -290,6 +314,9 @@ for userhost in "${hosts[@]}"; do
|
||||||
enote "Le nom d'hôte utilisé est $host"
|
enote "Le nom d'hôte utilisé est $host"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
save_initial_paths
|
||||||
|
[ -n "$auto_runsmod" ] && runsmod_autoconf one "$host"
|
||||||
|
|
||||||
if [ "$host" != "localhost" ]; then
|
if [ "$host" != "localhost" ]; then
|
||||||
if [ -n "$init" ]; then
|
if [ -n "$init" ]; then
|
||||||
action=--init
|
action=--init
|
||||||
|
@ -298,10 +325,10 @@ for userhost in "${hosts[@]}"; do
|
||||||
fi
|
fi
|
||||||
|
|
||||||
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" --no-auto-runsmod \
|
||||||
${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 +344,12 @@ 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"}
|
--no-auto-runsmod
|
||||||
${runsmodulespath:+--runsmodulespath "$runsmodulespath"}
|
--export --runsexportdir "$exportdir"
|
||||||
${runshostspath:+--runshostspath "$runshostspath"}
|
--runsscriptspath "$RUNSSCRIPTSPATH"
|
||||||
|
--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)
|
||||||
|
@ -424,5 +453,7 @@ bits=$MYBITS"'
|
||||||
eend
|
eend
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
restore_initial_paths
|
||||||
|
|
||||||
eend
|
eend
|
||||||
done
|
done
|
||||||
|
|
62
runs
62
runs
|
@ -1,7 +1,7 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# -*- coding: utf-8 mode: sh -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8
|
# -*- 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
|
source "$(dirname "$0")/lib/ulib/ulib" || exit 1
|
||||||
urequire DEFAULTS runs
|
urequire DEFAULTS runs runsmod
|
||||||
|
|
||||||
function display_help() {
|
function display_help() {
|
||||||
uecho "$scriptname: Lancer un script avec le protocole runs
|
uecho "$scriptname: Lancer un script avec le protocole runs
|
||||||
|
@ -58,12 +58,16 @@ 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"
|
||||||
}
|
}
|
||||||
|
|
||||||
set_defaults runs
|
|
||||||
|
|
||||||
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"
|
||||||
|
}
|
||||||
|
|
||||||
|
runs_before_parse_args
|
||||||
|
|
||||||
|
auto_runsmod=1
|
||||||
action=runs
|
action=runs
|
||||||
create_verbose=
|
create_verbose=
|
||||||
init_sysinfos=--NOT-SET--
|
init_sysinfos=--NOT-SET--
|
||||||
|
@ -77,14 +81,18 @@ 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
|
||||||
runs_init "$scriptdir"
|
runs_init "$scriptdir"
|
||||||
parse_opts "${PRETTYOPTS[@]}" \
|
parse_opts "${PRETTYOPTS[@]}" \
|
||||||
--help '$exit_with display_help' \
|
--help '$exit_with display_help' \
|
||||||
|
--no-auto-runsmod auto_runsmod= \
|
||||||
--i '$action=init;create_verbose=false' \
|
--i '$action=init;create_verbose=false' \
|
||||||
--init '$action=init;create_verbose=true' \
|
--init '$action=init;create_verbose=true' \
|
||||||
--verify action=verify \
|
--verify action=verify \
|
||||||
|
@ -106,17 +114,18 @@ 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" ] && RUNSSCRIPTSPATH="$runsscriptspath"
|
runs_after_parse_args
|
||||||
[ -n "$runsmodulespath" ] && RUNSMODULESPATH="$runsmodulespath"
|
|
||||||
[ -n "$runshostspath" ] && RUNSHOSTSPATH="$runshostspath"
|
|
||||||
|
|
||||||
if [ "$action" == runs \
|
if [ "$action" == runs \
|
||||||
-o "$action" == init -o "$action" == verify \
|
-o "$action" == init -o "$action" == verify \
|
||||||
|
@ -141,9 +150,11 @@ if [ "$action" == runs \
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
[ -n "$auto_runsmod" ] && runsmod_autoconf
|
||||||
|
|
||||||
if ! is_root && [ -n "$run_as_root" ]; then
|
if ! is_root && [ -n "$run_as_root" ]; then
|
||||||
# reconstruire la ligne de commande
|
# reconstruire la ligne de commande
|
||||||
args=()
|
args=(--no-auto-runsmod)
|
||||||
if [ "$action" == "init" ]; then
|
if [ "$action" == "init" ]; then
|
||||||
args=("${args[@]}" --init)
|
args=("${args[@]}" --init)
|
||||||
elif [ "$action" == "verify" ]; then
|
elif [ "$action" == "verify" ]; then
|
||||||
|
@ -210,8 +221,8 @@ bits=$MYBITS"
|
||||||
|
|
||||||
resolv_ips __runs_ips "$runshost"
|
resolv_ips __runs_ips "$runshost"
|
||||||
if [ -z "${__runs_ips[*]}" ]; then
|
if [ -z "${__runs_ips[*]}" ]; then
|
||||||
eerror "$runshost ne semble pas être une adresse valide."
|
check_interaction -c && eerror "$runshost ne semble pas être une adresse valide."
|
||||||
ask_yesno "Voulez-vous réellement utiliser cette adresse, bien qu'elle n'existe pas dans le DNS?" N || die
|
ask_yesno "Voulez-vous réellement utiliser cette adresse, bien qu'elle n'existe pas dans le DNS?" C || die
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$action" == "init" ]; then
|
if [ "$action" == "init" ]; then
|
||||||
|
@ -220,8 +231,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 +278,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 +321,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
|
||||||
|
|
21
uproject
21
uproject
|
@ -217,14 +217,6 @@ done
|
||||||
################################################################################
|
################################################################################
|
||||||
# Traiter les commandes
|
# Traiter les commandes
|
||||||
|
|
||||||
function use_ssh_wrapper() {
|
|
||||||
__UTOOLS_FORCE_PATH="$PATH"
|
|
||||||
__UTOOLS_FORCE_SSH="${GIT_SSH:-ssh}"
|
|
||||||
export __UTOOLS_FORCE_PATH __UTOOLS_FORCE_SSH
|
|
||||||
udelpath "$scriptdir/lib/ssh-wrapper" __UTOOLS_FORCE_PATH
|
|
||||||
uinspath "$scriptdir/lib/ssh-wrapper" PATH
|
|
||||||
}
|
|
||||||
|
|
||||||
if [ "$CMD" == "grep" ]; then
|
if [ "$CMD" == "grep" ]; then
|
||||||
## grep
|
## grep
|
||||||
if [ $# -eq 1 -a "$1" == "--help" ]; then
|
if [ $# -eq 1 -a "$1" == "--help" ]; then
|
||||||
|
@ -259,7 +251,7 @@ elif array_contains GITANNEX_CMDS "$CMD"; then
|
||||||
git annex sync
|
git annex sync
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
use_ssh_wrapper
|
git_annex_use_ssh_wrapper
|
||||||
case "$CMD" in
|
case "$CMD" in
|
||||||
annex) git annex "$@";;
|
annex) git annex "$@";;
|
||||||
xsync) xsync;;
|
xsync) xsync;;
|
||||||
|
@ -280,9 +272,14 @@ elif [ "$CMD" == clone ]; then
|
||||||
fi
|
fi
|
||||||
[ -d "$destdir" ] && die "$(ppath "$destdir"): répertoire existant"
|
[ -d "$destdir" ] && die "$(ppath "$destdir"): répertoire existant"
|
||||||
|
|
||||||
use_ssh_wrapper
|
git_annex_use_ssh_wrapper
|
||||||
git clone "$repourl" "$destdir" || die
|
git clone "$repourl" "$destdir" || die
|
||||||
( cd "$destdir"; git_have_rbranch develop && git checkout develop ) || die
|
(
|
||||||
|
cd "$destdir"
|
||||||
|
if git_have_rbranch develop; then
|
||||||
|
git checkout develop || exit 1
|
||||||
|
fi
|
||||||
|
) || die
|
||||||
git_annex_initial "$destdir" || die
|
git_annex_initial "$destdir" || die
|
||||||
|
|
||||||
elif [ "$CMD" == crone ]; then
|
elif [ "$CMD" == crone ]; then
|
||||||
|
@ -307,7 +304,7 @@ elif [ "$CMD" == crone ]; then
|
||||||
userhost="$user@$host"
|
userhost="$user@$host"
|
||||||
[ -n "$path" ] || die "Vous devez spécifier le chemin du dépôt git"
|
[ -n "$path" ] || die "Vous devez spécifier le chemin du dépôt git"
|
||||||
|
|
||||||
use_ssh_wrapper
|
git_annex_use_ssh_wrapper
|
||||||
ssh "$userhost" create "$path" || die
|
ssh "$userhost" create "$path" || die
|
||||||
if [ -n "$tmpdestdir" ]; then
|
if [ -n "$tmpdestdir" ]; then
|
||||||
setxx destname=abspath "$destdir" // basename
|
setxx destname=abspath "$destdir" // basename
|
||||||
|
|
Loading…
Reference in New Issue