runs: ajout des options --force, --copy-links et --with-vcs à ref()
This commit is contained in:
parent
91686fb86f
commit
1ca0ee54b5
|
@ -1300,10 +1300,17 @@ function runs_action_desc() {
|
|||
function ref() {
|
||||
local -a __args
|
||||
parse_opts + \
|
||||
-r,--required,-m,--mandatory '$:' \
|
||||
-f,--required-file '$:' \
|
||||
-d,--required-dir '$:' \
|
||||
-s:,--sconf: '$:' \
|
||||
--rs,--rsconf,--required-sconf '$:' \
|
||||
-V:,--refvar: '$:' \
|
||||
-v:,--vars: '$:' \
|
||||
-l:,--lconf: '$:' \
|
||||
--force '$:' \
|
||||
--copy-links '$:' \
|
||||
--with-vcs '$:' \
|
||||
@ __args -- "$@" && set -- "${__args[@]}" || die "$__args"
|
||||
runs_var "$@"
|
||||
RUNSVARDESC=
|
||||
|
@ -1343,10 +1350,17 @@ function runs_action_dump() {
|
|||
function ref() {
|
||||
local -a __args
|
||||
parse_opts + \
|
||||
-r,--required,-m,--mandatory '$:' \
|
||||
-f,--required-file '$:' \
|
||||
-d,--required-dir '$:' \
|
||||
-s:,--sconf: '$:' \
|
||||
--rs,--rsconf,--required-sconf '$:' \
|
||||
-V:,--refvar: '$:' \
|
||||
-v:,--vars: '$:' \
|
||||
-l:,--lconf: '$:' \
|
||||
--force '$:' \
|
||||
--copy-links '$:' \
|
||||
--with-vcs '$:' \
|
||||
@ __args -- "$@" && set -- "${__args[@]}" || die "$__args"
|
||||
runs_var "$@"
|
||||
RUNSVARDESC=
|
||||
|
@ -1417,6 +1431,9 @@ function runs_action_run() {
|
|||
-V:,--refvar: __refvarname= \
|
||||
-v:,--vars: '$:' \
|
||||
-l:,--lconf: '$:' \
|
||||
--force '$:' \
|
||||
--copy-links '$:' \
|
||||
--with-vcs '$:' \
|
||||
@ __args -- "$@" && set -- "${__args[@]}" || die "$__args"
|
||||
|
||||
if [ -n "$__shellconf" ]; then
|
||||
|
@ -1584,8 +1601,8 @@ function runs_action_export() {
|
|||
local -a __args
|
||||
local __ref __name __value __copy __required __rdir __rfile __rsconf
|
||||
local __shellconfs __shellconf __refvarname=refdir __refvar __shellvars
|
||||
local __lineconfs __lineconf
|
||||
local __tmpconf __wildconf
|
||||
local __lineconfs __lineconf __force __copy_links __novcs=1
|
||||
local __tmpconf __wildconf __cpcmd
|
||||
parse_opts + \
|
||||
-r,--required,-m,--mandatory __required=1 \
|
||||
-f,--required-file '$__required=1; __rfile=1' \
|
||||
|
@ -1595,6 +1612,9 @@ function runs_action_export() {
|
|||
-V:,--refvar: __refvarname= \
|
||||
-v:,--vars: __shellvars= \
|
||||
-l:,--lconf: __lineconf= \
|
||||
--force __force=1 \
|
||||
--copy-links __copy_links=1 \
|
||||
--with-vcs __novcs= \
|
||||
@ __args -- "$@" && set -- "${__args[@]}" || die "$__args"
|
||||
|
||||
if [ -n "$__shellconf" ]; then
|
||||
|
@ -1665,6 +1685,16 @@ function runs_action_export() {
|
|||
[ -n "$__shellconf" -o -n "$__lineconf" ] && die "-f est incompatible avec -s et -l"
|
||||
fi
|
||||
|
||||
# utiliser par défaut cpnovcs pour la copie des fichiers sauf si
|
||||
# --with-vcs est utilisé
|
||||
[ -n "$__novcs" ] && __cpcmd=cpnovcs || __cpcmd=cpvcs
|
||||
local -a __CPNOVCS_RSYNC_ARGS
|
||||
if [ -n "$__copy_links" ]; then
|
||||
__CPNOVCS_RSYNC_ARGS=(--copy-links)
|
||||
else
|
||||
__CPNOVCS_RSYNC_ARGS=(--copy-unsafe-links)
|
||||
fi
|
||||
|
||||
for __ref in "$@"; do
|
||||
if [ -n "$__shellconf" -a -z "$__shellvars" ]; then
|
||||
ewarn "L'option -v n'a pas été spécifiée pour $__ref"
|
||||
|
@ -1702,6 +1732,9 @@ function runs_action_export() {
|
|||
RUNSVARDESC=
|
||||
array_add RUNSREFS "$__name"
|
||||
|
||||
# options de copie
|
||||
[ -n "$__force" ] && __copy=1
|
||||
|
||||
if [ -n "$__copy" ]; then
|
||||
if [ -n "$__shellconf" ]; then
|
||||
# copier les fichiers mentionnés dans le fichier de
|
||||
|
@ -1710,7 +1743,6 @@ function runs_action_export() {
|
|||
mkdirof "$RUNSROOTDIR$__value"
|
||||
if [ -n "$__shellvars" ]; then
|
||||
(
|
||||
__CPNOVCS_RSYNC_ARGS=(--copy-unsafe-links)
|
||||
array_split __shellvars "$__shellvars" ,
|
||||
splitwcs "$__shellconf" __tmpconf __wildconf
|
||||
if [ -n "$__wildconf" ]; then
|
||||
|
@ -1729,7 +1761,7 @@ function runs_action_export() {
|
|||
for __shellvar in "${__shellvars[@]}"; do
|
||||
[ -n "${!__shellvar}" ] || continue
|
||||
estep "... Copie de ${!__shellvar}"
|
||||
cpnovcs "$__value/${!__shellvar}" "$(dirname "$RUNSROOTDIR$__value/${!__shellvar}")"
|
||||
"$__cpcmd" "$__value/${!__shellvar}" "$(dirname "$RUNSROOTDIR$__value/${!__shellvar}")"
|
||||
done
|
||||
done
|
||||
)
|
||||
|
@ -1740,7 +1772,6 @@ function runs_action_export() {
|
|||
estep "Vérification du répertoire $(ppath "$__value")"
|
||||
mkdirof "$RUNSROOTDIR$__value"
|
||||
(
|
||||
__CPNOVCS_RSYNC_ARGS=(--copy-unsafe-links)
|
||||
splitwcs "$__lineconf" __tmpconf __wildconf
|
||||
if [ -n "$__wildconf" ]; then
|
||||
array_lsall __lineconfs "$__tmpconf" "$__wildconf"
|
||||
|
@ -1752,15 +1783,15 @@ function runs_action_export() {
|
|||
array_from_lines __relpaths "$(<"$__lineconf" filter_conf)"
|
||||
for __relpath in "${__relpaths[@]}"; do
|
||||
estep "... Copie de $__relpath"
|
||||
cpnovcs "$__value/$__relpath" "$(dirname "$RUNSROOTDIR$__value/$__relpath")"
|
||||
"$__cpcmd" "$__value/$__relpath" "$(dirname "$RUNSROOTDIR$__value/$__relpath")"
|
||||
done
|
||||
done
|
||||
)
|
||||
elif [ ! -e "$RUNSROOTDIR$__value" ]; then
|
||||
else
|
||||
# copie standard
|
||||
estep "Copie de $(ppath "$__value")"
|
||||
mkdirof "$RUNSROOTDIR$__value"
|
||||
cpnovcs "$__value" "$(dirname "$RUNSROOTDIR$__value")"
|
||||
"$__cpcmd" "$__value" "$(dirname "$RUNSROOTDIR$__value")"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
|
Loading…
Reference in New Issue