les recettes ont maintenant l'extension .rr par défaut

This commit is contained in:
Jephté Clain 2015-12-09 22:34:35 +04:00
parent a2e863e216
commit 98ba626897
1 changed files with 34 additions and 13 deletions

View File

@ -158,24 +158,24 @@ function runs_initdir() {
echo "$sysinfost" >"$runshostdir/sysinfos.conf"
fi
if [ ! -f "$runshostdir/default" ]; then
estep "Création de $(ppath "$runshostdir/default")"
echo "$defaultt" >"$runshostdir/default"
estep "Création de $(ppath "$runshostdir/default.rr")"
echo "$defaultt" >"$runshostdir/default.rr"
edit_default=1
fi
if [ ! -f "$runshostdir/config" ]; then
estep "Création de $(ppath "$runshostdir/config")"
echo "$configt" >"$runshostdir/config"
estep "Création de $(ppath "$runshostdir/config.rr")"
echo "$configt" >"$runshostdir/config.rr"
fi
if [ ! -f "$runshostdir/services" ]; then
estep "Création de $(ppath "$runshostdir/services")"
echo "$servicest" >"$runshostdir/services"
estep "Création de $(ppath "$runshostdir/services.rr")"
echo "$servicest" >"$runshostdir/services.rr"
fi
if [ ! -f "$runshostdir/userdefault" ]; then
estep "Création de $(ppath "$runshostdir/userdefault")"
echo "$userdefaultt" >"$runshostdir/userdefault"
estep "Création de $(ppath "$runshostdir/userdefault.rr")"
echo "$userdefaultt" >"$runshostdir/userdefault.rr"
fi
[ -n "$edit_default" ] && "${EDITOR:-vi}" "$runshostdir/default"
[ -n "$edit_default" ] && "${EDITOR:-vi}" "$runshostdir/default.rr"
return 0
}
@ -189,9 +189,9 @@ function __runs_create_rscript() {
template="$runsconft"
elif [ "$rscriptname" == "sysinfos.conf" ]; then
template="$sysinfost"
elif [ "$rscriptname" == "default" ]; then
elif [ "$rscriptname" == "default" -o "$rscriptname" == "default.rr" ]; then
template="$defaultt"
elif [ "$rscriptname" == "userdefault" ]; then
elif [ "$rscriptname" == "userdefault" -o "$rscriptname" == "userdefault.rr" ]; then
template="$userdefaultt"
else
withext "$rscript" || rscript="$rscript.rs"
@ -629,11 +629,24 @@ function runs_recipe() {
recipe="$(abspath "$1")"
if [ -d "$recipe" ]; then
if is_root; then
recipe="$recipe/default"
if [ -f "$recipe/default.rr" ]; then
recipe="$recipe/default.rr"
elif [ -f "$recipe/default" ]; then
recipe="$recipe/default"
else
recipe="$recipe/default.rr"
fi
else
recipe="$recipe/userdefault"
if [ -f "$recipe/userdefault.rr" ]; then
recipe="$recipe/userdefault.rr"
elif [ -f "$recipe/userdefault" ]; then
recipe="$recipe/userdefault"
else
recipe="$recipe/userdefault.rr"
fi
fi
fi
[ ! -f "$recipe" -a -f "$recipe.rr" ] && recipe="$recipe.rr"
if [ ! -f "$recipe" ]; then
eerror "$(ppath "$recipe"): fichier introuvable"
return 1
@ -724,6 +737,14 @@ function runs_recipepath() {
# pas été trouvé, sinon retourner la valeur de retour de runs_recipe()
local RUNSDIR RUNSSCRIPT RUNSSCRIPTDIR RUNSSCRIPTNAME RUNSDIRPATH RUNSSCRIPTPATH
local RUNSSCRIPTSDIRS RUNSMODULESDIRS RUNSHOSTSDIRS; __runs_setpath
if [ "${1%.rr}" == "$1" ]; then
# essayer d'abord avec l'extension .rr
if runs_find_scriptfile "$1"; then
runs_recipe "$RUNSSCRIPT"
return $?
fi
fi
if ! runs_find_scriptfile "$1"; then
eerror "$1: fichier introuvable. Vérifiez les valeurs suivantes:
RUNSSCRIPTSPATH=$RUNSSCRIPTSPATH