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
|
||||||
|
|
218
fndate
218
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 {
|
||||||
gsub(/%/, "%%", format)
|
if (format ~ /YYYYMMDD/) type = "long"
|
||||||
gsub(/YYYY/, "%Y", format)
|
else if (format ~ /YYMMDD/) type = "short"
|
||||||
gsub(/YY/, "%y", format)
|
else type = "custom"
|
||||||
gsub(/MM/, "%m", format)
|
|
||||||
gsub(/DD/, "%d", format)
|
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(/YYYY/, "%Y", format)
|
||||||
|
gsub(/YY/, "%y", format)
|
||||||
|
gsub(/MM/, "%m", 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) {
|
||||||
print dir date "-" name
|
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
|
||||||
|
}
|
||||||
|
} 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) {
|
||||||
print dir date name
|
if (force_date != "") {
|
||||||
|
if (type == "long") {
|
||||||
|
if (name ~ /^[0-9]{8}/) name = substr(name, 9)
|
||||||
|
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
|
else
|
||||||
case "$create" in
|
setx destname=replace_ph "" "$force_date"
|
||||||
file) einfo "Création d'un nouveau fichier";;
|
confirm_action=entrer
|
||||||
dir) einfo "Création d'un nouveau répertoire";;
|
if [ -d "$destname" ]; then
|
||||||
esac
|
ewarn "$destname: répertoire existant"
|
||||||
setx destname=replace_ph
|
confirm_action=confirmer
|
||||||
read_value "Veuillez entrer le nom" destname "$destname"
|
elif [ -e "$destname" ]; then
|
||||||
|
ewarn "$destname: fichier existant"
|
||||||
|
confirm_action=confirmer
|
||||||
|
else
|
||||||
|
case "$create" in
|
||||||
|
file) estep "Création d'un nouveau fichier";;
|
||||||
|
dir) estep "Création d'un nouveau répertoire";;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
|
||||||
|
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"
|
||||||
|
|
637
lib/ulib/runsmod
637
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
|
||||||
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 +284,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 +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,60 +433,80 @@ 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"
|
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#*//}"
|
reposuffixes=()
|
||||||
[ -n "$reposuffix" ] && reposuffix="/$reposuffix"
|
reposuffix="${repospec#*//}"
|
||||||
repospec="${repospec%%//*}"
|
[ -n "$reposuffix" ] && reposuffix="/$reposuffix"
|
||||||
else
|
repospec="${repospec%%//*}"
|
||||||
reposuffix=
|
if __runsmod_has_vhost "$reposuffix"; then
|
||||||
fi
|
if [ -n "$all_hosts" -o -z "$host" ]; then
|
||||||
|
reposuffix="${reposuffix//%h\//}"
|
||||||
reponames=()
|
reposuffix="${reposuffix//\/%h/}"
|
||||||
if __runsmod_has_vhost "$repospec"; then
|
reposuffixes=("$reposuffix")
|
||||||
if [ -n "$all_hosts" ]; then
|
elif [ -n "$host" ]; then
|
||||||
setx repospec=__runsmod_replace1 "$repospec" "*"
|
local rs1 rs2
|
||||||
__runsmod_match_repo_add repolist "$repospec" reponames
|
setx rs1=__runsmod_replace1 "$reposuffix" "$host"
|
||||||
elif [ -n "$host" ]; then
|
setx rs2=__runsmod_replace2 "$reposuffix" "$host"
|
||||||
setx reponame=__runsmod_replace1 "$repospec" "$host"
|
reposuffixes=("$rs1")
|
||||||
array_contains repolist "$reponame" && array_add reponames "$reponame"
|
[ "$rs2" != "$rs1" ] && array_add reposuffixes "$rs2"
|
||||||
setx reponame=__runsmod_replace2 "$repospec" "$host"
|
fi
|
||||||
array_contains repolist "$reponame" && array_add reponames "$reponame"
|
else
|
||||||
|
reposuffixes=("$reposuffix")
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
reposuffixes=("")
|
||||||
fi
|
fi
|
||||||
else
|
|
||||||
array_contains repolist "$repospec" && array_add reponames "$repospec"
|
|
||||||
fi
|
|
||||||
|
|
||||||
edebug "...... reponames=(${reponames[*]})"
|
reponames=()
|
||||||
for reponame in "${reponames[@]}"; do
|
if __runsmod_has_vhost "$repospec"; then
|
||||||
repodir="$RUNSMOD_BASEDIR/$repopath/$reponame"
|
if [ -n "$all_hosts" ]; then
|
||||||
|
setx rs1=__runsmod_replace1 "$repospec" "*"
|
||||||
|
__runsmod_match_repo_add repolist "$rs1" reponames
|
||||||
|
elif [ -n "$host" ]; then
|
||||||
|
setx rs1=__runsmod_replace1 "$repospec" "$host"
|
||||||
|
array_contains repolist "$rs1" && array_add reponames "$rs1"
|
||||||
|
setx rs2=__runsmod_replace2 "$repospec" "$host"
|
||||||
|
array_contains repolist "$rs2" && array_add reponames "$rs2"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
array_contains repolist "$repospec" && array_add reponames "$repospec"
|
||||||
|
fi
|
||||||
|
|
||||||
setx repourl=__runsmod_fixurl "$reponame" "$baseurl"
|
edebug "...... reponames=(${reponames[*]})"
|
||||||
__runsmod_clone_or_pull "$repourl" "$repodir" || r=1
|
for reponame in "${reponames[@]}"; do
|
||||||
|
repodir="$RUNSMOD_BASEDIR/$repopath/$reponame"
|
||||||
|
|
||||||
[ -d "$repodir" ] || continue
|
setx repourl=__runsmod_fixurl "$reponame" "$baseurl"
|
||||||
array_contains REPODIRS "$repodir" && continue
|
setx repodir=__runsmod_mapdir "$repodir" "$RUNSMOD_BASEDIR/$repopath"
|
||||||
array_addu REPODIRS "$repodir"
|
__runsmod_clone_or_pull "$repourl" "$repodir" || r=1
|
||||||
|
|
||||||
repodir="$repodir$reposuffix"
|
[ -d "$repodir" ] || continue
|
||||||
case "$vprefix" in
|
array_contains REPODIRS "$repodir" && continue
|
||||||
SCRIPTS) array_addu SCRIPTSDIRS "$repodir";;
|
array_addu REPODIRS "$repodir"
|
||||||
MODULES) array_addu MODULESDIRS "$repodir";;
|
|
||||||
HOSTS) array_addu HOSTSDIRS "$repodir";;
|
for reposuffix in "${reposuffixes[@]}"; do
|
||||||
esac
|
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
|
done
|
||||||
done
|
done
|
||||||
|
@ -443,89 +522,109 @@ 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
|
||||||
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"
|
edebug ".. baseurl=$baseurl, repopath=$repopath"
|
||||||
for module in "${modules[@]}"; do
|
for module in "${modules[@]}"; do
|
||||||
if [ "$module" == "*" ]; then
|
if [ "$module" == "*" ]; then
|
||||||
module=
|
module=
|
||||||
all_modules=1
|
all_modules=1
|
||||||
else
|
else
|
||||||
array_contains foundmodules "$module" && continue
|
array_contains foundmodules "$module" && continue
|
||||||
all_modules=
|
all_modules=
|
||||||
fi
|
fi
|
||||||
edebug ".... module=$module"
|
edebug ".... module=$module"
|
||||||
|
|
||||||
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#*//}"
|
reposuffixes=()
|
||||||
[ -n "$reposuffix" ] && reposuffix="/$reposuffix"
|
reposuffix="${repospec#*//}"
|
||||||
repospec="${repospec%%//*}"
|
[ -n "$reposuffix" ] && reposuffix="/$reposuffix"
|
||||||
else
|
repospec="${repospec%%//*}"
|
||||||
reposuffix=
|
if __runsmod_has_vhost "$reposuffix"; then
|
||||||
fi
|
if [ -n "$all_hosts" -o -z "$host" ]; then
|
||||||
|
reposuffix="${reposuffix//%h\//}"
|
||||||
reponames=()
|
reposuffix="${reposuffix//\/%h/}"
|
||||||
if [ -n "$all_modules" ]; then
|
reposuffixes=("$reposuffix")
|
||||||
if __runsmod_has_vhost "$repospec"; then
|
elif [ -n "$host" ]; then
|
||||||
if [ -n "$all_hosts" ]; then
|
local rs1 rs2
|
||||||
setx repospec=__runsmod_replace1 "$repospec" "*" "*"
|
setx rs1=__runsmod_replace1 "$reposuffix" "$host"
|
||||||
__runsmod_match_repo_add repolist "$repospec" reponames
|
setx rs2=__runsmod_replace2 "$reposuffix" "$host"
|
||||||
elif [ -n "$host" ]; then
|
reposuffixes=("$rs1")
|
||||||
setx repospec=__runsmod_replace1 "$repospec" "$host" "*"
|
[ "$rs2" != "$rs1" ] && array_add reposuffixes "$rs2"
|
||||||
__runsmod_match_repo_add repolist "$repospec" reponames
|
fi
|
||||||
setx repospec=__runsmod_replace2 "$repospec" "$host" "*"
|
else
|
||||||
__runsmod_match_repo_add repolist "$repospec" reponames
|
reposuffixes=("$reposuffix")
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
setx repospec=__runsmod_replace1 "$repospec" "" "*"
|
reposuffixes=("")
|
||||||
__runsmod_match_repo_add repolist "$repospec" reponames
|
|
||||||
fi
|
fi
|
||||||
else
|
|
||||||
if __runsmod_has_vhost "$repospec"; then
|
reponames=()
|
||||||
if [ -n "$host" ]; then
|
if [ -n "$all_modules" ]; then
|
||||||
setx reponame=__runsmod_replace1 "$repospec" "$host" "$module"
|
if __runsmod_has_vhost "$repospec"; then
|
||||||
array_contains repolist "$reponame" && array_add reponames "$reponame"
|
if [ -n "$all_hosts" ]; then
|
||||||
setx reponame=__runsmod_replace2 "$repospec" "$host" "$module"
|
setx rs1=__runsmod_replace1 "$repospec" "*" "*"
|
||||||
array_contains repolist "$reponame" && array_add reponames "$reponame"
|
__runsmod_match_repo_add repolist "$rs1" reponames
|
||||||
|
elif [ -n "$host" ]; then
|
||||||
|
setx rs1=__runsmod_replace1 "$repospec" "$host" "*"
|
||||||
|
__runsmod_match_repo_add repolist "$rs1" reponames
|
||||||
|
setx rs2=__runsmod_replace2 "$repospec" "$host" "*"
|
||||||
|
__runsmod_match_repo_add repolist "$rs2" reponames
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
setx rs1=__runsmod_replace1 "$repospec" "" "*"
|
||||||
|
__runsmod_match_repo_add repolist "$rs1" reponames
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
setx reponame=__runsmod_replace1 "$repospec" "" "$module"
|
if __runsmod_has_vhost "$repospec"; then
|
||||||
array_contains repolist "$reponame" && array_add reponames "$reponame"
|
if [ -n "$host" ]; then
|
||||||
|
setx rs1=__runsmod_replace1 "$repospec" "$host" "$module"
|
||||||
|
array_contains repolist "$rs1" && array_add reponames "$rs1"
|
||||||
|
setx rs2=__runsmod_replace2 "$repospec" "$host" "$module"
|
||||||
|
array_contains repolist "$rs2" && array_add reponames "$rs2"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
setx rs1=__runsmod_replace1 "$repospec" "" "$module"
|
||||||
|
array_contains repolist "$rs1" && array_add reponames "$rs1"
|
||||||
|
fi
|
||||||
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"
|
||||||
__runsmod_clone_or_pull "$repourl" "$repodir" || r=1
|
setx repodir=__runsmod_mapdir "$repodir" "$RUNSMOD_BASEDIR/$repopath"
|
||||||
|
__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"
|
[ -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
|
||||||
|
@ -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
|
||||||
|
|
67
rruns
67
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
|
||||||
|
|
64
runs
64
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
|
||||||
|
__runs_setpath
|
||||||
if [ -n "$runshost" ]; then
|
if [ -n "$runshost" ]; then
|
||||||
__runs_setpath
|
|
||||||
[ -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
|
__runs_setpath
|
||||||
# sans l'option -f, il faut définir RUNS*PATH
|
if [ -z "${rscripts[*]}" -a -z "${recipes[*]}" ]; then
|
||||||
__runs_setpath
|
# sans les options -f et -r, prendre par défaut le répertoire courant
|
||||||
[ -n "${RUNSSCRIPTSDIRS[*]}" ] || runs_path_required RUNSSCRIPTSPATH
|
# comme répertoire de script, de module et d'hôtes
|
||||||
[ -n "${RUNSMODULESDIRS[*]}" ] || runs_path_required RUNSMODULESPATH
|
refix=
|
||||||
[ -z "$runshost" -o -n "${RUNSHOSTSDIRS[*]}" ] || runs_path_required RUNSHOSTSPATH
|
[ -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