From e3f76cdcbc1c15c4f9497dec426cf498ce261720 Mon Sep 17 00:00:00 2001 From: Jephte Clain Date: Mon, 22 Jun 2015 01:25:27 +0400 Subject: [PATCH 1/4] =?UTF-8?q?possibilit=C3=A9=20de=20sp=C3=A9cifier=20si?= =?UTF-8?q?=20un=20profil=20doit=20=C3=AAtre=20install=C3=A9=20dans=20le?= =?UTF-8?q?=20r=C3=A9pertoire=20de=20profil=20partag=C3=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .udir | 2 +- ...bash_completion => bash_completion.shared} | 0 ...r_ls.[Darwin] => color_ls.[Darwin].shared} | 0 ...lor_ls.[Linux] => color_ls.[Linux].shared} | 0 ...lor_ls.[SunOS] => color_ls.[SunOS].shared} | 0 ...nfirm_rm,mv,cp => confirm_rm,mv,cp.shared} | 0 .../{ls_options => ls_options.shared} | 0 .../{bash_prompt => bash_prompt.shared} | 0 .../{bin_in_path => bin_in_path.shared} | 0 lib/profile.d/{dbus => dbus.shared} | 0 .../{histcontrol => histcontrol.shared} | 0 ...win] => local_bin_in_path.[Darwin].shared} | 0 lib/profile.d/{nutools => nutools.shared} | 0 lib/profile.d/{proxy => proxy.shared} | 0 .../{webobjects => webobjects.shared} | 0 lib/ulib/uenv_update | 26 +++++++++++++------ 16 files changed, 19 insertions(+), 9 deletions(-) rename lib/bashrc.d/{bash_completion => bash_completion.shared} (100%) rename lib/bashrc.d/{color_ls.[Darwin] => color_ls.[Darwin].shared} (100%) rename lib/bashrc.d/{color_ls.[Linux] => color_ls.[Linux].shared} (100%) rename lib/bashrc.d/{color_ls.[SunOS] => color_ls.[SunOS].shared} (100%) rename lib/bashrc.d/{confirm_rm,mv,cp => confirm_rm,mv,cp.shared} (100%) rename lib/bashrc.d/{ls_options => ls_options.shared} (100%) rename lib/profile.d/{bash_prompt => bash_prompt.shared} (100%) rename lib/profile.d/{bin_in_path => bin_in_path.shared} (100%) rename lib/profile.d/{dbus => dbus.shared} (100%) rename lib/profile.d/{histcontrol => histcontrol.shared} (100%) rename lib/profile.d/{local_bin_in_path.[Darwin] => local_bin_in_path.[Darwin].shared} (100%) rename lib/profile.d/{nutools => nutools.shared} (100%) rename lib/profile.d/{proxy => proxy.shared} (100%) rename lib/profile.d/{webobjects => webobjects.shared} (100%) diff --git a/.udir b/.udir index b8ace89..c816bf3 100644 --- a/.udir +++ b/.udir @@ -18,7 +18,7 @@ kvm_service= openvz_service= configure_variables=(dest uninst_utools rm_utools kvm_service openvz_service) -configure_dest_for=(bashrc profile lib/uinst/conf lib/uinst/rootconf lib/profile.d/nutools lib/bashrc.d/bash_completion lib/init.d/kvm-stop-all legacy/sysinc/utools legacy/sysinc/system_caps legacy/sysinc/private/init) +configure_dest_for=(bashrc profile lib/uinst/conf lib/uinst/rootconf lib/profile.d/nutools.shared lib/bashrc.d/bash_completion.shared lib/init.d/kvm-stop-all legacy/sysinc/utools legacy/sysinc/system_caps legacy/sysinc/private/init) config_scripts=(lib/uinst/conf lib/uinst/system_caps.legacy) install_profiles=true profiledir=lib/profile.d diff --git a/lib/bashrc.d/bash_completion b/lib/bashrc.d/bash_completion.shared similarity index 100% rename from lib/bashrc.d/bash_completion rename to lib/bashrc.d/bash_completion.shared diff --git a/lib/bashrc.d/color_ls.[Darwin] b/lib/bashrc.d/color_ls.[Darwin].shared similarity index 100% rename from lib/bashrc.d/color_ls.[Darwin] rename to lib/bashrc.d/color_ls.[Darwin].shared diff --git a/lib/bashrc.d/color_ls.[Linux] b/lib/bashrc.d/color_ls.[Linux].shared similarity index 100% rename from lib/bashrc.d/color_ls.[Linux] rename to lib/bashrc.d/color_ls.[Linux].shared diff --git a/lib/bashrc.d/color_ls.[SunOS] b/lib/bashrc.d/color_ls.[SunOS].shared similarity index 100% rename from lib/bashrc.d/color_ls.[SunOS] rename to lib/bashrc.d/color_ls.[SunOS].shared diff --git a/lib/bashrc.d/confirm_rm,mv,cp b/lib/bashrc.d/confirm_rm,mv,cp.shared similarity index 100% rename from lib/bashrc.d/confirm_rm,mv,cp rename to lib/bashrc.d/confirm_rm,mv,cp.shared diff --git a/lib/bashrc.d/ls_options b/lib/bashrc.d/ls_options.shared similarity index 100% rename from lib/bashrc.d/ls_options rename to lib/bashrc.d/ls_options.shared diff --git a/lib/profile.d/bash_prompt b/lib/profile.d/bash_prompt.shared similarity index 100% rename from lib/profile.d/bash_prompt rename to lib/profile.d/bash_prompt.shared diff --git a/lib/profile.d/bin_in_path b/lib/profile.d/bin_in_path.shared similarity index 100% rename from lib/profile.d/bin_in_path rename to lib/profile.d/bin_in_path.shared diff --git a/lib/profile.d/dbus b/lib/profile.d/dbus.shared similarity index 100% rename from lib/profile.d/dbus rename to lib/profile.d/dbus.shared diff --git a/lib/profile.d/histcontrol b/lib/profile.d/histcontrol.shared similarity index 100% rename from lib/profile.d/histcontrol rename to lib/profile.d/histcontrol.shared diff --git a/lib/profile.d/local_bin_in_path.[Darwin] b/lib/profile.d/local_bin_in_path.[Darwin].shared similarity index 100% rename from lib/profile.d/local_bin_in_path.[Darwin] rename to lib/profile.d/local_bin_in_path.[Darwin].shared diff --git a/lib/profile.d/nutools b/lib/profile.d/nutools.shared similarity index 100% rename from lib/profile.d/nutools rename to lib/profile.d/nutools.shared diff --git a/lib/profile.d/proxy b/lib/profile.d/proxy.shared similarity index 100% rename from lib/profile.d/proxy rename to lib/profile.d/proxy.shared diff --git a/lib/profile.d/webobjects b/lib/profile.d/webobjects.shared similarity index 100% rename from lib/profile.d/webobjects rename to lib/profile.d/webobjects.shared diff --git a/lib/ulib/uenv_update b/lib/ulib/uenv_update index 83767fc..c3f6194 100644 --- a/lib/ulib/uenv_update +++ b/lib/ulib/uenv_update @@ -224,7 +224,8 @@ cas, il faut décommenter la ligne dans ~/.bash_profile qui source ~/.profile" function uenv_install_profiles() { local projdir="$1" profiledir="$2" bashrcdir="$3" defaultdir="$4" local tmpfile - local prefix envsrcdir envdestdir envfiles envfile envsrc envdest + local prefix envsrcdir envdestdir shadestdir envfiles envfile envsrc envdest shadest + local shared_profiledestdir shared_bashrcdestdir shared_defaultdestdir local profiledestdir bashrcdestdir defaultdestdir uenv_set_destdirs @@ -237,16 +238,25 @@ function uenv_install_profiles() { array_from_lines envfiles "$(list_files "$envsrcdir")" for envfile in "${envfiles[@]}"; do - envsrc="$envsrcdir/$envfile" - envdest="$envdestdir/$envfile" - shadest="$shadestdir/$envfile" - mkdir -p "$envdestdir" "$shadestdir" - if [ ! -f "$envdest" -a -f "$shadest" ]; then - # Si déjà installé en partagé, continuer à mettre à jour ce - # fichier-là + if [ "${envfile%.shared}" != "$envfile" ]; then + # Avec l'extension .shared, toujours installer dans le + # répertoire des profils partagés + envsrc="$envsrcdir/$envfile" + envfile="${envfile%.shared}" + shadest="$shadestdir/$envfile" envdest="$shadest" + else + envsrc="$envsrcdir/$envfile" + envdest="$envdestdir/$envfile" + shadest="$shadestdir/$envfile" + if [ ! -f "$envdest" -a -f "$shadest" ]; then + # Si déjà installé en partagé, continuer à mettre à jour ce + # fichier-là + envdest="$shadest" + fi fi + if [ ! -f "$envdest" ]; then estep "Installation du profil par défaut $envfile dans $(ppath "$envdestdir")" /bin/cp -f "$envsrc" "$envdestdir" From e9089d86d6625e351da00bbc51a260cf6529ad62 Mon Sep 17 00:00:00 2001 From: Jephte Clain Date: Mon, 22 Jun 2015 09:53:54 +0400 Subject: [PATCH 2/4] =?UTF-8?q?les=20r=C3=A9pertoires=20de=20profil=20part?= =?UTF-8?q?ag=C3=A9=20et=20de=20machine=20sont=20trait=C3=A9s=20comme=20un?= =?UTF-8?q?=20seul=20r=C3=A9pertoire?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bashrc | 2 +- lib/ulib/base | 11 +++-- lib/ulib/uenv | 3 +- lib/ulib/uenv_update | 113 +++++++++++++++++++++++++++---------------- profile | 2 +- uenv | 13 +++-- 6 files changed, 92 insertions(+), 52 deletions(-) diff --git a/bashrc b/bashrc index ffcd428..bca2482 100644 --- a/bashrc +++ b/bashrc @@ -2,5 +2,5 @@ function uprovide() { :; } source @@dest@@/lib/ulib/uenv || return -__uenv_source_dirs @@dest@@/bashrc.d "$HOME/etc/bashrc.d" "$HOME/etc/${HOSTNAME%%.*}-bashrc.d" +__uenv_source_dirs @@dest@@/bashrc.d "$HOME/etc/bashrc.${HOSTNAME%%.*}.d" __uenv_cleanup diff --git a/lib/ulib/base b/lib/ulib/base index 711cb8b..c6218ef 100644 --- a/lib/ulib/base +++ b/lib/ulib/base @@ -3962,7 +3962,10 @@ function get_defaults_files() { __gd_fs=("${__gd_fs[@]}" "/etc/default/$__gd_f") __gd_found=1 fi - if [ -r "$HOME/etc/default/$__gd_f" ]; then + if [ -r "$HOME/etc/default.${HOSTNAME%%.*}/$__gd_f" ]; then + __gd_fs=("${__gd_fs[@]}" "$HOME/etc/default.${HOSTNAME%%.*}/$__gd_f") + __gd_found=1 + elif [ -r "$HOME/etc/default/$__gd_f" ]; then __gd_fs=("${__gd_fs[@]}" "$HOME/etc/default/$__gd_f") __gd_found=1 fi @@ -3976,9 +3979,9 @@ function get_defaults_files() { } function set_defaults() { -# Pour chaque argument, sourcer /etc/default/$arg *et* ~/etc/default/$arg si -# ceux-ci existent. *Sinon*, lire $scriptdir/lib/default/$arg si ce fichier -# existe +# Pour chaque argument, sourcer /etc/default/$arg *et* (en priorité +# ~/etc/default.$HOSTNAME/$arg ou à défaut ~/etc/default/$arg) si ceux-ci +# existent. *Sinon*, lire $scriptdir/lib/default/$arg si ce fichier existe local -a __sd_fs local __sd_f get_defaults_files __sd_fs "$@" diff --git a/lib/ulib/uenv b/lib/ulib/uenv index 7925dd8..e7de9ea 100644 --- a/lib/ulib/uenv +++ b/lib/ulib/uenv @@ -57,7 +57,8 @@ function __uenv_source_dirs() { source "$sio" else for file in "$dir/"*; do - if __uenv_check_file "$(dirname -- "$file")" "$(basename -- "$file")"; then + [ -f "$file" ] || continue + if __uenv_check_file "$dir" "$(basename -- "$file")"; then source "$file" fi done diff --git a/lib/ulib/uenv_update b/lib/ulib/uenv_update index c3f6194..0d34a77 100644 --- a/lib/ulib/uenv_update +++ b/lib/ulib/uenv_update @@ -7,18 +7,20 @@ uprovide uenv_update urequire base uenv function __uenv_move_after() { - # Dans le fichier $1, déplacer la ligne $2 après la ligne $3. + # Dans le fichier $1, déplacer la ligne $2 après la ligne commençant par + # l'expression régulière '^$3:' # Si la ligne $2 n'existe pas, ne rien faire # Si la ligne $3 n'existe pas ou vaut '*', mettre la ligne $2 en dernier. # Si $4 est spécifié, l'utiliser comme fichier temporaire. local tmpfile="$4" [ -n "$tmpfile" ] || ac_set_tmpfile tmpfile - # XXX Il faudrait quoter $2 et $3 pour éviter les caractères spéciaux de - # grep! - if quietgrep "^$2$" "$1"; then - if [ "$3" != "*" ] && quietgrep "^$3$" "$1"; then - awkrun line="$2" after="$3" ' + # XXX Il faudrait quoter $3 pour éviter les caractères spéciaux de grep! + if quietgrep -F "$2" "$1"; then + local re_after="$3" + [ "$re_after" != "*" ] && re_after="^$re_after:" + if [ "$re_after" != "*" ] && quietgrep "$re_after" "$1"; then + awkrun line="$2" re_after="$re_after" ' BEGIN { found_line = 0 found_after = 0 @@ -29,10 +31,10 @@ BEGIN { next } } -! found_after && $0 == after { +! found_after && $0 ~ re_after { found_after = 1 if (found_line) { - # si nous avons trouvé la ligne avant after, la mettre juste après + # si nous avons trouvé la ligne avant re_after, la mettre juste après # sinon, pas la peine de faire de modification print print line @@ -41,7 +43,7 @@ BEGIN { } { print } END { - if (! found_after && after == "*") { + if (! found_after && re_after == "*") { if (found_line) { print line } @@ -49,7 +51,7 @@ END { }' <"$1" >"$tmpfile" && cat "$tmpfile" >"$1" else - grep -v "^$2$" "$1" >"$tmpfile" + grep -vF "$2" "$1" >"$tmpfile" echo "$2" >>"$tmpfile" cat "$tmpfile" >"$1" fi @@ -57,18 +59,20 @@ END { } function __uenv_move_before() { - # Dans le fichier $1, déplacer la ligne $2 avant la ligne $3. + # Dans le fichier $1, déplacer la ligne $2 avant la ligne commençant par + # l'expression régulière '^$3:' # Si la ligne $2 n'existe pas, ne rien faire # Si la ligne $3 n'existe pas ou vaut '*', mettre la ligne $2 en premier. # Si $4 est spécifié, l'utiliser comme fichier temporaire. local tmpfile="$4" [ -n "$tmpfile" ] || ac_set_tmpfile tmpfile - # XXX Il faudrait quoter $2 et $3 pour éviter les caractères spéciaux de - # grep! - if quietgrep "^$2$" "$1"; then - if [ "$3" != "*" ] && quietgrep "^$3$" "$1"; then - awkrun line="$2" before="$3" ' + # XXX Il faudrait quoter $3 pour éviter les caractères spéciaux de grep! + if quietgrep -F "$2" "$1"; then + local re_before="$3" + [ "$re_before" != "*" ] && re_before="^$re_before:" + if [ "$re_before" != "*" ] && quietgrep "$re_before" "$1"; then + awkrun line="$2" re_before="$re_before" ' BEGIN { found_line = 0 found_before = 0 @@ -79,7 +83,7 @@ BEGIN { next } } -! found_before && ($0 == before || before == "*") { +! found_before && ($0 ~ re_before || re_before == "*") { found_before = 1 if (! found_line) { print line @@ -92,7 +96,7 @@ BEGIN { cat "$tmpfile" >"$1" else echo "$2" >"$tmpfile" - grep -v "^$2$" "$1" >>"$tmpfile" + grep -vF "$2" "$1" >>"$tmpfile" cat "$tmpfile" >"$1" fi fi @@ -107,36 +111,47 @@ function uenv_update_dir() { # $3(=$1) est le répertoire de destination. Si $1 est un répertoire de # préparation temporaire, on peut spécifier grâce à $3 quel est le # répertoire final après préparation. - local dir="$(abspath "$1")" - local destdir="${3:-$dir}" - local tmpfile="$2" - [ -n "$tmpfile" ] || ac_set_tmpfile tmpfile + # S'ils sont spécifiés, les arguments $4..* sont des répertoires contenant + # des fichiers de profils supplémentaires qu'il faut considérer aussi. Dans + # ce cas, $3 est ignoré. + local dir="$(abspath "$1")"; shift + local tmpfile="$1"; shift + local destdir="${1:-$dir}"; shift local sio="$dir/.source_in_order" - local before after file + local before after file filename local -a files + [ -n "$tmpfile" ] || ac_set_tmpfile tmpfile + [ $# -gt 0 ] && destdir= + set -- "$dir" "$@" + local __uname_system="$UNAME_SYSTEM" local __myhostname="$MYHOSTNAME" >"$sio" - for file in "$dir/"*; do - [ -f "$file" ] || continue - file="$(basename "$file")" - files=("${files[@]}" "$file") - __uenv_check_file "$dir" "$file" && echo "$file" >>"$sio" + for dir in "$@"; do + for file in "$dir/"*; do + [ -f "$file" ] || continue + files=("${files[@]}" "$file") + filename="$(basename -- "$file")" + __uenv_check_file "$dir" "$filename" && echo "$filename:$file" >>"$sio" + done done # traiter d'abord les fichiers qui ont '@before *' ou '@after *' local -a nfiles for file in "${files[@]}"; do - before="$(<"$dir/$file" awk '$0 ~ /^##@before / { print $2; exit 0 }')" + filename="$(basename -- "$file")" + + before="$(<"$file" awk '$0 ~ /^##@before / { print $2; exit 0 }')" if [ "$before" == "*" ]; then - __uenv_move_before "$sio" "$file" "$before" "$tmpfile" + __uenv_move_before "$sio" "$filename:$file" "$before" "$tmpfile" else array_set nfiles "$file" fi - after="$(<"$dir/$file" awk '$0 ~ /^##@after / { print $2; exit 0 }')" + + after="$(<"$file" awk '$0 ~ /^##@after / { print $2; exit 0 }')" if [ "$after" == "*" ]; then - __uenv_move_after "$sio" "$file" "$after" "$tmpfile" + __uenv_move_after "$sio" "$filename:$file" "$after" "$tmpfile" else array_set nfiles "$file" fi @@ -146,13 +161,29 @@ function uenv_update_dir() { # est avant *, si A est traité avant B, A risque de se trouver après B si B # est déplacé au début de la liste. for file in "${nfiles[@]}"; do - before="$(<"$dir/$file" awk '$0 ~ /^##@before / { print $2; exit 0 }')" - [ -n "$before" -a "$before" != "*" ] && __uenv_move_before "$sio" "$file" "$before" "$tmpfile" - after="$(<"$dir/$file" awk '$0 ~ /^##@after / { print $2; exit 0 }')" - [ -n "$after" -a "$after" != "*" ] && __uenv_move_after "$sio" "$file" "$after" "$tmpfile" + filename="$(basename -- "$file")" + + before="$(<"$file" awk '$0 ~ /^##@before / { print $2; exit 0 }')" + [ -n "$before" -a "$before" != "*" ] && __uenv_move_before "$sio" "$filename:$file" "$before" "$tmpfile" + + after="$(<"$file" awk '$0 ~ /^##@after / { print $2; exit 0 }')" + [ -n "$after" -a "$after" != "*" ] && __uenv_move_after "$sio" "$filename:$file" "$after" "$tmpfile" done - awkrun destdir="$destdir" '{ print "source " destdir "/" $0 }' <"$sio" >"$tmpfile" && + awkrun destdir="$destdir" '{ + pos = match($0, /:/) + if (pos != 0) { + filename = substr($0, 1, pos - 1) + file = substr($0, pos + 1) + if (destdir != "") { + print "source " destdir "/" filename + } else { + print "source " file + } + } else { + print "source " destdir "/" $0 + } +}' <"$sio" >"$tmpfile" && cat "$tmpfile" >"$sio" } @@ -161,9 +192,9 @@ function uenv_set_destdirs() { shared_profiledestdir="$HOME/etc/profile.d" shared_bashrcdestdir="$HOME/etc/bashrc.d" shared_defaultdestdir="$HOME/etc/default" - profiledestdir="$HOME/etc/${hostname}-profile.d" - bashrcdestdir="$HOME/etc/${hostname}-bashrc.d" - defaultdestdir="$HOME/etc/${hostname}-default" + profiledestdir="$HOME/etc/profile.${hostname}.d" + bashrcdestdir="$HOME/etc/bashrc.${hostname}.d" + defaultdestdir="$HOME/etc/default.${hostname}" } function uenv_sourced_in() { @@ -287,7 +318,7 @@ function uenv_install_profiles() { if [ "$prefix" != "default" ]; then estep "Mise à jour de l'ordre de lecture de $(ppath "$envdestdir")" - uenv_update_dir "$envdestdir" "$tmpfile" + uenv_update_dir "$envdestdir" "$tmpfile" "" "$shadestdir" fi done ac_clean "$tmpfile" diff --git a/profile b/profile index 9dcfadc..7311591 100644 --- a/profile +++ b/profile @@ -4,5 +4,5 @@ function uprovide() { :; } source @@dest@@/lib/ulib/uenv || return -__uenv_source_dirs @@dest@@/profile.d "$HOME/etc/profile.d" "$HOME/etc/${HOSTNAME%%.*}-profile.d" +__uenv_source_dirs @@dest@@/profile.d "$HOME/etc/profile.${HOSTNAME%%.*}.d" __uenv_cleanup diff --git a/uenv b/uenv index 231aa6e..610fa1d 100755 --- a/uenv +++ b/uenv @@ -100,9 +100,14 @@ if [ -n "$update" ]; then else ## Mettre uniquement à jour l'ordre de chargement des fichiers ## ~/etc/{profile.d,bashrc.d} - for dir in "$shared_profiledestdir" "$shared_bashrcdestdir" "$profiledestdir" "$bashrcdestdir"; do - [ -d "$dir" ] || continue - estep "Mise à jour de $(ppath "$dir")" - uenv_update_dir "$dir" "$envsetup_tmpfile" + ac_set_tmpfile tmpfile + for prefix in profile bashrc; do + envdir="${prefix}dir"; envdir="${!envdir}" + shadir="shared_${prefix}dir"; shadir="${!shadir}" + + [ -d "$envdir" ] || continue + estep "Mise à jour de $(ppath "$envdir")" + uenv_update_dir "$envdir" "$tmpfile" "" "$shadir" done + ac_clean "$tmpfile" fi From d73c929594cd31d81ea759fd00881e3af190d2c0 Mon Sep 17 00:00:00 2001 From: Jephte CLAIN Date: Mon, 22 Jun 2015 10:09:08 +0400 Subject: [PATCH 3/4] =?UTF-8?q?correction=20d'un=20bug=20avec=20le=20choix?= =?UTF-8?q?=20du=20r=C3=A9pertoire=20de=20destination?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/ulib/uenv_update | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/lib/ulib/uenv_update b/lib/ulib/uenv_update index 0d34a77..ca37027 100644 --- a/lib/ulib/uenv_update +++ b/lib/ulib/uenv_update @@ -266,10 +266,10 @@ function uenv_install_profiles() { envdestdir="${prefix}destdir"; envdestdir="${!envdestdir}" shadestdir="shared_${prefix}destdir"; shadestdir="${!shadestdir}" [ -n "$envsrcdir" -a -d "$envsrcdir" ] || continue + mkdir -p "$envdestdir" "$shadestdir" array_from_lines envfiles "$(list_files "$envsrcdir")" for envfile in "${envfiles[@]}"; do - mkdir -p "$envdestdir" "$shadestdir" if [ "${envfile%.shared}" != "$envfile" ]; then # Avec l'extension .shared, toujours installer dans le # répertoire des profils partagés @@ -288,9 +288,10 @@ function uenv_install_profiles() { fi fi + local actual_envdestdir="$(dirname -- "$envdest")" if [ ! -f "$envdest" ]; then - estep "Installation du profil par défaut $envfile dans $(ppath "$envdestdir")" - /bin/cp -f "$envsrc" "$envdestdir" + estep "Installation du profil par défaut $envfile dans $(ppath "$actual_envdestdir")" + /bin/cp -f "$envsrc" "$actual_envdestdir" elif [ "$prefix" == "default" ]; then # ne jamais mettre à jour dans default if testdiff "$envdest" "$envsrc"; then @@ -302,7 +303,7 @@ function uenv_install_profiles() { estepi "Le profil $(ppath "$envdest") a été conservé" fi elif testdiff "$envdest" "$envsrc"; then - estep "Le profil par défaut $envfile dans $(ppath "$envdestdir") a été modifié" + estep "Le profil par défaut $envfile dans $(ppath "$actual_envdestdir") a été modifié" if show_info; then eecho "Voici les différences détectées:" eecho "" @@ -310,8 +311,8 @@ function uenv_install_profiles() { eecho "" fi - if ask_yesno "Faut-il remplacer $(ppath "$envdestdir/$envfile") par le profil par défaut?" O; then - /bin/cp -f "$envsrc" "$envdestdir" + if ask_yesno "Faut-il remplacer $(ppath "$envdest") par le profil par défaut?" O; then + /bin/cp -f "$envsrc" "$actual_envdestdir" fi fi done From bd8c7f86465e9c56c13f16f0fb5f79bf8893c613 Mon Sep 17 00:00:00 2001 From: Jephte CLAIN Date: Mon, 22 Jun 2015 10:23:21 +0400 Subject: [PATCH 4/4] correction d'un bug avec le nom final --- lib/ulib/uenv_update | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/ulib/uenv_update b/lib/ulib/uenv_update index ca37027..4a7a01b 100644 --- a/lib/ulib/uenv_update +++ b/lib/ulib/uenv_update @@ -291,7 +291,7 @@ function uenv_install_profiles() { local actual_envdestdir="$(dirname -- "$envdest")" if [ ! -f "$envdest" ]; then estep "Installation du profil par défaut $envfile dans $(ppath "$actual_envdestdir")" - /bin/cp -f "$envsrc" "$actual_envdestdir" + /bin/cp -f "$envsrc" "$envdest" elif [ "$prefix" == "default" ]; then # ne jamais mettre à jour dans default if testdiff "$envdest" "$envsrc"; then @@ -312,7 +312,7 @@ function uenv_install_profiles() { fi if ask_yesno "Faut-il remplacer $(ppath "$envdest") par le profil par défaut?" O; then - /bin/cp -f "$envsrc" "$actual_envdestdir" + /bin/cp -f "$envsrc" "$envdest" fi fi done